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::backen
1---2name: tdd-workflows-tdd-cycle3description: Use when working with tdd workflows tdd cycle 4category: Document Processing5source: antigravity6tags: [api, ai, agent, workflow, design, document, rag]7url: https://github.com/sickn33/antigravity-awesome-skills/tree/main/skills/tdd-workflows-tdd-cycle8metadata:9 source: https://skillmd.com/skills/sickn33/tdd-workflows-tdd-cycle10---111213## Use this skill when1415- Working on tdd workflows tdd cycle tasks or workflows16- Needing guidance, best practices, or checklists for tdd workflows tdd cycle1718## Do not use this skill when1920- The task is unrelated to tdd workflows tdd cycle21- You need a different domain or tool outside this scope2223## Instructions2425- Clarify goals, constraints, and required inputs.26- Apply relevant best practices and validate outcomes.27- Provide actionable steps and verification.28- If detailed examples are required, open `resources/implementation-playbook.md`.2930Execute a comprehensive Test-Driven Development (TDD) workflow with strict red-green-refactor discipline:3132[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.]3334## Configuration3536### Coverage Thresholds37- Minimum line coverage: 80%38- Minimum branch coverage: 75%39- Critical path coverage: 100%4041### Refactoring Triggers42- Cyclomatic complexity > 1043- Method length > 20 lines44- Class length > 200 lines45- Duplicate code blocks > 3 lines4647## Phase 1: Test Specification and Design4849### 1. Requirements Analysis50- Use Task tool with subagent_type="comprehensive-review::architect-review"51- Prompt: "Analyze requirements for: $ARGUMENTS. Define acceptance criteria, identify edge cases, and create test scenarios. Output a comprehensive test specification."52- Output: Test specification, acceptance criteria, edge case matrix53- Validation: Ensure all requirements have corresponding test scenarios5455### 2. Test Architecture Design56- Use Task tool with subagent_type="unit-testing::test-automator"57- Prompt: "Design test architecture for: $ARGUMENTS based on test specification. Define test structure, fixtures, mocks, and test data strategy. Ensure testability and maintainability."58- Output: Test architecture, fixture design, mock strategy59- Validation: Architecture supports isolated, fast, reliable tests6061## Phase 2: RED - Write Failing Tests6263### 3. Write Unit Tests (Failing)64- Use Task tool with subagent_type="unit-testing::test-automator"65- Prompt: "Write FAILING unit tests for: $ARGUMENTS. Tests must fail initially. Include edge cases, error scenarios, and happy paths. DO NOT implement production code."66- Output: Failing unit tests, test documentation67- **CRITICAL**: Verify all tests fail with expected error messages6869### 4. Verify Test Failure70- Use Task tool with subagent_type="tdd-workflows::code-reviewer"71- 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."72- Output: Test failure verification report73- **GATE**: Do not proceed until all tests fail appropriately7475## Phase 3: GREEN - Make Tests Pass7677### 5. Minimal Implementation78- Use Task tool with subagent_type="backend-development::backend-architect"79- 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."80- Output: Minimal working implementation81- Constraint: No code beyond what's needed to pass tests8283### 6. Verify Test Success84- Use Task tool with subagent_type="unit-testing::test-automator"85- Prompt: "Run all tests for: $ARGUMENTS and verify they pass. Check test coverage metrics. Ensure no tests were accidentally broken."86- Output: Test execution report, coverage metrics87- **GATE**: All tests must pass before proceeding8889## Phase 4: REFACTOR - Improve Code Quality9091### 7. Code Refactoring92- Use Task tool with subagent_type="tdd-workflows::code-reviewer"93- Prompt: "Refactor implementation for: $ARGUMENTS while keeping tests green. Apply SOLID principles, remove duplication, improve naming, and optimize performance. Run tests after each refactoring."94- Output: Refactored code, refactoring report95- Constraint: Tests must remain green throughout9697### 8. Test Refactoring98- Use Task tool with subagent_type="unit-testing::test-automator"99- Prompt: "Refactor tests for: $ARGUMENTS. Remove test duplication, improve test names, extract common fixtures, and enhance test readability. Ensure tests still provide same coverage."100- Output: Refactored tests, improved test structure101- Validation: Coverage metrics unchanged or improved102103## Phase 5: Integration and System Tests104105### 9. Write Integration Tests (Failing First)106- Use Task tool with subagent_type="unit-testing::test-automator"107- Prompt: "Write FAILING integration tests for: $ARGUMENTS. Test component interactions, API contracts, and data flow. Tests must fail initially."108- Output: Failing integration tests109- Validation: Tests fail due to missing integration logic110111### 10. Implement Integration112- Use Task tool with subagent_type="backend-development::backen