.claude/skills/ln-630-test-auditor/SKILL.md
Test suite audit coordinator (L2). Delegates to 5 workers (Business Logic, E2E, Value, Coverage, Isolation). Aggregates results, creates Linear task in Epic 0.
npx skillsauth add cbbkrd-tech/jl-finishes ln-630-test-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 comprehensive test suite audit across 6 quality categories using 5 specialized workers.
"Write tests. Not too many. Mostly integration." — Kent Beck "Test based on risk, not coverage." — ISO 29119
Key Principles:
Inputs: Codebase root directory
Actions:
**/*.test.* (Jest, Vitest)**/*.spec.* (Mocha, Jasmine)**/__tests__/**/* (Jest convention)Output: testFilesMetadata — list of test files with basic stats
Goal: Gather testing best practices context ONCE, share with all workers
Actions:
contextStore with:
Output: contextStore — shared context for all workers
Key Benefit: Context gathered ONCE → passed to all workers → token-efficient
Purpose: Detect project domains from production code folder structure for domain-aware coverage analysis.
Algorithm: (same as ln-360-codebase-auditor)
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},
{"name": "orders", "path": "src/orders", "file_count": 32},
{"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.
Prompt template:
Task(description: "Test audit via ln-63X",
prompt: "Execute ln-63X-{worker}. Read skill from ln-63X-{worker}/SKILL.md. Context: {contextStore}",
subagent_type: "general-purpose")
Anti-Patterns:
Global workers scan entire test suite (not domain-aware):
| # | Worker | Category | What It Audits | |---|--------|----------|----------------| | 1 | ln-631-test-business-logic-auditor | Business Logic Focus | Framework/Library tests (Prisma, Express, bcrypt, JWT, axios, React hooks) → REMOVE | | 2 | ln-632-test-e2e-priority-auditor | E2E Priority | E2E baseline (2/endpoint), Pyramid validation, Missing E2E tests | | 3 | ln-633-test-value-auditor | Risk-Based Value | Usefulness Score = Impact × Probability<br>Decisions: ≥15 KEEP, 10-14 REVIEW, <10 REMOVE | | 5 | ln-635-test-isolation-auditor | Isolation + Anti-Patterns | Isolation (6 categories), Determinism, Anti-Patterns (6 types) |
Invocation (4 workers in PARALLEL):
FOR EACH worker IN [ln-631, ln-632, ln-633, ln-635]:
Task(description: "Test audit via " + worker,
prompt: "Execute " + worker + ". Read skill. Context: " + JSON.stringify(contextStore),
subagent_type: "general-purpose")
Domain-aware worker runs once per domain:
| # | Worker | Category | What It Audits | |---|--------|----------|----------------| | 4 | ln-634-test-coverage-auditor | Coverage Gaps | Missing tests for critical paths per domain (Money 20+, Security 20+, Data 15+, Core Flows 15+) |
Invocation:
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 }
}
Skill(skill="ln-634-test-coverage-auditor", args=JSON.stringify(domain_context))
ELSE:
// Fallback: invoke once for entire codebase (global mode)
Skill(skill="ln-634-test-coverage-auditor", args=JSON.stringify(contextStore))
Parallelism strategy:
Worker Output Contract (Unified):
All workers MUST return JSON with this structure:
{
"category": "Category Name",
"score": 7,
"total_issues": 12,
"critical": 0,
"high": 3,
"medium": 7,
"low": 2,
"findings": [
{
"severity": "HIGH",
"location": "path/file.ts:123",
"issue": "Description of the issue",
"principle": "Category / Sub-principle",
"recommendation": "How to fix",
"effort": "S"
}
]
}
Unified Scoring Formula (all workers):
penalty = (critical × 2.0) + (high × 1.0) + (medium × 0.5) + (low × 0.2)
score = max(0, 10 - penalty)
Domain-aware workers add optional fields: domain, scan_path
Goal: Merge all worker results into unified Test Suite Audit Report
Aggregation Algorithm:
1. Collect JSON from all 5 workers
2. Merge findings from all workers into single array
3. Sum severity counts:
total_critical = sum(worker.critical for all workers)
total_high = sum(worker.high for all workers)
total_medium = sum(worker.medium for all workers)
total_low = sum(worker.low for all workers)
4. Calculate Overall Score:
overall_score = average(worker.score for all workers)
5. Sort findings by severity: CRITICAL → HIGH → MEDIUM → LOW
6. Group findings by category for report sections
Actions:
Findings grouping:
Context Validation (Post-Filter):
MANDATORY READ: Load shared/references/context_validation.md
Apply Rules 1, 5 + test-specific filters 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 5: Locality/Single-Consumer
IF "extract shared helper" suggestion AND consumer_count == 1 → advisory
# Test-specific: Custom wrapper detection
IF "framework test" finding (ln-631) AND test imports custom wrapper class:
→ advisory (tests custom logic, not framework)
# Test-specific: Setup/fixture code
IF "The Liar" finding (ln-635) AND file is conftest/fixture/setup:
→ advisory (setup code, no assertions expected)
# Test-specific: Parameterized test
IF "The Giant" finding (ln-635) AND test is parameterized/data-driven:
→ severity -= 1 (size from data, not complexity)
Downgraded findings → "Advisory Findings" section in report.
Recalculate scores excluding advisory findings from penalty.
Exempt: Coverage gap CRITICAL findings (ln-634), risk-value scores (ln-633).
## Test Suite Audit Report - [DATE]
### Executive Summary
[2-3 sentences: test suite health, major issues, key recommendations]
### Severity Summary
| Severity | Count |
|----------|-------|
| Critical | X |
| High | X |
| Medium | X |
| Low | X |
| **Total** | **X** |
### Compliance Score
| Category | Score | Notes |
|----------|-------|-------|
| Business Logic Focus | X/10 | X framework tests found |
| E2E Critical Coverage | X/10 | X critical paths missing E2E |
| Risk-Based Value | X/10 | X low-value tests |
| Coverage Gaps | X/10 | X critical paths untested |
| Isolation & Anti-Patterns | X/10 | X isolation + anti-pattern issues |
| **Overall** | **X/10** | Average of 5 categories |
### Domain Coverage Summary (NEW - if domain_mode="domain-aware")
| Domain | Critical Paths | Tested | Coverage % | Gaps |
|--------|---------------|--------|------------|------|
| users | 8 | 6 | 75% | 2 |
| orders | 12 | 8 | 67% | 4 |
| payments | 6 | 5 | 83% | 1 |
| **Total** | **26** | **19** | **73%** | **7** |
### Audit Findings
| Severity | Location | Issue | Principle | Recommendation | Effort |
|----------|----------|-------|-----------|----------------|--------|
| **CRITICAL** | routes/payment.ts:45 | Missing E2E for payment processing (Priority 25) | E2E Critical Coverage / Money Flow | Add E2E: successful payment + discount edge cases | M |
| **HIGH** | auth.test.ts:45-52 | Test 'bcrypt hashes password' validates library behavior | Business Logic Focus / Crypto Testing | Delete — bcrypt already tested by maintainers | S |
| **HIGH** | db.test.ts:78-85 | Test 'Prisma findMany returns array' validates ORM | Business Logic Focus / ORM Testing | Delete — Prisma already tested | S |
| **HIGH** | user.test.ts:45 | Anti-pattern 'The Liar' — no assertions | Anti-Patterns / The Liar | Add specific assertions or delete test | S |
| **MEDIUM** | utils.test.ts:23-27 | Test 'validateEmail' has Usefulness Score 4 | Risk-Based Value / Low Priority | Delete — likely covered by E2E registration | S |
| **MEDIUM** | order.test.ts:200-350 | Anti-pattern 'The Giant' — 150 lines | Anti-Patterns / The Giant | Split into focused tests | M |
| **LOW** | payment.test.ts | Anti-pattern 'Happy Path Only' — no error tests | Anti-Patterns / Happy Path | Add negative tests | M |
### Coverage Gaps by Domain (if domain_mode="domain-aware")
#### Domain: users (src/users/)
| Severity | Category | Missing Test | Location | Priority | Effort |
|----------|----------|--------------|----------|----------|--------|
| CRITICAL | Money | E2E: processRefund() | services/user.ts:120 | 20 | M |
| HIGH | Security | Unit: validatePermissions() | middleware/auth.ts:45 | 18 | S |
#### Domain: orders (src/orders/)
| Severity | Category | Missing Test | Location | Priority | Effort |
|----------|----------|--------------|----------|----------|--------|
| CRITICAL | Money | E2E: applyDiscount() | services/order.ts:45 | 25 | M |
| HIGH | Data | Integration: orderTransaction() | repositories/order.ts:78 | 16 | M |
Each worker:
contextStore with testing best practicestestFilesMetadata with test file listToken Efficiency:
shared/references/orchestrator_pattern.mdshared/references/risk_based_testing_guide.mdshared/references/task_delegation_pattern.mdshared/references/audit_scoring.mdshared/references/audit_output_schema.mdWorkers:
Reference:
Version: 4.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.