| name | test-driven-development |
| description | Drive implementation with tests. Use when fixing bugs, changing behavior, adding logic, modifying contracts, or proving that agent-written code works and remains safe across regressions. |
Test-Driven Development
Skill Interface
- Name: test-driven-development.
- Description: Drive implementation with tests when fixing bugs, changing behavior, adding logic, modifying contracts, or proving that agent-written code works and remains safe across regressions.
- Parameters: Desired behavior, bug reproduction, affected logic or contract, existing tests, suitable test layer, fixtures or inputs, and available test commands.
- Instructions: Use this skill before or during behavior changes. Start with a failing or relevant test, make the smallest implementation change, refactor while tests stay green, and run adjacent regression checks.
Use tests to prove behavior, not to document implementation trivia.
Cycle
- Red: write or identify a failing test that captures the required behavior or
bug.
- Green: make the smallest implementation change that passes.
- Refactor: simplify while keeping tests green.
- Regression: run adjacent existing tests that could be affected.
Bug Fix Pattern
- Reproduce the bug with a failing test, fixture, command, trace, or fixed
input/output pair.
- Confirm the failure matches the reported issue.
- Fix the root cause.
- Re-run the same reproduction and relevant regression tests.
- Keep the regression test unless it is too expensive and a documented manual
check is more appropriate.
Test Selection
- Unit tests for deterministic logic.
- Integration tests for boundaries, adapters, persistence, and schemas.
- Contract tests for APIs, events, messages, and error envelopes.
- End-to-end tests for critical user workflows.
- Smoke tests for live providers only when environment and cost are acceptable.
Rules
- Do not delete failing tests to get a green run.
- Do not loosen assertions unless the old assertion was wrong.
- Do not mock the core behavior being tested.
- Do not hide races with fixed sleeps.
- Do not claim unexecuted tests passed.
Coverage Checklist
Consider:
- Normal success.
- Invalid input.
- Unknown fields or variants.
- Upstream failure.
- Permission denied.
- Timeout and cancellation.
- Retry or duplicate event.
- Partial result or degraded behavior.