Skills DirectorySkills Directory
SkillsLearnSecurityCategoriesDocsCommunityBlog
Sign InSubmit Skill
Skills Directory

Security-tested agent skills for Claude, coding agents, and AI workflows.

Directory

  • Browse Skills
  • All Skills A–Z
  • Claude Skills
  • Claude Code Skills
  • Agent Skills
  • Categories
  • Authors
  • Submit a Skill

Learn

  • Learn Hub
  • Install Claude Skills
  • Write SKILL.md
  • Skills vs MCP
  • Directories Compared

Security

  • Security
  • Methodology
  • Secure Claude Skills
  • Security Badges

Company

  • About
  • Community
  • Blog
  • API Docs
  • Advertise

2026 Skills Directory. All rights reserved.

ProTermsPrivacyRefunds
Back to skills

Tdd Loop

ASecurity

Writes the failing test first, watches it fail for the right reason, then makes it pass with the smallest change. Use before implementing any feature or bug fix, when adding a regression test, or when a change needs proof it works. Refuses to write implementation code before a red test exists.

9 stars
0 votes
0 copies
0 views
Added 9/27/2026
ai-agentsgotestingrefactoring

Security Analysis

A100/100

Scanned 9/27/2026

Install to Claude Code

$npx -y skills add khuynh22/agent-dev-team --skill tdd-loop --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Tdd Loop?

Add the live security badge to your README — it updates automatically with every re-scan.

Security grade badge for Tdd Loop
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/khuynh22-tdd-loop/badge)](https://www.skillsdirectory.com/skills/khuynh22-tdd-loop)

More formats (shields.io, HTML) on the badges page.

Download with Pro
Files
SKILL.md
---
name: tdd-loop
description: Writes the failing test first, watches it fail for the right reason, then makes it pass with the smallest change. Use before implementing any feature or bug fix, when adding a regression test, or when a change needs proof it works. Refuses to write implementation code before a red test exists.
license: MIT
metadata:
  phase: build
  owners: [software-engineer, senior-engineer, test-engineer]
  version: "0.1.0"
---

# TDD Loop

The discipline is not "have tests". It is **watch the test fail before you make it pass**.
A test you never saw red proves only that it passes, which is also true of a test that
asserts nothing.

## The loop

1. **Red.** Write one failing test for the next smallest piece of behavior.
2. **Run it.** Read the failure message. Confirm it fails for the reason you expect. A
   test failing on an import error or a typo is not red, it is broken.
3. **Green.** Write the smallest change that makes it pass. Not the general version. Not
   the version you can already see you will need.
4. **Run the whole suite.** A green new test with a red suite is a broken build.
5. **Refactor.** With the suite green, improve the shape. Tests do not change during a
   refactor; if they must, it was not a refactor.
6. **Repeat.**

Commit at each green. A green commit is a safe point to return to.

## Writing the first test

Start from the acceptance criterion, not from the function you plan to write. The test
names the behavior a caller cares about:

```
Bad:   sumLines returns 0 for []
Good:  an empty cart totals zero
```

If you cannot write the test because you do not know what the behavior should be, that is
a requirements problem. Stop and ask, or escalate. It is not a reason to write the code
first and infer the behavior from it.

If you cannot write the test because the code is hard to reach, that is a design problem.
The seam is missing. Escalate to `senior-engineer` rather than mocking around it.

## For a bug fix

1. Reproduce the bug in a test. The test fails with the same symptom the user reported.
2. Name the test after the bug, not the fix: "rejects a refund larger than the original
   charge".
3. Fix it.
4. The test now passes, and it stays in the suite forever as the guard.

A bug fix without a reproducing test will be reintroduced.

## Choosing the level

The cheapest level that would actually catch the failure. Unit for logic and boundaries;
integration for wiring, serialization, and queries; end to end for the one critical path
a user walks. See `references/testing-patterns.md`.

## When the test is written after the code

Sometimes it is. Then you must manufacture red: break the implementation deliberately,
run the test, confirm it fails, restore the implementation, confirm it passes. Skipping
this leaves you with a test that passes for reasons you have not verified.

## Verification

Report all four, quoted:

```
Red:    <the failing run, with the assertion message>
Green:  <the passing run>
Suite:  <the full-suite summary line>
Build:  <type check or build summary line>
```

Then check `references/definition-of-done.md`.

## Red flags

| Thought | Reality |
|---------|---------|
| "It is too small to test" | Small changes break things. The test costs a minute. |
| "I'll write the tests at the end" | Then they are written to fit the code, and they test your implementation rather than the requirement. |
| "The test passed the first time I ran it" | Then you have not seen it fail. Break the code and watch. |
| "It fails, that is enough" | Read *why* it fails. An import error is not a red test. |
| "I'll make it general while I'm here" | Smallest change. The general version is usually the wrong general version. |
| "Refactoring broke a test so I updated the test" | Then it was a behavior change. Separate the commits. |
| "Six mocks were needed but it works" | Six mocks is a design finding. Escalate it. |

Attribution

khuynh22khuynh22
View sourceMore from khuynh22 →
SSkills DirectorySkills Directory

Know which skills are safe — weekly.

Best new skills + every skill we flagged as malicious. From the team that scanned 103,619.

Join free

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 (0)

No comments yet. Be the first to comment!

SSkills DirectorySkills Directory

Know which skills are safe — weekly.

Best new skills + every skill we flagged as malicious. From the team that scanned 103,619.

Join free

Related Skills

Caveman

Ultra-compressed communication mode that cuts output tokens while keeping technical accuracy. Levels: lite, full, ultra and the wenyan variants. Use for /caveman, "caveman mode", "talk like caveman", "be brief" or "less tokens".

1074701 votes

Hyperplan

Adversarial multi-agent planning skill. Self-orchestrates 5 hostile category members (unspecified-low, unspecified-high, deep, ultrabrain, artistry) via team-mode for ruthless cross-critique debate, distills only the defensible insights, then MANDATORILY hands the distilled insight bundle to the `plan` agent for executable plan formalization. Use when planning needs maximum rigor and surfacing of weak assumptions, blind spots, and over-engineering. Triggers: 'hyperplan', 'hpp', '/hyperplan', ...

694821 votes

Mcp Code Execution

Routes multi-tool workflows through MCP servers for large datasets and pipelines. Use when Bash tool overhead is limiting throughput on data-heavy tasks.

3351 votes

catchup

Recovers the conversation and failed tool calls of a previous Codex, Claude Code, Antigravity, Cline, Copilot CLI, Cursor, DeepSeek Harness, Kimi, OpenCode, Pi Agent, or ZCode session. Use when the user says "catch up", "what did the last session do", "get me up to speed", "I switched agents", asks to recover/summarize a previous session before continuing, or asks to diagnose or report a catchup failure. Do NOT use for the current conversation, git history, or any non-agent log.

691 votes

math-skill

A comprehensive mathematical reasoning skill for AI assistants — handles arithmetic to research-level problems with rigorous step-by-step reasoning, systematic verification, and transparent uncertainty handling

381 votes
View all in ai-agents →