AGENT SKILL

tdd

Reference material for test-driven development discipline. Red before green, one slice at a time. Use as reference during implementation, not as a step-by-step procedure.

License 许可
MIT
最近更新
2026-08-05
Stars
★ 0
Forks
0

01 前言 Front Matter

name
tdd
description
Reference material for test-driven development discipline. Red before green, one slice at a time. Use as reference during implementation, not as a step-by-step procedure.

03 SKILL.md 正文

TDD

Reference material — not a procedure. This skill defines the discipline; implement defines the steps.

The loop

Red → Green. That's it. Refactoring belongs in the code-review pass, not interleaved with implementation.

Red

Write a failing test that expresses the expected behavior at a pre-agreed seam (public interface). Run it. Confirm it fails for the right reason — not a missing import, not a syntax error, not an unrelated failure. The failure message should describe the gap between current and desired behavior.

Green

Write the smallest honest implementation that makes the test pass. "Honest" means: no hardcoding expected output, no stubbing the behavior the test claims to verify. If the honest implementation is larger than expected, that's fine — the test defines correctness, not the estimate.

Principles

  • Tests verify behavior through seams — pre-agreed public interfaces and boundaries. Never test implementation internals.
  • One slice at a time. Finish red→green for one behavior before starting the next.
  • The test is the spec. If you can't write the test, the spec is unclear — go back to grilling, don't guess.

Anti-patterns

  • Implementation-coupled tests (testing private methods, internal state)
  • Tautological assertions (mock wired to return X, then assert X)
  • Tests that can't actually fail (always-true conditions)
  • Writing multiple tests before any green (batching red)

04 同仓库更多 Skills

lynchypin
lynchypin/project-onboard

wayfinder

The orchestration hub for all work. Creates a map of investigation tickets (grilling, research, prototype, task, bug), resolves them one at a time with strict grilling discipline, manages risk posture pauses during implementation, and hands off to to-spec when the map is complete. Use for any work regardless of size — a trivial task has a small map, a large migration has many tickets.

★ 0
lynchypin
lynchypin/project-onboard

to-tickets

Break the spec into small, independently-implementable tracer-bullet vertical slices. No checkpoint gate — hands off directly to wayfinder for implementation orchestration.

★ 0
lynchypin
lynchypin/project-onboard

to-spec

Synthesize a specification from the completed wayfinder map. Never runs its own interview — it only writes down what wayfinder's grilling tickets already established, at a depth proportional to the project's documentation tier.

★ 0
lynchypin
lynchypin/project-onboard

start-session

Orient a new session in any project directory. Detects empty directory, existing codebase, or resume state, gathers cheap signals, and routes to wayfinder. The only user-invoked entry point.

★ 0
lynchypin
lynchypin/project-onboard

setup

Configures the issue tracker. Called by start-session during first orient. Model-invoked — runs automatically as part of the flow, not user-triggered.

★ 0
lynchypin
lynchypin/project-onboard

scope-lock

Produces a short context manifest of which files and directories are in-bounds for the current task on a medium or large existing codebase. Keeps subsequent reading inside that boundary unless explicitly widened. Prevents context bloat.

★ 0