test-first

test-first is a skill for Claude Code, Codex from ao92265/claude-code-playbook. It costs 81 tokens per session (647 once invoked), scanned A, original, MIT.

A test-driven development workflow, or TDD, where tests are written before the code they describe.

In plain words
What is it for?
Use it when building a feature or fixing a bug. It covers normal cases, edge cases, and error cases before implementation.
Why use it?
It turns the requirement into a checked contract and exposes mistakes early through the red-green-refactor cycle: write a failing test, make it pass, then clean up the code.

Skill for Claude CodeCodex

Part of the playbook plugin — 49 skills, 4 hooks shipped together

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add skills/ao92265/claude-code-playbook/test-first
Any agent
npx skills add ao92265/claude-code-playbook --skill test-first
Clone the repo
git clone --depth 1 https://github.com/ao92265/claude-code-playbook

Made for: Claude Code, Codex.

Or install playbook, the plugin that ships this one along with the rest of its 49 skills, 4 hooks.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for test-first

README.md
[![agentmods](https://agentmods.dev/badge/skills/ao92265/claude-code-playbook/test-first.svg)](https://agentmods.dev/skills/ao92265/claude-code-playbook/test-first)
Your own site
<a href="https://agentmods.dev/skills/ao92265/claude-code-playbook/test-first"><img src="https://agentmods.dev/badge/skills/ao92265/claude-code-playbook/test-first.svg" alt="Measured on agentmods" height="20"></a>
Per session 81 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 647 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5 $0.00081 $0.00647
Opus 5 $0.00041 $0.00324
Sonnet 5 $0.00016 $0.00129
Haiku 4.5 $0.00008 $0.00065

Measured 5d ago against content hash f2ac92fe1d82, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

test-first scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 5d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

skills/test-first/SKILL.md · 67 lines

How it starts

The opening of the file, as written. The whole thing — 67 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Test-First Development

Enforce the Red-Green-Refactor cycle. Tests define the contract before implementation begins.

Steps

  1. Understand the requirement:

    • Clarify what the feature/fix should do
    • Identify inputs, outputs, edge cases, and error conditions
    • Ask clarifying questions if the spec is ambiguous
  2. Write failing tests (RED):

    • Create test file(s) if they don't exist
    • Write test cases that define expected behavior
    • Include happy path, edge cases, and error cases
    • Tests should be specific and descriptive — test names explain the contract
  3. Confirm tests fail for the right reason (NON-NEGOTIABLE):

    • Run the test suite: npm test, pytest, go test, etc.
    • Verify failures are "function not found" or "wrong return value" — not syntax errors
    • If tests fail for the wrong reason, fix the test first
    • Never skip this step. Tests that go green on first run are tautological or mocked the behavior under test. A test you never watched fail is theater, not verification.
  4. Implement minimum code to pass (GREEN):

    • Write the simplest code that makes all tests pass
    • Do not optimize or generalize yet
    • Do not add code that isn't required by a test
  5. Confirm all tests pass:

    • Run the full test suite
    • All new tests must be green
    • All existing tests must still pass (no regressions)
  6. Refactor (REFACTOR):

    • Clean up implementation while keeping tests green
    • Extract helpers, rename variables, simplify logic
    • Run tests after each refactoring step
  7. Final verification:

    • Run full test suite one last time
    • Run type checker / linter if applicable
    • Show the user the test results and implementation summary

Important

  • Never skip the RED step. If you can't write a failing test first, you don't understand the requirement well enough.
  • Never write implementation before tests exist. The test defines the contract.
  • Keep tests fast. Prefer unit tests over integration tests where possible.
  • One behavior per test. Each test should verify exactly one thing.
  • Test names are documentation. Use descriptive names: should_return_404_when_user_not_found.

Read the full file on GitHub · 67 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 5d ago First seen · 67 lines · 81 tokens per session scan A f2ac92fe1d82

Subscribe to this mod's changes

test-first is a skill published in the GitHub repository ao92265/claude-code-playbook (10 stars, last pushed 18d ago), licensed MIT. It adds 81 tokens to every session and 647 once invoked, about $0.0004 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-31.