agentleFS
CrystalPlatformsCrystalPlatforms/ADM-CLI/.claude/skills/tdd/SKILL.md

tdd

Skill1 starsChanged 6 months agoMITView on GitHub

Test-Driven Development workflow using vertical slices. Use when implementing features with TDD, writing tests before code, or doing red-green-refactor cycles.

193 other projects use a version of this, 34 of them edited.

Adopted by

Most recently taken up by

Used with

Projects with it also use make-bot-ui, Poteto Mode 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.
  • eryzerzSkill

    make-bot-ui

    Use when building a custom UI (page, dashboard, buttons) that should wake a Grok Bot over a webhook, when the user must provide a webhook sender key, or when exposing that UI on Tailscale.

    Also in 8 projects that use this

  • jtarorehSkill

    Poteto Mode

    poteto's agent style for concise, detailed responses, deliberate subagents, unslopped prose, simple code, and verified work. Use for poteto, /poteto-mode, or requests to work in this style.

    Also in 5 projects that use this

  • risadamsSkill

    which-skill

    Router over this pack's skills and flows. Ask it "which skill fits X" when you don't remember what's available.

    Also in 7 projects that use this

  • TheOnlyFusionCubeSkill

    principle-attack-the-premise

    Inventory who actually owns or exhibits the imbalance, then challenge the shared premise before writing another patch. Use when two or more fixes that share one premise have failed the same gate.

    Also in 11 projects that use this

  • TheOnlyFusionCubeSkill

    principle-test-behavior-not-implementation

    Call the system the way its consumer does and assert meaningful observable output; avoid mocks or assertions that only mirror internal calls. Use when when writing or evaluating tests.

    Also in 11 projects that use this

  • shreyT19Skill

    principle-laziness-protocol

    Apply when refactoring, evaluating diff size, or tempted to add abstractions, layers, or signal threading. Bias toward deletion and the smallest change that solves the problem.

    Also in 22 projects that use this

The file

Show its rules and text

We split this skill into the rules it gives an agent

15 rules. 0 are common, 12 are distinctive, and 3 are very specific to this project.

  • 0

    Common

    Most of the 177 edited versions we read keep these.

  • 12

    Distinctive

    This author's own choices. Worth a look.

  • 3

    Very specific

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

  • Common
  • Distinctive
  • Very specific
  1. Very specific:

    When invoked with a GitHub issue, fetch the issue body with gh issue view <number> and use it as the scope for the planning step.

    line 16
  2. Very specific:

    If a plan exists in ./plans/ for the feature being implemented, read it for architectural decisions and phase context.

    line 18
  3. Distinctive:

    Before writing any code:

    line 28
  4. Distinctive:

    If a GitHub issue was provided, review its scope and acceptance criteria

    line 30
  5. Very specific:

    If a plan file exists in ./plans/, review architectural decisions and phase boundaries

    line 31
  6. Distinctive:

    Ask: "What should the public interface look like?

    line 37
  7. Distinctive:

    State assumptions before RED: Before writing the first failing test, write down — in a comment in the test file, in the session notes, or …

    line 39
  8. Distinctive:

    Write ONE test that confirms ONE thing about the system:

    line 55
  9. Distinctive:

    After all tests pass:

    line 77
  10. Distinctive:

    Run tests after each refactor step

    line 81
  11. Distinctive:

    Every changed line must trace to the current test: If a line wasn't required to make the test pass (or to pass an earlier test), it doesn't …

    line 89
  12. Distinctive:

    Don't "improve" adjacent code: If you spot dead code, an unrelated bug, or a style issue near the code you're editing, mention it in the PR …

    line 90
  13. Distinctive:

    Don't remove pre-existing dead code unless asked: Only remove orphans your own changes created (unused imports, variables, helpers that …

    line 91
  14. Distinctive:

    Test names describe behavior: "calculates total for multiple items", not "test calculateTotal"

    line 117
  15. Distinctive:

    If you feel the need to mock an internal module, the code is doing too much or you're testing at the wrong level.

    line 130

“Common” is measured: kept by at least 6 in 10 of the 177 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

Usage

/tdd              — start TDD from scratch (manual planning)
/tdd #123         — start TDD from GitHub issue #123 (pulls scope + acceptance criteria)
/tdd #123 #124    — batch related issues into one TDD session

When invoked with a GitHub issue, fetch the issue body with gh issue view <number> and use it as the scope for the planning step. The issue's acceptance criteria become the initial behavior list.

If a plan exists in ./plans/ for the feature being implemented, read it for architectural decisions and phase context. Plans are created by /carve and contain vertical slices, durable decisions, and dependency ordering that should inform your test strategy.

Philosophy

