agentleFS
ToussaintKnightToussaintKnight/superpowers-workbuddy/skills/superpowers-tdd/SKILL.md

superpowers-tdd

Skill2 starsChanged 6 months agoMITView on GitHub

RED-GREEN-REFACTOR enforcement. Write failing test first, watch it fail, write minimal code to pass. This skill should be used when implementing any feature, bugfix, or behavior change that involves writing code.

2 other projects use a version of this, 1 of them edited.

Adopted by

Most recently taken up by

  • Other versions2 projects use a version of this.

    Word for word · 0

    None found.

    Edited · 1

    1. ErrorNotFound808/claude-skills★ 045% same

    Wrote their own version · 1

    1. karim-embarek/superpowers-antigravity★ 2same name

    How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.

  • In this repository3 other files it gives its agents.

The file

We split this skill into the rules it gives an agent

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

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈11

    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:

    Write the test first. Watch it fail.

    line 12
  2. Distinctive:

    Core principle: If you didn't watch the test fail, you don't know if it tests the right thing.

    line 14
  3. Distinctive:

    Write code before the test?

    line 22
  4. Distinctive:

    Write one minimal test showing what should happen.

    line 28
  5. Distinctive:

    MANDATORY. Never skip: Run the test. Confirm: test fails (not errors), failure message is expected, fails because feature missing (not …

    line 32
  6. Distinctive:

    Write simplest code to pass the test.

    line 36
  7. Distinctive:

    MANDATORY: Run the test. Confirm: test passes, other tests still pass, output pristine.

    line 40
  8. Distinctive:

    After green only: remove duplication, improve names, extract helpers.

    line 44
  9. Distinctive:

    Before marking work complete:

    line 64
  10. Distinctive:

    Every new function/method has a test

    line 66
  11. Distinctive:

    All tests pass, output pristine

    line 70

≈ “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

Test-Driven Development (TDD)

Overview

Write the test first. Watch it fail. Write minimal code to pass.

Core principle: If you didn't watch the test fail, you don't know if it tests the right thing.

The Iron Law

NO PRODUCTION CODE WITHOUT A FAILING TEST FIRST

Write code before the test? Delete it. Start over. Don't keep it as "reference", don't "adapt" it — delete means delete. Implement fresh from tests.

Red-Green-Refactor

RED — Write Failing Test

Write one minimal test showing what should happen. One behavior, clear name, real code (no mocks unless unavoidable).

Verify RED — Watch It Fail

MANDATORY. Never skip. Run the test. Confirm: test fails (not errors), failure message is expected, fails because feature missing (not typos).

GREEN — Minimal Code

Write simplest code to pass the test. Don't add features, refactor other code, or improve beyond the test.

Verify GREEN — Watch It Pass

MANDATORY. Run the test. Confirm: test passes, other tests still pass, output pristine.

REFACTOR — Clean Up

After green only: remove duplication, improve names, extract helpers. Keep tests green. Don't add behavior.

Common Rationalizations

ExcuseReality
"Too simple to test"Simple code breaks. Test takes 30 seconds.
"I'll test after"Tests passing immediately prove nothing.
"Already manually tested"Ad-hoc is not systematic. No record, can't re-run.
"Deleting hours is wasteful"Sunk cost fallacy. Unverified code is technical debt.
"TDD will slow me down"TDD is faster than debugging.

Red Flags — STOP and Start Over

Code before test. Test after implementation. Test passes immediately. Tests added "later". Rationalizing "just this once". "Keep as reference" or "adapt existing code". "This is different because..."

All of these mean: Delete code. Start over with TDD.

Verification Checklist

Before marking work complete:

  • Every new function/method has a test
  • Watched each test fail before implementing
  • Each test failed for expected reason (feature missing, not typo)
  • Wrote minimal code to pass each test
  • All tests pass, output pristine

Final Rule

Production code must have a test that existed and failed first. Otherwise it is not TDD.

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.