.claude/skills/ln-620-codebase-auditor/SKILL.md
Coordinates 9 specialized audit workers (security, build, architecture, code quality, dependencies, dead code, observability, concurrency, lifecycle). Researches best practices, delegates parallel audits, aggregates results into docs/project/codebase_audit.md.
npx skillsauth add cbbkrd-tech/jl-finishes ln-620-codebase-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 9 specialized audit workers to perform comprehensive codebase quality analysis.
docs/project/codebase_audit.md (file-based, no task creation)docs/project/codebase_audit.mdLoad project metadata:
docs/project/tech_stack.md - detect tech stack for researchdocs/principles.md - project-specific quality principlespackage.json, requirements.txt, go.mod, Cargo.tomldocs/tasks/kanban_board.mdExtract metadata only (not full codebase scan):
Determine project type from tech_stack metadata and skip inapplicable workers.
Project type detection:
| Project Type | Detection | Skip Workers | |-------------|-----------|--------------| | CLI tool | No web framework, has CLI framework (Typer/Click/Commander/cobra/etc.) | ln-627 (health checks), ln-629 (graceful shutdown) | | Library/SDK | No entry point, only exports | ln-627, ln-629 | | Script/Lambda | Single entry, <500 LOC | ln-627, ln-628 (concurrency), ln-629 | | Web Service | Has web framework (Express/FastAPI/ASP.NET/Spring/etc.) | None — all applicable | | Worker/Queue | Has queue framework (Bull/Celery/etc.) | None |
Algorithm:
project_type = detect_from_tech_stack(tech_stack, package_manifests)
skipped_workers = APPLICABILITY_TABLE[project_type].skip
applicable_workers = ALL_WORKERS - skipped_workers
FOR EACH skipped IN skipped_workers:
skipped.score = "N/A"
skipped.reason = "Not applicable for {project_type} projects"
Skipped workers are NOT delegated. They get score "N/A" in report and are excluded from overall score calculation.
For each major dependency identified in Phase 1:
mcp__Ref__ref_search_documentation for current best practicesmcp__context7__get-library-docs for up-to-date library documentation| Type | Research Focus | |------|----------------| | Web Framework | Async patterns, middleware, error handling, request lifecycle | | ML/AI Libraries | Inference optimization, memory management, batching | | Database | Connection pooling, transactions, query optimization | | Containerization | Multi-stage builds, security, layer caching | | Language Runtime | Idioms, performance patterns, memory management |
Build contextStore:
{
"tech_stack": {...},
"best_practices": {...},
"principles": {...},
"codebase_root": "...",
"output_dir": "docs/project/.audit"
}
Purpose: Detect project domains from folder structure for domain-aware auditing.
Algorithm:
Priority 1: Explicit domain folders
src/domains/*/, src/features/*/, src/modules/*/packages/*/, libs/*/, apps/*/Priority 2: Top-level src/ folders*
src/users/, src/orders/, src/payments/utils, shared, common, lib, helpers, config, types, interfaces, constants, middleware, infrastructure, corePriority 3: Fallback to global mode
domain_mode = "global"Heuristics for domain detection:
| Heuristic | Indicator | Example |
|-----------|-----------|---------|
| File count | >5 files in folder | src/users/ with 12 files |
| Structure | controllers/, services/, models/ present | MVC/Clean Architecture |
| Barrel export | index.ts/index.js exists | Module pattern |
| README | README.md describes domain | Domain documentation |
Output:
{
"domain_mode": "domain-aware",
"all_domains": [
{"name": "users", "path": "src/users", "file_count": 45, "is_shared": false},
{"name": "orders", "path": "src/orders", "file_count": 32, "is_shared": false},
{"name": "shared", "path": "src/shared", "file_count": 15, "is_shared": true}
]
}
Shared folder handling:
shared, common, utils, lib, core → mark is_shared: trueCRITICAL: All delegations use Task tool with
subagent_type: "general-purpose"for context isolation.
Before delegating to workers:
1. Delete docs/project/.audit/ if exists (clean previous run)
2. Create docs/project/.audit/ directory
3. Add output_dir to contextStore (already set in Phase 3)
Prompt template:
Task(description: "Audit via ln-62X",
prompt: "Execute ln-62X-{worker}-auditor. Read skill from ln-62X-{worker}-auditor/SKILL.md. Context: {contextStore}",
subagent_type: "general-purpose")
Anti-Patterns:
Worker Output Contract (File-Based):
Workers write full report to docs/project/.audit/{worker_id}.md per shared/templates/audit_worker_report_template.md.
Workers return minimal summary in-context (~50 tokens):
Report written: docs/project/.audit/621-security.md
Score: 7.5/10 | Issues: 5 (C:0 H:2 M:2 L:1)
Coordinator extracts score/counts from return values. Full findings stay in files.
Unified Scoring Formula (all workers):
penalty = (critical × 2.0) + (high × 1.0) + (medium × 0.5) + (low × 0.2)
score = max(0, 10 - penalty)
Global workers scan entire codebase (not domain-aware). Each writes report to docs/project/.audit/.
| # | Worker | Priority | What It Audits | Output File |
|---|--------|----------|----------------|-------------|
| 1 | ln-621-security-auditor | CRITICAL | Hardcoded secrets, SQL injection, XSS, insecure deps | 621-security.md |
| 2 | ln-622-build-auditor | CRITICAL | Compiler/linter errors, deprecations, type errors | 622-build.md |
| 5 | ln-625-dependencies-auditor | MEDIUM | Outdated packages, unused deps, custom implementations | 625-dependencies.md |
| 6 | ln-626-dead-code-auditor | LOW | Dead code, unused imports/variables, commented-out code | 626-dead-code.md |
| 7 | ln-627-observability-auditor | MEDIUM | Structured logging, health checks, metrics, tracing | 627-observability.md |
| 8 | ln-628-concurrency-auditor | HIGH | Race conditions, async/await, resource contention | 628-concurrency.md |
| 9 | ln-629-lifecycle-auditor | MEDIUM | Bootstrap, graceful shutdown, resource cleanup | 629-lifecycle.md |
Invocation (applicable workers in PARALLEL):
// Filter by Phase 2 applicability gate
applicable_global = [ln-621, ln-622, ln-625, ln-626, ln-627, ln-628, ln-629].filter(w => !skipped_workers.includes(w))
FOR EACH worker IN applicable_global:
Task(description: "Audit via " + worker,
prompt: "Execute " + worker + ". Read skill. Context: " + JSON.stringify(contextStore),
subagent_type: "general-purpose")
Domain-aware workers run once per domain. Each writes report with domain suffix.
| # | Worker | Priority | What It Audits | Output File |
|---|--------|----------|----------------|-------------|
| 3 | ln-623-code-principles-auditor | HIGH | DRY/KISS/YAGNI violations, TODO/FIXME, error handling, DI | 623-principles-{domain}.md |
| 4 | ln-624-code-quality-auditor | MEDIUM | Cyclomatic complexity, O(n²), N+1 queries, magic numbers | 624-quality-{domain}.md |
Invocation (2 workers × N domains):
IF domain_mode == "domain-aware":
FOR EACH domain IN all_domains:
domain_context = {
...contextStore,
domain_mode: "domain-aware",
current_domain: { name: domain.name, path: domain.path }
}
Task(description: "Audit principles " + domain.name + " via ln-623",
prompt: "Execute ln-623-code-principles-auditor. Read skill. Context: " + JSON.stringify(domain_context),
subagent_type: "general-purpose")
Task(description: "Audit quality " + domain.name + " via ln-624",
prompt: "Execute ln-624-code-quality-auditor. Read skill. Context: " + JSON.stringify(domain_context),
subagent_type: "general-purpose")
ELSE:
// Fallback: invoke once for entire codebase (global mode)
Task(description: "Audit principles via ln-623",
prompt: "Execute ln-623-code-principles-auditor. Read skill. Context: " + JSON.stringify(contextStore),
subagent_type: "general-purpose")
Task(description: "Audit quality via ln-624",
prompt: "Execute ln-624-code-quality-auditor. Read skill. Context: " + JSON.stringify(contextStore),
subagent_type: "general-purpose")
Parallelism strategy:
Workers wrote reports to docs/project/.audit/ and returned minimal summaries. Aggregation uses return values for numbers and file reads for findings tables.
Extract score/counts from worker return strings (already in context, 0 file reads):
FOR EACH worker_return IN worker_results:
Parse: "Score: {score}/10 | Issues: {total} (C:{c} H:{h} M:{m} L:{l})"
Store: {worker, category, score, counts, report_file}
From parsed return values:
FOR EACH category IN 9 categories:
IF category is domain-aware (Architecture, Quality):
category_score = average(domain_scores for this category)
ELSE:
category_score = worker_score
overall_score = average(all applicable category scores) // exclude N/A
From parsed return values:
total_critical = sum(worker.counts.critical for all workers)
total_high = sum(worker.counts.high for all workers)
total_medium = sum(worker.counts.medium for all workers)
total_low = sum(worker.counts.low for all workers)
From parsed return values of ln-623/ln-624:
FOR EACH domain:
arch_score = ln-623 score for this domain
quality_score = ln-624 score for this domain
issues = ln-623 issues + ln-624 issues for this domain
Read only ln-623 report files to extract FINDINGS-EXTENDED JSON block:
principle_files = Glob("docs/project/.audit/623-principles-*.md")
FOR EACH file IN principle_files:
Read file → extract <!-- FINDINGS-EXTENDED [...] --> JSON
Filter findings with pattern_signature field
Group by pattern_signature across domains:
IF same signature in 2+ domains → create Cross-Domain DRY finding:
severity: HIGH
principle: "Cross-Domain DRY Violation"
list all affected domains and locations
recommendation: "Extract to shared/ module"
Read each worker report file and copy Findings table into corresponding report section:
FOR EACH report_file IN Glob("docs/project/.audit/6*.md"):
Read file → extract "## Findings" table rows
Insert into matching category section in final report
Global categories (Security, Build, etc.) → single Findings table per category. Domain-aware categories → subtables per domain (one per file).
MANDATORY READ: Load shared/references/context_validation.md
Apply Rules 1-5 to assembled findings. Uses data already in context:
docs/reference/adrs/ or docs/decisions/)FOR EACH finding IN assembled_findings WHERE severity IN (HIGH, MEDIUM):
# Rule 1: ADR/Planned Override
IF finding matches ADR title/description → advisory "[Planned: ADR-XXX]"
# Rule 2: Trivial DRY
IF DRY finding AND duplicated_lines < 5 → remove finding
# Rule 3: Cohesion (god_classes, long_methods, large_file)
IF size-based finding:
Read flagged file ONCE, check 4 cohesion indicators
IF cohesion >= 3 → advisory "[High cohesion module]"
# Rule 4: Already-Latest
IF dependency finding: cross-check ln-622 audit output
IF latest + 0 CVEs → remove finding
# Rule 5: Locality/Single-Consumer
IF DRY/schema finding: Grep import count
IF import_count == 1 → advisory "[Single consumer, locality correct]"
IF import_count <= 3 with different API contracts → advisory "[API contract isolation]"
Downgraded findings → "Advisory Findings" section in report.
Recalculate category scores excluding advisory findings from penalty.
Exempt: Security (ln-621), N+1 queries, CRITICAL build errors, concurrency (ln-628).
MANDATORY READ: Load shared/templates/codebase_audit_template.md for full report structure.
Report is written to docs/project/codebase_audit.md using the template. Key sections:
MANDATORY READ: Load shared/templates/codebase_audit_template.md for report format.
Write consolidated report to docs/project/codebase_audit.md:
docs/project/.audit/ directory cleaned and created.audit/.audit/docs/project/codebase_audit.md with Advisory Findings sectionSee individual worker SKILL.md files for detailed audit rules:
shared/references/orchestrator_pattern.mdshared/references/task_delegation_pattern.mdshared/references/audit_scoring.mdshared/references/audit_output_schema.mdshared/templates/audit_worker_report_template.mdshared/templates/codebase_audit_template.mddocs/principles.mddocs/project/tech_stack.mddocs/tasks/kanban_board.mdVersion: 5.0.0 Last Updated: 2025-12-23
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.