skills/team/tdd-verify/SKILL.md
Verify AI-generated code follows TDD discipline. Use when auditing commits for TDD discipline, checking test coverage quality, detecting TDD anti-patterns, or generating compliance scorecards. Do NOT use when reviewing legacy code written before TDD was applied without first establishing a baseline; Do NOT use when you have not reviewed project history.
npx skillsauth add michaelalber/ai-toolkit tdd-verifyInstall 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.
"Any fool can write code that a computer can understand. Good programmers write code that humans can understand." — Martin Fowler
TDD verification ensures that the discipline was followed, not just that tests exist. Tests written after implementation feel different, test different things, and provide different value than tests written first.
The Gatekeeper's Role: Detect when TDD wasn't followed. Identify coverage theater (tests that don't test). Score TDD compliance. Guide improvement.
| Query | When to Call |
|-------|--------------|
| search_knowledge("TDD anti-patterns test after implementation coverage theater") | During verification — authoritative anti-pattern catalog to check against |
| search_knowledge("test quality desiderata behavioral isolated deterministic") | When scoring test quality — confirms the 12 properties and their verification questions |
| search_knowledge("code coverage mutation testing quality metrics") | When assessing coverage quality vs. coverage theater |
| search_knowledge("TDD discipline red green refactor commit order") | When auditing commit history — confirms expected TDD commit sequence |
Search at verification start to load authoritative compliance criteria. Cite the source path in the scorecard.
| Property | Verification Question | |----------|----------------------| | Isolated | Can each test run independently? | | Composable | Can tests be run in any subset? | | Deterministic | Do tests always give the same result? | | Specific | Do failures point to the exact cause? | | Behavioral | Do tests verify behavior, not implementation? | | Structure-insensitive | Would refactoring break these tests? | | Fast | Is feedback loop quick enough? | | Writable | Are tests easy to create? | | Readable | Can you understand intent quickly? | | Automated | Do tests run without intervention? | | Predictive | Does passing mean it works? | | Inspiring | Do tests give confidence to change? |
Commit History Analysis — verify test-first development by examining git history:
# Check if tests were committed before implementation
git log --oneline --name-only | less
# Expected: test file commit precedes implementation file commit
Coverage Quality Analysis — look beyond percentage to quality. Coverage theater signs: 100% coverage with no assertions, tests that only call methods, happy path only, implementation details tested.
Test Quality Audit — checklist per test: test name describes behavior, Arrange-Act-Assert structure clear, single concept per test, assertions are specific, no implementation details exposed, failure message would be helpful.
Compliance Scorecard — five categories scored 0–5: Test-First Evidence, Behavioral Tests, Minimal Implementation, Refactoring Discipline, Coverage Quality. Total out of 25.
Collect: git commit history (chronological), test file contents, implementation file contents, coverage report (if available), test execution results.
Check if tests preceded implementation. Flag any commit that contains both test and implementation files in a single commit ("should be separate"), and any implementation commit without a preceding test commit.
| Commit | Type | TDD Compliant? | |--------|------|----------------| | abc123 | Test | N/A (first) | | def456 | Impl | Yes (test first) | | ghi789 | Both | No (should be separate) | | jkl012 | Impl | No (no preceding test) |
For each test, evaluate against the 12 Desiderata. Note: Behavioral (tests outcome, not internal call), Specific (precise assertion), Isolated (no shared state), Structure-insensitive (not verifying private methods or internal structure).
High-quality indicators: tests fail when behavior breaks, edge cases covered, error paths tested, assertions verify outcomes. Theater indicators: tests pass even with broken behavior, no assertions, only exercises code paths, happy path only.
Compile findings into a report with: Overall assessment, Strengths, Improvement Areas, Recommendations (immediate, short-term, long-term), and per-category scores.
| Anti-Pattern | Signs | Detection Signal |
|---|---|---|
| Test-After Implementation | Tests mirror impl structure; same variable names as impl; test "documents" rather than "specifies" | Both test and impl in same commit; no failing-test commit before impl commit |
| Over-Mocking | More mocks than real objects; tests verify method calls; mocks returning mocks | assert_called_with(...) on implementation-internal methods |
| Happy Path Only | No error, edge, or boundary tests | Test inventory missing: zero cases, overflow cases, invalid input cases |
| Assert-Free Tests | Tests only call methods; tests print output; tests "verify" nothing | Zero assertion statements in test body |
| Implementation Coupling | Tests break on refactoring; tests verify private methods; tests depend on specific structure | _private_method or _internal_state references in test assertions |
| Copy-Paste Tests | Tests differ only in values; no parameterization; duplicated setup code | Test names following pattern test_X_1, test_X_2, test_X_3 |
## TDD Compliance Scorecard: [Repo/Branch]
**Period**: [date range] | **Commits Analyzed**: N
| Category | Score | Status |
|----------|-------|--------|
| Test-First Development | X/5 | GREEN/YELLOW/RED |
| Behavioral Testing | X/5 | GREEN/YELLOW/RED |
| Minimal Implementation | X/5 | GREEN/YELLOW/RED |
| Refactoring Discipline | X/5 | GREEN/YELLOW/RED |
| Coverage Quality | X/5 | GREEN/YELLOW/RED |
**Overall**: X/25 ([percentage]%)
Anti-patterns: [list or "none"]
Recommendations: Immediate: [...] | Short-term: [...] | Ongoing: [...]
Full templates (Detailed Verification Report with per-category analysis and Appendix): references/compliance-scoring.md
<tdd-verify-state>
scope: [repo path | branch | commit range | "pending"]
commits_analyzed: [N | "none yet"]
current_category: [test-first | behavioral | minimal-impl | refactor | coverage | "complete"]
score_so_far: [e.g., "12/20 — 3 categories complete"]
anti_patterns_found: [comma-separated list or "none"]
findings_pending_review: [N items]
last_action: [what was just done]
next_action: [what should happen next]
</tdd-verify-state>
Evidence-based verification only. Never claim TDD compliance without evidence. Commit history must show test-first ordering. Coverage must show meaningful assertions. Tests must exercise behavior, not internal structure.
Be constructive — verification is for improvement, not punishment. Frame findings as opportunities. Provide specific, actionable recommendations. Acknowledge what was done well.
Context matters. Legacy code may not follow TDD. Time pressure affects discipline. Learning curves are real. Consider the situation before scoring.
Distinguish intent from mistakes. Some code may intentionally skip tests. Some tests may be exploratory. Ask before assuming violations when the situation is ambiguous.
tdd — Audit a session run under the canonical tdd inner loop; full-cycle commit history (one test → one implementation → refactor → commit) provides the richest evidencetdd-agent — Run tdd-verify after an autonomous tdd-agent session to confirm discipline was followedtdd-pair — Run tdd-verify at the end of a pair session to score compliance and surface improvement areastdd-refactor — If tdd-verify finds implementation-coupled tests, invoke tdd-refactor to decouple them safelytdd-implementer — If tdd-verify finds over-engineering or over-mocking, trace findings back to the GREEN phase for root-causeReference files: references/compliance-scoring.md (detailed scoring methodology) | references/ai-antipatterns.md (patterns specific to AI-generated code)
development
Federal / government security overlay applied ON TOP OF a base language security review (dotnet/python/php/rust/react). Language-agnostic: adds NIST SP 800-53 control mapping, FIPS 140-2/3 cryptographic compliance (with a per-language crypto table), CUI handling, EO 14028 supply-chain requirements, and DOE Order 205.1B, and emits POA&M-ready findings with FIPS 199 impact levels. Use for federal/DOE/DOD/national-laboratory systems. Triggers on "federal security review", "NIST compliance", "NIST 800-53", "FISMA", "CUI", "FIPS audit", "DOE security", "POA&M", "ATO review". Do NOT use alone — run the matching <lang>-security-review FIRST; this overlay maps and extends it.
tools
OWASP-based security review of React / TypeScript front-end applications. Detects the framework (Vite/CRA/Next), entry points, and data flows, scans against the OWASP Top 10 (2025) mapped to React client-side patterns (XSS via raw HTML, URL/protocol injection, secrets in the bundle, insecure token storage, dependency CVEs, missing CSP, open redirects), and produces a manager-friendly executive summary plus a graded technical findings table. Use to audit React code for vulnerabilities. Triggers on "react security review", "frontend security audit", "audit react for vulnerabilities", "owasp react", "react xss", "react security posture", "npm audit review". For federal / gov / DOE / NIST / FIPS / CUI context, run security-review-federal after this base review. Do NOT use to grade architecture/structure — use react-architecture-checklist.
tools
Analyzes legacy React codebases and produces actionable modernization plans. Primary migration paths include class components to function components + hooks, Create React App to Vite, React 16/17 to 18 to 19, JavaScript to TypeScript, Enzyme to React Testing Library, legacy Redux to Redux Toolkit / Zustand / Context, and deprecated lifecycle/API removal. Does NOT perform the migration — assesses, quantifies risk, and plans. Triggers on phrases like "modernize react", "class to hooks", "upgrade react", "migrate CRA to vite", "react legacy migration", "react 17 to 18", "react js to typescript", "react technical debt", "enzyme to RTL".
development
Scaffolds feature-based React / TypeScript architecture using feature folders, presentational + container components, custom hooks, a typed data layer, and structural CQRS (query hooks vs mutation hooks). React analog of dotnet-vertical-slice and python-feature-slice — no DI framework; uses props/context for dependency injection and a query cache for server state. Use when creating feature-based React projects, adding React features, organizing components by feature rather than by technical type, or scaffolding a feature's data layer. Triggers on phrases like "scaffold react feature", "create react slice", "react feature folder", "react vertical slice", "add react feature", "react feature architecture", "organize react by feature".