AGENT SKILL

tdd

Test-first features, bug fixes, integration tests, or red-green-refactor requests at agreed seams.

License 许可
MIT
所属仓库
BetoFrega/skills
最近更新
2026-11-14
Stars
★ 0
Forks
0

01 前言 Front Matter

name
tdd
description
Test-first features, bug fixes, integration tests, or red-green-refactor requests at agreed seams.

02 资源文件 4

03 SKILL.md 正文

Test-Driven Development

Apply every section before and during each red-green cycle. Read CONTEXT.md when present and relevant ADRs; use domain vocabulary in tests and interfaces.

What a good test is

Test behavior through public interfaces. Tests read as specifications and survive internal rewrites. Consult tests.md for examples and mocking.md for dependency strategy. Each test must also earn its runtime: apply Tests Earn Their Runtime.

Seams: where tests go

Test only at public seams. Before writing any test, record seams and confirm them with the user; reuse prior agreement. Prioritize critical paths and complex logic instead of exhaustive edge coverage.

When interface shape, module depth, or seam placement is unresolved, consult codebase-design as vocabulary reference.

Anti-patterns

  • Implementation-coupled: internal mocks, private methods, or side-channel verification such as querying storage past the interface; refactors break tests without changed behavior.
  • Tautological: expected values recompute implementation, so assertions cannot disagree. Use independent literals, worked examples, or the spec.
  • Horizontal slicing: all tests before all code locks in imagined behavior. Use vertical tracer bullets informed by the previous cycle.

Rules of the loop

  • Red before green: fail first; implement only enough to pass, without anticipated tests or speculative features.
  • One slice: one seam, one test, one minimal implementation per cycle.
  • Refactoring: belongs to code-review, outside the red-green implementation cycle.

04 同仓库更多 Skills