Repository navigation
Description
Summary
When reporting test results, the workflow reports "N tests passed" without indicating whether those tests actually cover the changed code. This is misleading and masks coverage gaps.
Root cause from real failure:
Tests: 5 passed ✅
Build: Success ✅
None of those 5 tests touched the changed file (server-actions.ts). The user only discovered this gap after explicitly asking.
Problem Statement
The issue isn't "we need more tests" — it's transparency about what's actually being tested.
Top engineering teams don't chase test quantity. They:
- Know exactly what's covered and what isn't
- Make informed decisions about where tests add value
- Write fewer, higher-quality tests that catch real bugs
Proposed Solution
1. Update Skill Instructions (Primary Fix)
Update /qa and /exec skills to require coverage reporting after npm test:
Detection (inline bash, no external tools):
# Get changed source files (excluding tests)
changed=$(git diff main...HEAD --name-only | grep -E '\.(ts|tsx|js|jsx)$' | grep -v -E '\.test\.|\.spec\.|__tests__')
# Check for corresponding test files
for file in $changed; do
base=$(basename "$file" .ts | sed 's/\.tsx$//')
if ! find . -name "${base}.test.*" -o -name "${base}.spec.*" 2>/dev/null | grep -q .; then
echo "NO TEST: $file"
fi
doneRequired reporting format:
| Scenario | Report |
|---|---|
| Tests cover changed files | Tests: N passed (covers changed files) |
| Tests don't cover changed files | Tests: N passed (⚠️ 0 cover changed files) |
| No tests for specific files | Tests: N passed (⚠️ NO TESTS: file1.ts, file2.ts) |
2. Test Requirement Tiers
Not all code needs tests. Define clear tiers in skill instructions:
| Tier | Change Type | Requirement |
|---|---|---|
| Critical | Auth, payments, mutations, security, middleware | Flag prominently if missing |
| Standard | Business logic, API handlers, utilities | Note if missing |
| Optional | Config, types-only, UI tweaks | No flag needed |
Detection heuristic:
# Critical paths
critical=$(echo "$changed" | grep -E 'auth|payment|security|server-action|middleware|admin')3. Quality Guidelines (Documentation)
Add to testing-requirements.md:
A quality test:
- Tests behavior, not implementation details
- Covers primary use case + at least 1 failure path
- Fails when the feature breaks, passes when it works
Avoid:
- Tests that mock everything
- Tests that only cover happy path
- Tests written just to hit coverage numbers
4. Optional Hook (Reliability Enhancement)
For users who want automatic enforcement, add optional hook:
# .claude/hooks/post-test.sh (optional)
# Automatically appends coverage analysis to npm test outputThis travels with sequant (portable) and makes it impossible for Claude to "forget" the coverage check.
Acceptance Criteria
- AC-1:
/qaskill requires test coverage reporting for changed files - AC-2:
/execskill requires test coverage reporting afternpm test - AC-3: Skills classify changes by tier (critical/standard/optional)
- AC-4:
testing-requirements.mdupdated with quality guidelines - AC-5: Output templates include coverage section
- AC-6: Optional hook added to
.claude/hooks/for automatic enforcement
Non-Goals
- ❌ Custom scripts in
scripts/(not portable, maintenance burden) - ❌ GitHub Actions (platform-specific, not portable with sequant)
- ❌ Enforcing minimum coverage percentages
- ❌ Auto-generating tests (leads to low-quality tests)
- ❌ Blocking merges for missing tests on non-critical paths
Files to Modify
.claude/skills/qa/SKILL.md # Add coverage reporting requirement
.claude/skills/exec/SKILL.md # Add coverage reporting requirement
.claude/skills/qa/references/testing-requirements.md # Add quality guidelines
.claude/skills/qa/references/quality-gates.md # Add coverage metric
.claude/hooks/post-test.sh # Optional hook (new file)
Why This Approach
| Approach | Portable? | Reliable? | Chosen? |
|---|---|---|---|
| Skill instructions | ✅ Yes | Medium | ✅ Primary |
| Claude Code hook | ✅ Yes | High | ✅ Optional |
| Custom scripts | ❌ Friction | Medium | ❌ No |
| GitHub Actions | ❌ Platform-specific | High | ❌ No |
Skills + optional hook = portable, reliable, no external dependencies.
Activity
admarble commentedon Jan 21, 2026
📋 Implementation Plan for #97
Acceptance Criteria with Verification
/qaskill requires test coverage reporting/qaon branch with uncovered changes, verify coverage gap reported/execskill requires test coverage reporting/exec, verify coverage gap in output afternpm testauth/file, verify "Critical path" flagtesting-requirements.mdupdatedCLAUDE_HOOKS_COVERAGE=true, run testsImplementation Phases
Phase 1: Core Detection Logic
/qaskill (SKILL.md)/execskill (SKILL.md)testing-requirements.mdwith quality guidelinesPhase 2: Output Templates
4. Update QA output template with coverage section
5. Update exec output template with coverage reporting
Phase 3: Optional Hook
6. Add opt-in coverage hook to
post-tool.shFiles to Modify
Key Decisions
*.test.*,*.spec.*,__tests__/Assumptions to Validate
Recommended Workflow
npx sequant run 97 # exec → qa (no quality loop needed)Generated by /spec
feat(#97): add test coverage transparency and quality guidelines
admarble commentedon Jan 21, 2026
🚀 Implementation Progress Update
AC Coverage
/qaskill requires test coverage reporting/execskill requires test coverage reportingtesting-requirements.mdupdated with quality guidelinesCoverage: 6/6 AC items fully met
Files Changed
.claude/skills/qa/SKILL.md.claude/skills/exec/SKILL.md.claude/skills/qa/references/testing-requirements.md.claude/hooks/post-tool.shTest/Build Results
npm run build: Successnpm test: 10 pre-existing failures instate-update-cli.test.ts(verified same failures exist on main)PR Status
✅ PR Created: #153
Implementation Notes
*.test.*or*.spec.*files matching changed source filesauth|payment|security|server-action|middleware|adminCLAUDE_HOOKS_COVERAGE=trueto automatically log coverage analysis after npm testNext Steps
/qa 97to validate implementationGenerated by /exec
admarble commentedon Jan 21, 2026
QA Review for Issue #97
AC Coverage
/qaskill requires test coverage reporting/execskill requires test coverage reportingnpm testtesting-requirements.mdupdated with quality guidelinesCLAUDE_HOOKS_COVERAGE=trueopt-in hook with coverage analysisCoverage: 6/6 AC items fully met
Quality Metrics
any)Test Coverage Analysis
.claude/hooks/post-tool.sh.claude/skills/qa/SKILL.md.claude/skills/exec/SKILL.md.claude/skills/qa/references/testing-requirements.mdCoverage: 0/1 executable files have tests (but shell hook is Optional tier)
Critical paths without tests: None
Code Review
Strengths:
CLAUDE_HOOKS_COVERAGE=true)Issues:
Suggestions:
Test Quality Review
N/A - No test files modified
Anti-Pattern Detection
Dependency Audit
N/A - No dependency changes
Code Patterns
post-tool.sh:239Critical Issues: 0
Warnings: 0 (minor pattern noted but acceptable)
Execution Evidence
npm run buildnpm testEvidence status: Complete
Note: Test failures are pre-existing in
state-update-cli.test.tsand confirmed present on main branch.Self-Evaluation
Verdict: READY_FOR_MERGE
All 6 acceptance criteria are fully met:
/qaand/execskills now require test coverage reportingThe implementation is portable (no external dependencies), well-documented, and follows the design principles in the issue (transparency over enforcement).
Documentation
Next Steps
/docs 97if admin documentation is desiredGenerated by /qa
admarble commentedon Jan 21, 2026
QA Review for Issue #97
AC Coverage
/qaskill requires test coverage reporting/execskill requires test coverage reportingnpm testtesting-requirements.mdupdated with quality guidelinesCLAUDE_HOOKS_COVERAGE=trueopt-in hook with coverage analysisCoverage: 6/6 AC items fully met
Quality Metrics
any)Test Coverage Analysis
.claude/hooks/post-tool.sh.claude/skills/qa/SKILL.md.claude/skills/exec/SKILL.md.claude/skills/qa/references/testing-requirements.mdCoverage: 0/1 executable files have tests (shell hook is Optional tier)
Critical paths without tests: None
Code Review
Strengths:
CLAUDE_HOOKS_COVERAGE=true)Issues:
Suggestions:
Test Quality Review
N/A - No test files modified
Anti-Pattern Detection
Dependency Audit
N/A - No dependency changes
Code Patterns
No critical patterns detected. Shell script follows best practices with proper quoting and error handling.
Critical Issues: 0
Warnings: 0
Execution Evidence
npm run buildnpm testbash -n post-tool.shEvidence status: Complete
Self-Evaluation
Verdict: READY_FOR_MERGE
All 6 acceptance criteria are fully met:
/qaand/execskills now require test coverage reporting with bash detection scripttesting-requirements.mdwith test value hierarchyCLAUDE_HOOKS_COVERAGE=trueThe implementation is portable (no external dependencies), well-documented, and follows the design principles in the issue (transparency over enforcement).
Documentation
testing-requirements.mdserves as reference documentationNext Steps
/docs 97if admin documentation is desiredGenerated by /qa
feat(#97): add test coverage transparency and quality guidelines (#153)