Tdd Mastery logo

Tdd Mastery

Community
xenitV1
tdd-mastery

Test-Driven Development Iron Law. Write the test first. Watch it fail. Write minimal code to pass. No exceptions.

Overview

PublisherxenitV1
Repositoryclaude-code-maestro
Skill nametdd-mastery
Stars
231
Forks
34
Bundled files
1
LicenseMIT
Links
  • Markdown instructions

    A SKILL.md file the model loads on demand, so it only costs tokens when a request actually matches.

  • Works with any LLM

    AI skills are plain Markdown, not provider-specific code, so this works with GPT, Claude, Gemini, Grok, or a local model.

  • 1 bundled files

    Scripts, templates, and references the model can read while it works. Files are read-only and never executed.

  • Open source

    Published by xenitV1 on GitHub. Read the source before you install it.

Installation

Install the Tdd Mastery AI skill in TypingMind to use it with any LLM, or drop it into another agent that reads SKILL.md.

1

Install in TypingMind

TypingMind installs a skill straight from its GitHub folder — it reads SKILL.md, bundles the resource files, and stores the result locally.

  1. Open the app and go to Plugins → Skills.
  2. Choose "Install from GitHub".
  3. Paste the skill folder URL below and confirm.
  4. Enable the skill in any chat where you want it available.
Plugins → Skills → Add skill → From GitHub URL, then paste the folder URL and press Continue.
2

Install in another agent

Any agent that reads the Agent Skills format can use this skill — copy the folder into that agent's skills directory.

Claude Code — .claude/skills
git clone --depth 1 https://github.com/xenitV1/claude-code-maestro.git /tmp/claude-code-maestro
mkdir -p .claude/skills
cp -r /tmp/claude-code-maestro/skills/tdd-mastery .claude/skills/tdd-mastery
Restart Claude Code after copying so it picks up the new skill.

Use it in TypingMind

Enable Tdd Mastery in any TypingMind chat and the model takes it from there. Its name and description sit in the system prompt, and the moment a request matches, the model loads the full instructions itself — you never invoke it by hand, and it costs no tokens until it is actually used.

The model loads Tdd Mastery on its own as soon as a request matches it.

Works with any AI model

AI skills are plain Markdown instructions rather than provider-specific code, so Tdd Mastery is not tied to the model it was written for. Install it once in TypingMind and use it with GPT-5, Claude, Gemini, Grok, DeepSeek, Mistral, Llama, or a local model you run yourself — all on your own API keys.

  • Loaded only when it is needed

    The system prompt carries just the name and description. The instructions are fetched on the first matching request, so an idle skill costs nothing.

  • Switch models mid-chat

    Because the skill is instructions rather than code, changing model does not break it — the next model reads the same SKILL.md.

Skill instructions

This is the SKILL.md content the model loads. Read it before installing — a skill is instructions your model will follow.

<domain_overview>

🧪 TDD MASTERY: THE IRON LAW

Philosophy: If you didn't watch the test fail, you don't know if it tests the right thing. TDD is not optional—it's the foundation of trustworthy code. TEST-FIRST INTEGRITY MANDATE (CRITICAL): Never write production code before a test exists and has been seen failing. AI-generated code often attempts to write implementation and tests simultaneously or implementation first. You MUST strictly adhere to the Red-Green-Refactor cycle. Any code submitted without a preceding failing test or that generates tests after the implementation must be rejected as "Legacy Code on Arrival".


🚨 THE IRON LAW

NO PRODUCTION CODE WITHOUT A FAILING TEST FIRST

Write code before the test? Delete it. Start over.

No exceptions:

  • Don't keep it as "reference"
  • Don't "adapt" it while writing tests
  • Don't look at it
  • Delete means delete

Implement fresh from tests. Period. </domain_overview> <core_workflow>

🔴 RED-GREEN-REFACTOR CYCLE

Phase 1: RED - Write Failing Test

Write one minimal test showing what should happen.

Good Example:

typescript
test('retries failed operations 3 times', async () => {
  let attempts = 0;
  const operation = () => {
    attempts++;
    if (attempts < 3) throw new Error('fail');
    return 'success';
  };

  const result = await retryOperation(operation);

  expect(result).toBe('success');
  expect(attempts).toBe(3);
});

Clear name, tests real behavior, one thing

Bad Example:

