workflow-tdd-plan
Sequences development into Red-Green-Refactor cycles and generates TDD-compliant documentation and task plans.
Install
mkdir -p .claude/skills/workflow-tdd-plan && curl -L -o skill.zip "https://agentskills.codes/api/skills/download/4717" && unzip -o skill.zip -d .claude/skills/workflow-tdd-plan && rm skill.zipInstalls to .claude/skills/workflow-tdd-plan
Activation
This is the description your AI agent reads to decide when to run this skill — the better it matches your request, the more reliably it fires.
TDD workflow planning with Red-Green-Refactor task chain generation, test-first development structure, cycle tracking, and post-execution compliance verification. Triggers on "workflow:tdd-plan", "workflow:tdd-verify".Key capabilities
- →Generates Red-Green-Refactor development plans
- →Creates task lists and implementation steps
- →Verifies TDD compliance
- →Tracks cycle-based implementation
How it works
It sequences project tasks by requiring a failing test to be defined before any implementation code is planned in the generated roadmap.
Inputs & outputs
When to use workflow-tdd-plan
- →Defining requirements before writing tests
- →Planning features using TDD
- →Verifying TDD compliance of an existing plan
- →Breaking down complex features into testable units
About this skill
Auto Mode
When --yes or -y: Skip all confirmations, use defaults, auto-verify. This skill is planning-only — it NEVER executes implementation. Output is the plan for user review.
Workflow TDD Plan
Usage
# Plan mode (default)
$workflow-tdd-plan "Build authentication system with JWT and OAuth"
$workflow-tdd-plan -y "Add rate limiting to API endpoints"
$workflow-tdd-plan --session WFS-auth "Extend with 2FA support"
# Verify mode
$workflow-tdd-plan verify --session WFS-auth
$workflow-tdd-plan verify
Flags:
-y, --yes: Skip all confirmations (auto mode)--session ID: Use specific session
Overview
Multi-mode TDD planning pipeline using subagent coordination. Plan mode runs 6 sequential phases with conditional branching; verify mode operates on existing plans with TDD compliance validation.
Core Principle: NO PRODUCTION CODE WITHOUT A FAILING TEST FIRST
┌──────────────────────────────────────────────────────────────────┐
│ WORKFLOW TDD PLAN PIPELINE │
├──────────────────────────────────────────────────────────────────┤
│ │
│ Mode Detection: plan | verify │
│ │
│ ═══ Plan Mode (default) ═══ │
│ │
│ Phase 1: Session Discovery │
│ ├─ Create or find workflow session │
│ └─ Initialize planning-notes.md with TDD context │
│ │
│ Phase 2: Context Gathering (spawn_agent: context-search-agent) │
│ ├─ Codebase analysis → context-package.json │
│ └─ Conflict risk assessment │
│ │
│ Phase 3: Test Coverage Analysis (spawn_agent: cli-explore-agent)│
│ ├─ Detect test framework and conventions │
│ ├─ Analyze existing test coverage │
│ └─ Output: test-context-package.json │
│ │
│ Phase 4: Conflict Resolution (conditional: risk ≥ medium) │
│ ├─ CLI-driven conflict analysis │
│ └─ User-selected resolution strategies │
│ │
│ Phase 5: TDD Task Generation (spawn_agent: action-planning-agent)│
│ ├─ Generate tasks with Red-Green-Refactor cycles │
│ └─ Output: IMPL_PLAN.md + task JSONs + TODO_LIST.md │
│ │
│ Phase 6: TDD Structure Validation │
│ ├─ Validate Red-Green-Refactor structure │
│ └─ Present Plan Confirmation Gate │
│ │
│ Plan Confirmation Gate (PLANNING ENDS HERE) │
│ ├─ "Verify TDD Compliance" → Phase 7 │
│ ├─ "Done" → Display next-step command for user │
│ └─ "Review Status" → Display inline │
│ │
│ ═══ Verify Mode ═══ │
│ Phase 7: TDD Verification (spawn_agent: cli-explore-agent) │
│ └─ 4-dimension TDD compliance → TDD_COMPLIANCE_REPORT.md │
│ │
└──────────────────────────────────────────────────────────────────┘
Data Flow
User Input (task description)
│
↓ [Convert to TDD Structured Format]
│ TDD: [Feature Name]
│ GOAL: [objective]
│ SCOPE: [boundaries]
│ CONTEXT: [background]
│ TEST_FOCUS: [test scenarios]
│
Phase 1 ──→ sessionId, planning-notes.md
│
Phase 2 ──→ context-package.json, conflictRisk
│
Phase 3 ──→ test-context-package.json
│
├── conflictRisk ≥ medium ──→ Phase 4 ──→ conflict-resolution.json
└── conflictRisk < medium ──→ skip Phase 4
│
Phase 5 ──→ IMPL_PLAN.md (with Red-Green-Refactor), task JSONs, TODO_LIST.md
│
Phase 6 ──→ TDD structure validation
│
├── Verify → Phase 7 → TDD_COMPLIANCE_REPORT.md
├── Execute → workflow-execute skill
└── Review → inline display
Session Structure
.workflow/active/WFS-{session}/
├── workflow-session.json # Session metadata
├── planning-notes.md # Accumulated context across phases
├── IMPL_PLAN.md # Implementation plan with TDD cycles
├── plan.json # Structured plan overview
├── TODO_LIST.md # Task checklist
├── .task/ # Task definitions with TDD phases
│ ├── IMPL-1.json # Each task has Red-Green-Refactor steps
│ └── IMPL-N.json
└── .process/
├── context-package.json # Phase 2 output
├── test-context-package.json # Phase 3 output
├── conflict-resolution.json # Phase 4 output (conditional)
└── TDD_COMPLIANCE_REPORT.md # Phase 7 output
Implementation
Session Initialization
const getUtc8ISOString = () => new Date(Date.now() + 8 * 60 * 60 * 1000).toISOString()
// Parse flags
const AUTO_YES = $ARGUMENTS.includes('--yes') || $ARGUMENTS.includes('-y')
const sessionMatch = $ARGUMENTS.match(/--session\s+(\S+)/)
const existingSessionId = sessionMatch ? sessionMatch[1] : null
// Mode detection
const cleanArgs = $ARGUMENTS
.replace(/--yes|-y|--session\s+\S+/g, '').trim()
let mode = 'plan'
if (cleanArgs.startsWith('verify')) mode = 'verify'
const taskDescription = cleanArgs
.replace(/^verify\s*/, '')
.replace(/^["']|["']$/g, '')
.trim()
// Convert to TDD structured format
function toTddStructured(desc) {
const featureName = desc.split(/\s+/).slice(0, 3).join(' ')
return `TDD: ${featureName}
GOAL: ${desc}
SCOPE: Core implementation
CONTEXT: New development
TEST_FOCUS: Unit tests, integration tests, edge cases`
}
const structuredDesc = toTddStructured(taskDescription)
Phase 1: Session Discovery (Plan Mode)
Objective: Create or find workflow session, initialize planning notes with TDD context.
if (mode !== 'plan') {
// verify: locate existing session
// → Jump to Phase 7
}
let sessionId, sessionFolder
if (existingSessionId) {
sessionId = existingSessionId
sessionFolder = `.workflow/active/${sessionId}`
if (!Bash(`test -d "${sessionFolder}" && echo yes`).trim()) {
console.log(`ERROR: Session ${sessionId} not found`)
return
}
} else {
// Auto-detect from .workflow/active/ or create new
const sessions = Bash(`ls -d .workflow/active/WFS-* 2>/dev/null`).trim().split('\n').filter(Boolean)
if (sessions.length === 0 || taskDescription) {
// Create new session
const slug = taskDescription.toLowerCase()
.replace(/[^a-z0-9\u4e00-\u9fa5]+/g, '-').substring(0, 40)
sessionId = `WFS-${slug}`
sessionFolder = `.workflow/active/${sessionId}`
Bash(`mkdir -p "${sessionFolder}/.task" "${sessionFolder}/.process"`)
Write(`${sessionFolder}/workflow-session.json`, JSON.stringify({
session_id: sessionId,
status: 'planning',
workflow_type: 'tdd',
created_at: getUtc8ISOString(),
task_description: taskDescription
}, null, 2))
} else if (sessions.length === 1) {
sessionId = sessions[0].split('/').pop()
sessionFolder = sessions[0]
} else {
// Multiple sessions — ask user
if (AUTO_YES) {
sessionFolder = sessions[0]
sessionId = sessions[0].split('/').pop()
} else {
const answer = functions.request_user_input({
questions: [{
question: "Multiple sessions found. Select one:",
header: "Session",
options: sessions.slice(0, 4).map(s => ({
label: s.split('/').pop(),
description: s
}))
}]
})
sessionId = answer.Session
sessionFolder = `.workflow/active/${sessionId}`
}
}
}
// Initialize planning-notes.md with TDD context
Write(`${sessionFolder}/planning-notes.md`, `# TDD Planning Notes
## User Intent
${structuredDesc}
## TDD Principles
- NO PRODUCTION CODE WITHOUT A FAILING TEST FIRST
- Red-Green-Refactor cycle for all tasks
- Test-first forces edge case discovery before implementation
`)
console.log(`Session: ${sessionId}`)
Phase 2: Context Gathering (spawn_agent)
Objective: Gather project context, assess conflict risk.
console.log(`\n## Phase 2: Context Gathering\n`)
const ctxAgent = spawn_agent({
agent_type: "context_search_agent",
instruction: `
Gather implementation context for TDD planning.
**Session**: ${sessionFolder}
**Task**: ${taskDescription}
**Mode**: TDD_PLAN
### Steps
1. Analyze project structure (package.json, tsconfig, etc.)
2. Search for existing similar implementations
3. Identify integration points and dependencies
4. Assess conflict risk with existing code
5. Generate context package
### Output
Write context package to: ${sessionFolder}/.process/context-package.json
Format: {
"critical_files": [...],
"patterns": [...],
"dependencies": [...],
"integration_points": [...],
"conflict_risk": "none" | "low" | "medium" | "high",
"conflict_areas": [...],
"constraints": [...]
}
`
})
wait_agent({ timeout_ms: 1800000 }) // 30 minutes
close_agent({ target: ctxAgent })
// Parse outputs
const contextPkg = JSON.parse(Read(`${sessionFolder}/.process/context-package.json`) || '{}')
co
---
*Content truncated.*
When not to use it
- →Prototyping where speed outweighs testing
- →Languages without standard test frameworks
Prerequisites
Limitations
- →Planning-only; does not write tests
- →Requires existing test coverage
How it compares
It forces a test-first planning structure rather than allowing the AI to write implementation code directly.
Compared to similar skills
workflow-tdd-plan side by side with the closest alternatives in the catalog.
| Skill | Installs | Updated | Safety | Difficulty |
|---|---|---|---|---|
| workflow-tdd-plan (this skill) | 1 | 3mo | Review | Intermediate |
| always-on-guidance | 0 | 6mo | No flags | Intermediate |
| bmad-agent-dev | 0 | 4mo | No flags | Advanced |
| python-testing-patterns | 77 | 2mo | Review | Intermediate |
Try saying
Example prompts that trigger this skill in your AI assistant.
More by catlog22
View all by catlog22 →You might also like
always-on-guidance
joelhooks
Always-on rule-oriented guidance for claude-plugin agents. Use to align behavior, tool usage, and model-specific defaults (GPT-5.2-code vs Opus 4.5) while avoiding deprecated bd/cass references.
bmad-agent-dev
pplancq
Senior software engineer for story execution and code implementation. Use when the user asks to talk to Amelia or requests the developer agent.
python-testing-patterns
wshobson
Implement comprehensive testing strategies with pytest, fixtures, mocking, and test-driven development. Use when writing Python tests, setting up test suites, or implementing testing best practices.
codex
Lucklyric
Invoke Codex CLI for complex coding tasks requiring high reasoning capabilities. This skill should be invoked when users explicitly mention "Codex", request complex implementation challenges, advanced reasoning, or need high-reasoning model assistance. Automatically triggers on codex-related requests and supports session continuation for iterative development.
dependency-upgrade
wshobson
Manage major dependency version upgrades with compatibility analysis, staged rollout, and comprehensive testing. Use when upgrading framework versions, updating major dependencies, or managing breaking changes in libraries.
vitest
antfu
Vitest fast unit testing framework powered by Vite with Jest-compatible API. Use when writing tests, mocking, configuring coverage, or working with test filtering and fixtures.