mirror of
https://github.com/catlog22/Claude-Code-Workflow.git
synced 2026-02-12 02:37:45 +08:00
🧪 TDD Workflow Commands: - /workflow:tdd-plan: 5-phase TDD planning with Red-Green-Refactor chains - /workflow:tdd-verify: 4-phase TDD compliance verification - /workflow:tools:task-generate-tdd: TDD task chain generator - /workflow:tools:tdd-coverage-analysis: Test coverage and cycle analysis 📋 Task Architecture: - Task ID format: TEST-N.M → IMPL-N.M → REFACTOR-N.M - Dependency enforcement: IMPL depends_on TEST, REFACTOR depends_on IMPL - Meta fields: tdd_phase (red/green/refactor), agent assignments 📊 Compliance Scoring: - Base score: 100 points with deductions for missing tasks - Comprehensive validation: chain structure, dependencies, cycle execution - Detailed reporting: TDD_COMPLIANCE_REPORT.md with recommendations 📚 Documentation: - Updated README.md and README_CN.md with TDD workflow examples - Added "How It Works" section explaining context-first architecture - Enhanced Getting Started with complete 4-phase workflow - Updated CHANGELOG.md with comprehensive v3.1.0 details 🎯 Design Philosophy: - Context-first architecture eliminates execution uncertainty - Pre-defined context gathering via context-package.json - JSON-first task model with pre_analysis steps - Multi-model orchestration (Gemini/Qwen/Codex) 🤖 Generated with Claude Code (https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
134 lines
4.1 KiB
Markdown
134 lines
4.1 KiB
Markdown
---
|
|
name: tdd-plan
|
|
description: Orchestrate TDD workflow planning with Red-Green-Refactor task chains
|
|
usage: /workflow:tdd-plan [--agent] <input>
|
|
argument-hint: "[--agent] \"feature description\"|file.md|ISS-001"
|
|
examples:
|
|
- /workflow:tdd-plan "Implement user authentication"
|
|
- /workflow:tdd-plan --agent requirements.md
|
|
- /workflow:tdd-plan ISS-001
|
|
allowed-tools: SlashCommand(*), TodoWrite(*), Read(*), Bash(*)
|
|
---
|
|
|
|
# TDD Workflow Plan Command (/workflow:tdd-plan)
|
|
|
|
## Coordinator Role
|
|
|
|
**This command is a pure orchestrator**: Execute 5 slash commands in sequence, parse outputs, pass context, and ensure complete TDD workflow creation.
|
|
|
|
**Execution Modes**:
|
|
- **Manual Mode** (default): Use `/workflow:tools:task-generate-tdd`
|
|
- **Agent Mode** (`--agent`): Use `/workflow:tools:task-generate-tdd --agent`
|
|
|
|
## Core Rules
|
|
|
|
1. **Start Immediately**: First action is TodoWrite initialization, second action is Phase 1 execution
|
|
2. **No Preliminary Analysis**: Do not read files before Phase 1
|
|
3. **Parse Every Output**: Extract required data for next phase
|
|
4. **Sequential Execution**: Each phase depends on previous output
|
|
5. **Complete All Phases**: Do not return until Phase 5 completes
|
|
6. **TDD Context**: All descriptions include "TDD:" prefix
|
|
|
|
## 5-Phase Execution
|
|
|
|
### Phase 1: Session Discovery
|
|
**Command**: `/workflow:session:start --auto "TDD: [structured-description]"`
|
|
|
|
**TDD Structured Format**:
|
|
```
|
|
TDD: [Feature Name]
|
|
GOAL: [Objective]
|
|
SCOPE: [Included/excluded]
|
|
CONTEXT: [Background]
|
|
TEST_FOCUS: [Test scenarios]
|
|
```
|
|
|
|
**Parse**: Extract sessionId
|
|
|
|
### Phase 2: Context Gathering
|
|
**Command**: `/workflow:tools:context-gather --session [sessionId] "TDD: [structured-description]"`
|
|
|
|
**Parse**: Extract contextPath
|
|
|
|
### Phase 3: TDD Analysis
|
|
**Command**: `/workflow:tools:concept-enhanced --session [sessionId] --context [contextPath]`
|
|
|
|
**Parse**: Verify ANALYSIS_RESULTS.md
|
|
|
|
### Phase 4: TDD Task Generation
|
|
**Command**:
|
|
- Manual: `/workflow:tools:task-generate-tdd --session [sessionId]`
|
|
- Agent: `/workflow:tools:task-generate-tdd --session [sessionId] --agent`
|
|
|
|
**Parse**: Extract feature count, chain count, task count
|
|
|
|
**Validate**:
|
|
- TDD_PLAN.md exists
|
|
- IMPL_PLAN.md exists
|
|
- TEST-*.json, IMPL-*.json, REFACTOR-*.json exist
|
|
- TODO_LIST.md exists
|
|
|
|
### Phase 5: TDD Structure Validation
|
|
**Internal validation (no command)**
|
|
|
|
**Validate**:
|
|
1. Each feature has TEST → IMPL → REFACTOR chain
|
|
2. Dependencies: IMPL depends_on TEST, REFACTOR depends_on IMPL
|
|
3. Meta fields: tdd_phase correct ("red"/"green"/"refactor")
|
|
4. Agents: TEST uses @code-review-test-agent, IMPL/REFACTOR use @code-developer
|
|
|
|
**Return Summary**:
|
|
```
|
|
TDD Planning complete for session: [sessionId]
|
|
|
|
Features analyzed: [N]
|
|
TDD chains generated: [N]
|
|
Total tasks: [3N]
|
|
|
|
Structure:
|
|
- Feature 1: TEST-1.1 → IMPL-1.1 → REFACTOR-1.1
|
|
[...]
|
|
|
|
Plans:
|
|
- TDD Structure: .workflow/[sessionId]/TDD_PLAN.md
|
|
- Implementation: .workflow/[sessionId]/IMPL_PLAN.md
|
|
|
|
Next: /workflow:execute or /workflow:tdd-verify
|
|
```
|
|
|
|
## TodoWrite Pattern
|
|
|
|
```javascript
|
|
// Initialize
|
|
[
|
|
{content: "Execute session discovery", status: "in_progress", activeForm: "..."},
|
|
{content: "Execute context gathering", status: "pending", activeForm: "..."},
|
|
{content: "Execute TDD analysis", status: "pending", activeForm: "..."},
|
|
{content: "Execute TDD task generation", status: "pending", activeForm: "..."},
|
|
{content: "Validate TDD structure", status: "pending", activeForm: "..."}
|
|
]
|
|
|
|
// Update after each phase: mark current "completed", next "in_progress"
|
|
```
|
|
|
|
## Input Processing
|
|
|
|
Convert user input to TDD-structured format:
|
|
|
|
**Simple text** → Add TDD context
|
|
**Detailed text** → Extract components with TEST_FOCUS
|
|
**File/Issue** → Read and structure with TDD
|
|
|
|
## Error Handling
|
|
|
|
- **Parsing failure**: Retry once, then report
|
|
- **Validation failure**: Report missing/invalid data
|
|
- **Command failure**: Keep phase in_progress, report error
|
|
- **TDD validation failure**: Report incomplete chains or wrong dependencies
|
|
|
|
## Related Commands
|
|
- `/workflow:plan` - Standard (non-TDD) planning
|
|
- `/workflow:execute` - Execute TDD tasks
|
|
- `/workflow:tdd-verify` - Verify TDD compliance
|
|
- `/workflow:status` - View progress
|