agentleFS
gleicongleicon/devskills/skills/ds-tdd-mode/SKILL.md

ds-tdd-mode

Skill20 starsChanged 46 days agoMITView on GitHub

Drive implementation with tests, one vertical slice at a time.

The file

We split this skill into the rules it gives an agent

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

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈3

    Distinctive · estimate

    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:

    When active, build the feature test-first.

    line 7
  2. Distinctive:

    Do not write all tests before any implementation.

    line 11
  3. Distinctive:

    Verify through a side channel (e.g.

    line 32

≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “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

When active, build the feature test-first. Each test verifies observable behavior through a public interface — never implementation details.

Anti-pattern: horizontal slicing

Do not write all tests before any implementation. Tests written against imagined behavior verify guessed data shapes, not real user-facing outcomes. Slice vertically instead: one test, one implementation, repeat.

Workflow

  1. Plan — Confirm the interface changes needed. List the behaviors to test, highest-value first. Design for testability (see below). Get user approval before writing code.
  2. Tracer bullet — Prove the path end to end: one test, then the minimal implementation that passes it.
  3. Incremental loop — Write one test, implement the minimal code to pass it. Do not anticipate future tests.
  4. Refactor — Only once tests pass. Remove duplication and apply design principles while keeping every test green.

Good tests vs bad tests

Good tests:

  • Exercise real code paths through the public API
  • Describe WHAT the system does, not HOW
  • Make one logical assertion
  • Survive internal refactors unchanged

Bad tests — red flags:

  • Mock internal collaborators
  • Assert on call counts or call order
  • Test private methods
  • Verify through a side channel (e.g. a raw DB query) instead of the interface
  • Recompute the expected value the way the code does (assert add(a, b) == a + b) — the test can never disagree with the code. Draw expected values from an independent source: a known-good literal, a worked example, or the spec.
  • Break during refactoring when behavior has not changed

A test that breaks on a behavior-preserving refactor is coupled to implementation. Rewrite it against the interface.

Design for testability

  • Inject dependencies — accept them as parameters; do not construct them inside the unit.
  • Prefer pure functions — return results rather than mutating shared state.
  • Keep the API surface small — fewer methods and parameters mean fewer test scenarios. Deep modules (small interface, substantial hidden implementation) test better than shallow ones.
  • Mock only at system boundaries — external APIs, the database, time, randomness, the filesystem. Never mock your own classes or internal collaborators; prefer a real or in-memory implementation (mocking internals couples the test to the design).

Output

For each slice: the test, then the implementation. Report which behaviors remain untested.

Confirm activation with "TDD mode active." Activating a mode only turns on this posture; it is not approval to begin work — continue with whatever the user already asked for, or wait for their next instruction.

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.