
tdd-workflows
Test-driven workflow plugin that enforces red-green-refactor cycles and adds code review for Claude Code.
- version
- 1.2.1
- GitHub stars
- 126
What it does
- Adds 4 commands (
/tdd-cycle,/tdd-red,/tdd-green,/tdd-refactor) and 2 agents (tdd-orchestrator,code-reviewer) - Covers six phases in
/tdd-cycle: test specification, red, green, refactor, integration testing, and continuous improvement - Enforces 80% line and 75% branch coverage thresholds, with anti-pattern detection for test-after development
- Designed for implementing features test-first, refactoring with confidence, or establishing TDD practices across a project
Test-driven development methodology with red-green-refactor cycles and code review
Add marketplace
/plugin marketplace add HermeticOrmus/LibreUIUX-Claude-CodeRun it inside Claude Code once, then install the plugin below.
Install
/plugin install tdd-workflows@libreuiuxRun it inside Claude Code after adding the marketplace.
Files
Discovered from sourceExecute a comprehensive Test-Driven Development (TDD) workflow with strict red-green-refactor discipline:
[Extended thinking: This workflow enforces test-first development through coordinated agent orchestration. Each phase of the TDD cycle is strictly enforced with fail-first verification, incremental implementation, and continuous refactoring. The workflow supports both single test and test suite approaches with configurable coverage thresholds.]
Configuration
Coverage Thresholds
- Minimum line coverage: 80%
- Minimum branch coverage: 75%
- Critical path coverage: 100%
Refactoring Triggers
- Cyclomatic complexity > 10
- Method length > 20 lines
- Class length > 200 lines
- Duplicate code blocks > 3 lines
Phase 1: Test Specification and Design
1. Requirements Analysis
- Use Task tool with subagent_type="comprehensive-review::architect-review"
- Prompt: "Analyze requirements for: $ARGUMENTS. Define acceptance criteria, identify edge cases, and create test scenarios. Output a comprehensive test specification."
- Output: Test specification, acceptance criteria, edge case matrix
- Validation: Ensure all requirements have corresponding test scenarios
2. Test Architecture Design
- Use Task tool with subagent_type="unit-testing::test-automator"
- Prompt: "Design test architecture for: $ARGUMENTS based on test specification. Define test structure, fixtures, mocks, and test data strategy. Ensure testability and maintainability."
- Output: Test architecture, fixture design, mock strategy
- Validation: Architecture supports isolated, fast, reliable tests
Phase 2: RED - Write Failing Tests
3. Write Unit Tests (Failing)
- Use Task tool with subagent_type="unit-testing::test-automator"
- Prompt: "Write FAILING unit tests for: $ARGUMENTS. Tests must fail initially. Include edge cases, error scenarios, and happy paths. DO NOT implement production code."
- Output: Failing unit tests, test documentation
- CRITICAL: Verify all tests fail with expected error messages
4. Verify Test Failure
- Use Task tool with subagent_type="tdd-workflows::code-reviewer"
- Prompt: "Verify that all tests for: $ARGUMENTS are failing correctly. Ensure failures are for the right reasons (missing implementation, not test errors). Confirm no false positives."
- Output: Test failure verification report
- GATE: Do not proceed until all tests fail appropriately
Phase 3: GREEN - Make Tests Pass
5. Minimal Implementation
- Use Task tool with subagent_type="backend-development::backend-architect"
- Prompt: "Implement MINIMAL code to make tests pass for: $ARGUMENTS. Focus only on making tests green. Do not add extra features or optimizations. Keep it simple."
- Output: Minimal working implementation
- Constraint: No code beyond what's needed to pass tests
6. Verify Test Success
- Use Task tool with subagent_type="unit-testing::test-automator"
- Prompt: "Run all tests for: $ARGUMENTS and verify they pass. Check test coverage metrics. Ensure no tests were accidentally broken."
- Output: Test execution report, coverage metrics
- GATE: All tests must pass before proceeding
Phase 4: REFACTOR - Improve Code Quality
7. Code Refactoring
- Use Task tool with subagent_type="tdd-workflows::code-reviewer"
- Prompt: "Refactor implementation for: $ARGUMENTS while keeping tests green. Apply SOLID principles, remove duplication, improve naming, and optimize performance. Run tests after each refactoring."
- Output: Refactored code, refactoring report
- Constraint: Tests must remain green throughout
8. Test Refactoring
- Use Task tool with subagent_type="unit-testing::test-automator"
- Prompt: "Refactor tests for: $ARGUMENTS. Remove test duplication, improve test names, extract common fixtures, and enhance test readability. Ensure tests still provide same coverage."
- Output: Refactored tests, improved test structure
- Validation: Coverage metrics unchanged or improved
Phase 5: Integration and System Tests
9. Write Integration Tests (Failing First)
- Use Task tool with subagent_type="unit-testing::test-automator"
- Prompt: "Write FAILING integration tests for: $ARGUMENTS. Test component interactions, API contracts, and data flow. Tests must fail initially."
- Output: Failing integration tests
- Validation: Tests fail due to missing integration logic
10. Implement Integration
- Use Task tool with subagent_type="backend-development::backend-architect"
- Prompt: "Implement integration code for: $ARGUMENTS to make integration tests pass. Focus on component interaction and data flow."
- Output: Integration implementation
- Validation: All integration tests pass
Phase 6: Continuous Improvement Cycle
11. Performance and Edge Case Tests
- Use Task tool with subagent_type="unit-testing::test-automator"
- Prompt: "Add performance tests and additional edge case tests for: $ARGUMENTS. Include stress tests, boundary tests, and error recovery tests."
- Output: Extended test suite
- Metric: Increased test coverage and scenario coverage
12. Final Code Review
- Use Task tool with subagent_type="comprehensive-review::architect-review"
- Prompt: "Perform comprehensive review of: $ARGUMENTS. Verify TDD process was followed, check code quality, test quality, and coverage. Suggest improvements."
- Output: Review report, improvement suggestions
- Action: Implement critical suggestions while maintaining green tests
Incremental Development Mode
For test-by-test development:
- Write ONE failing test
- Make ONLY that test pass
- Refactor if needed
- Repeat for next test
Use this approach by adding --incremental flag to focus on one test at a time.
Test Suite Mode
For comprehensive test suite development:
- Write ALL tests for a feature/module (failing)
- Implement code to pass ALL tests
- Refactor entire module
- Add integration tests
Use this approach by adding --suite flag for batch test development.
Validation Checkpoints
RED Phase Validation
- All tests written before implementation
- All tests fail with meaningful error messages
- Test failures are due to missing implementation
- No test passes accidentally
GREEN Phase Validation
- All tests pass
- No extra code beyond test requirements
- Coverage meets minimum thresholds
- No test was modified to make it pass
REFACTOR Phase Validation
- All tests still pass after refactoring
- Code complexity reduced
- Duplication eliminated
- Performance improved or maintained
- Test readability improved
Coverage Reports
Generate coverage reports after each phase:
- Line coverage
- Branch coverage
- Function coverage
- Statement coverage
Failure Recovery
If TDD discipline is broken:
- STOP immediately
- Identify which phase was violated
- Rollback to last valid state
- Resume from correct phase
- Document lesson learned
TDD Metrics Tracking
Track and report:
- Time in each phase (Red/Green/Refactor)
- Number of test-implementation cycles
- Coverage progression
- Refactoring frequency
- Defect escape rate
Anti-Patterns to Avoid
- Writing implementation before tests
- Writing tests that already pass
- Skipping the refactor phase
- Writing multiple features without tests
- Modifying tests to make them pass
- Ignoring failing tests
- Writing tests after implementation
Success Criteria
- 100% of code written test-first
- All tests pass continuously
- Coverage exceeds thresholds
- Code complexity within limits
- Zero defects in covered code
- Clear test documentation
- Fast test execution (< 5 seconds for unit tests)
Notes
- Enforce strict RED-GREEN-REFACTOR discipline
- Each phase must be completed before moving to next
- Tests are the specification
- If a test is hard to write, the design needs improvement
- Refactoring is NOT optional
- Keep test execution fast
- Tests should be independent and isolated
TDD implementation for: $ARGUMENTS
Readme
TDD Workflows
Agents and commands for disciplined test-driven development with strict red-green-refactor cycle enforcement.
Overview
This plugin provides a complete TDD workflow system with a dedicated orchestrator agent, a code review agent, and four commands that map to the phases of test-driven development. It enforces the red-green-refactor discipline, coordinates multi-agent TDD workflows, and tracks TDD metrics. Use this plugin when implementing features test-first, refactoring with confidence, or establishing TDD practices across a project.
Contents
Agents
-
tdd-orchestrator -- Master TDD orchestrator that enforces red-green-refactor discipline across projects. Coordinates multi-agent workflows, manages TDD cycle timing, detects anti-patterns (test-after, partial coverage), supports both Chicago School and London School approaches, and integrates with property-based testing, mutation testing, and legacy code characterization. Runs on Sonnet.
-
code-reviewer -- Elite code review expert combining AI-powered analysis with manual review techniques. Covers security vulnerabilities (OWASP Top 10), performance optimization, configuration review, production reliability, SOLID principles, and multi-language expertise. Provides structured feedback organized by severity with specific code examples. Runs on Sonnet.
Commands
-
tdd-cycle -- Executes a complete TDD workflow across six phases: test specification and design, RED (write failing tests), GREEN (make tests pass), REFACTOR (improve code quality), integration testing, and continuous improvement. Includes configurable coverage thresholds (80% line, 75% branch), validation checkpoints, failure recovery protocol, and anti-pattern detection.
-
tdd-red -- Generates comprehensive failing tests following TDD red phase principles. Produces tests across unit, integration, contract, and property categories using framework-appropriate patterns (Jest, pytest, Go testing, RSpec). Enforces proper failure for the right reasons, not syntax errors.
-
tdd-green -- Implements minimal code to make failing tests pass. Follows green phase strategies: "Fake It" for initial tests, "Obvious Implementation" for trivial solutions, and "Triangulation" for generalization. Includes decision frameworks for when to fake versus implement real logic, with complete progressive examples across React, Django, and Express.
-
tdd-refactor -- Refactors code while keeping all tests green. Applies code smell detection, SOLID principles, design patterns (Factory, Strategy, Observer), and performance optimization. Uses incremental steps with test verification after each change, rollback protocols, and before/after metrics comparison.
Skills
None
Usage
Install this plugin into your Claude Code project:
claude plugin install tdd-workflows
Run a complete TDD cycle for a feature:
/tdd-cycle user authentication with JWT tokens
Or use individual phase commands for granular control:
/tdd-red user registration validation
/tdd-green
/tdd-refactor
Related Plugins
- unit-testing -- Provides the test-automator and debugger agents that the TDD commands delegate to for test generation and execution.
- team-collaboration -- Code review and issue resolution workflows that complement TDD practices.
- systems-programming -- Language-specific agents for implementing TDD in C, C++, Go, or Rust projects.
Details
- Marketplace
- HermeticOrmus/LibreUIUX-Claude-Code
- Source
- plugins/tdd-workflows
- Author
- Seth Hobson
- Category
- Workflows
- License
- MIT
- Keywords
- tdd, test-driven, workflow, red-green-refactor
- Listed since
- Apr 7, 2026
More from HermeticOrmus/LibreUIUX-Claude-Code
All 71- team-collaborationv1.2.0
- unit-testingv1.2.0
- vibe-codingv1.0.0
- web-scriptingv1.2.0
- accessibility-compliancev1.2.0
- agent-orchestrationv1.2.0
- api-scaffoldingv1.2.1
- api-testing-observabilityv1.2.0
- application-performancev1.2.1
- archetypal-alchemyv1.0.0
- arm-cortex-microcontrollersv1.2.0
- backend-api-securityv1.2.0
- backend-developmentv1.2.3
- blockchain-web3v1.2.1
- business-analyticsv1.2.0
- cicd-automationv1.2.1
- cloud-infrastructurev1.2.1
- code-documentationv1.2.0
- code-refactoringv1.2.0
- code-review-aiv1.2.0
- codebase-cleanupv1.2.0
- comprehensive-reviewv1.2.1
- content-marketingv1.2.0
- context-managementv1.2.0
Similar to tdd-workflows
More Testing & QA
tdd-workflowPluginaws-solutions-library-samples/guidance-for-claude-code-with-amazon-bedrock412 starsTDD workflow with 6 specialized agents for test-first development, red-green-refactor cycle, and comprehensive quality analysis
jutsu-tddPluginTheBushidoCollective/han201 starsTest-Driven Development (TDD) principles and red-green-refactor cycle enforcement
test-driven-developmentSkilladdyosmani/agent-skills75.8K installsStructured red-green-refactor workflow that writes a failing test before any code change, including bug fixes.
tddSkillvinvcn/mattpocock-skills-zh-cn6.2K installsTest-driven development workflow that enforces red-green-refactor cycles through public-interface tests and vertical slices.
testPluginudecode/dotai1.1K starsTest-driven development workflow for writing tests before implementation - red-green-refactor cycle with deterministic unit tests
code-refactoringPluginHermeticOrmus/LibreUIUX-Claude-Code126 starsCode cleanup, refactoring automation, and technical debt management with context restoration