TDD Workflow
CautionTest-driven development skill that enforces the red-green-refactor cycle. Write failing tests first, then implement minimal code to pass.
Install
Claude Code
Copy the SKILL.md file to .claude/skills/tdd-workflow.md About This Skill
TDD Workflow enforces the classic red-green-refactor cycle in your AI-assisted development. Instead of writing code first, the agent writes a failing test, implements the minimum code to make it pass, then refactors.
The Cycle
- Red — Write a test that describes the desired behavior. Run it to confirm it fails.
- Green — Write the minimal implementation to make the test pass. No more, no less.
- Refactor — Clean up the code while keeping all tests green.
- Commit — Make a small, focused commit.
Why Use This Skill
- Forces the agent to think about requirements before implementation
- Produces code with built-in test coverage
- Keeps implementations minimal and focused
- Creates a natural commit rhythm with working checkpoints
Use Cases
- Feature development with test-first approach
- Bug fixing with regression test coverage
- Refactoring with confidence
- Teaching TDD methodology to teams
Pros & Cons
Pros
- + Guarantees test coverage for new code
- + Prevents over-engineering
- + Creates clean commit history
- + Works with any test framework
Cons
- - Slower initial development pace
- - Requires a working test runner in the project
- - Not ideal for exploratory/prototyping work
Related Skills
Code Reviewer
Verified CC Cu Cx WS
Automated code review agent that checks for bugs, security vulnerabilities, performance issues, and style violations across multiple languages.
8,900 development
View
Systematic Debugging
Caution CC Cu Cx Gm
Systematic debugging with root cause analysis, stack trace interpretation, and hypothesis-driven troubleshooting.
11,200 development
View
Stay Updated on Agent Skills
Get weekly curated skills + safety alerts
每周精选 Skills + 安全预警