agentleFS
NoaiRoxNoaiRox/specialist-agent/skills/tdd/SKILL.md

tdd

Skill2 starsChanged 9 months agoMITView on GitHub

Use when implementing any feature or bugfix where correctness matters - before writing implementation code.

194 other projects use a version of this.

Adopted by

Most recently taken up by

Used with

Projects with it also use capture-learning-tools, design-frontend-dev 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.
  • The-Vibe-CompanySkill

    capture-learning-tools

    Turn technical conversations, bugs, CI failures, review comments,

    Also in 5 projects that use this

  • The-Vibe-CompanySkill

    design-frontend-dev

    Clean Impeccable frontend design skill. Use when the user wants to

    Also in 5 projects that use this

  • tristanphvnSkill

    ketchup-video

    Catch the user up like /keel:ketchup, with a short silent video of slides for what happened and the waiting calls as text under it. Use for /keel:ketchup-video.

    Also in 14 projects that use this

  • jaydubya818Skill

    figure-it-out

    Use when novel or multi-phase work needs an auditable workflow and no narrower playbook fits.

    Also in 54 projects that use this

  • jaydubya818Skill

    principle-laziness-protocol

    Apply when a refactor is adding wrappers or abstractions instead of simplifying.

    Also in 45 projects that use this

  • +2 more from The-Vibe-Company
  • +5 more from jaydubya818

The file

We split this skill into the rules it gives an agent

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

  • 0

    Common

    Most of the 186 edited versions we read keep these.

  • 4

    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:

    BLOCKED: if test passes (wrong test or code exists)

    line 56
  2. Distinctive:

    BLOCKED: if test fails (fix before continuing)

    line 70
  3. Distinctive:

    Every test run must be captured:

    line 95
  4. Distinctive:

    Always REFACTOR: - Don't skip

    line 155

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

/tdd - Test-Driven Development

Implement the feature using strict TDD methodology.

Target: $ARGUMENTS

Iron Law

╔══════════════════════════════════════════════════════════════╗
║  NO IMPLEMENTATION CODE WITHOUT A FAILING TEST FIRST         ║
╚══════════════════════════════════════════════════════════════╝

Workflow

Cycle Structure

For each behavior to implement:

┌───────┐      ┌───────┐      ┌──────────┐
│  RED  │ ───► │ GREEN │ ───► │ REFACTOR │
└───────┘      └───────┘      └──────────┘

Step 1: RED - Write Failing Test

  1. Create/open test file
  2. Write test for ONE behavior:
    it('should [expected behavior] when [condition]', () => {
      // Arrange
      const input = ...;
    
      // Act
      const result = functionUnderTest(input);
    
      // Assert
      expect(result).toBe(expected);
    });
  3. Run test:
    npm test -- --testNamePattern="[test name]"
  4. Verify FAILS - Capture output showing failure
  5. BLOCKED if test passes (wrong test or code exists)

Step 2: GREEN - Minimal Implementation

  1. Write minimum code to pass:
    • No extra features
    • No optimization
    • Just enough to pass
  2. Run test:
    npm test -- --testNamePattern="[test name]"
  3. Verify PASSES - Capture output showing success
  4. BLOCKED if test fails (fix before continuing)

Step 3: REFACTOR - Improve

  1. Improve code quality:
    • Remove duplication
    • Improve naming
    • Simplify logic
  2. Run ALL tests:
    npm test
  3. Verify ALL PASS
  4. Commit cycle:
    git add -A && git commit -m "feat: [behavior] (TDD cycle N)"

Repeat

Continue cycles until feature is complete.

Verification Protocol

Every test run must be captured:

──── RED Phase ────
Test: should calculate discount for valid coupon
Running: npm test -- --testNamePattern="calculate discount"
Output:
  FAIL  src/discount.test.ts
  ✕ should calculate discount for valid coupon
    Expected: 90
    Received: undefined
Status: FAIL ✓ - Proceeding to GREEN

──── GREEN Phase ────
Running: npm test -- --testNamePattern="calculate discount"
Output:
  PASS  src/discount.test.ts
  ✓ should calculate discount for valid coupon
Status: PASS ✓ - Proceeding to REFACTOR

Output

──── /tdd ────
Feature: [name]

Cycle #1: [behavior]
  RED:      Test written, FAIL ✓
  GREEN:    Implemented, PASS ✓
  REFACTOR: Cleaned, PASS ✓

Cycle #2: [behavior]
  RED:      Test written, FAIL ✓
  GREEN:    Implemented, PASS ✓
  REFACTOR: Cleaned, PASS ✓

──── TDD Summary ────
Cycles completed: 2
Tests added: 2
All tests passing: ✓
Coverage: [if available]

Anti-Rationalization

ExcuseReality
"I know it works, no need to test first"Write the test. If it works, RED phase takes 30 seconds.
"This is too simple for TDD"Simple code has simple tests. No excuse to skip.
"I'll write tests after"Tests written after implementation verify your bias, not correctness.
"The test framework isn't set up"Set it up. That's part of the task.
"Just this once I'll skip RED""Just this once" is how every shortcut becomes a habit.

Rules

  1. Never implement before RED
  2. Capture all test output - Proof, not trust
  3. One behavior per test
  4. Minimal GREEN - Just enough to pass
  5. Always REFACTOR - Don't skip
  6. Document each cycle

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.