Skip to content
Back to skills

Test First

ASecurity

Write the failing test that proves the change is needed, watch it fail for the right reason, then write the smallest code that makes it pass, then tidy up with the tests green.

  • 2 stars
  • 0 votes
  • 0 copies
  • 0 views
  • Added October 22, 2026
ai-agents

Security analysis

A100/100

Scanned October 22, 2026

npx -y skills add gaurav8936/oneroof --skill test-first --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Test First?

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

Security grade badge for Test First
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/gaurav8936-test-first/badge)](https://www.skillsdirectory.com/skills/gaurav8936-test-first)

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-first
description: Write the failing test that proves the change is needed, watch it fail for the right reason, then write the smallest code that makes it pass, then tidy up with the tests green.
runtime: [shared]
triggers: [test first, write the test first, tdd, red green]
---

# test-first — red, green, tidy

## Steps

1. **Find the test home.** Locate the project's test runner and an existing test close to the change. Match its
   style. Run the suite once to know the starting state (note any tests already failing; they are not yours).
2. **Write one failing test** for the behaviour you want, named after the behaviour ("rejects an empty cart"), not
   the function.
3. **Run it and read the failure.** It must fail *because the behaviour is missing*, not because of a typo, an import
   error or a wrong path. If it fails for the wrong reason, fix the test first.
4. **Write the smallest change** that makes it pass. Resist adding features the test does not ask for.
5. **Run the whole suite.** Everything that passed before still passes.
6. **Tidy** names, duplication and structure with the tests green. Run them again.
7. **Repeat** for the next behaviour. For a bug, the first test reproduces the bug.

## Report

For each behaviour: the test name, the failing output (one line), the passing run, and the files changed.

## Never

- Never change a test to make it pass unless the test itself was wrong, and say so if you do.
- Never skip or delete a failing test to get green.
- Never claim "tests pass" without the command and its output.

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.