agentleFS
broneqbroneq/bdk/skills/test-driven-development/SKILL.md

test-driven-development

Skill1 starsChanged 48 days agoMITView on GitHub

Rigid TDD process for writing and verifying tests before implementation. Use when implementing any feature or bugfix. Receives test case bullet points from the plan and enforces red-green cycle.

190 other projects use a version of this.

Adopted by

Most recently taken up by

Used with

Projects with it also use chinese-code-review, chinese-commit-conventions and 10 more.

Other files people use alongside this one.

Files found in the same public projects as a version of this one, more often than they turn up anywhere else. Each project counts once, large collections count for less, and this file's own repository is left out.
  • Leodorareluctant259Skill

    chinese-code-review

    中文代码审查规范——在保持专业严谨的同时,用符合国内团队文化的方式给出有效反馈

    Also in 8 projects that use this

  • Leodorareluctant259Skill

    chinese-commit-conventions

    中文 Git 提交规范 — 适配国内团队的 commit message 规范和 changelog 自动化

    Also in 8 projects that use this

  • obraSkill

    diagnosing-superpowers

    Use when a superpowers session went wrong and your human partner wants to know why — repeated work, ignored plans, stumbles, poor results, a skill that didn't fire, "it took too long", "why is it so expensive", "what is it doing" — or wants to build a bug report for the superpowers maintainers, for the current session or a past one identified by id or path, on any harness.

    Also in 19 projects that use this

  • LLl0k0laDSkill

    using-agent-skills

    Use when starting a session or when you need to discover which skill applies to the current task. This is the meta-skill that governs how all other skills are discovered and invoked.

    Also in 39 projects that use this

  • LLl0k0laDSkill

    git-workflow-and-versioning

    Use when making any code change. Use when committing, branching, resolving conflicts, or when you need to organize work across multiple parallel streams.

    Also in 47 projects that use this

  • MrCipherSmithSkill

    constraint-driven-development

    Use when a project needs a persistent, measurable quality bar — starting a project without documented standards, 'set up constraints', or when coverage/perf/a11y thresholds get re-debated per-PR. Produces CONSTRAINTS.md with enforceable numbers, ratchets, and a guard against silent weakening. NOT for throwaway prototypes or a one-off CI setup.

    Also in 15 projects that use this

  • +3 more from Leodorareluctant259
  • +3 more from LLl0k0laD

The file

We split this skill into the rules it gives an agent

8 rules. 0 are common, 8 are distinctive, and 0 are very specific to this project.

  • 0

    Common

    Most of the 178 edited versions we read keep these.

  • 8

    Distinctive

    This author's own choices. Worth a look.

  • 0

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Test file conventions (location, naming)

    line 72
  2. Distinctive:

    Search the test directories for the code under change: find existing tests to avoid duplication, understand blast radius to prioritize edge …

    line 76
  3. Distinctive:

    Test quality rules - a test that violates these is not written, whatever the plan says:

    line 86
  4. Distinctive:

    Write exactly one test per ✅ bullet, using the project's test framework and the conventions from GATE 0.

    line 90
  5. Distinctive:

    Add an unlisted edge-case test ONLY when its absence would let a real production bug through - and name that bug in the test's name or …

    line 92
  6. Distinctive:

    Negative tests (❌ bullets): Write when real value exists.

    line 94
  7. Distinctive:

    Tests PASS: Stop. Implementation already exists or test wrong.

    line 114
  8. Distinctive:

    Do not widen the scope on the way out — no full suite, no other tier, no "while I'm here" sweep.

    line 134

“Common” is measured: kept by at least 6 in 10 of the 178 edited versions of this file we could read. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

Test-Driven Development

Relies on BDK foundation (STARTUP_INSTRUCTIONS.md) for project context.

Rigid, gated process. Follow every gate in order. No skipping.

digraph tdd {
    rankdir=TB
    node [shape=box, style="rounded,filled", fillcolor="#f0f0f0"]

    start [label="Receive test cases\n+ implementation spec", shape=ellipse, fillcolor="#d4edda"]
    g0 [label="GATE 0\nLoad project context\nFind test conventions", fillcolor="#cce5ff"]
    g1 [label="GATE 1\nWrite tests from ✅ bullets\nOne test per bullet", fillcolor="#cce5ff"]
    g2 [label="GATE 2\nRun scoped tests via Bash\nExpect: ALL FAIL", fillcolor="#cce5ff"]
    tests_pass [label="Tests\nPASS?", shape=diamond, fillcolor="#fff3cd"]
    stop_investigate [label="STOP\nImplementation exists\nor test is wrong.", shape=ellipse, fillcolor="#f8d7da"]
    g3 [label="GATE 3\nImplement as described in plan", fillcolor="#cce5ff"]
    g4 [label="GATE 4\nRe-run same command\nExpect: ALL PASS", fillcolor="#cce5ff"]
    green_pass [label="Tests\nPASS?", shape=diamond, fillcolor="#fff3cd"]
    fix_attempt [label="Fix implementation\n(attempt N/3)", fillcolor="#fff3cd"]
    too_many [label="STOP\nAsk user", shape=ellipse, fillcolor="#f8d7da"]
    attempts_left [label="Attempts\n< 3?", shape=diamond, fillcolor="#fff3cd"]
    done [label="Task done ✓", shape=ellipse, fillcolor="#d4edda"]

    start -> g0
    g0 -> g1
    g1 -> g2
    g2 -> tests_pass
    tests_pass -> stop_investigate [label="YES (unexpected)"]
    tests_pass -> g3 [label="NO (expected)"]
    g3 -> g4
    g4 -> green_pass
    green_pass -> done [label="YES"]
    green_pass -> attempts_left [label="NO"]
    attempts_left -> fix_attempt [label="YES"]
    attempts_left -> too_many [label="NO"]
    fix_attempt -> g4
}

