This skill should be used when implementing features with TDD, writing tests first, or refactoring with test coverage. Applies disciplined Red-Green-Refactor cycles with TypeScript/Bun and Rust tooling.
Installer avec Codex ou Claude Copiez ce prompt, collez-le dans Codex, Claude ou un autre assistant, puis laissez-le vérifier la page du skill et l'installer pour vous.
Une commande directe contourne le prompt de vérification. Examinez la source avant de l'exécuter.
This skill should be used when implementing features with TDD, writing tests first, or refactoring with test coverage. Applies disciplined Red-Green-Refactor cycles with TypeScript/Bun and Rust tooling.
metadata
{"version":"2.1.0"}
Test-Driven Development
Write tests first, implement minimal code to pass, refactor systematically.
Write failing test reproducing bug (Start "Red" in_progress)
Verify fails for right reason
Fix with minimal code (Transition to "Green")
Verify passes, all others still pass
Refactor if needed (Transition to "Refactor" or skip to "Verify")
Commit: fix: [bug description] with test coverage
Example:
// 1. Failing testtest('handles division by zero gracefully', () => {
expect(divide(10, 0)).toMatchObject({ type: 'error', code: 'DIVISION_BY_ZERO' })
})
// 3. Fixfunctiondivide(a: number, b: number): Result {
if (b === 0) return { type: 'error', code: 'DIVISION_BY_ZERO' }
return { type: 'success', value: a / b }
}
</bug_fixes>
ALWAYS:
Track progress with Tasks (load maintain-tasks skill)
Write tests before implementation (RED first)
Run tests after each stage
Verify tests fail for right reason in RED
Keep cycles 5-15 min max
Descriptive test names forming sentences
Test behavior, not implementation
Each test = one reason to fail
NEVER:
Skip to implementation without tests
Change test behavior during refactoring
Test implementation details or private methods
Allow tests to depend on execution order
Write flaky tests
Mark stage complete without running tests
Multiple unrelated assertions per test
<quick_reference>
# TypeScript/Bun
bun test# Run all tests
bun test --watch # Watch mode
bun test --coverage # Coverage report
bun test --only # Run only .only tests
bun x stryker run # Mutation testing# Rust
cargo test# Run all tests
cargo test --test NAME # Specific integration test
cargo tarpaulin # Coverage report
cargo mutants # Mutation testing
cargo test -- --nocapture # Show println! output
</quick_reference>
test-patterns.md - Discriminated unions, builders, mocking, parameterized tests, async patterns for TypeScript and Rust
quality-metrics.md - Coverage analysis, mutation testing setup, CI integration, thresholds