Skip to content
Skills Library
Programming · Testing

tdd

/tdd

Test-Driven Development with enforced RED-GREEN-REFACTOR cycle and Git checkpoints per phase. Use for new testable features and bug fixes (reproduction test first) — not for config, docs, or renames.

Licence
MIT
Last repository change
06.10.2026

Assessment and security

100/ 100Class: good
Format25 / 25
Frontmatter with name and description, valid name, description up to 1,024 characters, name matching the folder.
Discoverability25 / 25
Description explains when to use the skill, has a reasonable length and uses third person.
Content35 / 35
At least 150 words and at most 500 lines, headings, step lists, examples or code.
Hygiene15 / 15
No placeholders such as TODO, no Windows paths, with a licence.
Riskno signals detected in the scan
Files in this package
1
Scripts
0
HTML comments
0
URLs in SKILL.md
0
Deprecation

No signals detected. Repository changed on 06.10.2026, without references to retired models or APIs.

Licence

MIT, open: use and modify while retaining author attribution.

What it does and when to use it

Test-Driven Development with enforced RED-GREEN-REFACTOR cycle and Git checkpoints per phase. Use for new testable features and bug fixes (reproduction test first) — not for config, docs, or renames.

Arguments

/tdd [feature-or-bug-description]
Original author description

Test-Driven Development with enforced RED-GREEN-REFACTOR cycle and Git checkpoints per phase. Use for new testable features and bug fixes (reproduction test first) — not for config, docs, or renames.

How it works

  1. When to Use
  2. Dynamic Context
  3. Purpose
  4. Usage
  5. The Cycle
  6. Phase 1: RED (Write Failing Test)
  7. Phase 2: GREEN (Make It Pass)
  8. Phase 3: REFACTOR (Clean Up)
  9. Cycle Completion
  10. Coverage Gate
Original SKILL.md headings · 174 lines, 696 words
SKILL.md preview
---
name: tdd
description: Test-Driven Development with enforced RED-GREEN-REFACTOR cycle and Git checkpoints per phase. Use for new testable features and bug fixes (reproduction test first) — not for config, docs, or renames.
user-invocable: true
argument-hint: [feature-or-bug-description]
---

## When to Use

Use proactively when:
- New feature implementation with testable behavior
- Bug fix (write reproduction test first)
- User explicitly requests TDD approach

Triggers: TDD, test-driven, test first, red green refactor,
write test first, failing test, reproduction test

Do NOT use for: config changes, documentation, simple renames, UI-only changes

## Dynamic Context

Recent TDD commits:
!`git log --oneline -5 --grep="red:\|green:\|refactor:" 2>/dev/null || echo "No TDD commits found"`

Test infrastructure:
!`ls tests/ __tests__/ test/ 2>/dev/null | head -10 || echo "No test directory found"`

# TDD Workflow Skill

## Purpose
Enforce disciplined RED-GREEN-REFACTOR cycle with Git checkpoints to prevent skipping steps.

## Usage

```bash
/tdd "user login validation"      # new feature
/tdd "fix: timeout on large files" # bug reproduction
/tdd                               # prompt for description
```

## The Cycle

```
RED → GREEN → REFACTOR → (repeat)
 │      │        │
 │      │        └─ git commit "refactor: ..."
 │      └─ git commit "green: ..."
 └─ git commit "red: ..."
```

## Phase 1: RED (Write Failing Test)

**Goal**: Write a test that describes the desired behavior. It MUST fail.

### Rules
- Write the test FIRST — before any production code
- Test should be minimal: one behavior per test
- Run the test suite and confirm failure

### RED Gate (CRITICAL)
```
DO NOT edit production code until RED state is confirmed.
```

