.claude/skills/ln-650-persistence-performance-auditor/SKILL.md
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 skillsauth add cbbkrd-tech/jl-finishes ln-650-persistence-performance-auditorInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
Paths: File paths (
shared/,references/,../ln-*) are relative to skills repo root. If not found at CWD, locate this SKILL.md directory and go up one level for repo root.
Coordinates 3 specialized audit workers to perform database efficiency, transaction correctness, and runtime performance analysis.
Load project metadata:
docs/project/tech_stack.md - detect DB, ORM, async frameworkrequirements.txt, pyproject.toml, package.json, go.moddocs/tasks/kanban_board.mdExtract DB-specific metadata:
| 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 create_async_engine, sessionmaker | expire_on_commit=False |
| Triggers/NOTIFY | migration files | pg_notify('job_events', ...) |
| Connection pooling | engine config | pool_size=10, max_overflow=20 |
Scan for triggers:
Grep("pg_notify|NOTIFY|CREATE TRIGGER", path="alembic/versions/")
OR path="migrations/"
→ Store: db_config.triggers = [{table, event, function}]
For each detected technology:
| 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 |
Build contextStore:
{
"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 with
subagent_type: "general-purpose"for context isolation.
Prompt template:
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")
Anti-Patterns:
Workers (ALL 3 in PARALLEL):
| # | 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 |
Invocation (3 workers in PARALLEL):
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")
Collect results from workers:
{
"category": "Query Efficiency",
"score": 6,
"total_issues": 8,
"findings": [...]
}
Aggregation steps:
Context Validation:
MANDATORY READ: Load shared/references/context_validation.md
Apply Rules 1, 6 to merged findings:
FOR EACH finding WHERE severity IN (HIGH, MEDIUM):
# Rule 1: ADR/Planned Override
IF finding matches ADR → advisory "[Planned: ADR-XXX]"
# Rule 6: Execution Context
IF finding.check IN (blocking_io, redundant_fetch, transaction_wide, cpu_bound):
context = 0
- Function in __init__/setup/bootstrap/migrate → context += 1
- File in tasks/jobs/cron/ → context += 1
- Has timeout/safeguard nearby → context += 1
- Small data (<100KB file, <100 items dataset) → context += 1
IF context >= 3 → advisory
IF context >= 1 → severity -= 1
Downgraded findings → "Advisory Findings" section in report.
Recalculate overall score excluding advisory findings from penalty.
Exempt: Missing rollback CRITICAL, N-UPDATE loops in hot paths.
## 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]
Create task in Epic 0:
Persistence & Performance Audit: [YYYY-MM-DD]refactoring, performance, auditdocs/project/tech_stack.mddocs/tasks/kanban_board.mdVersion: 1.0.0 Last Updated: 2026-02-04
testing
When the user wants to plan a content strategy, decide what content to create, or figure out what topics to cover. Also use when the user mentions "content strategy," "what should I write about," "content ideas," "blog strategy," "topic clusters," or "content planning." For writing individual pieces, see copywriting. For SEO-specific audits, see seo-audit.
development
When the user wants to create competitor comparison or alternative pages for SEO and sales enablement. Also use when the user mentions 'alternative page,' 'vs page,' 'competitor comparison,' 'comparison page,' '[Product] vs [Product],' '[Product] alternative,' or 'competitive landing pages.' Covers four formats: singular alternative, plural alternatives, you vs competitor, and competitor vs competitor. Emphasizes deep research, modular content architecture, and varied section types beyond feature tables.
development
Write B2B cold emails and follow-up sequences that get replies. Use when the user wants to write cold outreach emails, prospecting emails, cold email campaigns, sales development emails, or SDR emails. Covers subject lines, opening lines, body copy, CTAs, personalization, and multi-touch follow-up sequences.
development
When the user wants to reduce churn, build cancellation flows, set up save offers, recover failed payments, or implement retention strategies. Also use when the user mentions 'churn,' 'cancel flow,' 'offboarding,' 'save offer,' 'dunning,' 'failed payment recovery,' 'win-back,' 'retention,' 'exit survey,' 'pause subscription,' or 'involuntary churn.' This skill covers voluntary churn (cancel flows, save offers, exit surveys) and involuntary churn (dunning, payment recovery). For post-cancel win-back email sequences, see email-sequence. For in-app upgrade paywalls, see paywall-upgrade-cro.