Tests verify behavior through public interfaces, not implementation details. Code can change entirely; tests shouldn't. A good test reads like a specification — "user can checkout with valid cart" tells you exactly what capability exists.

Workflow

1. Plan

Before writing any code:

  • If a GitHub issue was provided, review its scope and acceptance criteria
  • If a plan file exists in ./plans/, review architectural decisions and phase boundaries
  • Confirm what interface changes are needed
  • Confirm which behaviors to test (prioritize — you can't test everything)
  • Identify opportunities for deep modules (small interface, deep implementation)
  • Get user approval on the plan

Ask: "What should the public interface look like? Which behaviors are most important to test?"

State assumptions before RED. Before writing the first failing test, write down — in a comment in the test file, in the session notes, or in the PR description — the assumptions the test will encode:

  • Input shape (types, ranges, required/optional fields)
  • Output shape (types, error modes, side effects)
  • Boundary conditions (empty input, max input, null/undefined, concurrent calls)
  • What is intentionally NOT tested in this iteration

Silent assumptions become test design choices that are expensive to reverse later.

Stop and ask if an AC is ambiguous. If an acceptance criterion in the issue or plan admits more than one reasonable interpretation, do NOT pick silently. Pause, surface the options, and ask. The entire test suite hangs off your interpretation — a wrong guess at this stage cascades through every RED→GREEN cycle that follows.

Issue AC: "Returns user's recent orders." You: "Recent = last 30 days, last 10 orders, or whatever fits one screen? Each gives a different test design."

2. Tracer Bullet

Write ONE test that confirms ONE thing about the system:

RED:   Write test for first behavior → test fails
GREEN: Write minimal code to pass → test passes

This proves the path works end-to-end.

3. Incremental Loop

For each remaining behavior:

RED:   Write next test → fails
GREEN: Minimal code to pass → passes

One test at a time. Only enough code to pass the current test. Don't anticipate future tests.

4. Refactor

After all tests pass:

  • Extract duplication
  • Deepen modules (move complexity behind simple interfaces)
  • Run tests after each refactor step

Never refactor while RED. Get to GREEN first.

Surgical Scope

Even while GREEN, keep changes surgical:

  • Every changed line must trace to the current test. If a line wasn't required to make the test pass (or to pass an earlier test), it doesn't belong in this change.
  • Don't "improve" adjacent code. If you spot dead code, an unrelated bug, or a style issue near the code you're editing, mention it in the PR description — don't fix it in this commit.
  • Don't remove pre-existing dead code unless asked. Only remove orphans your own changes created (unused imports, variables, helpers that nothing references after your edit).
  • Match existing style even if you'd write it differently. Stylistic refactors belong in their own PR.

The test: imagine reading the diff cold. Could every changed line be traced to "needed for test X"? If not, the surplus lines need to come out.

Anti-Pattern: Horizontal Slices

DO NOT write all tests first, then all implementation.

Tests written in bulk test imagined behavior, not actual behavior. You end up testing the shape of things rather than user-facing behavior. Tests become insensitive to real changes.

WRONG (horizontal):
  RED:   test1, test2, test3, test4, test5
  GREEN: impl1, impl2, impl3, impl4, impl5

RIGHT (vertical):
  RED→GREEN: test1→impl1
  RED→GREEN: test2→impl2
  RED→GREEN: test3→impl3

Conventions

  • Co-locate tests: foo.test.ts next to foo.ts (not a parallel __tests__/ tree)
  • Wrap in describe named after the unit under test
  • Test names describe behavior: "calculates total for multiple items", not "test calculateTotal"
  • Coverage thresholds apply per file — simplify unreachable code rather than lowering thresholds

Mocking Rules

Mock only at system boundaries:

  • External APIs, databases, time (Date.now), randomness (Math.random), file system

Never mock things you control:

  • Your own modules, internal collaborators, utility functions, data transformations

If you feel the need to mock an internal module, the code is doing too much or you're testing at the wrong level.

For patterns (dependency injection, SDK wrappers, examples of good vs bad mocks), see mocking.md.

Acceptance Checklist

[ ] Assumptions stated before the first RED (input/output/boundary)
[ ] AC interpretation confirmed with user (no silent picks on ambiguous ACs)
[ ] Test describes behavior, not implementation
[ ] Test uses the public interface
[ ] Test would survive an internal refactor
[ ] Mocks only at system boundaries
[ ] Co-located next to source file
[ ] Code is minimal for this test
[ ] No speculative features added
[ ] Every changed line traces to the current test (no adjacent improvements)
[ ] Pre-existing dead code left untouched (mentioned in PR description if noticed)
[ ] Coverage thresholds pass for the file under test

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.