Input

Plan task provides:

**Test cases:**
- ✅ Positive: given [input], expects [output]
- ❌ Negative: given [invalid input], raises [error]

**Implementation:** [what to build — file path, class, method]

A task marked Verification: none must never be routed to this skill - the coordinator dispatches it without TDD.


GATE 0: Load Context

Read project context:

  • Test file conventions (location, naming)
  • Test framework
  • Existing patterns (fixtures, factories, assertions)

Search the test directories for the code under change: find existing tests to avoid duplication, understand blast radius to prioritize edge cases.

Identify test file path per project conventions.

Cannot proceed without understanding project test conventions.


GATE 1: Write Tests

Test quality rules - a test that violates these is not written, whatever the plan says:

!python3 ${CLAUDE_PLUGIN_ROOT}/scripts/inject-rules.py test-quality

Write exactly one test per ✅ bullet, using the project's test framework and the conventions from GATE 0.

Add an unlisted edge-case test ONLY when its absence would let a real production bug through - and name that bug in the test's name or docstring. Otherwise do not add it.

Negative tests (❌ bullets): Write when real value exists. Skip if no meaningful failure modes.

No bullet is satisfied by a banned shape. If the only faithful implementation of a ✅ bullet is on the banned list above - a word-presence assertion over prose, a tautology, a vacuous check - do not write a degraded test to satisfy the one-per-bullet rule. Stop and return Status: BLOCKED, naming the bullet and which ban it hits. The plan gets fixed; the test does not get faked.

Cannot proceed until every ✅ bullet has a corresponding test that a real product change could make fail.


GATE 2: Verify RED

Inject test command: !python3 ${CLAUDE_PLUGIN_ROOT}/scripts/get_settings.py test-tools

Run it yourself, via Bash. Do not spawn a bdk:test-runner agent for this. One test file's worth of output is a few lines; a spawn costs a cold start, a preload, and a model round-trip — an order of magnitude more wall-clock than the run it wraps, paid twice per task (RED and GREEN) and again on every fix attempt. bdk:test-runner exists to keep a large run's output out of a caller's context (group verification, the end-of-plan gate). This is not that.

Pick the command from the injected blocks: the tier matching the test cases you just wrote, scoped form, substituting {files} with {test_file_path}. Never the full form of any tier.

If that tier has no scoped form, derive one from full — append -- {test_file_path} for an npm/yarn/pnpm script, or a bare path for most direct runners — and note in your report that you derived it, so the settings get fixed once instead of re-derived every run. Only if no scoped form is derivable at all: stop and return Status: BLOCKED rather than defaulting to a full run. The coordinator's end-of-plan gate is the only place a full suite runs.

Record the exact command you ran; GATE 4 re-runs the same one.

Tests PASS: Stop. Implementation already exists or test wrong.

Tests FAIL as expected: Proceed to GATE 3. ✓


GATE 3: Implement

Implement per plan task. Focused on passing tests — no extra features.


GATE 4: Verify GREEN

Re-run the same scoped command from GATE 2 via Bash. Expect: ALL tests PASS. Still no agent spawn — same reasoning as GATE 2, and now the cost would be paid once per fix attempt.

Tests FAIL: Fix implementation, re-run the same command. Max 3 attempts. After 3, stop and ask user.

Tests PASS: Proceed. ✓

Do not widen the scope on the way out — no full suite, no other tier, no "while I'm here" sweep. Whoever called you owns the wider checks: the coordinator schedules group verification, and the end-of-plan gate runs the full suite once.


Anti-Patterns

  • ❌ Skipping GATE 2 ("I know it will fail")
  • ❌ Writing implementation before tests exist
  • ❌ Forcing negative test when no real failure mode exists
  • ❌ Hardcoding test commands — always detect project's test runner
  • ❌ Spawning bdk:test-runner (or any agent) for a GATE 2/4 run. The spawn costs more wall-clock than the run; use Bash directly
  • ❌ Falling back to a bare full-suite command (any tier) in GATE 2/4 because scoping "wasn't obvious" — escalate as BLOCKED instead; full-suite runs belong only to the coordinator's end-of-plan gate
  • ❌ Running an e2e/integration tier in GATE 2/4 for tests that are not e2e specs. Run the tier your new tests belong to, nothing else
  • ❌ Padding GATE 1 with boundary/edge tests the spec never asked for and no real bug motivates
  • ❌ Writing a test that asserts on prose: a phrase present in a documentation file, README, docstring, or comment. Documentation is not behavior
  • ❌ Writing a tautological test: asserting a literal the test's own stub supplied, or mirroring a constant's definition
  • ❌ Writing a vacuous test: an always-true assertion, a not-null check as the only check, an existence or callability probe, or a shape check that asserts no value's meaning
  • ❌ Faking a test to satisfy the one-per-bullet rule when the bullet itself asks for a banned shape - return Status: BLOCKED instead

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.