| name | tdd |
| description | Enforce Test-Driven Development when writing or modifying code. Use when implementing features, fixing bugs, or when the user asks to write code. Activates automatically for code changes unless user says "quick fix" or "no tdd". |
TDD Skill
Enforce Red-Green-Refactor discipline for all code changes.
When This Skill Activates
- User asks to implement a feature
- User asks to fix a bug
- User asks to write or modify code
/start-devdelegates Phase 3 to this skill
When This Skill Does NOT Activate
- User says "quick fix" or "no tdd"
- Pure refactoring with no behavior change (user specifies)
- Documentation-only changes
Review Modes
Mode determines when user reviews your work. Default is interactive.
Changing Modes
User can say:
use interactive- review each cycle (default)use batch-ac- review after each acceptance criterionuse batch-story- review after all acceptance criteriause autonomous strict- agent reviews, flags any code smelluse autonomous normal- agent reviews, flags significant issuesuse autonomous relaxed- agent reviews, flags blockers only
Mode Behavior
| Mode | Review Point | Best For |
|---|---|---|
| Interactive | After each Red-Green cycle | Learning, complex logic, unfamiliar code |
| Batch AC | After completing an acceptance criterion | Moderate oversight, well-understood domain |
| Batch Story | After all acceptance criteria complete | Maximum flow, trusted patterns |
| Autonomous | Agent reviews continuously | Speed with quality gates |
Mode Persistence
- Remember the current mode throughout the conversation
- If uncertain about mode, default to interactive
- Acknowledge mode on each cycle: "Running in [mode] mode..."
- When mode changes, confirm: "Switched to [mode] mode"
The Red-Green-Refactor Workflow
For each piece of functionality:
RED: Write a Failing Test
- Identify the smallest next piece of functionality
- Write just enough test code to fail
- Interactive/Batch: Show the test, explain what it tests
- Autonomous: Proceed without showing
- Run the test:
./gradlew test - Confirm RED: Test MUST fail
- If it passes: STOP - this is suspicious, discuss with user
GREEN: Make it Pass
Choose a technique:
Technique When How Fake It Unsure of implementation Return constant, replace with variables later Obvious Implementation Know exactly what to type Write real implementation directly Triangulation Design unclear Add test cases to reveal pattern Write minimum code to pass - no more
Interactive/Batch: Show the implementation
Autonomous: Proceed without showing
Run the test:
./gradlew testConfirm GREEN: Test MUST pass before proceeding
REFACTOR: Clean Up
- Look for duplication (primary target)
- Apply clean code principles
- Interactive mode: Ask "Any refactoring before we commit?"
- Batch mode: Note refactoring opportunities, continue
- Autonomous mode: Invoke Review skill, act on findings based on threshold
- If refactoring: Run tests again to ensure still GREEN
COMMIT
Interactive mode: Wait for user confirmation before committing
Batch mode: Commit automatically, user reviews at batch point
Autonomous mode: Commit if Review skill found no blockers
git add -A && git commit -m "<descriptive message> #<issue-number>
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>"
Autonomous Mode Details
When in autonomous mode, invoke the Review skill after GREEN phase.
Threshold Behavior
| Threshold | Interrupt For | Continue If |
|---|---|---|
| Strict | Any finding (blocker, warning, suggestion) | No findings at all |
| Normal | Blockers and warnings | Only suggestions |
| Relaxed | Blockers only | Warnings and suggestions OK |
On Interrupt
When Review skill finds issues above threshold:
- Show the findings to user
- Ask how to proceed:
- Fix now
- Ignore and continue
- Switch to interactive mode
Batch Review Points
Batch AC Mode
After completing an acceptance criterion:
- Show summary of all changes made
- Show cumulative Review skill findings (if any)
- Ask user to review
- Address feedback before next criterion
Batch Story Mode
After completing all acceptance criteria:
- Show full summary of implementation
- Run comprehensive Review skill scan
- Present findings by category
- Address feedback before marking story complete
Integration with /start-dev
When invoked from /start-dev:
- Story context is already established
- Acceptance criteria are defined
- Work through criteria one by one
- Use review mode specified (or default to interactive)
Key Principles
From docs/context/testing.md:
Kent Beck's Two Rules
- Write new code only if an automated test has failed
- Eliminate duplication
The Three Laws (Uncle Bob)
- No production code unless it makes a failing test pass
- No more test code than sufficient to fail
- No more production code than sufficient to pass
Remember
- No code without a failing test first - non-negotiable
- Tests must actually run - "this would fail" doesn't count
- Small steps - each test covers one small piece
- When uncertain, ask - never proceed without clarity