AGENT SKILL

tdd

Build behavior test-first, one red-green cycle at a time, testing through public interfaces. Use when implementing a ticket or a fix, when the user asks for TDD or a failing test first, or when a coder needs the rules of the loop.

License 许可
MIT
最近更新
2026-11-04
Stars
★ 0
Forks
0

01 前言 Front Matter

name
tdd
metadata
{ "layer": "L3", "source": "mattpocock/skills@49dd158:skills/engineering/tdd/SKILL.md + mocking.md; obra/superpowers@bb92a77:skills/test-driven-development/SKILL.md; cursor/plugins@1e5c90a:pstack/skills/tdd/SKILL.md", "license": "MIT" }
description
Build behavior test-first, one red-green cycle at a time, testing through public interfaces. Use when implementing a ticket or a fix, when the user asks for TDD or a failing test first, or when a coder needs the rules of the loop.

03 SKILL.md 正文

TDD

One behavior per cycle: a failing test, the least code that passes it, repeat. What makes a test worth keeping is test-behavior; apply it to every test you write.

Before the first test

  • Commands. ven-profile get commands.test.single. If it is missing or unverified, say so. Fall back to commands.test.all only if that one is verified; otherwise stop, because there is no loop to run.
  • Vocabulary. Read $(ven-profile path)/GLOSSARY.md so test names and interfaces use domain terms.
  • Seams. A seam is the public interface a test drives. Test only at agreed seams.
    • In the main session: propose each seam with one line on what it catches and what it misses, and confirm with the user. If the interface's shape is itself the question, apply deep-modules.
    • As a background coder you cannot ask. The seams come from the ticket. If the ticket names none and the code offers no single obvious public interface, return VEN-RESULT: BLOCKED: which seam should <behavior> be tested at?
  • Bugs. The first red test is the repro that reproduce built, moved to the seam where the bug really happens.

The cycle

  1. Red. Write one test for the next behavior in the acceptance criteria. Run ven-profile run commands.test.single --file <test path>. Watch it fail, for the expected reason: the assertion on the missing behavior, not a typo, an import error or a broken fixture. A test that passes at once tests something that already exists; fix the test.
  2. Green. Write the least code that makes it pass. Nothing the test doesn't demand. Re-run: it passes, and the other tests in the file still pass, with clean output.
  3. Next. Pick the next behavior. Each test is a tracer bullet that reacts to what the last cycle taught you.

Rules

  • Vertical, never horizontal. Don't write all the tests and then all the code; bulk tests check imagined behavior and lock in structure too early.
  • No production code without a red test that demands it. Code written ahead of its test gets deleted and rebuilt from the test, not kept as a reference.
  • Fix the code, not the test. Never edit a test to match a wrong result, and never weaken an assertion unless the spec changed.
  • Mock only at system boundaries: outside services, time, randomness, and sometimes the filesystem or a store the repo can't run locally. Never mock your own modules. Pass a boundary in rather than building it inside, and give each outside operation its own narrow function, so each stand-in returns one shape and needs no branching.
  • Tidy only on green, and re-run after. Reshaping the design is not part of the loop; note it for review.
  • Flaky is red. Make the test deterministic (pin time, seed randomness) before you trust it.

Done

  • Every acceptance criterion has a test you watched go red, then green.
  • The whole suite passes: ven-profile run commands.test.all when it is verified. A failure you didn't cause still goes in your report, by name.
  • Then run verify for each change type you touched.

04 同仓库更多 Skills

Ventorius
Ventorius/ven-stack

yeet

Take every local change green through the repo's own checks, slice it into conventional commits, push, and with --pr open a pull request on the code host. Use only when the user explicitly asks to yeet, or to commit and push everything; never on your own initiative.

★ 0
Ventorius
Ventorius/ven-stack

write-docs

Write or update documentation from the code: gather facts, pick the shape for the reader, write it plain, and prove every command and path in it. Use when asked to document a repo, module or feature, or to bring stale docs up to date.

★ 0
Ventorius
Ventorius/ven-stack

why

Find why code is shaped the way it is (design rationale, trade-offs, regressions, odd thresholds) from history, tickets, docs and chat, citing every claim and stating its confidence. Use for 'why does X work this way', 'why did we pick Y', or before changing code whose purpose is unclear.

★ 0
Ventorius
Ventorius/ven-stack

verify

Prove a change works with the check that matches its type, do the read-back, and log the pass against the exact tree. Use when a change is ready to call done, before review, commit or stopping, and whenever ven-decisions end refuses an unverified tree.

★ 0
Ventorius
Ventorius/ven-stack

unslop

Cut AI writing tells (filler, model vocabulary, metaphor nouns, hedging, formatting tics) from text while keeping every fact. Use when editing or checking any prose before it ships: docs, PR bodies, reports, skill text.

★ 0
Ventorius
Ventorius/ven-stack

type-discipline

Apply when designing types or data shapes, reviewing a signature, or handling outside data, in any language. Make wrong states fail early: in the compiler for typed languages, in validated runtime contracts for untyped ones.

★ 0