Agent skill
tdd
Guide Test-Driven Development using Kent Beck's Red-Green-Refactor cycle. Use when writing tests, implementing features via TDD, or following plan.md test instructions.
Install this agent skill to your Project
npx add-skill https://github.com/majiayu000/claude-skill-registry/tree/main/skills/data/tdd
SKILL.md
INSTRUCTIONS
Follow Kent Beck's TDD and Tidy First principles using the three-phase workflow:
- RED -
/tdd:red- Write ONE small failing test - GREEN -
/tdd:green- Make it pass with minimal code, then commit - REFACTOR -
/tdd:refactor- Improve structure without changing behavior, commit each step
Workflow Pattern
/tdd:red → write failing test → /tdd:green → pass test → /git:commit
↓
← next feature ← /tdd:red ← satisfied? ← /tdd:refactor (repeat as needed)
Core Principles
- One test at a time: Each RED adds exactly ONE failing test
- Minimal code: GREEN phase writes just enough to pass
- Never skip REFACTOR: Every TDD cycle must complete all three phases
- Tidy First: Separate structural changes (refactor) from behavioral changes (feat/fix)
- Small commits: Commit after GREEN, commit after EACH refactor step
Strategy Selection (GREEN Phase)
| Confidence | Strategy | Use When |
|---|---|---|
| Low | Fake It | Return constant, generalize later |
| High | Obvious Implementation | Solution is clear |
| Generalizing | Triangulation | Add test to break a fake |
Quality Standards
- Eliminate duplication between test and production code
- Express intent through clear naming
- Keep methods small and focused
- Run ALL tests after EVERY change
Recommended Agent Skills
Expand your agent's capabilities with these related and highly-rated skills.
agent-ops-spec
Manage specification documents in .agent/specs/. Use when user provides requirements, acceptance criteria, or feature descriptions that need to be tracked and validated against implementation.
agent-ops-state
Maintain .agent state files. Use at session start, after meaningful steps, and before concluding: read/update constitution/memory/focus/issues/baseline consistently.
agent-ops-spec
Manage specification documents in .agent/specs/. Use when user provides requirements, acceptance criteria, or feature descriptions that need to be tracked and validated against implementation.
agent-ops-testing
Test strategy, execution, and coverage analysis. Use when designing tests, running test suites, or analyzing test results beyond baseline checks.
agent-ops-testing
Test strategy, execution, and coverage analysis. Use when designing tests, running test suites, or analyzing test results beyond baseline checks.
agent-ops-state
Maintain .agent state files. Use at session start, after meaningful steps, and before concluding: read/update constitution/memory/focus/issues/baseline consistently.
Didn't find tool you were looking for?