xarchitecture
Design, analyze, and evolve system architecture using Domain-Driven Design, 12-Factor App, and proven patterns
Complete Test-Driven Development workflow automation with Red-Green-Refactor-Commit cycle
How it fires
How this command gets triggered: by you, by Claude, or both.
/xtddContext preview
What this command does when you run it.
Complete Test-Driven Development workflow automation with Red-Green-Refactor-Commit cycle
description: Complete Test-Driven Development workflow automation with Red-Green-Refactor-Commit cycle tags: [tdd, testing, red-green-refactor, workflow, specifications, automation]
Execute complete TDD workflow automation based on the arguments provided in $ARGUMENTS.
**Basic TDD workflow:**
/xtdd
**Start RED phase:**
/xtdd --red ContactForm
**Implement GREEN phase:**
/xtdd --green
**Help and options:**
/xtdd --help
If $ARGUMENTS contains "help" or "--help": Display this usage information and exit.
First, verify project structure and TDD readiness: !ls -la specs/ 2>/dev/null || echo "No specs directory found" !find specs/tests/ -name "*.py" | head -5 2>/dev/null || echo "No tests found" !python -c "import pytest; print('pytest available')" 2>/dev/null || echo "pytest not available"
Based on $ARGUMENTS, perform the appropriate TDD phase:
If starting RED phase (--red): !grep -r "#{#$spec_id" specs/specifications/ 2>/dev/null || echo "Specification not found" !find specs/tests/ -name "*.py" -exec grep -l "$spec_id" {} \; 2>/dev/null | head -3
Create failing test for specification:
If implementing GREEN phase (--green): !python -m pytest specs/tests/ -x --tb=short 2>/dev/null || echo "Tests currently failing" !find . -name "*.py" | grep -v test | head -5
Implement minimal passing code:
If refactoring (--refactor): !python -m pytest specs/tests/ -v 2>/dev/null || echo "Tests must pass before refactoring" !python -c "import mypy" 2>/dev/null && echo "MyPy available" || echo "MyPy not available" !python -c "import ruff" 2>/dev/null && echo "Ruff available" || echo "Ruff not available"
Improve code quality while maintaining tests:
If committing changes (--commit): !git status --porcelain !grep -r "#{#$spec_id" specs/specifications/ 2>/dev/null | grep -o "authority=[^}]*" !python -m pytest --cov=. --cov-report=term specs/tests/ 2>/dev/null | grep "TOTAL" || echo "Coverage not available"
Create commit with TDD traceability:
If validating TDD state: !find specs/tests/ -name "*.py" -exec grep -l "def test_" {} \; | wc -l !python -m pytest specs/tests/ --collect-only 2>/dev/null | grep "test" | wc -l || echo "0"
Validate TDD workflow compliance:
If running quality checks: !mypy . --ignore-missing-imports 2>/dev/null || echo "Type checking not available" !ruff check . 2>/dev/null || echo "Linting not available" !ruff format . --check 2>/dev/null || echo "Formatting needed"
Automated quality validation:
Think step by step about TDD workflow requirements and provide:
1. **Current TDD State Analysis**:
2. **Phase-Specific Guidance**:
3. **Quality Assurance**:
4. **Workflow Optimization**:
Generate comprehensive TDD workflow automation with complete Red-Green-Refactor-Commit cycle, specification traceability, and quality assurance integration.
If no specific phase is provided, analyze current TDD state and recommend next appropriate action based on project status and requirements.
Transform Claude Code into a complete development platform with 45 AI-powered commands that automate your entire software development workflow. Now with improved git identity management!
Design, analyze, and evolve system architecture using Domain-Driven Design, 12-Factor App, and proven patterns
Manage project configuration files, environment variables, and application settings
Continue an execution plan from where it left off across sessions
Interactive debugging support with error analysis and fix suggestions - integrates with Debug Specialist sub-agent for complex…