typescript
test('retry works', async () => {
  const mock = jest.fn()
    .mockRejectedValueOnce(new Error())
    .mockResolvedValueOnce('success');
  await retryOperation(mock);
  expect(mock).toHaveBeenCalledTimes(2);
});

Vague name, tests mock not code

Requirements:

  • One behavior per test
  • Clear, descriptive name
  • Real code (mocks only if unavoidable)

Phase 2: VERIFY RED - Watch It Fail

MANDATORY. Never skip.

bash
npm test path/to/test.test.ts
# or
pytest tests/path/test.py::test_name -v

Confirm:

  • Test fails (not errors)
  • Failure message is expected
  • Fails because feature missing (not typos)

Test passes? You're testing existing behavior. Fix test.

Test errors? Fix error, re-run until it fails correctly.

Phase 3: GREEN - Minimal Code

Write simplest code to pass the test.

Good:

typescript
async function retryOperation<T>(fn: () => Promise<T>): Promise<T> {
  for (let i = 0; i < 3; i++) {
    try {
      return await fn();
    } catch (e) {
      if (i === 2) throw e;
    }
  }
  throw new Error('unreachable');
}

Just enough to pass

Bad:

typescript
async function retryOperation<T>(
  fn: () => Promise<T>,
  options?: {
    maxRetries?: number;
    backoff?: 'linear' | 'exponential';
    onRetry?: (attempt: number) => void;
  }
): Promise<T> {
  // YAGNI - You Aren't Gonna Need It
}

Over-engineered

Don't add features, refactor other code, or "improve" beyond the test.

Phase 4: VERIFY GREEN - Watch It Pass

MANDATORY.

bash
npm test path/to/test.test.ts

Confirm:

  • Test passes
  • Other tests still pass
  • Output pristine (no errors, warnings)

Test fails? Fix code, not test.

Other tests fail? Fix now.

Phase 5: REFACTOR - Clean Up

After green only:

  • Remove duplication
  • Improve names
  • Extract helpers

Keep tests green. Don't add behavior.

Phase 6: COMMIT

bash
git add tests/path/test.ts src/path/file.ts
git commit -m "feat: add specific feature with tests"

Repeat for next behavior.


</core_workflow>

<quality_standards>

📋 GOOD TEST QUALITIES

QualityGoodBad
MinimalOne thing. "and" in name? Split it.test('validates email and domain and whitespace')
ClearName describes behaviortest('test1')
Shows intentDemonstrates desired APIObscures what code should do
Real behaviorTests actual codeTests mock behavior

🚫 COMMON RATIONALIZATIONS (ALL INVALID)

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 ≠ systematic. No record, can't re-run.
"Deleting X hours is wasteful"Sunk cost fallacy. Keeping unverified code is debt.
"Keep as reference"You'll adapt it. That's testing after. Delete means delete.
"Need to explore first"Fine. Throw away exploration, start with TDD.
"Test hard = skip test"Hard to test = hard to use. Simplify design.
"TDD will slow me down"TDD faster than debugging. Pragmatic = test-first.
"Existing code has no tests"You're improving it. Add tests for existing code.

🚨 RED FLAGS - STOP AND START OVER

If you catch yourself:

  • Writing code before test
  • Test passes immediately
  • Can't explain why test failed
  • Tests added "later"
  • "Just this once"
  • "I already manually tested it"
  • "Keep as reference"
  • "TDD is dogmatic, I'm being pragmatic"

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


</quality_standards>

<bug_fix_protocol>

🐛 BUG FIX WORKFLOW

Bug found? Write failing test reproducing it. Follow TDD cycle.

Example:

Bug: Empty email accepted

RED:
test('rejects empty email', async () => {
  const result = await submitForm({ email: '' });
  expect(result.error).toBe('Email required');
});

VERIFY RED:
$ npm test
FAIL: expected 'Email required', got undefined

GREEN:
function submitForm(data: FormData) {
  if (!data.email?.trim()) {
    return { error: 'Email required' };
  }
  // ...
}

VERIFY GREEN:
$ npm test
PASS

Never fix bugs without a test.


</bug_fix_protocol>

<integration_and_tooling>

🔗 RALPH WIGGUM INTEGRATION

When Ralph Wiggum is active:

  1. Before ANY implementation: Write failing test first
  2. Proactive Gate: Check edge cases BEFORE coding (use TDD to cover them)
  3. Reflection Loop: After implementation, verify RED-GREEN was followed
  4. Verification Matrix: Track test coverage for each feature

