37 lines
1.1 KiB
Markdown
37 lines
1.1 KiB
Markdown
---
|
|
name: test-driven-development
|
|
description: Apply red-green-refactor by default for code changes, with narrowly defined exceptions and explicit alternate verification
|
|
permalink: opencode-config/skills/test-driven-development/skill
|
|
---
|
|
|
|
# Test-Driven Development
|
|
|
|
Use this skill for all code changes unless a narrow exception applies.
|
|
|
|
## Default Cycle
|
|
|
|
1. Red: add or identify a test that fails for the target behavior.
|
|
2. Green: implement the minimal code change to make the test pass.
|
|
3. Refactor: improve structure while keeping tests green.
|
|
4. Re-run focused and relevant regression tests.
|
|
|
|
## Narrow Exceptions
|
|
|
|
Allowed exceptions only:
|
|
|
|
- docs-only changes
|
|
- config-only changes
|
|
- pure refactors with provably unchanged behavior
|
|
- repos without a reliable automated test harness
|
|
|
|
When using an exception, state:
|
|
|
|
- why TDD was not practical
|
|
- what alternative verification was used
|
|
|
|
## Role Expectations
|
|
|
|
- Planner: specify tasks and verification that preserve red-green-refactor intent.
|
|
- Builder/Coder: follow TDD during implementation or explicitly invoke a valid exception.
|
|
- Tester/Reviewer: verify that TDD evidence (or justified exception) is present.
|