Acceptable RED states:
- Test fails with assertion error (expected behavior not implemented)
- Test fails with compile/import error (function/class doesn't exist yet)

NOT acceptable:
- Test fails because of typo in test code
- Test fails because test framework misconfigured

### Checkpoint
```bash
git add -A && git commit -m "red: [describe expected behavior]"
```

## Phase 2: GREEN (Make It Pass)

**Goal**: Write the MINIMUM production code to make the test pass. Nothing more.

### Rules
- Only write code that the failing test requires
- No premature optimization
- No extra features
- "Fake it till you make it" is valid (hardcoded returns → generalize later)

### GREEN Gate
```
ALL tests must pass. No new test failures introduced.
```

### Checkpoint
```bash
git add -A && git commit -m "green: [describe what was implemented]"
```

## Phase 3: REFACTOR (Clean Up)

**Goal**: Improve code quality without changing behavior. Tests stay green throughout.

### Rules
- Extract duplications
- Rename for clarity
- Simplify logic
- Run tests after EVERY change — if any test breaks, revert immediately

### Checkpoint
```bash
git add -A && git commit -m "refactor: [describe improvement]"
```

## Cycle Completion

After REFACTOR, evaluate:
- More behaviors to implement? → Start new RED phase
- All requirements met? → Run full test suite → Report coverage

## Coverage Gate

After all cycles complete:

```bash
# JavaScript/TypeScript
pnpm test -- --coverage

# Python
pytest --cov --cov-report=term-missing
```

**Minimum threshold**: Report actual coverage. Flag untested paths. Do not set arbitrary percentage targets unless the project defines one.

## Anti-patterns — Must Avoid

- Writing production code before test (defeats TDD purpose)
- Writing test that already passes (not RED)
- Skipping REFACTOR phase ("it works, ship it")
- Testing implementation details instead of behavior
- Brittle selectors (CSS classes, DOM structure) in tests
- Test-to-test dependencies (each test must be independent)
- Large RED→GREEN jumps (write too much code at once)

## Integration with Verification Iron Law

TDD checkpoints feed directly into the Verification Iron Law:
- RED commit = evidence that test correctly fails
- GREEN commit = evidence that implementation works
- REFACTOR commit = evidence that tests remain green after cleanup

Each commit is a verification artifact.

## Output Format

```
## TDD Cycle 1: [behavior]

### RED
- Test: `test/auth.test.ts` — `should reject empty password`
- Status: FAIL ✓ (assertion error: expected rejection)
- Commit: `red: reject empty password validation`

### GREEN
- Implementation: `src/auth.ts:validatePassword()`
- Status: ALL PASS ✓
- Commit: `green: implement password validation`

### REFACTOR
- Change: extracted validation rules to constants
- Status: ALL PASS ✓
- Commit: `refactor: extract validation constants`

## Coverage: 87% (src/auth.ts: 100%)
```

## Related Skills

- `/pytest-runner` - Python test execution
- `/verify` - Post-implementation verification
- `/confidence-check` - Pre-implementation assessment

Versions

RepositoryScoreLicence
This page · excatt/superclaude-plusplus100MIT
kdlbs/kandev100AGPL-3.0
sentimony/skills100MIT
sentimony/skills100MIT
TerminalSkills/skills100Apache-2.0
duronext/jig100MIT
xoai/sage100MIT
rolemodel/skills100MIT
matteocodogno/wellforge100MIT

Database snapshot: 13.11.2026 · package version f599b47fc699 (SHA-256 digest of the entire package)

Downloads in the last 30 days: 0 · ranking

Report a problem with this skill: harmful content, incorrect descriptions or an author’s removal request.

Similar skills

  • 100tdd-workflow
    Use this skill for test-first implementation of new features, bug fixes, and refactors with RED-GREEN-REFACTOR discipline and explicit verification gates.
  • 100tdd-with-agents
    TDD enforcement with RED→GREEN→REFACTOR cycle and advanced testing patterns. Use for test-driven development across all layers.
  • 90tdd-workflow
    Implements features and bug fixes test-first using the red, green, refactor cycle, detecting the project's existing test framework and conventions. Use when the user asks for TDD, test-first development, to "add tests", or to implement behavior that must be reliably verified.
  • 90tdd-cycle
    Red-Green-Refactor TDD loop with mandatory false-positive check. Use when: test, TDD, red-green, failing test, write test first, test-driven.
  • 100test-driven-development
    Use when implementing new features or logic that requires tests — before writing implementation code. Covers Red-Green-Refactor cycle, stack-specific test patterns, test naming conventions, and mocking. Triggers: "write tests first", "TDD", "test-driven", "failing test",…
  • 100tdd-workflow
    TDD red-green-refactor workflow. Use when implementing a feature or bug fix test-first.

Feedback and reports

Your message goes to Bartosz Sokoliński. An email address is needed only for a reply. See the privacy policy.