From odin
Guides 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.
How this skill is triggered — by the user, by Claude, or both
Slash command
/odin:test-drivenThe summary Claude sees in its skill listing — used to decide when to auto-load this skill
Tests define the specification. Design them from requirements before any implementation. The RED-GREEN-REFACTOR cycle is the heartbeat: write a failing test, make it pass with minimal code, then clean up while green.
Tests define the specification. Design them from requirements before any implementation. The RED-GREEN-REFACTOR cycle is the heartbeat: write a failing test, make it pass with minimal code, then clean up while green.
Modern insight (2025): TDD + property-based testing pairing is the standard -- example tests prevent regressions, property tests discover edge cases. TDD also serves AI-assisted development: structural integrity keeps code understandable for both human and AI collaborators (Kent Beck, "Augmented Coding"). Mutation testing validates test quality beyond coverage metrics (TDD+Mutation: 63.3% vs TDD-alone: 39.4% mutation coverage).
See frameworks for language-specific test runners, property testing, coverage, and mutation tools. See examples for brief TDD cycle patterns per language.
| Gate | Pass Criteria | Blocking |
|---|---|---|
| Tests Created | Test files exist for target module | Yes |
| RED State | All new tests fail before implementation | Yes |
| GREEN State | All tests pass after implementation | Yes |
| Coverage | >= 80% line coverage | No |
| Mutation | Mutation score reviewed (no threshold enforced) | No |
| Code | Meaning |
|---|---|
| 0 | TDD cycle complete, all tests pass |
| 11 | No test framework detected |
| 12 | Test compilation failed |
| 13 | Tests not failing (RED state invalid) |
| 14 | Tests fail after implementation (GREEN not achieved) |
| 15 | Tests fail after refactor (regression) |
references/mocking.md — when to mock vs use real implementations; trade-offs.references/interface-design.md — interface shape and depth in TDD context.references/refactoring.md — refactor step discipline post-green.references/deep-modules.md — Ousterhout's deep-module heuristic applied to TDD.references/tests.md — what counts as a real-bug test vs ceremony.These reference docs are MIT-licensed (see /home/alpha/.claude/claude/skills/LICENSES.md for full attribution).
npx claudepluginhub outlinedriven/odin-claude-plugin --plugin odinGuides TDD workflow with red-green-refactor cycle: plan interfaces, tracer bullet tests, minimal implementation to green, refactor under tests. For explicit TDD requests only.