Initial commit

This commit is contained in:
Zhongwei Li
2025-11-29 18:29:07 +08:00
commit 8b4a1b1a99
75 changed files with 18583 additions and 0 deletions

View File

@@ -0,0 +1,37 @@
---
name: grey-haven-tdd-orchestration
description: "Master TDD orchestration with multi-agent coordination, strict red-green-refactor enforcement, automated test generation, coverage tracking, and >90% coverage quality gates. Coordinates tdd-python, tdd-typescript, and test-generator agents. Use when implementing features with TDD workflow, coordinating multiple TDD agents, enforcing test-first development, or when user mentions 'TDD workflow', 'test-first', 'TDD orchestration', 'multi-agent TDD', 'test coverage', or 'red-green-refactor'."
---
# TDD Orchestration Skill
Master TDD orchestrator ensuring strict red-green-refactor discipline with multi-agent coordination and comprehensive metrics.
## Description
Orchestrates Test-Driven Development workflows with automated test generation, implementation coordination, coverage tracking, and quality gates.
## What's Included
- **Examples**: Multi-agent TDD workflows, feature implementation with TDD
- **Reference**: TDD best practices, red-green-refactor patterns, coverage strategies
- **Templates**: TDD workflow templates, test planning structures
- **Checklists**: TDD verification, coverage validation
## Use This Skill When
- Implementing features with strict TDD methodology
- Coordinating multiple agents in TDD workflow
- Enforcing test-first development
- Achieving >90% test coverage
## Related Agents
- `tdd-orchestrator` - Multi-agent TDD coordinator
- `tdd-typescript-implementer` - TypeScript/JavaScript TDD
- `tdd-python-implementer` - Python TDD
- `test-generator` - Automated test creation
---
**Skill Version**: 1.0

View File

@@ -0,0 +1,87 @@
# TDD Orchestrator Checklists
Quick-reference checklists for TDD discipline and quality gates.
## Available Checklists
### [tdd-discipline-checklist.md](tdd-discipline-checklist.md)
Comprehensive checklist for ensuring test-first discipline throughout RED-GREEN-REFACTOR cycles.
**Use when**:
- Starting a TDD session
- Training new developers on TDD
- Auditing TDD compliance
- Sprint retrospectives
**Covers**:
- Pre-session setup
- RED phase discipline (test-first)
- GREEN phase discipline (minimal implementation)
- REFACTOR phase discipline (behavior preservation)
- Post-session review
---
### [quality-gates-checklist.md](quality-gates-checklist.md)
Quality gates for coverage thresholds, mutation scores, and production readiness.
**Use when**:
- Before code review
- Before merge to main
- Before production deployment
- Sprint quality reviews
**Covers**:
- Coverage thresholds (line, branch, function)
- Mutation testing scores
- Code quality metrics
- Performance requirements
- Security requirements
---
## Usage Pattern
### Daily TDD Work
1. **Start of session**: Review [tdd-discipline-checklist.md](tdd-discipline-checklist.md)
2. **During cycles**: Follow RED-GREEN-REFACTOR discipline
3. **End of session**: Check [quality-gates-checklist.md](quality-gates-checklist.md)
### Code Review
1. **Developer**: Complete [quality-gates-checklist.md](quality-gates-checklist.md)
2. **Reviewer**: Verify checklist items
3. **Approve**: Only if all quality gates pass
### Production Deployment
1. **All quality gates**: Must pass
2. **Coverage thresholds**: Must meet or exceed
3. **Mutation score**: Must meet minimum
4. **Performance**: No regressions
---
## Quick Reference
### TDD Discipline
- ✅ Write test BEFORE code (RED)
- ✅ Write MINIMAL code to pass (GREEN)
- ✅ Improve design WITHOUT changing behavior (REFACTOR)
- ✅ Run tests after EVERY change
- ✅ Commit after GREEN or REFACTOR
### Quality Gates
| Metric | Minimum | Target | Critical Path |
|--------|---------|--------|---------------|
| Line Coverage | 80% | 85-90% | 100% |
| Branch Coverage | 75% | 80-85% | 100% |
| Function Coverage | 85% | 90-95% | 100% |
| Mutation Score | 85% | 90-95% | 95%+ |
---
Return to [tdd-orchestrator agent](../tdd-orchestrator.md) | [examples/](../examples/INDEX.md) | [reference/](../reference/INDEX.md) | [templates/](../templates/INDEX.md)

View File

