AGENT SKILL

tdd

Test-driven development with a red-green loop, one vertical slice at a time, plus what makes a test worth keeping. Use when building a feature or fixing a bug test-first, when the user mentions TDD or red-green-refactor, when writing integration tests, and when another skill implements a change at an agreed seam.

License 许可
Apache-2.0
最近更新
2026-11-13
Stars
★ 0
Forks
1

01 前言 Front Matter

name
tdd
description
Test-driven development with a red-green loop, one vertical slice at a time, plus what makes a test worth keeping. Use when building a feature or fixing a bug test-first, when the user mentions TDD or red-green-refactor, when writing integration tests, and when another skill implements a change at an agreed seam.

02 资源文件 3

03 SKILL.md 正文

Test-Driven Development

TDD is the red → green loop. This skill is the reference that makes the loop produce tests worth keeping.

Read the project's GLOSSARY.md (if any) so test names use the domain's words, and respect ADRs in the area you're changing.

Agree the seams first

A seam is the public interface you test at: where you observe behaviour without reaching inside. Before writing any test, list the seams you intend to test and confirm them with the user. You can't test everything; agreeing the seams up front puts the effort on critical paths and complex logic. When the shape of the interface itself is in question (how deep the module is, where the seam belongs), call the Skill tool with "codebase-design" for the vocabulary.

Done when the user has confirmed the seams, or the task names them already.

The loop

  1. Red. Write one failing test at an agreed seam, for one behaviour. Done when you have run it and seen it fail for the reason you expect.
  2. Green. Write only enough code to pass it: no code for tests you haven't written yet. Done when the test and its neighbours pass.
  3. Repeat with the next behaviour.

Work in vertical slices: one test, one implementation, then the next, each test a tracer bullet that responds to what the last cycle taught you. Writing all the tests first and then all the code tests imagined behaviour and locks in a structure before you understand it.

Refactor after green as its own step, or leave it to review (the code-reviewer skill), never inside the red-green cycle.

What a good test is

A good test exercises behaviour through the public interface and reads like a specification: "user can check out with a valid cart". It survives a rewrite of the internals because it never looked at them. Examples are in tests.md; when and how to mock is in mocking.md.

Three anti-patterns, each with its tell:

  • Implementation-coupled: mocks internal collaborators, tests private methods, or checks results through a side channel (querying the database instead of the interface). Tell: it breaks when you refactor and behaviour hasn't changed.
  • Tautological: the expected value is computed the way the code computes it (expect(add(a, b)).toBe(a + b)), so it passes by construction. Take expected values from an independent source: a known literal, a worked example, the spec.
  • Unfalsifiable: it can't fail when the defect it targets is present. The red step proves this for a test written first; for a test written after the code, break the code it covers and watch the test go red before trusting it.

04 同仓库更多 Skills

dougborg
dougborg/harness-kit

teach

Teach yourself a topic over several sessions, with lessons, references, and a record of what you've learned.

教师与教育
★ 0
dougborg
dougborg/harness-kit

svg-logo-designer

Generate SVG logos with multiple concepts, layouts, and color variations.

图像与多媒体
★ 0
dougborg
dougborg/harness-kit

documentation-writer

Writes and revises human-facing documentation — READMEs, contributor and setup guides, reference pages, architecture notes, CLAUDE.md, and changelog entries. Covers picking the right document type for the question being asked, structuring for skimming, writing examples that actually run, and keeping docs from going stale. Use when creating or rewriting docs, when a README has drifted from the code, or when deciding where a piece of information belongs. For SKILL.md and agent files, use /skill-writer instead.

内容创作者写作与文案
★ 0
dougborg
dougborg/harness-kit

adhd-mode

Shapes every response for a reader with ADHD: the next action first, numbered steps, progress restated each turn, tangents held back, concrete time estimates, wins made visible. Stays on for the rest of the session until the reader says "stop adhd mode". On Claude Code, the harness-kit:adhd output style does the same without invoking this skill.

★ 0
dougborg
dougborg/harness-kit

wait-what

That last message didn't land: re-explain it with the missing context.

★ 0
dougborg
dougborg/harness-kit

to-questionnaire

Turn a decision you can't make alone into a questionnaire for the one person who can answer it, filled in async or together in a meeting.

★ 0