Use this skill when
- Working on tdd workflows tdd cycle tasks or workflows
- Needing guidance, best practices, or checklists for tdd workflows tdd cycle
Do not use this skill when
- The task is unrelated to tdd workflows tdd cycle
- You need a different domain or tool outside this scope
Instructions
- Clarify goals, constraints, and required inputs.
- Apply relevant best practices and validate outcomes.
- Provide actionable steps and verification.
- If detailed examples are required, open
resources/implementation-playbook.md.
Execute a comprehensive Test-Driven Development (TDD) workflow with strict red-green-refactor discipline:
[Extended thinking: This workflow enforces test-first development through coordinated agent orchestration. Each phase of the TDD cycle is strictly enforced with fail-first verification, incremental implementation, and continuous refactoring. The workflow supports both single test and test suite approaches with configurable coverage thresholds.]
Configuration
Coverage Thresholds
- Minimum line coverage: 80%
- Minimum branch coverage: 75%
- Critical path coverage: 100%
Refactoring Triggers
- Cyclomatic complexity > 10
- Method length > 20 lines
- Class length > 200 lines
- Duplicate code blocks > 3 lines
Phase 1: Test Specification and Design
1. Requirements Analysis
- Use Task tool with subagent_type="comprehensive-review::architect-review"
- Prompt: "Analyze requirements for: $ARGUMENTS. Define acceptance criteria, identify edge cases, and create test scenarios. Output a comprehensive test specification."
- Output: Test specification, acceptance criteria, edge case matrix
- Validation: Ensure all requirements have corresponding test scenarios
2. Test Architecture Design
- Use Task tool with subagent_type="unit-testing::test-automator"
- Prompt: "Design test architecture for: $ARGUMENTS based on test specification. Define test structure, fixtures, mocks, and test data strategy. Ensure testability and maintainability."
- Output: Test architecture, fixture design, mock strategy
- Validation: Architecture supports isolated, fast, reliable tests
Phase 2: RED - Write Failing Tests
3. Write Unit Tests (Failing)
- Use Task tool with subagent_type="unit-testing::test-automator"
- Prompt: "Write FAILING unit tests for: $ARGUMENTS. Tests must fail initially. Include edge cases, error scenarios, and happy paths. DO NOT implement production code."
- Output: Failing unit tests, test documentation
- CRITICAL: Verify all tests fail with expected error messages
4. Verify Test Failure
- Use Task tool with subagent_type="tdd-workflows::code-reviewer"
- Prompt: "Verify that all tests for: $ARGUMENTS are failing correctly. Ensure failures are for the right reasons (missing implementation, not test errors). Confirm no false positives."
- Output: Test failure verification report
- GATE: Do not proceed until all tests fail appropriately
Phase 3: GREEN - Make Tests Pass
5. Minimal Implementation
- Use Task tool with subagent_type="backend-development::backend-architect"
- Prompt: "Implement MINIMAL code to make tests pass for: $ARGUMENTS. Focus only on making tests green. Do not add extra features or optimizations. Keep it simple."
- Output: Minimal working implementation
- Constraint: No code beyond what's needed to pass tests
6. Verify Test Success
- Use Task tool with subagent_type="unit-testing::test-automator"
- Prompt: "Run all tests for: $ARGUMENTS and verify they pass. Check test coverage metrics. Ensure no tests were accidentally broken."
- Output: Test execution report, coverage metrics
- GATE: All tests must pass before proceeding
Phase 4: REFACTOR - Improve Code Quality
7. Code Refactoring
- Use Task tool with subagent_type="tdd-workflows::code-reviewer"
- Prompt: "Refactor implementation for: $ARGUMENTS while keeping tests green. Apply SOLID principles, remove duplication, improve naming, and optimize performance. Run tests after each refactoring."
- Output: Refactored code, refactoring report
- Constraint: Tests must remain green throughout
8. Test Refactoring
- Use Task tool with subagent_type="unit-testing::test-automator"
- Prompt: "Refactor tests for: $ARGUMENTS. Remove test duplication, improve test names, extract common fixtures, and enhance test readability. Ensure tests still provide same coverage."
- Output: Refactored tests, improved test structure
- Validation: Coverage metrics unchanged or improved
Phase 5: Integration and System Tests
9. Write Integration Tests (Failing First)
- Use Task tool with subagent_type="unit-testing::test-automator"
- Prompt: "Write FAILING integration tests for: $ARGUMENTS. Test component interactions, API contracts, and data flow. Tests must fail initially."
- Output: Failing integration tests
- Validation: Tests fail due to missing integration logic
10. Implement Integration
- Use Task tool with subagent_type="backend-development::backend-architect"
- Prompt: "Implement integration code for: $ARGUMENTS to make integration tests pass. Focus on component interaction and data flow."
- Output: Integration implementation
- Validation: All integration tests pass
Phase 6: Continuous Improvement Cycle
11. Performance and Edge Case Tests
- Use Task tool with subagent_type="unit-testing::test-automator"
- Prompt: "Add performance tests and additional edge case tests for: $ARGUMENTS. Include stress tests, boundary tests, and error recovery tests."
- Output: Extended test suite
- Metric: Increased test coverage and scenario coverage
12. Final Code Review
- Use Task tool with subagent_type="comprehensive-review::architect-review"
- Prompt: "Perform comprehensive review of: $ARGUMENTS. Verify TDD process was followed, check code quality, test quality, and coverage. Suggest improvements."
- Output: Review report, improvement suggestions
- Action: Implement critical suggestions while maintaining green tests
Incremental Development Mode
For test-by-test development:
- Write ONE failing test
- Make ONLY that test pass
- Refactor if needed
- Repeat for next test
Use this approach by adding --incremental flag to focus on one test at a time.
Test Suite Mode
For comprehensive test suite development:
- Write ALL tests for a feature/module (failing)
- Implement code to pass ALL tests
- Refactor entire module
- Add integration tests
Use this approach by adding --suite flag for batch test development.
Validation Checkpoints
RED Phase Validation
GREEN Phase Validation
REFACTOR Phase Validation
Coverage Reports
Generate coverage reports after each phase:
- Line coverage
- Branch coverage
- Function coverage
- Statement coverage
Failure Recovery
If TDD discipline is broken:
- STOP immediately
- Identify which phase was violated
- Rollback to last valid state
- Resume from correct phase
- Document lesson learned
TDD Metrics Tracking
Track and report:
- Time in each phase (Red/Green/Refactor)
- Number of test-implementation cycles
- Coverage progression
- Refactoring frequency
- Defect escape rate
Anti-Patterns to Avoid
- Writing implementation before tests
- Writing tests that already pass
- Skipping the refactor phase
- Writing multiple features without tests
- Modifying tests to make them pass
- Ignoring failing tests
- Writing tests after implementation
Success Criteria
- 100% of code written test-first
- All tests pass continuously
- Coverage exceeds thresholds
- Code complexity within limits
- Zero defects in covered code
- Clear test documentation
- Fast test execution (< 5 seconds for unit tests)
Notes
- Enforce strict RED-GREEN-REFACTOR discipline
- Each phase must be completed before moving to next
- Tests are the specification
- If a test is hard to write, the design needs improvement
- Refactoring is NOT optional
- Keep test execution fast
- Tests should be independent and isolated
TDD implementation for: $ARGUMENTS
Limitations
- Use this skill only when the task clearly matches the scope described above.
- Do not treat the output as a substitute for environment-specific validation, testing, or expert review.
- Stop and ask for clarification if required inputs, permissions, safety boundaries, or success criteria are missing.
Source: sickn33/agentic-awesome-skills → skills/tdd-workflows-tdd-cycle/SKILL.md
Also appears in: sickn33/agentic-awesome-skills/plugins/agentic-awesome-skills/skills/tdd-workflows-tdd-cycle/SKILL.md, sickn33/agentic-awesome-skills/plugins/agentic-awesome-skills-claude/skills/tdd-workflows-tdd-cycle/SKILL.md
1---2name: tdd-workflows-tdd-cycle3description: Use when working with tdd workflows tdd cycle4---567## Use this skill when89- Working on tdd workflows tdd cycle tasks or workflows10- Needing guidance, best practices, or checklists for tdd workflows tdd cycle1112## Do not use this skill when1314- The task is unrelated to tdd workflows tdd cycle15- You need a different domain or tool outside this scope1617## Instructions1819- Clarify goals, constraints, and required inputs.20- Apply relevant best practices and validate outcomes.21- Provide actionable steps and verification.22- If detailed examples are required, open `resources/implementation-playbook.md`.2324Execute a comprehensive Test-Driven Development (TDD) workflow with strict red-green-refactor discipline:2526[Extended thinking: This workflow enforces test-first development through coordinated agent orchestration. Each phase of the TDD cycle is strictly enforced with fail-first verification, incremental implementation, and continuous refactoring. The workflow supports both single test and test suite approaches with configurable coverage thresholds.]2728## Configuration2930### Coverage Thresholds31- Minimum line coverage: 80%32- Minimum branch coverage: 75%33- Critical path coverage: 100%3435### Refactoring Triggers36- Cyclomatic complexity > 1037- Method length > 20 lines38- Class length > 200 lines39- Duplicate code blocks > 3 lines4041## Phase 1: Test Specification and Design4243### 1. Requirements Analysis44- Use Task tool with subagent_type="comprehensive-review::architect-review"45- Prompt: "Analyze requirements for: $ARGUMENTS. Define acceptance criteria, identify edge cases, and create test scenarios. Output a comprehensive test specification."46- Output: Test specification, acceptance criteria, edge case matrix47- Validation: Ensure all requirements have corresponding test scenarios4849### 2. Test Architecture Design50- Use Task tool with subagent_type="unit-testing::test-automator"51- Prompt: "Design test architecture for: $ARGUMENTS based on test specification. Define test structure, fixtures, mocks, and test data strategy. Ensure testability and maintainability."52- Output: Test architecture, fixture design, mock strategy53- Validation: Architecture supports isolated, fast, reliable tests5455## Phase 2: RED - Write Failing Tests5657### 3. Write Unit Tests (Failing)58- Use Task tool with subagent_type="unit-testing::test-automator"59- Prompt: "Write FAILING unit tests for: $ARGUMENTS. Tests must fail initially. Include edge cases, error scenarios, and happy paths. DO NOT implement production code."60- Output: Failing unit tests, test documentation61- **CRITICAL**: Verify all tests fail with expected error messages6263### 4. Verify Test Failure64- Use Task tool with subagent_type="tdd-workflows::code-reviewer"65- Prompt: "Verify that all tests for: $ARGUMENTS are failing correctly. Ensure failures are for the right reasons (missing implementation, not test errors). Confirm no false positives."66- Output: Test failure verification report67- **GATE**: Do not proceed until all tests fail appropriately6869## Phase 3: GREEN - Make Tests Pass7071### 5. Minimal Implementation72- Use Task tool with subagent_type="backend-development::backend-architect"73- Prompt: "Implement MINIMAL code to make tests pass for: $ARGUMENTS. Focus only on making tests green. Do not add extra features or optimizations. Keep it simple."74- Output: Minimal working implementation75- Constraint: No code beyond what's needed to pass tests7677### 6. Verify Test Success78- Use Task tool with subagent_type="unit-testing::test-automator"79- Prompt: "Run all tests for: $ARGUMENTS and verify they pass. Check test coverage metrics. Ensure no tests were accidentally broken."80- Output: Test execution report, coverage metrics81- **GATE**: All tests must pass before proceeding8283## Phase 4: REFACTOR - Improve Code Quality8485### 7. Code Refactoring86- Use Task tool with subagent_type="tdd-workflows::code-reviewer"87- Prompt: "Refactor implementation for: $ARGUMENTS while keeping tests green. Apply SOLID principles, remove duplication, improve naming, and optimize performance. Run tests after each refactoring."88- Output: Refactored code, refactoring report89- Constraint: Tests must remain green throughout9091### 8. Test Refactoring92- Use Task tool with subagent_type="unit-testing::test-automator"93- Prompt: "Refactor tests for: $ARGUMENTS. Remove test duplication, improve test names, extract common fixtures, and enhance test readability. Ensure tests still provide same coverage."94- Output: Refactored tests, improved test structure95- Validation: Coverage metrics unchanged or improved9697## Phase 5: Integration and System Tests9899### 9. Write Integration Tests (Failing First)100- Use Task tool with subagent_type="unit-testing::test-automator"101- Prompt: "Write FAILING integration tests for: $ARGUMENTS. Test component interactions, API contracts, and data flow. Tests must fail initially."102- Output: Failing integration tests103- Validation: Tests fail due to missing integration logic104105### 10. Implement Integration106- Use Task tool with subagent_type="backend-development::backend-architect"107- Prompt: "Implement integration code for: $ARGUMENTS to make integration tests pass. Focus on component interaction and data flow."108- Output: Integration implementation109- Validation: All integration tests pass110111## Phase 6: Continuous Improvement Cycle112113### 11. Performance and Edge Case Tests114- Use Task tool with subagent_type="unit-testing::test-automator"115- Prompt: "Add performance tests and additional edge case tests for: $ARGUMENTS. Include stress tests, boundary tests, and error recovery tests."116- Output: Extended test suite117- Metric: Increased test coverage and scenario coverage118119### 12. Final Code Review120- Use Task tool with subagent_type="comprehensive-review::architect-review"121- Prompt: "Perform comprehensive review of: $ARGUMENTS. Verify TDD process was followed, check code quality, test quality, and coverage. Suggest improvements."122- Output: Review report, improvement suggestions123- Action: Implement critical suggestions while maintaining green tests124125## Incremental Development Mode126127For test-by-test development:1281. Write ONE failing test1292. Make ONLY that test pass1303. Refactor if needed1314. Repeat for next test132133Use this approach by adding `--incremental` flag to focus on one test at a time.134135## Test Suite Mode136137For comprehensive test suite development:1381. Write ALL tests for a feature/module (failing)1392. Implement code to pass ALL tests1403. Refactor entire module1414. Add integration tests142143Use this approach by adding `--suite` flag for batch test development.144145## Validation Checkpoints146147### RED Phase Validation148- [ ] All tests written before implementation149- [ ] All tests fail with meaningful error messages150- [ ] Test failures are due to missing implementation151- [ ] No test passes accidentally152153### GREEN Phase Validation154- [ ] All tests pass155- [ ] No extra code beyond test requirements156- [ ] Coverage meets minimum thresholds157- [ ] No test was modified to make it pass158159### REFACTOR Phase Validation160- [ ] All tests still pass after refactoring161- [ ] Code complexity reduced162- [ ] Duplication eliminated163- [ ] Performance improved or maintained164- [ ] Test readability improved165166## Coverage Reports167168Generate coverage reports after each phase:169- Line coverage170- Branch coverage171- Function coverage172- Statement coverage173174## Failure Recovery175176If TDD discipline is broken:1771. **STOP** immediately1782. Identify which phase was violated1793. Rollback to last valid state1804. Resume from correct phase1815. Document lesson learned182183## TDD Metrics Tracking184185Track and report:186- Time in each phase (Red/Green/Refactor)187- Number of test-implementation cycles188- Coverage progression189- Refactoring frequency190- Defect escape rate191192## Anti-Patterns to Avoid193194- Writing implementation before tests195- Writing tests that already pass196- Skipping the refactor phase197- Writing multiple features without tests198- Modifying tests to make them pass199- Ignoring failing tests200- Writing tests after implementation201202## Success Criteria203204- 100% of code written test-first205- All tests pass continuously206- Coverage exceeds thresholds207- Code complexity within limits208- Zero defects in covered code209- Clear test documentation210- Fast test execution (< 5 seconds for unit tests)211212## Notes213214- Enforce strict RED-GREEN-REFACTOR discipline215- Each phase must be completed before moving to next216- Tests are the specification217- If a test is hard to write, the design needs improvement218- Refactoring is NOT optional219- Keep test execution fast220- Tests should be independent and isolated221222TDD implementation for: $ARGUMENTS223224## Limitations225- Use this skill only when the task clearly matches the scope described above.226- Do not treat the output as a substitute for environment-specific validation, testing, or expert review.227- Stop and ask for clarification if required inputs, permissions, safety boundaries, or success criteria are missing.228229---230231**Source:** [`sickn33/agentic-awesome-skills`](https://github.com/sickn33/agentic-awesome-skills) → `skills/tdd-workflows-tdd-cycle/SKILL.md`232233**Also appears in:** `sickn33/agentic-awesome-skills/plugins/agentic-awesome-skills/skills/tdd-workflows-tdd-cycle/SKILL.md`, `sickn33/agentic-awesome-skills/plugins/agentic-awesome-skills-claude/skills/tdd-workflows-tdd-cycle/SKILL.md`