.claude/skills/tdd-cycle/SKILL.md
Execute a complete TDD cycle (RED → GREEN → REFACTOR) for one test. Orchestrates the full workflow from writing a failing test through implementation and refactoring to commit.
npx skillsauth add swiftyjunnos/claude-code-with-tdd tdd-cycleInstall 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.
This skill orchestrates a complete Test-Driven Development cycle, guiding through all phases: RED (write failing test), GREEN (make it pass), REFACTOR (improve structure), and proper commits. Use this when you want to complete one full TDD iteration.
Use this skill when:
Execute tdd-red skill:
Success Criteria:
Use: /red command or tdd-red skill
Execute tdd-green skill:
Success Criteria:
Use: /green command or tdd-green skill
Execute tdd-refactor skill (if needed):
Success Criteria:
When to Skip:
Use: /refactor command or tdd-refactor skill
Commit Strategy:
If Structural Changes Were Made:
First, commit structural changes separately:
/commit-tidy
Then, commit behavioral changes:
/commit-behavior
If No Structural Changes:
/commit-behavior
Commit Prerequisites:
Prepare for Next Cycle:
START
↓
RED: Write failing test
↓
Confirm test fails? ──No──> Fix test
↓ Yes
GREEN: Implement minimum code
↓
All tests pass? ──No──> Debug & fix
↓ Yes
Need refactoring? ──Yes──> REFACTOR: Improve structure
↓ No ↓
←───────────────────────────┘
COMMIT: Save changes
↓
Next test? ──Yes──> START
↓ No
DONE
RED Phase:
GREEN Phase:
REFACTOR Phase:
COMMIT Phase:
Within this cycle, you can use:
/red - Execute RED phase/green - Execute GREEN phase/refactor - Execute REFACTOR phase/tidy - Make structural changes (Tidy First)/commit-tidy - Commit structural changes/commit-behavior - Commit behavioral changes/run-tests - Run all tests/next-test - View next test in PLAN.mdRED: Write test "should calculate total price with discount"
calculateTotalWithDiscount is not definedGREEN: Implement basic calculation
function calculateTotalWithDiscount(price, discount) {
return price - discount;
}
REFACTOR: Extract validation logic
COMMIT:
REPEAT: Move to next test
After completing one full cycle:
development
Execute Kent Beck's Tidy First approach by making structural changes to code without changing behavior. Prepares code for easier behavioral changes by improving structure first.
development
Execute the REFACTOR phase of TDD by improving code structure while keeping all tests green. Removes duplication, improves naming, and enhances code quality without changing behavior.
testing
Execute the RED phase of TDD by writing a failing test for the next unmarked item in PLAN.md. Writes tests with Korean descriptions and confirms test failure.
development
Execute the GREEN phase of TDD by implementing the minimum code needed to make the failing test pass. Follows the principle of simplest solution that could possibly work.