Test Suite Auditor (L2 Coordinator)
Coordinates comprehensive test suite audit across 6 quality categories using 5 specialized workers.
Purpose & Scope
- L2 Coordinator that delegates to L3 specialized audit workers
- Audits all tests against 6 quality categories (via 5 workers)
- Calculates Usefulness Score for each test (Keep/Remove/Refactor)
- Identifies missing tests for critical business logic
- Detects anti-patterns and isolation issues
- Aggregates results into unified report
- Creates single Linear task in Epic 0
- Manual invocation by user; not part of Story pipeline
Core Philosophy
"Write tests. Not too many. Mostly integration." — Kent Beck
"Test based on risk, not coverage." — ISO 29119
Key Principles:
- Test business logic, not frameworks — bcrypt/Prisma/Express already tested
- No performance/load/stress tests — Tests infrastructure, not code correctness (use k6/JMeter separately)
- Risk-based prioritization — Priority ≥15 or remove
- E2E for critical paths only — Money/Security/Data (Priority ≥20)
- Usefulness over quantity — One useful test > 10 useless tests
- Every test must justify existence — Impact × Probability ≥15
Workflow
Phase 1: Discovery (Automated)
Inputs: Codebase root directory
Actions:
- Find all test files using Glob:
**/*.test.* (Jest, Vitest)
**/*.spec.* (Mocha, Jasmine)
**/__tests__/**/* (Jest convention)
- Parse test file structure (test names, assertions count)
- Auto-discover Team ID from docs/tasks/kanban_board.md
Output: testFilesMetadata — list of test files with basic stats
Phase 2: Research Best Practices (ONCE)
Goal: Gather testing best practices context ONCE, share with all workers
Actions:
- Use MCP Ref/Context7 to research testing best practices for detected tech stack
- Load ../ln-350-story-test-planner/references/risk_based_testing_guide.md
- Build
contextStore with:
- Testing philosophy (E2E primary, Unit supplementary)
- Usefulness Score formulas (Impact × Probability)
- Anti-patterns catalog
- Framework detection patterns
Output: contextStore — shared context for all workers
Key Benefit: Context gathered ONCE → passed to all workers → token-efficient
Phase 3: Domain Discovery (NEW)
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
- Check for:
src/domains/*/, src/features/*/, src/modules/*/
- Monorepo patterns:
packages/*/, libs/*/, apps/*/
- If found (>1 match) → use as domains
Priority 2: Top-level src/ folders*
- List folders:
src/users/, src/orders/, src/payments/
- Exclude infrastructure:
utils, shared, common, lib, helpers, config, types, interfaces, constants, middleware, infrastructure, core
- If remaining >1 → use as domains
Priority 3: Fallback to global mode
- If <2 domains detected →
domain_mode = "global"
- All workers scan entire codebase (backward-compatible behavior)
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:
- Folders named
shared, common, utils, lib, core → mark is_shared: true
- Shared code audited but grouped separately in report
Phase 4: Delegate to Workers
CRITICAL: 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:
- ❌ Direct Skill tool invocation without Task wrapper
- ❌ Any execution bypassing subagent context isolation
Phase 4a: Global Workers (PARALLEL)
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 × ProbabilityDecisions: ≥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")
Phase 4b: Domain-Aware Worker (PARALLEL per domain)
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:
- Phase 4a: All 4 global workers run in PARALLEL
- Phase 4b: All N domain-aware invocations run in PARALLEL
- Example: 3 domains → 3 ln-374 invocations in single message
Each worker returns structured JSON:
{
"category": "Business Logic Focus",
"score": 7,
"total_issues": 12,
"findings": [
{
"severity": "MEDIUM",
"test_file": "auth.test.ts",
"test_name": "bcrypt hashes password",
"decision": "REMOVE",
"usefulness_score": 3,
"reason": "Tests library behavior, not OUR code",
"effort": "S"
}
]
}
Phase 5: Aggregate Results
Goal: Merge all worker results into unified Test Suite Audit Report with domain grouping
Actions:
- Collect results from all workers (global + domain-aware)
- Global workers (ln-371, ln-372, ln-373, ln-375) → merge findings (as before)
- Domain-aware worker (ln-374) → group by domain.name:
- Aggregate coverage gaps per domain
- Build Domain Coverage Summary table
- Merge findings into decision categories:
- Tests to REMOVE (Usefulness Score <10)
- Tests to REVIEW (Usefulness Score 10-14)
- Tests to KEEP (Usefulness Score ≥15)
- Missing Tests (Priority/Justification) — grouped by domain if domain_mode="domain-aware"
- Anti-Patterns Found (counts + examples)
- Calculate compliance scores (6 categories, each /10)
- Build decision summary (KEEP/REVIEW/REMOVE counts)
- Generate Executive Summary (2-3 sentences)
- Create Linear task in Epic 0 with full report (see Output Format below)
- Return summary to user
Findings grouping:
- Categories 1-3, 5-6 (Business Logic, E2E, Value, Isolation, Anti-Patterns) → single tables (global)
- Category 4 (Coverage Gaps) → subtables per domain (if domain_mode="domain-aware")
Output Format
## Test Suite Audit Report - [DATE]
### Executive Summary
[2-3 sentences: test suite health, major issues, key recommendations]
### Test Count by Decision
| Decision | Count | % |
|----------|-------|---|
| KEEP | X | X% |
| REVIEW | X | X% |
| REMOVE | X | X% |
| **Total** | **X** | |
### Compliance Score
| Category | Score | Notes |
|----------|-------|-------|
| Business Logic Focus | X/10 | X framework tests found |
| E2E Priority | X/10 | X E2E, X Integration, X Unit |
| Risk-Based Value | X/10 | X tests with Priority <10 |
| Coverage Gaps | X/10 | X critical paths untested |
| Test Isolation | X/10 | X isolation issues |
| Anti-Patterns | X/10 | X anti-patterns found |
| **Overall** | **X/10** | |
### 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 | Violated Principle | Recommendation | Effort |
|----------|----------|-------|-------------------|----------------|--------|
| **CRITICAL** | - | Missing E2E for payment with discount | #3: E2E for critical paths only (Money Priority 25) | Add E2E test: successful payment + discount edge cases | M |
| **HIGH** | auth.test.ts:45 | Test "bcrypt hashes password" (Score 3) | #1: Test business logic, not frameworks | Delete — bcrypt already tested by maintainers | S |
| **HIGH** | db.test.ts:78 | Test "Prisma findMany returns array" (Score 4) | #1: Test business logic, not frameworks | Delete — Prisma ORM already tested | S |
| **HIGH** | - | Missing Unit test for tax calculation edge cases | #5: Every test must justify existence (Impact 5 × Probability 4 = 20) | Add Unit tests for country-specific tax rules | M |
| **MEDIUM** | utils.test.ts:23 | Test "validateEmail returns true" (Score 12) | #4: Usefulness over quantity | Review: if E2E login covers → DELETE; else KEEP | S |
| **MEDIUM** | order.test.ts:200-350 | Giant test (>100 lines) | Anti-pattern: The Giant | Split into focused tests (one scenario per test) | M |
| **MEDIUM** | test.ts:45 | No assertions in test | Anti-pattern: The Liar | Add specific assertions or delete test | S |
| **LOW** | auth.test.ts | Only positive login scenarios | Anti-pattern: Happy Path Only | Add negative tests (invalid credentials, expired tokens) | 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 |
Worker Architecture
Each worker:
- Receives
contextStore with testing best practices
- Receives
testFilesMetadata with test file list
- Loads full test file contents when analyzing
- Returns structured JSON with category findings
- Operates independently (failure in one doesn't block others)
Token Efficiency:
- Coordinator: metadata only (~1000 tokens)
- Workers: full test file contents when needed (~5000-10000 tokens each)
- Context gathered ONCE, shared with all workers
Critical Rules
- Two-stage delegation: Global workers (4) + Domain-aware worker (ln-374 × N domains)
- Domain discovery: Auto-detect domains from folder structure; fallback to global mode if <2 domains
- Parallel execution: All workers (global + domain-aware) run in PARALLEL
- Domain-grouped output: Coverage Gaps findings grouped by domain (if domain_mode="domain-aware")
- Delete > Archive: Remove useless tests, don't comment out
- E2E baseline: Every endpoint needs 2 E2E (positive + negative)
- Justify each test: If can't explain Priority ≥15, remove it
- Trust frameworks: Don't test Express/Prisma/bcrypt behavior
- No performance/load tests: Flag and REMOVE tests measuring throughput/latency/memory (DevOps Epic territory)
- Code is truth: If test contradicts code behavior, update test
- Language preservation: Report in project's language (EN/RU)
Definition of Done
- All test files discovered via Glob
- Context gathered from testing best practices (MCP Ref/Context7)
- Domain discovery completed (domain_mode determined)
- contextStore built with test metadata + domain info
- Global workers (4) invoked in PARALLEL
- Domain-aware worker (ln-374) invoked per domain in PARALLEL
- All workers completed successfully (or reported errors)
- Results aggregated with domain grouping (if domain_mode="domain-aware")
- Domain Coverage Summary built (if domain_mode="domain-aware")
- Compliance scores calculated (6 categories)
- Keep/Remove/Refactor decisions for each test
- Missing tests identified with Priority (grouped by domain if applicable)
- Anti-patterns catalogued
- Linear task created in Epic 0 with full report
- Summary returned to user
Related Skills
Version: 4.0.0
Last Updated: 2025-12-23
1---2name: ln-630-test-auditor3description: Test suite audit coordinator (L2). Delegates to 5 workers (Business Logic, E2E, Value, Coverage, Isolation). Aggregates results, creates Linear task in Epic 0.4---5
6# Test Suite Auditor (L2 Coordinator)
7
8Coordinates comprehensive test suite audit across 6 quality categories using 5 specialized workers.
9
10## Purpose & Scope
11
12- **L2 Coordinator** that delegates to L3 specialized audit workers
13- Audits all tests against 6 quality categories (via 5 workers)
14- Calculates **Usefulness Score** for each test (Keep/Remove/Refactor)
15- Identifies missing tests for critical business logic
16- Detects anti-patterns and isolation issues
17- Aggregates results into unified report
18- Creates single Linear task in Epic 0
19- Manual invocation by user; not part of Story pipeline
20
21## Core Philosophy
22
23> "Write tests. Not too many. Mostly integration." — Kent Beck
24> "Test based on risk, not coverage." — ISO 29119
25
26**Key Principles:**
271. **Test business logic, not frameworks** — bcrypt/Prisma/Express already tested
282. **No performance/load/stress tests** — Tests infrastructure, not code correctness (use k6/JMeter separately)
293. **Risk-based prioritization** — Priority ≥15 or remove
304. **E2E for critical paths only** — Money/Security/Data (Priority ≥20)
315. **Usefulness over quantity** — One useful test > 10 useless tests
326. **Every test must justify existence** — Impact × Probability ≥15
33
34## Workflow
35
36### Phase 1: Discovery (Automated)
37
38**Inputs:** Codebase root directory
39
40**Actions:**
411. Find all test files using Glob:
42 - `**/*.test.*` (Jest, Vitest)
43 - `**/*.spec.*` (Mocha, Jasmine)
44 - `**/__tests__/**/*` (Jest convention)
452. Parse test file structure (test names, assertions count)
463. Auto-discover Team ID from [docs/tasks/kanban_board.md](../docs/tasks/kanban_board.md)
47
48**Output:** `testFilesMetadata` — list of test files with basic stats
49
50### Phase 2: Research Best Practices (ONCE)
51
52**Goal:** Gather testing best practices context ONCE, share with all workers
53
54**Actions:**
551. Use MCP Ref/Context7 to research testing best practices for detected tech stack
562. Load [../ln-350-story-test-planner/references/risk_based_testing_guide.md](../ln-350-story-test-planner/references/risk_based_testing_guide.md)
573. Build `contextStore` with:
58 - Testing philosophy (E2E primary, Unit supplementary)
59 - Usefulness Score formulas (Impact × Probability)
60 - Anti-patterns catalog
61 - Framework detection patterns
62
63**Output:** `contextStore` — shared context for all workers
64
65**Key Benefit:** Context gathered ONCE → passed to all workers → token-efficient
66
67### Phase 3: Domain Discovery (NEW)
68
69**Purpose:** Detect project domains from production code folder structure for domain-aware coverage analysis.
70
71**Algorithm:** (same as ln-360-codebase-auditor)
72
731. **Priority 1: Explicit domain folders**
74 - Check for: `src/domains/*/`, `src/features/*/`, `src/modules/*/`
75 - Monorepo patterns: `packages/*/`, `libs/*/`, `apps/*/`
76 - If found (>1 match) → use as domains
77
782. **Priority 2: Top-level src/* folders**
79 - List folders: `src/users/`, `src/orders/`, `src/payments/`
80 - Exclude infrastructure: `utils`, `shared`, `common`, `lib`, `helpers`, `config`, `types`, `interfaces`, `constants`, `middleware`, `infrastructure`, `core`
81 - If remaining >1 → use as domains
82
833. **Priority 3: Fallback to global mode**
84 - If <2 domains detected → `domain_mode = "global"`
85 - All workers scan entire codebase (backward-compatible behavior)
86
87**Heuristics for domain detection:**
88
89| Heuristic | Indicator | Example |
90|-----------|-----------|---------|
91| File count | >5 files in folder | `src/users/` with 12 files |
92| Structure | controllers/, services/, models/ present | MVC/Clean Architecture |
93| Barrel export | index.ts/index.js exists | Module pattern |
94| README | README.md describes domain | Domain documentation |
95
96**Output:**
97```json
98{
99 "domain_mode": "domain-aware",
100 "all_domains": [
101 {"name": "users", "path": "src/users", "file_count": 45},
102 {"name": "orders", "path": "src/orders", "file_count": 32},
103 {"name": "shared", "path": "src/shared", "file_count": 15, "is_shared": true}
104 ]
105}
106```
107
108**Shared folder handling:**
109- Folders named `shared`, `common`, `utils`, `lib`, `core` → mark `is_shared: true`
110- Shared code audited but grouped separately in report
111
112### Phase 4: Delegate to Workers
113
114> **CRITICAL:** All delegations use Task tool with `subagent_type: "general-purpose"` for context isolation.
115
116**Prompt template:**
117```
118Task(description: "Test audit via ln-63X",
119 prompt: "Execute ln-63X-{worker}. Read skill from ln-63X-{worker}/SKILL.md. Context: {contextStore}",
120 subagent_type: "general-purpose")
121```
122
123**Anti-Patterns:**
124- ❌ Direct Skill tool invocation without Task wrapper
125- ❌ Any execution bypassing subagent context isolation
126
127#### Phase 4a: Global Workers (PARALLEL)
128
129**Global workers** scan entire test suite (not domain-aware):
130
131| # | Worker | Category | What It Audits |
132|---|--------|----------|----------------|
133| 1 | [ln-631-test-business-logic-auditor](../ln-631-test-business-logic-auditor/) | Business Logic Focus | Framework/Library tests (Prisma, Express, bcrypt, JWT, axios, React hooks) → REMOVE |
134| 2 | [ln-632-test-e2e-priority-auditor](../ln-632-test-e2e-priority-auditor/) | E2E Priority | E2E baseline (2/endpoint), Pyramid validation, Missing E2E tests |
135| 3 | [ln-633-test-value-auditor](../ln-633-test-value-auditor/) | Risk-Based Value | Usefulness Score = Impact × Probability<br>Decisions: ≥15 KEEP, 10-14 REVIEW, <10 REMOVE |
136| 5 | [ln-635-test-isolation-auditor](../ln-635-test-isolation-auditor/) | Isolation + Anti-Patterns | Isolation (6 categories), Determinism, Anti-Patterns (6 types) |
137
138**Invocation (4 workers in PARALLEL):**
139```javascript
140FOR EACH worker IN [ln-631, ln-632, ln-633, ln-635]:
141 Task(description: "Test audit via " + worker,
142 prompt: "Execute " + worker + ". Read skill. Context: " + JSON.stringify(contextStore),
143 subagent_type: "general-purpose")
144```
145
146#### Phase 4b: Domain-Aware Worker (PARALLEL per domain)
147
148**Domain-aware worker** runs once per domain:
149
150| # | Worker | Category | What It Audits |
151|---|--------|----------|----------------|
152| 4 | [ln-634-test-coverage-auditor](../ln-634-test-coverage-auditor/) | Coverage Gaps | Missing tests for critical paths per domain (Money 20+, Security 20+, Data 15+, Core Flows 15+) |
153
154**Invocation:**
155```javascript
156IF domain_mode == "domain-aware":
157 FOR EACH domain IN all_domains:
158 domain_context = {
159 ...contextStore,
160 domain_mode: "domain-aware",
161 current_domain: { name: domain.name, path: domain.path }
162 }
163 Skill(skill="ln-634-test-coverage-auditor", args=JSON.stringify(domain_context))
164ELSE:
165 // Fallback: invoke once for entire codebase (global mode)
166 Skill(skill="ln-634-test-coverage-auditor", args=JSON.stringify(contextStore))
167```
168
169**Parallelism strategy:**
170- Phase 4a: All 4 global workers run in PARALLEL
171- Phase 4b: All N domain-aware invocations run in PARALLEL
172- Example: 3 domains → 3 ln-374 invocations in single message
173
174**Each worker returns structured JSON:**
175```json
176{
177 "category": "Business Logic Focus",
178 "score": 7,
179 "total_issues": 12,
180 "findings": [
181 {
182 "severity": "MEDIUM",
183 "test_file": "auth.test.ts",
184 "test_name": "bcrypt hashes password",
185 "decision": "REMOVE",
186 "usefulness_score": 3,
187 "reason": "Tests library behavior, not OUR code",
188 "effort": "S"
189 }
190 ]
191}
192```
193
194### Phase 5: Aggregate Results
195
196**Goal:** Merge all worker results into unified Test Suite Audit Report with domain grouping
197
198**Actions:**
1991. **Collect results** from all workers (global + domain-aware)
2002. **Global workers (ln-371, ln-372, ln-373, ln-375)** → merge findings (as before)
2013. **Domain-aware worker (ln-374)** → group by domain.name:
202 - Aggregate coverage gaps per domain
203 - Build Domain Coverage Summary table
2044. **Merge findings** into decision categories:
205 - **Tests to REMOVE** (Usefulness Score <10)
206 - **Tests to REVIEW** (Usefulness Score 10-14)
207 - **Tests to KEEP** (Usefulness Score ≥15)
208 - **Missing Tests** (Priority/Justification) — grouped by domain if domain_mode="domain-aware"
209 - **Anti-Patterns Found** (counts + examples)
2105. **Calculate compliance scores** (6 categories, each /10)
2116. **Build decision summary** (KEEP/REVIEW/REMOVE counts)
2127. **Generate Executive Summary** (2-3 sentences)
2138. **Create Linear task** in Epic 0 with full report (see Output Format below)
2149. **Return summary** to user
215
216**Findings grouping:**
217- Categories 1-3, 5-6 (Business Logic, E2E, Value, Isolation, Anti-Patterns) → single tables (global)
218- Category 4 (Coverage Gaps) → subtables per domain (if domain_mode="domain-aware")
219
220## Output Format
221
222```markdown
223## Test Suite Audit Report - [DATE]
224
225### Executive Summary
226[2-3 sentences: test suite health, major issues, key recommendations]
227
228### Test Count by Decision
229
230| Decision | Count | % |
231|----------|-------|---|
232| KEEP | X | X% |
233| REVIEW | X | X% |
234| REMOVE | X | X% |
235| **Total** | **X** | |
236
237### Compliance Score
238
239| Category | Score | Notes |
240|----------|-------|-------|
241| Business Logic Focus | X/10 | X framework tests found |
242| E2E Priority | X/10 | X E2E, X Integration, X Unit |
243| Risk-Based Value | X/10 | X tests with Priority <10 |
244| Coverage Gaps | X/10 | X critical paths untested |
245| Test Isolation | X/10 | X isolation issues |
246| Anti-Patterns | X/10 | X anti-patterns found |
247| **Overall** | **X/10** | |
248
249### Domain Coverage Summary (NEW - if domain_mode="domain-aware")
250
251| Domain | Critical Paths | Tested | Coverage % | Gaps |
252|--------|---------------|--------|------------|------|
253| users | 8 | 6 | 75% | 2 |
254| orders | 12 | 8 | 67% | 4 |
255| payments | 6 | 5 | 83% | 1 |
256| **Total** | **26** | **19** | **73%** | **7** |
257
258### Audit Findings
259
260| Severity | Location | Issue | Violated Principle | Recommendation | Effort |
261|----------|----------|-------|-------------------|----------------|--------|
262| **CRITICAL** | - | Missing E2E for payment with discount | #3: E2E for critical paths only (Money Priority 25) | Add E2E test: successful payment + discount edge cases | M |
263| **HIGH** | auth.test.ts:45 | Test "bcrypt hashes password" (Score 3) | #1: Test business logic, not frameworks | Delete — bcrypt already tested by maintainers | S |
264| **HIGH** | db.test.ts:78 | Test "Prisma findMany returns array" (Score 4) | #1: Test business logic, not frameworks | Delete — Prisma ORM already tested | S |
265| **HIGH** | - | Missing Unit test for tax calculation edge cases | #5: Every test must justify existence (Impact 5 × Probability 4 = 20) | Add Unit tests for country-specific tax rules | M |
266| **MEDIUM** | utils.test.ts:23 | Test "validateEmail returns true" (Score 12) | #4: Usefulness over quantity | Review: if E2E login covers → DELETE; else KEEP | S |
267| **MEDIUM** | order.test.ts:200-350 | Giant test (>100 lines) | Anti-pattern: The Giant | Split into focused tests (one scenario per test) | M |
268| **MEDIUM** | test.ts:45 | No assertions in test | Anti-pattern: The Liar | Add specific assertions or delete test | S |
269| **LOW** | auth.test.ts | Only positive login scenarios | Anti-pattern: Happy Path Only | Add negative tests (invalid credentials, expired tokens) | M |
270
271### Coverage Gaps by Domain (if domain_mode="domain-aware")
272
273#### Domain: users (src/users/)
274
275| Severity | Category | Missing Test | Location | Priority | Effort |
276|----------|----------|--------------|----------|----------|--------|
277| CRITICAL | Money | E2E: processRefund() | services/user.ts:120 | 20 | M |
278| HIGH | Security | Unit: validatePermissions() | middleware/auth.ts:45 | 18 | S |
279
280#### Domain: orders (src/orders/)
281
282| Severity | Category | Missing Test | Location | Priority | Effort |
283|----------|----------|--------------|----------|----------|--------|
284| CRITICAL | Money | E2E: applyDiscount() | services/order.ts:45 | 25 | M |
285| HIGH | Data | Integration: orderTransaction() | repositories/order.ts:78 | 16 | M |
286```
287
288## Worker Architecture
289
290Each worker:
291- Receives `contextStore` with testing best practices
292- Receives `testFilesMetadata` with test file list
293- Loads full test file contents when analyzing
294- Returns structured JSON with category findings
295- Operates independently (failure in one doesn't block others)
296
297**Token Efficiency:**
298- Coordinator: metadata only (~1000 tokens)
299- Workers: full test file contents when needed (~5000-10000 tokens each)
300- Context gathered ONCE, shared with all workers
301
302## Critical Rules
303
304- **Two-stage delegation:** Global workers (4) + Domain-aware worker (ln-374 × N domains)
305- **Domain discovery:** Auto-detect domains from folder structure; fallback to global mode if <2 domains
306- **Parallel execution:** All workers (global + domain-aware) run in PARALLEL
307- **Domain-grouped output:** Coverage Gaps findings grouped by domain (if domain_mode="domain-aware")
308- **Delete > Archive:** Remove useless tests, don't comment out
309- **E2E baseline:** Every endpoint needs 2 E2E (positive + negative)
310- **Justify each test:** If can't explain Priority ≥15, remove it
311- **Trust frameworks:** Don't test Express/Prisma/bcrypt behavior
312- **No performance/load tests:** Flag and REMOVE tests measuring throughput/latency/memory (DevOps Epic territory)
313- **Code is truth:** If test contradicts code behavior, update test
314- **Language preservation:** Report in project's language (EN/RU)
315
316## Definition of Done
317
318- All test files discovered via Glob
319- Context gathered from testing best practices (MCP Ref/Context7)
320- Domain discovery completed (domain_mode determined)
321- contextStore built with test metadata + domain info
322- Global workers (4) invoked in PARALLEL
323- Domain-aware worker (ln-374) invoked per domain in PARALLEL
324- All workers completed successfully (or reported errors)
325- Results aggregated with domain grouping (if domain_mode="domain-aware")
326- Domain Coverage Summary built (if domain_mode="domain-aware")
327- Compliance scores calculated (6 categories)
328- Keep/Remove/Refactor decisions for each test
329- Missing tests identified with Priority (grouped by domain if applicable)
330- Anti-patterns catalogued
331- Linear task created in Epic 0 with full report
332- Summary returned to user
333
334## Related Skills
335
336- **Workers:**
337 - [ln-631-test-business-logic-auditor](../ln-631-test-business-logic-auditor/) — Framework tests detection
338 - [ln-632-test-e2e-priority-auditor](../ln-632-test-e2e-priority-auditor/) — E2E baseline validation
339 - [ln-633-test-value-auditor](../ln-633-test-value-auditor/) — Usefulness Score calculation
340 - [ln-634-test-coverage-auditor](../ln-634-test-coverage-auditor/) — Coverage gaps identification
341 - [ln-635-test-isolation-auditor](../ln-635-test-isolation-auditor/) — Isolation + Anti-Patterns
342
343- **Reference:**
344 - [../ln-350-story-test-planner](../ln-350-story-test-planner/) — Risk-Based Testing Guide
345 - [../ln-620-codebase-auditor](../ln-620-codebase-auditor/) — Codebase audit coordinator (similar pattern)
346
347---
348**Version:** 4.0.0
349**Last Updated:** 2025-12-23