ValentinNikolaev/agent-skills / agent-plugins/skills/test-driven-development
test-driven-development
VerifiedImplement behavior test-first with red, green, refactor; not auditing existing green checks.
Test-Driven Development
Use a focused red, green, refactor loop to guide a requested behavior change. Adapted from Addy Osmani's test-driven-development workflow; see the bundled license and repository third-party notice.
Route precisely
- Use when implementing a defined behavior or a diagnosed, reproducible bug where a useful automated test can run. If the cause is still unknown, use
debugging-and-error-recoveryto establish it first. - Use
prove-checkswhen the task is to establish whether an existing green check could detect a defect. Usecode-reviewfor a read-only diff review. - For visual, operational, or otherwise hard-to-automate behavior, choose a proportionate executable check or observed manual verification and explain the limit; do not create a test that merely mirrors implementation.
Discover the local test contract
Read repository instructions, test locations, manifests, configuration, and CI commands. Identify the narrow runner for one case and the normal gate for the affected area. Preserve existing test style and working-tree changes. Do not assume a language, framework, or globally installed test command.
Choose a discriminating observation
Name the caller-visible boundary and the behavior one case will observe before writing the test. Use the existing contract and domain vocabulary; ask only when a missing decision changes the expected behavior. Do not require fresh approval for every test boundary already established by the task.
Name the concrete regression the case would reject, then inspect existing coverage before adding it. Extend or parameterize equivalent scenarios when sufficient; keep distinct failure paths. Follow the scope and copy guidance to avoid duplicate suites, incidental wording checks, and tests of unrelated global or framework behavior. Do not add tests solely to increase their count or match the number of public methods; repository requirements still apply.
Prefer tests that survive an internal refactor. Mock external boundaries when useful without mocking away the behavior under test. Internal seams, interactions, call counts, and persistence observations can be legitimate when they express the contract being checked; they are not automatically defects or universally forbidden techniques.
Derive expected results independently from a specification, worked example, or known literal. A test that repeats the implementation's algorithm can repeat its bug. See references/test-observations.md for concrete controls. Work in vertical slices: one observed failure, one minimal implementation, then the next behavior; do not build a speculative batch of tests around an imagined design.
Selected observation and anti-tautology guidance adapts Matt Pocock's TDD skill, under the bundled LICENSE.mattpocock-skills. The local workflow retains refactoring and evidence requirements below.
Red, green, refactor
- Define one behavior and an observable failure. Write or adapt the smallest test that would reject the missing behavior or original bug.
- Run that exact test. Confirm the intended assertion fails on the old behavior; a setup error, compile failure unrelated to the behavior, skipped case, or zero selected cases is not red evidence.
- Change only enough production code to satisfy the case. Re-run the focused test and inspect the result, including warnings and skips.
- Refactor only if it improves clarity without changing behavior. Re-run the focused check after the refactor.
- Add adjacent edge or failure cases when they distinguish a plausible regression. Run broader repository gates in proportion to the changed boundary and project policy; avoid automatic full-suite runs for a narrow change unless required.
Report
State the behavior, red assertion and observed result, production change, green result, any refactor, broader checks, and unverified paths. Never say a regression test was proven to catch the bug when its relevant negative control was not observed. Do not skip or weaken a failing check to obtain green.
Related skills
| Skill | Stars | Updated | Works with | Status | Install |
|---|---|---|---|---|---|
| rea-analysis-optimizationmorluto/reaOptimize REA providers and shared analysis workflows for agent context, latency, CPU, and memory while preserving correctness and Evidence. Use for analysis bottlenecks and cache or query design; CI/test-suite optimization belongs to rea-ci-tests-audit. | Stars: 468k | Updated | Claude CodeCodex | Verified | Install |
| rea-ci-tests-auditmorluto/reaAudit REA CI and test suites for correctness, fixture drift, false passes, and measured performance; use for suite or workflow investigations and efficiency changes, rather than ordinary feature testing or a single test failure. | Stars: 468k | Updated | Claude CodeCodex | Verified | Install |
| rea-tool-designmorluto/reaAudit, investigate, design, or change REA investigation tools, CLI/MCP contracts, provider capabilities, and Evidence semantics. | Stars: 468k | Updated | Claude CodeCodex | Verified | Install |
| ponytail-auditDietrichGebert/ponytailQuality audit of the whole repo: bugs, security, real load, missing tests, speed, and what to delete. Most important first. | Stars: 194k | Updated | Claude CodeCodex | Verified | Install |