From tdd-workflows
Implements minimal code to pass failing tests in TDD green phase. Provide descriptions of failing tests or test file paths as argument.
How this command is triggered — by the user, by Claude, or both
Slash command
/tdd-workflows:tdd-green <description of failing tests or test file paths>The summary Claude sees in its command listing — used to decide when to auto-load this command
# TDD Green Phase ## CRITICAL BEHAVIORAL RULES You MUST follow these rules exactly. Violating any of them is a failure. 1. **Implement only what tests require.** Do NOT add features, optimizations, or error handling beyond what failing tests demand. 2. **Run tests after each change.** Verify progress incrementally — do not batch implement and hope it works. 3. **Halt on failure.** If tests remain red after implementation or existing tests break, STOP and present the error to the user. 4. **Use only local agents.** All `subagent_type` references use agents bundled with this plugin or `gen...
You MUST follow these rules exactly. Violating any of them is a failure.
subagent_type references use agents bundled with this plugin or general-purpose. No cross-plugin dependencies.Use the Task tool to implement minimal passing code:
Task:
subagent_type: "general-purpose"
description: "Implement minimal code to pass failing tests"
prompt: |
You are a test automation expert implementing the GREEN phase of TDD.
Implement MINIMAL code to make these failing tests pass: $ARGUMENTS
Follow TDD green phase principles:
1. **Pre-Implementation Analysis**
- Review all failing tests and their error messages
- Identify the simplest path to make tests pass
- Map test requirements to minimal implementation needs
- Avoid premature optimization or over-engineering
- Focus only on making tests green, not perfect code
2. **Implementation Strategy**
- **Fake It**: Return hard-coded values when appropriate
- **Obvious Implementation**: When solution is trivial and clear
- **Triangulation**: Generalize only when multiple tests require it
- Start with the simplest test and work incrementally
- One test at a time — don't try to pass all at once
3. **Code Structure Guidelines**
- Write the minimal code that could possibly work
- Avoid adding functionality not required by tests
- Use simple data structures initially
- Defer architectural decisions until refactor phase
- Keep methods/functions small and focused
- Don't add error handling unless tests require it
4. **Progressive Implementation**
- Make first test pass with simplest possible code
- Run tests after each change to verify progress
- Add just enough code for next failing test
- Resist urge to implement beyond test requirements
- Keep track of technical debt for refactor phase
- Document assumptions and shortcuts taken
5. **Success Criteria**
- All tests pass (green)
- No extra functionality beyond test requirements
- Code is readable even if not optimal
- No broken existing functionality
- Clear path to refactoring identified
Output should include:
- Complete implementation code
- Test execution results showing all green
- List of shortcuts taken for later refactoring
- Technical debt documentation
- Readiness assessment for refactor phase
After implementation:
If tests still fail:
npx claudepluginhub arogyareddy/https-github.com-wshobson-agents --plugin tdd-workflows/tdd-greenImplements minimal code to pass failing tests in TDD green phase. Provide descriptions of failing tests or test file paths as argument.
/tdd-greenExecutes the TDD Green phase by implementing minimal code to pass failing test cases, verifies tests pass, and records implementation details and quality assessment.
/red-green-refactorStarts a TDD session using the red-green-refactor cycle: write failing tests, implement minimal passing code, then refactor in Ruby or JavaScript.
/tddGuides an interactive TDD cycle for a feature: Red (write failing test), Green (minimal passing code), Refactor (cleanup), repeat for next behavior.