Back to skills
SkillHub ClubShip Full StackFull StackTesting

test-driven-development

This skill enforces strict TDD workflow by requiring failing tests before implementation. It provides concrete examples of the red-green-refactor cycle and includes verification checklists. The documentation clearly explains when to use it and what triggers should activate the skill.

Packaged view

This page reorganizes the original catalog entry around fit, installability, and workflow context first. The original raw source lives below.

Stars
5
Hot score
82
Updated
March 20, 2026
Overall rating
A8.0
Composite score
4.9
Best-practice grade
A92.0

Install command

npx @skill-hub/cli install timequity-plugins-test-driven-development
testingworkflowcode-qualitybest-practices

Repository

timequity/plugins

Skill path: craft-coder/test-driven-development

This skill enforces strict TDD workflow by requiring failing tests before implementation. It provides concrete examples of the red-green-refactor cycle and includes verification checklists. The documentation clearly explains when to use it and what triggers should activate the skill.

Open repository

Best for

Primary workflow: Ship Full Stack.

Technical facets: Full Stack, Testing.

Target audience: Developers learning TDD or needing discipline to follow the red-green-refactor cycle consistently.

License: Unknown.

Original source

Catalog source: SkillHub Club.

Repository owner: timequity.

This is still a mirrored public skill entry. Review the repository before installing into production workflows.

What it helps with

  • Install test-driven-development into Claude Code, Codex CLI, Gemini CLI, or OpenCode workflows
  • Review https://github.com/timequity/plugins before adding test-driven-development to shared team environments
  • Use test-driven-development for development workflows

Works across

Claude CodeCodex CLIGemini CLIOpenCode

Favorites: 0.

Sub-skills: 0.

Aggregator: No.

Original source / Raw SKILL.md

---
name: test-driven-development
description: |
  Write failing test first, then minimal code to pass. Red-Green-Refactor cycle.
  Use when: implementing features, fixing bugs, refactoring code.
  Triggers: "implement", "add feature", "fix bug", "tdd", "test first",
  "write tests", "test-driven".
---

# Test-Driven Development (TDD)

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.

## Red-Green-Refactor

### RED — Write Failing Test

Write one minimal test showing what should happen.

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

**Requirements:**
- One behavior
- Clear name
- Real code (no mocks unless unavoidable)

### Verify RED — Watch It Fail

**MANDATORY. Never skip.**

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

Confirm:
- Test fails (not errors)
- Failure message is expected
- Fails because feature missing

### GREEN — Minimal Code

Write simplest code to pass the test.

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

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

### Verify GREEN — Watch It Pass

**MANDATORY.**

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

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

| Excuse | Reality |
|--------|---------|
| "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. |
| "TDD will slow me down" | TDD faster than debugging. |

## Red Flags — STOP and Start Over

- Code before test
- Test passes immediately
- Can't explain why test failed
- "Just this once"

## Verification Checklist

Before marking work complete:

- [ ] Every new function has a test
- [ ] Watched each test fail before implementing
- [ ] Wrote minimal code to pass each test
- [ ] All tests pass
- [ ] Output pristine (no errors, warnings)
test-driven-development | SkillHub