@@ -0,0 +1,76 @@
# TDD Orchestrator Examples
Real-world TDD workflow examples demonstrating red-green-refactor discipline, mutation testing, and multi-agent coordination.
## Files in This Directory
### [red-green-refactor-example.md](red-green-refactor-example.md)
Complete TDD cycle for implementing user authentication - demonstrates strict red-green-refactor discipline with 19-minute cycle time, 87% coverage, and 91% mutation score.
**When to use**: Learning core TDD cycle, demonstrating methodology to teams
**Demonstrates**: RED phase validation, GREEN minimal implementation, REFACTOR with confidence
**Metrics**: 5min RED, 8min GREEN, 6min REFACTOR = 19min total
---
### [outside-in-tdd-example.md](outside-in-tdd-example.md)
Feature-first TDD approach for order processing system - starts with acceptance test, works inward through layers (API → Service → Repository → Database).
**When to use**: Building new features, establishing architectural boundaries
**Demonstrates**: Acceptance tests first, mocking collaborators, layer-by-layer implementation
**Metrics**: 4-day feature, 95% coverage, zero defects in production
---
### [mutation-testing-example.md](mutation-testing-example.md)
Mutation testing workflow to validate test quality - identifies weak tests through code mutations, improves from 73% to 94% mutation score.
**When to use**: Validating test suite quality, finding edge cases
**Demonstrates**: Mutation generation, survivor analysis, test strengthening
**Tools**: mutmut (Python), Stryker (JavaScript)
---
### [tdd-rescue-example.md](tdd-rescue-example.md)
Recovery protocols for TDD failures - handles test passing unexpectedly, green phase failures, and refactoring breaks.
**When to use**: Recovering from TDD anti-patterns, training teams on recovery
**Demonstrates**: RED phase failures, GREEN phase debugging, REFACTOR rollback
**Outcome**: 3 failed cycles recovered, methodology restored
---
## Usage Patterns
**Learning TDD**: Start with [red-green-refactor-example.md](red-green-refactor-example.md)
**Building Features**: Use [outside-in-tdd-example.md](outside-in-tdd-example.md)
**Improving Test Quality**: Follow [mutation-testing-example.md](mutation-testing-example.md)
**Handling Problems**: Reference [tdd-rescue-example.md](tdd-rescue-example.md)
## Quick Reference
**TDD Cycle Duration**:
- RED: 3-10 minutes (write failing test)
- GREEN: 5-15 minutes (minimal implementation)
- REFACTOR: 5-10 minutes (improve design)
- Total: 15-35 minutes per cycle
**Coverage Targets**:
- Line coverage: 80% minimum
- Branch coverage: 75% minimum
- Critical path: 100% required
- Mutation score: 85%+ excellent
**Anti-Patterns to Avoid**:
- Writing implementation before test
- Multiple tests before implementation
- Skipping refactor phase
- Tests that don't fail first
- Over-engineering in GREEN phase
---
Return to [tdd-orchestrator agent](../tdd-orchestrator.md)

View File

