Identifies missing tests for unique critical local logic: money, auth, permissions, data integrity, algorithms, and domain rules. Use when auditing critical logic coverage gaps.
Paths: File paths (references/, ../ln-*) are relative to this skill directory.
Critical Logic Coverage Auditor (L3 Worker)
Type: L3 Worker
Specialized worker identifying missing tests for unique critical local logic.
Purpose & Scope
Audit Critical Logic Coverage (Category 4: High Priority)
Identify untested unique local logic only
Classify by category (Money, Auth/Permissions, Data Integrity, Algorithms, Domain Rules)
Emit ADD_MISSING findings for missing high-value tests
Do not recommend tests just to increase coverage percentage
Calculate compliance score (X/10)
Inputs
MANDATORY READ: Load references/audit_worker_core_contract.md and references/mcp_tool_preferences.md.
Tool policy: You may run as an isolated subagent where host AGENTS.md is not in scope, so default to hex-line MCP first for file reads, search, and edits. Load references/mcp_integration_patterns.md only when MCP behavior is unclear.
Domain-aware: Supports domain_mode + current_domain (see audit_output_schema.md#domain-aware-worker-output).
Use hex-graph first when hotspots materially improve coverage-gap discovery. Use hex-line first for local code and test reads when available. If MCP is unavailable, unsupported, or not indexed, continue with built-in Read/Grep/Glob/Bash and state the fallback in the report.
Workflow
Detection policy: use two-layer detection (candidate scan, then context verification); load references/two_layer_detection.md only when the verification method is ambiguous.
Check test coverage for each critical path (Layer 1)
Search ALL test files for coverage (tests may be in different location than production code)
Match by function name, module name, or test description
3b) Context Analysis (Layer 2 -- MANDATORY): For each gap candidate, ask:
Is this function already covered by E2E/integration test? -> downgrade to LOW
Is this a helper function with <10 lines called from tested code? -> skip
Is keyword match a false positive (e.g., paymentIcon() is UI, not payment logic)? -> skip
Collect missing tests
Tag each finding with domain: domain_name (if domain-aware)
Set action: "ADD_MISSING" for every confirmed finding
Calculate Score: Count violations by severity, calculate compliance score (X/10)
Write Report: Build full markdown report in memory per references/templates/audit_worker_report_template.md, write to {output_dir}/ln-634--{identifier}.md (or {output_dir}/ln-634--{identifier}.md if domain-aware) in single Write call
Return Summary: Return minimal summary to coordinator (see Output Format)
Write JSON summary per references/audit_summary_contract.md. In managed mode the caller passes both runId and summaryArtifactPath; in standalone mode the worker generates its own run-scoped artifact path per shared contract.
Write report to {output_dir}/ln-634--{identifier}.md (global) or {output_dir}/ln-634--{identifier}.md (domain-aware) with category: "Critical Logic Coverage" and checks: money_logic_coverage, auth_permission_coverage, data_integrity_coverage, algorithm_domain_rule_coverage.
Return summary per references/audit_summary_contract.md.
When summaryArtifactPath is absent, write the standalone runtime summary under .hex-skills/runtime-artifacts/runs/{run_id}/evaluation-worker/{worker}--{identifier}.json and optionally echo the same summary in structured output.
Apply the already-loaded references/audit_worker_core_contract.md.
Domain-aware scanning: If domain_mode="domain-aware", scan ONLY scan_path production code (not entire codebase)
Tag findings: Include domain field in each finding when domain-aware
Test search scope: Search ALL test files for coverage (tests may be in different location than production code)
Match by name: Use function name, module name, or test description to match tests to production code
Do not auto-fix: Report only
Unique angle: Only find missing tests for unique local critical logic. Do not evaluate existing low-value tests, E2E journey priority, trustworthiness, oracle strength, manual evidence, or structure.
No coverage-percent work: Do not recommend tests merely to improve line/branch coverage metrics.
Action required: Every finding uses action: "ADD_MISSING".
Definition of Done
Apply the already-loaded references/audit_worker_core_contract.md.
1---2name: ln-634-test-coverage-auditor3description: Identifies missing tests for unique critical local logic: money, auth, permissions, data integrity, algorithms, and domain rules. Use when auditing critical logic coverage gaps.4license: MIT5---67> **Paths:** File paths (`references/`, `../ln-*`) are relative to this skill directory.89# Critical Logic Coverage Auditor (L3 Worker)1011**Type:** L3 Worker1213Specialized worker identifying missing tests for unique critical local logic.1415## Purpose & Scope1617- Audit **Critical Logic Coverage** (Category 4: High Priority)18- Identify untested unique local logic only19- Classify by category (Money, Auth/Permissions, Data Integrity, Algorithms, Domain Rules)20- Emit `ADD_MISSING` findings for missing high-value tests21- Do not recommend tests just to increase coverage percentage22- Calculate compliance score (X/10)2324## Inputs2526**MANDATORY READ:** Load `references/audit_worker_core_contract.md` and `references/mcp_tool_preferences.md`.27Tool policy: You may run as an isolated subagent where host `AGENTS.md` is not in scope, so default to hex-line MCP first for file reads, search, and edits. Load `references/mcp_integration_patterns.md` only when MCP behavior is unclear.2829Receives `contextStore` with: `tech_stack`, `testFilesMetadata`, `codebase_root`, `output_dir`.3031**Domain-aware:** Supports `domain_mode` + `current_domain` (see `audit_output_schema.md#domain-aware-worker-output`).3233Use `hex-graph` first when hotspots materially improve coverage-gap discovery. Use `hex-line` first for local code and test reads when available. If MCP is unavailable, unsupported, or not indexed, continue with built-in `Read/Grep/Glob/Bash` and state the fallback in the report.3435## Workflow3637Detection policy: use two-layer detection (candidate scan, then context verification); load `references/two_layer_detection.md` only when the verification method is ambiguous.38391) **Parse context** -- extract fields, determine `scan_path` (domain-aware if specified)40 ELSE:41 scan_path = codebase_root42 domain_name = null43 ```44452) **Identify critical local logic in scan_path** (not entire codebase)46 - Scan production code in `scan_path` for money/auth/permission/data/algorithm/domain-rule keywords47 - All Grep/Glob patterns use `scan_path` (not codebase_root)48 - Example: `Grep(pattern="payment|refund|discount", path=scan_path)`49503) **Check test coverage for each critical path (Layer 1)**51 - Search ALL test files for coverage (tests may be in different location than production code)52 - Match by function name, module name, or test description533b) **Context Analysis (Layer 2 -- MANDATORY):** For each gap candidate, ask:54 - Is this function already covered by E2E/integration test? -> **downgrade to LOW**55 - Is this a helper function with <10 lines called from tested code? -> **skip**56 - Is keyword match a false positive (e.g., `paymentIcon()` is UI, not payment logic)? -> **skip**57584) **Collect missing tests**59 - Tag each finding with `domain: domain_name` (if domain-aware)60 - Set `action: "ADD_MISSING"` for every confirmed finding61625) **Calculate Score:** Count violations by severity, calculate compliance score (X/10)63646) **Write Report:** Build full markdown report in memory per `references/templates/audit_worker_report_template.md`, write to `{output_dir}/ln-634--{identifier}.md` (or `{output_dir}/ln-634--{identifier}.md` if domain-aware) in single Write call65667) **Return Summary:** Return minimal summary to coordinator (see Output Format)6768## Critical Local Logic Classification6970### 1. Money Flows (Priority 20+)7172**What:** Any code handling financial transactions7374**Examples:**75- Payment processing (`/payment`, `processPayment()`)76- Discounts/promotions (`calculateDiscount()`, `applyPromoCode()`)77- Tax calculations (`calculateTax()`, `getTaxRate()`)78- Refunds (`processRefund()`, `/refund`)79- Invoices/billing (`generateInvoice()`, `createBill()`)80- Currency conversion (`convertCurrency()`)8182**Min Priority:** 208384**Why Critical:** Money loss, fraud, legal compliance8586### 2. Auth & Permissions (Priority 20+)8788**What:** Local authentication, authorization, permission, and security decisions8990**Examples:**91- Login/logout (`/login`, `authenticate()`)92- Token refresh (`/refresh-token`, `refreshAccessToken()`)93- Password reset (`/forgot-password`, `resetPassword()`)94- Permissions/RBAC (`checkPermission()`, `hasRole()`)95- Encryption/hashing (custom crypto orchestration or policy, NOT library behavior such as bcrypt/argon2)96- API key validation (`validateApiKey()`)9798**Min Priority:** 2099100**Why Critical:** Security breach, data leak, unauthorized access101102### 3. Data Integrity (Priority 15+)103104**What:** CRUD operations, transactions, validation105106**Examples:**107- Critical CRUD (`createUser()`, `deleteOrder()`, `updateProduct()`)108- Database transactions (`withTransaction()`)109- Data validation (custom validators, NOT framework defaults)110- Data migrations (`runMigration()`)111- Unique constraints (`checkDuplicateEmail()`)112113**Min Priority:** 15114115**Why Critical:** Data corruption, lost data, inconsistent state116117### 4. Algorithms & Domain Rules (Priority 15+)118119**What:** Local calculations, branching rules, state transitions, and algorithms that encode project-specific behavior120121**Examples:**122- Ranking/scoring algorithms123- Eligibility rules124- Domain state transitions125- Custom validation rules beyond framework defaults126- Import/export transformations127128**Min Priority:** 15129130**Why Critical:** Wrong product behavior, bad decisions, corrupted business state131132## Audit Rules133134### 1. Identify Critical Local Logic135136**Process:**137- Scan codebase for money-related keywords: `payment`, `refund`, `discount`, `tax`, `price`, `currency`138- Scan for auth/permission keywords: `auth`, `login`, `password`, `token`, `permission`, `role`, `policy`139- Scan for data keywords: `transaction`, `validation`, `migration`, `constraint`140- Scan for algorithms/domain rules: `score`, `rank`, `eligibility`, `state`, `workflow`, `rule`141- Exclude framework defaults, generated behavior, and library primitives; `ln-631` owns product-vs-platform test focus for existing tests142143### 2. Check Test Coverage144145**For each critical path:**146- Search test files for matching test name/description147- If NO test found -> add to missing tests list148- If test found but inadequate (only positive, no edge cases) -> add to gaps list149150### 3. Categorize Gaps151152**Severity by Priority:**153- **CRITICAL:** Priority 20+ (Money, Security)154- **HIGH:** Priority 15-19 (Data, Core Flows)155- **MEDIUM:** Priority 10-14 (Important but not critical)156- **Downgrade when:** Function already covered by E2E test -> LOW. Helper with <10 lines called from tested code -> skip157158### 4. Provide Justification159160**For each missing test:**161- Explain WHY it's critical (money loss, security breach, etc.)162- Suggest test type (E2E, Integration, Unit)163- Set action to `ADD_MISSING`164- Estimate effort (S/M/L)165166## Scoring Algorithm167168**MANDATORY READ:** Load `references/audit_scoring.md`.169170**Severity mapping by Priority:**171- Priority 20+ (Money, Security) missing test -> CRITICAL172- Priority 15-19 (Data Integrity, Core Flows) missing test -> HIGH173- Priority 10-14 (Important) missing test -> MEDIUM174- Priority <10 (Nice-to-have) -> LOW175176## Output Format177178**MANDATORY READ:** Load `references/templates/audit_worker_report_template.md`.179180Write JSON summary per `references/audit_summary_contract.md`. In managed mode the caller passes both `runId` and `summaryArtifactPath`; in standalone mode the worker generates its own run-scoped artifact path per shared contract.181182Write report to `{output_dir}/ln-634--{identifier}.md` (global) or `{output_dir}/ln-634--{identifier}.md` (domain-aware) with `category: "Critical Logic Coverage"` and checks: money_logic_coverage, auth_permission_coverage, data_integrity_coverage, algorithm_domain_rule_coverage.183184Return summary per `references/audit_summary_contract.md`.185186When `summaryArtifactPath` is absent, write the standalone runtime summary under `.hex-skills/runtime-artifacts/runs/{run_id}/evaluation-worker/{worker}--{identifier}.json` and optionally echo the same summary in structured output.187```188Report written: .hex-skills/runtime-artifacts/runs/{run_id}/audit-report/ln-634--{identifier}.md189Score: X.X/10 | Issues: N (C:N H:N M:N L:N)190```191192## Critical Rules193194Apply the already-loaded `references/audit_worker_core_contract.md`.195196- **Domain-aware scanning:** If `domain_mode="domain-aware"`, scan ONLY `scan_path` production code (not entire codebase)197- **Tag findings:** Include `domain` field in each finding when domain-aware198- **Test search scope:** Search ALL test files for coverage (tests may be in different location than production code)199- **Match by name:** Use function name, module name, or test description to match tests to production code200- **Do not auto-fix:** Report only201- **Unique angle:** Only find missing tests for unique local critical logic. Do not evaluate existing low-value tests, E2E journey priority, trustworthiness, oracle strength, manual evidence, or structure.202- **No coverage-percent work:** Do not recommend tests merely to improve line/branch coverage metrics.203- **Action required:** Every finding uses `action: "ADD_MISSING"`.204205## Definition of Done206207Apply the already-loaded `references/audit_worker_core_contract.md`.208209- [ ] contextStore parsed successfully (including output_dir, domain_mode, current_domain)210- [ ] scan_path determined (domain path or codebase root)211- [ ] Critical local logic identified in scan_path (Money, Auth/Permissions, Data Integrity, Algorithms, Domain Rules)212- [ ] Test coverage checked for each critical local logic path213- [ ] Missing tests collected with severity, priority, justification, domain, and `ADD_MISSING` action214- [ ] Score calculated using penalty algorithm215- [ ] Report written to `{output_dir}/ln-634--{identifier}.md` or `ln-634--{identifier}.md` (atomic single Write call)216- [ ] Summary written per contract217218## Reference Files219220- **Audit output schema:** `references/audit_output_schema.md`221222---223**Version:** 3.0.0224**Last Updated:** 2025-12-23
Run npx skillmds@latest add tuyv/ln-634-test-coverage-auditor in your terminal (requires Node.js), paste this page's agent-chat prompt into Claude, Cursor, or any MCP-connected agent, or download the SKILL.md file and copy it into your agent's skills directory.
Identifies missing tests for unique critical local logic: money, auth, permissions, data integrity, algorithms, and domain rules. Use when auditing critical logic coverage gaps. It is listed under Coding & Dev Tools on SkillMD.
This skill has not completed SkillMD's automated safety review yet. SkillMD never runs a skill's scripts for you; review the SKILL.md before installing.
This skill is tagged as working with Claude Code, Claude.ai, OpenAI Codex. SKILL.md is an open format, so most agents that read a skills directory can load it too.
Yes. Installing skills from SkillMD is free. This skill is licensed under MIT.
tuyv (@tuyv) published this skill. Their other Agent Skills are listed on their SkillMD profile.