agentleFS
Cody-SimsCody-Sims/agent-skills/skills/test-driven-development/SKILL.md

test-driven-development

Skill0 starsChanged 4 months agoMITView on GitHub

Implements behavior through a verified red-green-refactor cycle. Use when adding a feature, fixing a reproducible bug, changing behavior, or explicitly working test-first; not for auditing existing test credibility or behavior-preserving cleanup alone.

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

6 rules. 0 are common, 4 are distinctive, and 2 are very specific to this project.

  • 0

    Common

    Most of the 180 edited versions we read keep these.

  • 4

    Distinctive

    This author's own choices. Worth a look.

  • 2

    Very specific

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

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Read applicable instructions, the target interface, and nearby tests.

    line 21
  2. Distinctive:

    Red: write the smallest public-interface test for that behavior.

    line 26
  3. Very specific:

    Avoid assertions that restate implementation or cannot realistically fail.

    line 54
  4. Very specific:

    Do not test libraries/language features, trivial getters/constants/pass-through code, or private structure that should remain free to …

    line 55
  5. Distinctive:

    Read test design when choosing levels, isolating nondeterminism, or assessing assertions/coverage needs deeper guidance.

    line 57
  6. Distinctive:

    Stop if intended red or required green cannot be established.

    line 62

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

Contract

Inputs: agreed behavior/acceptance criteria, existing test conventions, and the repository runner. Write a behavior test and observe its expected failure before production implementation. An unobserved red step is not TDD evidence.

Workflow

  1. Read applicable instructions, the target interface, and nearby tests. Choose one small observable behavior. Use existing test files/tooling and the lowest level that proves it: unit for logic, integration for boundary collaboration, end-to-end only for critical flows. No automatic worker or broad repository exploration is needed for a known test/change site.
  2. Red: write the smallest public-interface test for that behavior. Run the focused case with the repository runner and inspect the failure. It must fail because behavior is missing, not because of syntax, imports, missing tools, or an unrelated failure. Resolve authorized setup/test defects and rerun; do not implement production behavior until the intended red is observed.
  3. Green: implement only what the test requires. Run the focused case, then affected surrounding tests, and inspect actual results. A failure means the cycle is not green; do not weaken the assertion to obtain a pass.
  4. Refactor: improve names, structure, or duplication without new behavior. Rerun affected tests after each structural edit. Additional behavior starts another red step. Repeat one behavior at a time.
  5. Inspect the diff and run final affected tests plus repository-required gates. Combine related selectors; do not rerun an unchanged full suite merely for narration or handoff. Preserve red/green evidence for each behavior and report unavailable validation rather than assuming it passes.

For a partial or uncertain write, read write recovery before retrying. Reconcile actual changes and rerun the affected cycle step; a write error is not observed behavioral red or green.

Test quality

  • Assert observable outcomes, not internal calls unless the interaction is the contract. Use specific values and one clear behavior per test; cover relevant branches, boundary/empty inputs, and error cases.
  • Seed/reset randomness, inject time, reset shared/global state, and await observable conditions with bounded timeouts instead of fixed sleeps.
  • Avoid assertions that restate implementation or cannot realistically fail. Do not test libraries/language features, trivial getters/constants/pass-through code, or private structure that should remain free to change.
  • Read test design when choosing levels, isolating nondeterminism, or assessing assertions/coverage needs deeper guidance.

Stop and output

Stop if intended red or required green cannot be established. Strict TDD may be skipped only for generated code, throwaway exploration, or configuration-only changes and only with repository-policy or user permission; state the exception and remaining validation. Never silently skip ordinary behavior tests.

Report behaviors specified, command/failure evidence for expected red, green results, final affected-test/gate results, and blockers. Do not claim a cycle completed when it failed for the wrong reason.

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.