Loading...
Loading...
Coordinates 3 specialized audit workers (query efficiency, transaction correctness, runtime performance). Researches DB/ORM/async best practices, delegates parallel audits, aggregates results into single Linear task in Epic 0.
npx skill4agent add levnikolaevich/claude-code-skills ln-650-persistence-performance-auditordocs/project/tech_stack.mdrequirements.txtpyproject.tomlpackage.jsongo.moddocs/tasks/kanban_board.md| Metadata | Source | Example |
|---|---|---|
| Database type | tech_stack.md, docker-compose.yml | PostgreSQL 16 |
| ORM | imports, requirements.txt | SQLAlchemy 2.0 |
| Async framework | imports, requirements.txt | asyncio, FastAPI |
| Session config | grep | |
| Triggers/NOTIFY | migration files | |
| Connection pooling | engine config | |
Grep("pg_notify|NOTIFY|CREATE TRIGGER", path="alembic/versions/")
OR path="migrations/"
→ Store: db_config.triggers = [{table, event, function}]| Technology | Research Focus |
|---|---|
| SQLAlchemy | Session lifecycle, expire_on_commit, bulk operations, eager/lazy loading |
| PostgreSQL | NOTIFY/LISTEN semantics, transaction isolation, batch operations |
| asyncio | to_thread, blocking detection, event loop best practices |
| FastAPI | Dependency injection scopes, background tasks, async endpoints |
{
"tech_stack": {"db": "postgresql", "orm": "sqlalchemy", "async": "asyncio"},
"best_practices": {"sqlalchemy": {...}, "postgresql": {...}, "asyncio": {...}},
"db_config": {
"expire_on_commit": false,
"triggers": [{"table": "jobs", "event": "UPDATE", "function": "notify_job_events"}],
"pool_size": 10
},
"codebase_root": "/project"
}CRITICAL: All delegations use Task tool withfor context isolation.subagent_type: "general-purpose"
Task(description: "Audit via ln-65X",
prompt: "Execute ln-65X-{worker}-auditor. Read skill from ln-65X-{worker}-auditor/SKILL.md. Context: {contextStore}",
subagent_type: "general-purpose")| # | Worker | Priority | What It Audits |
|---|---|---|---|
| 1 | ln-651-query-efficiency-auditor | HIGH | Redundant queries, N-UPDATE loops, over-fetching, caching scope |
| 2 | ln-652-transaction-correctness-auditor | HIGH | Commit patterns, trigger interaction, transaction scope, rollback |
| 3 | ln-653-runtime-performance-auditor | MEDIUM | Blocking IO in async, allocations, sync sleep, string concat |
FOR EACH worker IN [ln-651, ln-652, ln-653]:
Task(description: "Audit via " + worker,
prompt: "Execute " + worker + ". Read skill. Context: " + JSON.stringify(contextStore),
subagent_type: "general-purpose"){
"category": "Query Efficiency",
"score": 6,
"total_issues": 8,
"findings": [...]
}## Persistence & Performance Audit Report - [DATE]
### Executive Summary
[2-3 sentences on overall persistence/performance health]
### Compliance Score
| Category | Score | Notes |
|----------|-------|-------|
| Query Efficiency | X/10 | ... |
| Transaction Correctness | X/10 | ... |
| Runtime Performance | X/10 | ... |
| **Overall** | **X/10** | |
### Severity Summary
| Severity | Count |
|----------|-------|
| Critical | X |
| High | X |
| Medium | X |
| Low | X |
### Findings by Category
#### 1. Query Efficiency
| Severity | Location | Issue | Recommendation | Effort |
|----------|----------|-------|----------------|--------|
| HIGH | job_processor.py:434 | Redundant entity fetch | Pass object not ID | S |
#### 2. Transaction Correctness
| Severity | Location | Issue | Recommendation | Effort |
|----------|----------|-------|----------------|--------|
| CRITICAL | job_processor.py:412 | Missing intermediate commits | Add commit at milestones | S |
#### 3. Runtime Performance
| Severity | Location | Issue | Recommendation | Effort |
|----------|----------|-------|----------------|--------|
| HIGH | job_processor.py:444 | Blocking read_bytes() in async | Use aiofiles/to_thread | S |
### Recommended Actions (Priority-Sorted)
| Priority | Category | Location | Issue | Recommendation | Effort |
|----------|----------|----------|-------|----------------|--------|
| CRITICAL | Transaction | ... | Missing commits | Add strategic commits | S |
| HIGH | Query | ... | Redundant fetch | Pass object not ID | S |
### Sources Consulted
- SQLAlchemy best practices: [URL]
- PostgreSQL NOTIFY docs: [URL]
- Python asyncio-dev: [URL]Persistence & Performance Audit: [YYYY-MM-DD]refactoringperformanceauditdocs/project/tech_stack.mddocs/tasks/kanban_board.md