mcpField
T
tdd

tdd

github.com/toy-craneTesting & quality376 installsUpdated 2d ago
Repository

About tdd

A TDD skill for developers that structures each red-green cycle around public behavior, minimal changes, and repository evidence. It also provides rules for choosing stable test seams and avoiding brittle or self-confirming tests.

Key features

  1. 01Behavior-focused tests through public interfaces
  2. 02One failing test per implementation cycle
  3. 03Stable seam selection
  4. 04Boundary-only mocking
  5. 05Decision and terminology checks

Use cases

  1. 01Add a behavior with a failing test first
  2. 02Choose a public boundary for verification
  3. 03Avoid tests coupled to implementation details

Install

Copy the command and run it in a terminal.

$npx skills add https://github.com/toy-crane/skills --skill tdd

After installing, type/tddin Claude Code to confirm it loaded.

Bundled files

References and scripts installed along with SKILL.md.

agents/
openai.yaml
evals/
evals.json
trigger-evals.json
evals/compare/
record-step.sh
score.mjs
evals/compare/bug/hidden/
criteria.test.js
reference.js
stub.js
evals/compare/bug/hidden/mutants/
oversized-coupon-ignored.js
percent-rounds.js
unclamped.js
unknown-type-accepted.js
evals/compare/bug/workspace/
package.json
evals/compare/bug/workspace/docs/
bug.md
evals/compare/bug/workspace/src/
cart.js
evals/compare/bug/workspace/test/
cart.test.js
evals/compare/feature/hidden/
criteria.test.js
reference.js
stub.js
evals/compare/feature/hidden/mutants/
negative-weight-allowed.js
qty-ignored.js
remote-skipped-when-free.js
threshold-exclusive.js
weight-rounds-down.js
evals/compare/feature/workspace/
package.json
evals/compare/feature/workspace/docs/
spec.md

Details

From the project README

Test-Driven Development

Apply these test-quality rules during each red → green cycle.

Read GLOSSARY.md, then use docs/decisions/README.md to load only the decision subjects relevant to the behavior under test. If code, spec, and a decision contract conflict at the decision level, surface the conflict instead of silently choosing one. Use current terms in test names and public interfaces.

Good tests

Test behavior through public interfaces so internal refactoring does not break tests. Use specification-style names that state the capability under test.

Mock only at system boundaries such as external APIs, time, and randomness; prefer a real test database over a mocked one.

Seams

A seam is the public boundary where a test observes behavior without reaching into internals.

Reuse an existing seam before creating one. Create a seam only for a stable use case or domain concept, not an implementation helper whose name may change.

Select test seams from the agreed behavior and existing public interfaces, prioritizing critical paths and complex logic. Briefly state the chosen seam and the behavior it will verify, then proceed with the first test.

Resolve technical uncertainty through repository evidence. Ask the user only when the expected behavior remains unclear or proceeding would change the agreed product contract.

Anti-patterns

  • Implementation-coupled: mocks internal collaborators, tests private methods, or verifies through a side channel. It breaks when implementation changes but behavior does not.
  • Tautological: derives the expected value using the same logic as the code, so the assertion passes by construction. Use an independent source such as a known literal, worked example, or spec.
  • Horizontal slicing: writes many tests before any implementation. Implement one failing test and its minimal code before choosing the next test.

Loop rules

  • Red before green. Write the failing test first, then only enough code to pass it. Do not anticipate future tests or add speculative features.
  • One slice at a time. Use one seam, one test, and one minimal implementation per cycle.
  • Refactor after green. Keep the tests green through the refactor. This loop opens no review of its own: reviewing the finished diff belongs to whatever workflow owns it, or to a review the user runs.

Comments

Markdown supported