agentleFS
troskatertroskater/flowdeck-claude/skills/tdd-workflow/SKILL.md

tdd-workflow

Skill0 starsChanged 23 days agoMITView on GitHub

Enforces Test-Driven Development with Red-Green-Refactor cycle and 80%+ coverage. Activate when writing new features, fixing bugs, or refactoring.

128 other projects use a version of this.

Adopted by

Most recently taken up by

Used with

Projects with it also use brand-discovery, configure-ecc 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.
  • ysyecustSkill

    brand-discovery

    Use when a brand needs to discover or articulate its identity through structured multi-session interviews. Covers purpose, positioning, audience, personality, voice, narrative, and founder-brand tension across 8 modules using laddering, 5 Whys, and projective techniques. Produces a resumable session with disk-persisted state and a master brandbook (90_SYNTHESIS.md).

    Also in 6 projects that use this

  • royaluniondesign-sysSkill

    configure-ecc

    Interactive installer for Everything Claude Code — guides users through selecting and installing skills and rules to user-level or project-level directories, verifies paths, and optionally optimizes installed files.

    Also in 12 projects that use this

  • junimnjwSkill

    ralphinho-rfc-pipeline

    RFC-driven multi-agent DAG execution pattern with quality gates, merge queues, and work unit orchestration.

    Also in 12 projects that use this

  • loulanyueSkill

    nuxt4-patterns

    Nuxt 4 app patterns for hydration safety, performance, route rules, lazy loading, and SSR-safe data fetching with useFetch and useAsyncData.

    Also in 10 projects that use this

  • royaluniondesign-sysSkill

    content-hash-cache-pattern

    Cache expensive file processing results using SHA-256 content hashes — path-independent, auto-invalidating, with service layer separation.

    Also in 16 projects that use this

  • RojiosSkill

    dart-flutter-patterns

    Production-ready Dart and Flutter patterns covering null safety, immutable state, async composition, widget architecture, popular state management frameworks (BLoC, Riverpod, Provider), GoRouter navigation, Dio networking, Freezed code generation, and clean architecture.

    Also in 7 projects that use this

The file

We split this skill into the rules it gives an agent

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

  • 0

    Common

    Most of the 117 edited versions we read keep these.

  • 4

    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. Distinctive:

    Write a test that describes the behavior you want.

    line 29
  2. Very specific:

    Run it: npm test → must fail with "cannot find function" or similar.

    line 60
  3. Distinctive:

    Write the minimum implementation:

    line 64
  4. Very specific:

    Run it: npm test → must pass.

    line 73
  5. Very specific:

    Run it: npm test → must still pass.

    line 90
  6. Distinctive:

    After each Red-Green-Refactor cycle:

    line 94
  7. Distinctive:

    Write unit tests for every function.

    line 109

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

Tests before code. Always. Red-Green-Refactor is not a suggestion.

When to Activate

Activate when:

  • Implementing any new feature
  • Fixing any bug
  • Refactoring existing code

Core Principles

  • Tests before code — write the failing test first, then the implementation
  • Minimum implementation — write the least code that makes the test pass
  • Refactor after green — clean up only when tests are passing
  • 80%+ coverage — non-negotiable threshold

Workflow

Red — Write a Failing Test

Write a test that describes the behavior you want. It must fail before you write any implementation.

// AAA Pattern: Arrange, Act, Assert
describe('calculateDiscount', () => {
  it('should apply 10% discount for premium users', () => {
    // Arrange
    const user = { tier: 'premium' };
    const price = 100;

    // Act
    const result = calculateDiscount(price, user);

    // Assert
    expect(result).toBe(90);
  });

  it('should return full price for standard users', () => {
    // Arrange
    const user = { tier: 'standard' };
    const price = 100;

    // Act
    const result = calculateDiscount(price, user);

    // Assert
    expect(result).toBe(100);
  });
});

Run it: npm test → must fail with "cannot find function" or similar.

Green — Minimum Code to Pass

Write the minimum implementation:

function calculateDiscount(price: number, user: { tier: string }): number {
  if (user.tier === 'premium') return price * 0.9;
  return price;
}

Run it: npm test → must pass.

Refactor — Clean Up While Green

Now clean up the implementation:

const DISCOUNT_RATES: Record<string, number> = {
  premium: 0.10,
};

function calculateDiscount(price: number, user: { tier: string }): number {
  const discountRate = DISCOUNT_RATES[user.tier] ?? 0;
  return price * (1 - discountRate);
}

Run it: npm test → must still pass.

Git Checkpoint

After each Red-Green-Refactor cycle:

git add -A
git commit -m "test: add calculateDiscount + implementation"

Test Types

TypeWhenTools
UnitFunctions, services with mocked depsvitest, jest
IntegrationAPI endpoints, database queriessupertest, vitest
E2ECritical user flowsplaywright, cypress

Write unit tests for every function. Integration tests for every API route. E2E only for critical paths.

Coverage Check

npx vitest --coverage          # vitest
npx jest --coverage            # jest

Threshold: 80% line coverage minimum. If below, write more tests before considering the work done.

Common Mistakes

  • Writing tests AFTER implementation — these are not TDD tests
  • Writing tests that always pass (asserting something trivially true)
  • Skipping the Refactor step — leaving messy green code is not TDD
  • Testing implementation details instead of behavior
  • Giant tests that test multiple behaviors at once

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.