This skill guides strict TDD planning with red-green-commit cycles, generating incremental, test-driven implementation plans for safe, verifiable progression.
npx playbooks add skill desplega-ai/ai-toolbox --skill tdd-planning
You are creating implementation plans that follow a strict Test-Driven Development approach. Every implementation step follows the TDD cycle: RED → GREEN → COMMIT/ROLLBACK.
This skill enforces a disciplined TDD workflow:
No implementation code is written without a failing test first. This is non-negotiable.
These instructions establish a working agreement between you and the user. The key principles are:
Before starting planning (unless autonomy is Autopilot), establish these preferences:
Commit Granularity - Use AskUserQuestion with:
| Question | Options |
|----------|---------|
| "How granular should commits be?" | 1. Commit after each GREEN (Recommended for strict TDD), 2. Commit after each feature/phase completes, 3. I'll handle commits manually |
Rollback Strategy - Use AskUserQuestion with:
| Question | Options |
|----------|---------|
| "When a test can't be made green after reasonable effort, what's the rollback strategy?" | 1. git checkout . to last commit (Recommended), 2. git stash changes for later analysis, 3. Keep failing code, ask for guidance |
File Review Preference - Check if the file-review plugin is available (look for file-review:file-review in available commands).
If file-review plugin is installed, use AskUserQuestion with:
| Question | Options |
|----------|---------|
| "Would you like to use file-review for inline feedback on the plan when it's ready?" | 1. Yes, open file-review when plan is ready (Recommended), 2. No, just show me the plan |
Store these preferences and act on them during implementation.
This skill activates when:
REQUIRED SUB-SKILL: Use desplega:tdd-planningAt the start of planning, adapt your interaction level based on the autonomy mode:
| Mode | Behavior |
|------|----------|
| Autopilot | Research independently, create complete TDD plan, present for final review only |
| Critical (Default) | Get buy-in at major decision points, validate test strategy |
| Verbose | Check in at each step, confirm test approach before each cycle |
The autonomy mode is passed by the invoking command. If not specified, default to Critical.
__tests__/, tests/, etc.)npm test, make test, pytest, etc.)First, present your findings as text:
Based on the research of the codebase, I understand we need to [summary].
Test Infrastructure:
- Framework: [testing framework]
- Test location: [where tests live]
- Test command: `[command]`
- Existing patterns: [relevant patterns found]
Then, if there are questions, use AskUserQuestion.
Use AskUserQuestion to validate approach:
| Question | Options |
|----------|---------|
| "I propose starting with [simplest test case] and progressing to [more complex cases]. Does this test progression make sense?" | 1. Yes, proceed, 2. Let's discuss the order, 3. Add more test cases |
Each feature/phase is broken into TDD cycles:
## Feature: [Name]
### Cycle 1: [Simplest behavior]
- RED: Test for [specific behavior]
- GREEN: Implement [minimal code]
- COMMIT: "[descriptive message]"
### Cycle 2: [Next behavior]
...
Before proceeding, exit plan mode to write the plan file.
Write the plan to thoughts/<username|shared>/plans/YYYY-MM-DD-tdd-description.md.
Path selection: Use the user's name (e.g., thoughts/taras/plans/) if known from context. Fall back to thoughts/shared/plans/ when unclear.
CRITICAL: Every TDD cycle MUST include exact test code to write and expected failure message. See template for exact format.
QA Specs (optional): Features that change user-facing behavior SHOULD include an optional ### QA Spec (optional): section at the Feature level (after the feature header, before the first TDD cycle). Unlike regular plans where QA specs attach per-phase, TDD plans attach them per-feature since the RED/GREEN cycle itself serves as the per-cycle verification. See the template for the format.
Template: Read and follow the template at cc-plugin/base/skills/tdd-planning/template.md
I've created the TDD implementation plan at:
`thoughts/<username|shared>/plans/YYYY-MM-DD-tdd-description.md`
Please review it.
/review on this TDD plan for completeness and gap analysis?"desplega:reviewing skill on the plan documentOPTIONAL SUB-SKILL: If significant insights, patterns, gotchas, or decisions emerged during this workflow, consider using desplega:learning to capture them via /learning capture. Focus on learnings that would help someone else in a future session.
After the plan is finalized (and optionally reviewed), use AskUserQuestion with:
| Question | Options |
|----------|---------|
| "The TDD plan is ready. What's the next step?" | 1. Implement this plan (→ /implement-plan), 2. Run a review first (→ /review), 3. Done for now (park the plan) |
Based on the answer:
/implement-plan command with the plan file pathdesplega:reviewing skill on the plan documentstatus to ready or parked as appropriateIf the file-review plugin is available and the user selected "Yes" during User Preferences setup:
/file-review:file-review <path>Every implementation step MUST follow the TDD cycle. Plans without proper TDD cycles are incomplete.
### Cycle N: [Behavior being implemented]
#### RED Phase
**Test to write:**
// Exact test code goes here
**Expected failure:**
[Expected error message or failure output]
**Verify RED:** `[test command]` should fail with the above message
#### GREEN Phase
**Implementation approach:**
[Brief description of minimal code needed]
**Files to modify:**
- `path/to/file.ext`: [what to add/change]
**Verify GREEN:** `[test command]` should now pass
#### COMMIT/ROLLBACK
**If GREEN:**
- Commit message: `"[descriptive message following conventional commits]"`
- Command: `git add -A && git commit -m "[message]"`
**If STUCK (can't reach GREEN after reasonable effort):**
- Rollback: `git checkout .` (or `git stash` based on preference)
- Reassess: Consider if the test is too big, or if design needs rethinking
Before finalizing any TDD plan, verify:
Weekly roundup of top Claude Code skills, MCP servers, and AI coding tips.