From Claude Kit
Enforces Red-Green-Refactor TDD cycle across any language with per-language test idioms (pytest, Jest, JUnit, etc.). Loaded unconditionally at startup — no production code without a failing test first.
How this skill is triggered — by the user, by Claude, or both
Slash command
/claude-kit:tdd-rulesThe summary Claude sees in its skill listing — used to decide when to auto-load this skill
`/coder` loads this skill **unconditionally** at startup (alongside `coder-rules`, `spec-check`, and the LANGUAGE-resolved `tdd-shapes/<LANGUAGE>.md`). RGR is the default Phase 2 cycle for every implementation run — no plan-level marker required. Plans MAY still include a `## TDD` heading for human-reader emphasis, but the heading is NOT a load predicate (deprecated as a contract; tolerated as ...
/coder loads this skill unconditionally at startup (alongside coder-rules, spec-check, and the LANGUAGE-resolved tdd-shapes/<LANGUAGE>.md). RGR is the default Phase 2 cycle for every implementation run — no plan-level marker required. Plans MAY still include a ## TDD heading for human-reader emphasis, but the heading is NOT a load predicate (deprecated as a contract; tolerated as prose).
NO PRODUCTION CODE WITHOUT A FAILING TEST FIRST
Wrote code before the test? Delete it. Implement fresh from a failing test run.
For EACH unit of behaviour:
{TEST_CMD}). MUST FAIL. If it passes, the test does not exercise new behaviour — revise.Return to RED for the next behaviour.
Concrete syntax for each step lives in tdd-shapes/<LANGUAGE>.md:
| LANGUAGE | File | Idiom |
|---|---|---|
| go | tdd-shapes/go.md | *testing.T, table-driven t.Run, testify |
| python | tdd-shapes/python.md | pytest, @pytest.mark.parametrize, fixtures |
| typescript | tdd-shapes/typescript.md | Jest/Vitest describe/it, it.each |
| rust | tdd-shapes/rust.md | #[test], assert_eq!, rstest |
| java | tdd-shapes/java.md | JUnit 5 @Test, assertEquals, @ParameterizedTest |
| any other / unset | tdd-shapes/_default.md | pseudocode (no language commitment) |
Selector lives in examples.md (reference_shapes block, mirrors planner-rules/examples.md).
Resolution order — highest precedence first:
PROJECT-KNOWLEDGE.md → LANGUAGE matches one of {go, python, typescript, rust, java} → load matching tdd-shapes/<LANGUAGE>.md.LANGUAGE slot is unset/empty (PROJECT-KNOWLEDGE.md missing OR slot empty) → fall back to CLAUDE.md Language Profile (kit-default = Go) → load tdd-shapes/go.md. Kit-dogfood C5 constraint preserved.LANGUAGE is set but does NOT match the 5-language enum (e.g., ruby, kotlin, kit's own "config-as-code") → load tdd-shapes/_default.md silently AND emit a consolidated NIT in coder handoff deviations_from_plan array (mirrors CG1 SKIP idiom)./coder startup step "Load TDD skill (unconditional)" duplicates this cascade — the two narratives MUST stay in sync (T3.6 single source of truth).
/coder implements each Part with interleaved tests by default — RED → GREEN → REFACTOR per behaviour. Tests are NOT a separate final Part; they are woven into each Part. Layer-dependency order from the plan is preserved either way.
Plans that still ship a Part N: Tests block (e.g. legacy plans authored before TDD-always-on, or plans following the documentation pattern in .claude/templates/plan-template.md L92-124) are tolerated — /coder will absorb the listed test cases into the per-Part RGR cycles rather than batching them into a final separate Part.
test1 / TestFooSee tdd-shapes/<LANGUAGE>.md + tdd-shapes/INVARIANTS.md for patterns; references/coder-integration.md for rationalisations + red flags.
npx claudepluginhub hex0xdeadbeef/claude-kit --plugin claude-kitGuides implementing Test-Driven Development (TDD) with RED-GREEN-REFACTOR cycle, property-based testing, and mutation testing across any language. Includes when to apply and anti-patterns.
Enforces red-green-refactor TDD cycle with configurable strictness (strict/recommended/off). Use before writing implementation code for any feature or bugfix.
Guides Test-Driven Development with Red-Green-Refactor cycle for writing code, implementing features, or fixing bugs in TDD projects.