@@ -0,0 +1,99 @@
# TDD Orchestrator Reference
Comprehensive reference materials for TDD methodologies, tools, and best practices.
## Files in This Directory
### [red-green-refactor-guide.md](red-green-refactor-guide.md)
Complete guide to the red-green-refactor cycle - the core TDD methodology with phase-by-phase instructions, timing guidelines, and quality gates.
**When to use**: Learning TDD fundamentals, training teams
**Covers**: RED (write failing test), GREEN (minimal implementation), REFACTOR (improve design)
**Key Concepts**: Test-first discipline, incremental development, refactoring with confidence
---
### [tdd-methodologies.md](tdd-methodologies.md)
Comparison of TDD approaches - Chicago School (classicist), London School (mockist), ATDD, BDD, Outside-In, Inside-Out, and Hexagonal TDD.
**When to use**: Choosing TDD approach for project, understanding trade-offs
**Covers**: 7 TDD methodologies with pros/cons, decision matrix
**Key Concepts**: State vs. interaction testing, mocking strategies, test doubles
---
### [mutation-testing-reference.md](mutation-testing-reference.md)
Comprehensive mutation testing guide - tools, mutation operators, score thresholds, and CI/CD integration for Python, JavaScript, Java, and C#.
**When to use**: Validating test quality, improving test effectiveness
**Covers**: mutmut, Stryker, PITest, mutation operators, score interpretation
**Key Concepts**: Test effectiveness, mutation score, equivalent mutations
---
### [coverage-thresholds.md](coverage-thresholds.md)
Coverage metrics, thresholds, and quality gates - line coverage, branch coverage, critical path coverage, differential coverage, and enforcement strategies.
**When to use**: Setting quality gates, configuring CI/CD, defining team standards
**Covers**: Coverage types, threshold recommendations, exemption policies
**Key Concepts**: 80% line, 75% branch, 100% critical path, differential coverage
---
### [refactoring-patterns.md](refactoring-patterns.md)
Catalog of refactoring patterns with SOLID principles - Extract Method, Extract Class, Replace Conditional with Polymorphism, Introduce Parameter Object, and 20+ patterns.
**When to use**: Refactoring during REFACTOR phase, improving design
**Covers**: 25+ refactoring patterns, SOLID principles, code smells
**Key Concepts**: Refactoring safety, behavior preservation, incremental improvement
---
## Quick Reference
### TDD Cycle Summary
```
1. RED: Write failing test (3-10 min)
2. GREEN: Minimal implementation (5-15 min)
3. REFACTOR: Improve design (5-10 min)
Repeat
```
**Total cycle time**: 15-35 minutes
### Coverage Targets
| Metric | Target | Critical Path |
|--------|--------|---------------|
| Line Coverage | 80%+ | 100% |
| Branch Coverage | 75%+ | 100% |
| Function Coverage | 85%+ | 100% |
| Mutation Score | 85%+ | 95%+ |
### Refactoring Triggers
- Duplicated code (DRY violation)
- Long functions (>50 lines)
- Deep nesting (>3 levels)
- Complex conditionals
- Many parameters (>4)
- God class (too many responsibilities)
### When to Use Each Methodology
| Methodology | Best For | Avoid When |
|-------------|----------|------------|
| Chicago School | Domain logic, algorithms | Complex dependencies |
| London School | Microservices, layered architecture | Simple utilities |
| ATDD | Business-driven features | Technical tasks |
| BDD | Customer-facing features | Internal APIs |
| Outside-In | New features, clean architecture | Refactoring legacy |
| Inside-Out | Core algorithms, utilities | User stories |
---
Return to [tdd-orchestrator agent](../tdd-orchestrator.md)

View File

@@ -0,0 +1,95 @@
# TDD Orchestrator Templates
Ready-to-use templates for TDD workflows, session reports, and refactoring checklists.
## Available Templates
### [tdd-workflow-template.md](tdd-workflow-template.md)
Copy-paste template for documenting TDD cycles with RED-GREEN-REFACTOR structure.
**Use when**:
- Starting a new TDD feature
- Documenting TDD sessions for team review
- Teaching TDD to new developers
- Creating examples for knowledge base
**Includes**:
- RED phase checklist (write failing test)
- GREEN phase checklist (minimal implementation)
- REFACTOR phase checklist (improve design)
- Test quality checklist
- Coverage and mutation score tracking
---
### [tdd-session-report-template.md](tdd-session-report-template.md)
Report template for TDD session metrics - cycle times, coverage, mutation scores, and learnings.
**Use when**:
- End of TDD session
- Sprint retrospectives
- Team TDD reviews
- Performance tracking
**Includes**:
- Session metrics (cycles completed, time spent)
- Coverage metrics (line, branch, function)
- Mutation testing results
- Key learnings and improvements
- Action items
---
### [refactoring-checklist-template.md](refactoring-checklist-template.md)
Comprehensive checklist for safe refactoring during REFACTOR phase.
**Use when**:
- Before refactoring production code
- Code review preparation
- Refactoring retrospectives
- Training new developers on safe refactoring
**Includes**:
- Pre-refactoring safety checks
- Refactoring pattern selection
- Step-by-step execution checklist
- Validation and rollback procedures
---
## Usage Pattern
### 1. Starting a TDD Session
Copy [tdd-workflow-template.md](tdd-workflow-template.md) and use it to document each RED-GREEN-REFACTOR cycle.
### 2. During Refactoring
Open [refactoring-checklist-template.md](refactoring-checklist-template.md) and follow the checklist step-by-step to ensure safe refactoring.
### 3. Ending a TDD Session
Fill out [tdd-session-report-template.md](tdd-session-report-template.md) to capture metrics and learnings.
---
## Quick Reference
### TDD Cycle Duration
```
RED: 3-10 min → Write failing test
GREEN: 5-15 min → Minimal implementation
REFACTOR: 5-10 min → Improve design
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
Total: 13-35 min per cycle
```
### Quality Gates
- ✅ Test fails before GREEN phase
- ✅ All tests pass before REFACTOR phase
- ✅ All tests pass after REFACTOR phase
- ✅ Coverage maintained or increased
---
Return to [tdd-orchestrator agent](../tdd-orchestrator.md) | [examples/](../examples/INDEX.md) | [reference/](../reference/INDEX.md)