tdd-refactor-coverage-audit

Installation
SKILL.md

TDD Refactor Coverage Audit

Companion to tdd-process and tdd-refactor-phase. Mechanically audits whether source files added since a reference commit have paired tests, using bundled JSON conventions file. Output is advisory only — warnings reported but never block TDD gate.

Runtime Requirements

Applies No-Runtime Fallback Pattern (see SKILL-DEVELOPMENT-GUIDE.md). Two paths, chosen by preflight:

Path Requires What it does
Primary (default) Node 18+ on PATH Invokes scripts/test-coverage-audit.js — deterministic, sub-second, exact convention-JSON-driven pairing check.
Fallback None (runs in Claude inline) Claude reads resources/test-coverage-conventions.json, runs git diff --name-status --diff-filter=A <sha>..HEAD via Bash tool, applies same pairing rules procedurally, emits equivalent advisory warnings.
Both paths preserve advisory-output contract: warnings emit; audit never halts or fails TDD gate. Fallback's output may have slight prose-formatting differences from script, but structural fields (newSources, pairedSources, missingTests[], coverage) and advisory-only semantics identical.

Preflight

Caller decides which path to invoke:

  1. Check Node: node --version available?
  2. If yes (primary path): invoke script as documented under "Invocation" below. Done.
  3. If no (fallback path): Surface Pattern 4 diagnostic — "This audit pairs newly added source files with their expected test files using language conventions. The Node script is the primary path; without Node, Claude can perform the same pairing inline by reading the convention JSON + running git diff via the Bash tool. The result is structurally equivalent and remains advisory. Or install Node 18+ for the deterministic primary path." Then execute Fallback Procedure below.

Fallback Procedure

When Node unavailable, perform audit inline:

  1. Read convention JSON from Skills/tdd-refactor-coverage-audit/resources/test-coverage-conventions.json. Defines languages (language → sourceExtensions[], testPatterns[], optional excludePatterns, inlineTests), ignoredSourcePatterns[], minTestCoverageRatio (default 0).
  2. Read project override (if present) from framework-config.json. If testCoverageAudit block exists, merge over bundled: additionalLanguages added to languages; ignoredSourcePatterns unioned; minTestCoverageRatio overridden.
  3. Enumerate added source files. Run git diff --name-status --diff-filter=A <since-commit>..HEAD via Bash. Leading A\t indicates added files; collect paths.
  4. For each added file: skip if matches ignoredSourcePatterns; detect language by extension against sourceExtensions (skip if no match); skip if matches language's excludePatterns; for each testPatterns entry, substitute {stem} (filename without extension) and {dir} (relative directory), check if any expanded path exists on disk; for languages with inlineTests: true (Rust), additionally read source and check for inline #[cfg(test)] block (counts as paired); if no test file found and no inline block, append to missingTests[] with file path, language, patterns checked.
Installs
1
GitHub Stars
1
First Seen
Jul 9, 2026
tdd-refactor-coverage-audit — tomevault-io/skills-registry