Skip to content
Back to skills

Test Driven Development

ASecurity

Use when writing or changing behaviour that can be tested — a bug fix, a new function, a parser, a formatter. Write the failing test first, watch it fail, then make it pass. Prevents tests that only pass because they were written against the finished code.

  • 5 stars
  • 0 votes
  • 0 copies
  • 0 views
  • Added November 10, 2026
ai-agentsgoexpress

Security analysis

A100/100

Scanned November 10, 2026

npx -y skills add Viqto0r/zames_pro --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/viqto0r-test-driven-development/badge)](https://www.skillsdirectory.com/skills/viqto0r-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 writing or changing behaviour that can be tested — a bug fix, a new function, a parser, a formatter. Write the failing test first, watch it fail, then make it pass. Prevents tests that only pass because they were written against the finished code.
---

# Test-driven development

RED → GREEN → REFACTOR. The order is the point, not a formality.

## The cycle

1. **RED** — write the smallest test that expresses the new behaviour and
   RUN it. It must FAIL, and fail for the RIGHT reason ("not implemented",
   not a typo or a missing import). A test you never saw fail proves nothing.
2. **GREEN** — write the MINIMUM code that makes it pass. Do not add the
   next feature "while you are there"; that code is untested.
3. **REFACTOR** — clean up with the test green, and re-run it.

## What makes a test good

- It asserts BEHAVIOUR (input → output), not implementation detail.
- It fails when the behaviour is wrong — verify this by breaking the code
  on purpose once, if you are unsure.
- It is deterministic: no sleeps, no network, no dependence on wall-clock
  time or on the order other tests ran in.
- One reason to fail, with a message that says what broke.

## Rules in this project

- A bug fix ALWAYS gets a regression test that reproduces the original bug.
- When you fix a test to make it pass, ask whether the TEST was wrong or the
  CODE was wrong; do not just move the assertion.
- If the code was written before its test, delete and rewrite it driven by
  the test — otherwise the test is shaped around the implementation.
- A test that writes a temp dir or file cleans it up itself: in this repo
  always go through `test/tmp-dir.ts` (`makeTmpDir(t, prefix)` /
  `makeTmpDirSync`), which registers the `t.after` cleanup. On WSL a leaked
  `os.tmpdir()` entry lives inside ext4.vhdx and never returns its space to
  the Windows host, so an abandoned temp dir fragments the disk permanently.

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.