Skip to content
Back to skills

Test Driven Development

ASecurity

Use when writing new code or fixing bugs during Stage 3 execution. Enforces RED-GREEN-REFACTOR cycle.

  • 8 stars
  • 0 votes
  • 0 copies
  • 0 views
  • Added May 28, 2026
ai-agentstestingdebuggingrefactoringdocumentation

Security analysis

A100/100

Scanned May 28, 2026

npx -y skills add seokan-jeong/team-shinchan --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/seokan-jeong-test-driven-development/badge)](https://www.skillsdirectory.com/skills/seokan-jeong-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: team-shinchan:test-driven-development
description: Use when writing new code or fixing bugs during Stage 3 execution. Enforces RED-GREEN-REFACTOR cycle.
user-invocable: false
---

# TDD Enforcement: RED-GREEN-REFACTOR

## The Iron Law

**No production code without a failing test first.**

Every line of production code must be justified by a test that failed without it. No exceptions unless explicitly approved by a human.

## The Cycle

### 1. RED -- Write a Failing Test

Write a test for the behavior you need. Run it. **It MUST fail.** If it passes, your test is wrong or the behavior already exists.

```
verify-RED: Run test → confirm FAIL
If test passes → STOP. Investigate why.
```

### 2. GREEN -- Write Minimal Code

Write the **minimum** production code to make the test pass. Nothing more.

```
verify-GREEN: Run test → confirm PASS
If test fails → fix production code (not the test)
```

### 3. REFACTOR -- Clean Up

Improve code structure while keeping tests green. Run tests after every change.

## Rationalization Table

Do NOT skip TDD. Every excuse has a counter:

| Excuse | Counter |
|--------|---------|
| "It's too simple to test" | Simple code has simple tests. Write it in 30 seconds. |
| "I'll add tests after" | You won't. And if you do, they'll test your implementation, not your intent. |
| "This is just a config change" | Config changes break things. Write a test that loads the config. |
| "Tests will slow me down" | Debugging without tests is slower. TDD prevents 80% of debugging. |
| "I need to prototype first" | Prototypes become production. Start with a test or get explicit human approval to skip. |
| "The existing code has no tests" | Add a test for the behavior you're changing. Don't perpetuate the gap. |
| "It's a one-line fix" | One-line fixes cause production outages. A one-line test prevents them. |

## Testing Anti-Patterns

- **Shotgun debugging**: Trying random fixes without understanding the failure. Write a failing test first.
- **Test-after rationalization**: "I'll test it later" is never later. Test first or never.
- **Mocking everything**: If you mock the world, you test nothing. Mock boundaries, not internals.
- **Testing implementation details**: Test behavior (what), not implementation (how). Tests should survive refactoring.

## Exceptions

TDD may be skipped ONLY with **explicit human approval** for:
- Throwaway prototypes (marked as such, with a plan to rewrite with TDD)
- Pure documentation or configuration with no behavioral impact

If in doubt, write the test. It takes less time than debating whether to skip it.

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.