Skip to content
Back to skills

Test Driven Development

ASecurity

Use when implementing any feature or bugfix, before writing implementation code

  • 47 stars
  • 0 votes
  • 0 copies
  • 4 views
  • Added September 12, 2026
testinggoapi

Works with

  • api

Security analysis

A100/100

Scanned September 12, 2026

npx -y skills add skeletorflet/opencode-supreme-setup --skill test-driven-development --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Test Driven Development?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Test Driven Development
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/skeletorflet-test-driven-development/badge)](https://www.skillsdirectory.com/skills/skeletorflet-test-driven-development)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
name: test-driven-development
description: Use when implementing any feature or bugfix, before writing implementation code
---

# Test-Driven Development (TDD)

## Overview

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

## Red-Green-Refactor

### RED - Write Failing Test
Write one minimal test showing what should happen. One behavior, clear name, real code.

### Verify RED - Watch It Fail
MANDATORY. Test must fail for expected reason (feature missing, not typos).

### GREEN - Minimal Code
Write simplest code to pass the test. Don't add features beyond the test.

### Verify GREEN - Watch It Pass
MANDATORY. Test passes, other tests still pass, output pristine.

### REFACTOR - Clean Up
After green only. Remove duplication, improve names, extract helpers. Keep tests green.

## Good Tests
- Minimal: One thing per test
- Clear: Name describes behavior
- Shows intent: Demonstrates desired API

## Common Rationalizations
- "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.
- "Deleting X hours is wasteful" - Sunk cost fallacy.

## Red Flags - STOP and Start Over
Code before test, test passes immediately, "just this once", "keep as reference".

## Example: Bug Fix
RED: Write test for empty email rejection.
Verify RED: Test fails with expected message.
GREEN: Add validation check.
Verify GREEN: Test passes.
REFACTOR: Extract validation if needed.

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.