Usage Examples
Real-world scenarios demonstrating effective use of the TDD plugin for test-first development and comprehensive test coverage.
Examples
Simple Feature with TDD
Scenario: You've implemented a utility function and need to ensure it has proper test coverage.
# Implement the function
> claude "create a function to validate email addresses with proper regex"
# Add test coverage
> /tdd:write-testsExpected Flow:
Plugin analyzes changes (single simple file)
Writes tests directly (no agent orchestration needed)
Creates test file with comprehensive cases:
Valid email formats
Invalid email formats
Edge cases (empty, special characters)
Error handling
Generated Test Example:
Complex Feature with Agent Orchestration
Scenario: You've implemented a multi-file payment processing feature and need comprehensive test coverage.
Expected Flow:
Plugin detects multiple changed files with complex logic
Launches parallel coverage reviewer agents per file
Coverage reviewers identify test cases needed:
Launches parallel developer agents to write tests
Verification agents confirm coverage completeness
Full test suite runs to verify all pass
Fixing Tests After Refactoring
Scenario: You refactored the authentication system from sessions to JWT, and now tests are failing.
Expected Flow:
Plugin runs full test suite, identifies 12 failing tests across 4 files
Groups failures by file:
Launches parallel agents per test file
Each agent analyzes failures and fixes:
Full suite passes after fixes
Agent Output Example:
Test-First Bug Fix
Scenario: Bug reported - empty usernames are accepted during registration.
Expected Flow:
Initial test written to fail:
Test fails (RED phase confirmed)
Fix implemented
Test passes (GREEN)
/tdd:write-testsadds comprehensive edge cases:
Coverage Review for Critical Module
Scenario: Before deploying a critical financial calculation module, you want to ensure comprehensive test coverage.
Expected Coverage Review Output:
After Test Generation:
Post-Dependency Update Test Fixes
Scenario: After updating a major dependency (React 17 to 18), several tests are failing due to API changes.
Expected Agent Analysis:
Multi-Module Test Coverage
Scenario: New microservice with multiple modules needs comprehensive test coverage before first deployment.
Expected Multi-Agent Orchestration:
Integration with Other Plugins
With Reflexion (Implement-Reflect-Test-Memorize)
Memorized Knowledge (added to CLAUDE.md):
With Code Review (TDD-Review-Fix Cycle)
Code Review Output:
With SDD (Spec-Driven Development)
With Git (Complete Pre-Commit Workflow)
Anti-Pattern Detection Examples
Detecting Mock Abuse
Scenario: Test is asserting on mock existence rather than behavior.
Plugin Detection:
Detecting Test-Only Methods
Scenario: Production class contains methods only used in tests.
Plugin Detection:
Detecting Incomplete Mocks
Scenario: Mock is missing fields that downstream code depends on.
Plugin Warning:
Command Cheat Sheet
Cover all local changes
/tdd:write-tests
Cover specific module
/tdd:write-tests authentication module
Focus on edge cases
/tdd:write-tests Focus on edge cases and error handling
Fix all failing tests
/tdd:fix-tests
Fix specific test files
/tdd:fix-tests payment tests
Fix after refactoring
/tdd:fix-tests after API refactoring
Fix after dependency update
/tdd:fix-tests React 18 migration
Last updated