Ralph Wiggum will REJECT:

  • Code without corresponding tests
  • Tests that were written after code
  • Tests that pass without implementation

✅ 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 (no errors, warnings)
  • Tests use real code (mocks only if unavoidable)
  • Edge cases and errors covered

Can't check all boxes? You skipped TDD. Start over.


🛠️ TESTING INFRASTRUCTURE

Stack Detection & Tool Setup

Auto-detect project type and setup appropriate tools:

Project TypeRequired Tools
Frontend (Vite/React)vitest + playwright
Fullstack (Next.js)vitest + playwright
Backend (Node)vitest or jest
Pythonpytest + pytest-cov
MicroservicesMSW (Mock Service Worker)

Test Coverage Rules

For every new function/component, generate:

  • 1 Happy Path - Expected successful behavior
  • 2 Edge Cases - Boundary conditions, invalid inputs
  • 1 Error Case - Expected failure handling

Contract-First (MSW)

Rule: Every frontend-backend interaction MUST have an MSW handler.

typescript
// Example MSW handler
import { http, HttpResponse } from 'msw'

export const handlers = [
  http.get('/api/users/:id', ({ params }) => {
    return HttpResponse.json({
      id: params.id,
      name: 'Test User'
    })
  })
]

Benefit: Decouples frontend development from backend availability.

Ghost Inspector Protocol

AI must scan for "Untested Logic Slabs" (>20 lines without coverage) and flag them:

bash
# Check coverage gaps
npm run test -- --coverage
# Look for files with <80% coverage

</integration_and_tooling>

<reference_and_audit>

📖 RELATED SKILLS

  • @testing-anti-patterns.md - Common mock/test mistakes to avoid
  • @clean-code - Code quality standards
  • @verification-mastery - Evidence before completion claims
  • @debug-mastery - When tests reveal bugs

🏁 FINAL RULE

Production code → test exists and failed first
Otherwise → not TDD

No exceptions without explicit user permission. </reference_and_audit>

Bundled files

The model reads these on demand while the skill is loaded. They are exposed as readable files and are never executed.

Frequently asked questions

What does the Tdd Mastery AI skill do?

Test-Driven Development Iron Law. Write the test first. Watch it fail. Write minimal code to pass. No exceptions.

Why use Tdd Mastery on TypingMind?

Because you install it once and use it with any model. Tdd Mastery is plain Markdown rather than provider-specific code, so the same skill runs on GPT-5, Claude, Gemini, Grok, or a local model — and you can switch model mid-chat without it breaking. TypingMind runs on your own API keys, so you pay providers directly instead of a per-seat subscription, and your skills and chats stay in your own storage.

How do I install Tdd Mastery in TypingMind?

Open Plugins → Skills → Install from GitHub in TypingMind and paste https://github.com/xenitV1/claude-code-maestro/tree/main/skills/tdd-mastery. TypingMind reads its SKILL.md and bundles its files and installs it as a skill you can enable per chat.

Which AI models can use Tdd Mastery?

Any model you connect in TypingMind. AI skills are plain Markdown instructions rather than provider-specific code, so GPT, Claude, Gemini, Grok, and local models can all load this skill when a request matches it.

How many AI models can I use with Tdd Mastery?

As many as you like. As long as a model supports skills, you can use Tdd Mastery with it — GPT, Claude, Gemini, Grok, DeepSeek, Mistral, Llama and more — all on TypingMind with your own API keys.

Is the Tdd Mastery AI skill free?

Yes. It is published on GitHub by xenitV1 under the MIT license. You only pay your own AI provider for the tokens you use.

What are AI skills?

An AI skill is a reusable instruction bundle that teaches an AI model how to do one specific task. It follows the open Agent Skills format: a SKILL.md file with a name and description, plus any scripts, templates or reference files the model may need. The model reads the instructions only when your request matches the skill, so an installed skill costs nothing until it is used.

How are AI skills different from plugins or MCP servers?

A plugin or MCP server gives a model new tools to call — code that runs somewhere and returns a result. An AI skill gives the model knowledge and process instead: how to approach a task, which steps to follow, what good output looks like. Skills are plain Markdown, so they need no server, no API key and no runtime, and they work with any model.

View all

Set up your own AI workspace now

Get notified about new features and future giveaways by subscribing to our newsletter 👇