Skip to content
Back to skills

Tdd

ASecurity

Builds code test-first (red, green, refactor) and records proof per task. Use when the user asks to build, add, implement or change code: a feature, a function, a behavior change, a fix for a bug with a known reproducible case, or \"build it\" or \"build it task by task\" once a plan is approved. Use this skill whenever code is about to be written, even if the user never mentions tests. Not for finding the cause of an unknown failure; use diagnose.

  • 10 stars
  • 0 votes
  • 0 copies
  • 1 view
  • Added November 29, 2026
ai-agentsgotesting

Security analysis

A100/100

Scanned December 4, 2026

npx -y skills add Mouad1/moskills --skill tdd --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Tdd?

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

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

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: tdd
description: "Builds code test-first (red, green, refactor) and records proof per task. Use when the user asks to build, add, implement or change code: a feature, a function, a behavior change, a fix for a bug with a known reproducible case, or \"build it\" or \"build it task by task\" once a plan is approved. Use this skill whenever code is about to be written, even if the user never mentions tests. Not for finding the cause of an unknown failure; use diagnose."
---

# TDD

Primary goal: Create a fast red-green-refactor feedback loop.

## Flow

```text
Red -> Green -> Refactor
```

## Steps

1. Pick one behavior from the current intent model.
2. Write the smallest failing test for that behavior.
3. Run the test and confirm it fails for the expected reason.
4. Write the smallest implementation that makes the test pass.
5. Run the test again.
6. Refactor only after tests are green.
7. Record commands run in `/checkpoint` or `/gatekeeper` when relevant.
8. When the behavior adds an entry point or data that a user owns, add the abuse cases below.

## Abuse Cases

A scanner reads code; only a test shows what the running code allows. Add abuse cases when the behavior adds or changes one of these:

- An entry point: an HTTP route, an RPC or GraphQL handler, a webhook, a queue consumer, or a command that acts on stored data.
- Data that a user owns, or an action that only some users can do.
- A token or an action that must work only once: a password reset, an invite, a payment, a coupon.

For each item that applies, write the test before the code:

1. Call the entry point without identity. Expect a refusal and no data.
2. Call it as user A with the ID of a resource of user B. Expect not found or forbidden, and no data of user B.
3. Send invalid input straight to the entry point, past the UI. Expect a refusal with a generic error.
4. Use a single-use token or action twice. Expect the second use to fail.

- Skip a case that does not apply, and write the reason in the task notes.
- Run each abuse case through `run-state wrap` like any other check, so the proof stays current.
- Keep the abuse cases in the suite. When a later change breaks one of them, the build fails.

## Good Tests

- Test behavior, not implementation details.
- Use clear names from `/shared-language` when available.
- Avoid broad tests that check many behaviors at once.
- Prefer real inputs and outputs over mocks when practical.

## Rules

- No production behavior change before a failing test when testing is practical.
- Do not call a test green unless command output was observed.
- If the project has no test setup, name that as `Unknown` in `/gatekeeper` and suggest the smallest useful test path.

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.

View all in ai-agents →

Comments

Loading comments…

Newsletter

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