tdd

tdd is a skill for Claude Code, Codex from tonyghiani/ai-essentials. It costs 59 tokens per session (861 once invoked), scanned A, original, MIT.

A test-first workflow called test-driven development, or TDD. It requires writing a test that fails for the intended reason before writing the code that makes it pass.

In plain words
What is it for?
Use it when explicitly requested or when adding behavior to code with existing tests, following the project’s testing style.
Why use it?
It clarifies the expected behavior and catches tests that fail because of setup mistakes rather than missing functionality.

Skill for Claude CodeCodex

Written for no agent in particular: nothing here depends on one.

Good fit Use it when explicitly requested or when adding behavior to code with existing tests, following the project’s testing style.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/tonyghiani/ai-essentials/tdd
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.

Any agent
npx skills add tonyghiani/ai-essentials --skill tdd
Clone the repo
git clone --depth 1 https://github.com/tonyghiani/ai-essentials

Made for: Claude Code, Codex.

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 tdd

README.md
[![agentmods](https://agentmods.dev/badge/skills/tonyghiani/ai-essentials/tdd/github.svg)](https://agentmods.dev/skills/tonyghiani/ai-essentials/tdd)
Your own site
<a href="https://agentmods.dev/skills/tonyghiani/ai-essentials/tdd"><img src="https://agentmods.dev/badge/skills/tonyghiani/ai-essentials/tdd/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for tdd

Your own site · 80×15
<a href="https://agentmods.dev/skills/tonyghiani/ai-essentials/tdd"><img src="https://agentmods.dev/badge/skills/tonyghiani/ai-essentials/tdd.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 59 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 861 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe.
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.1 $0.00059 $0.00861
Opus 5.5 $0.00024 $0.00344
Sonnet 5.5 $0.00012 $0.00172
Haiku 4.5 $0.00006 $0.00086

Measured 18d ago against content hash afdfc69b0ab4, method: parsed. Prices are Anthropic first-party input rates as of 2026-10-07, from the pricing page.

Security

Grade A, and why

tdd 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 18d 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/tdd/SKILL.md · 81 lines

How it starts

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

TDD loop

Opt-in only. When invoked, you do not write implementation code until a test fails for the right reason.

The loop

1. Name the behaviour. One sentence, declarative, third person, no "should":

returns enabled when no state has been persisted

If you can't phrase it that way, the behaviour isn't defined yet. Go ask.

2. Write the failing test. Colocated <name>.test.ts(x) beside the source. Match the house style:

describe('SignificantEventsMaintenanceService', () => {
  describe('getState', () => {
    it('returns enabled when no state has been persisted', async () => {
      const service = makeService();
      await expect(service.getState()).resolves.toBe('enabled');
    });
  });
});

3. Run it and read the failure. This is the step people skip.

# use your project's test runner, e.g.:
npx jest <path/to/file.test.ts>

The test must fail because the behaviour is missing, not because of a typo, a bad import, or a mock that throws. A test that fails for the wrong reason proves nothing. If the error isn't the one you predicted, fix the test before touching the implementation.

4. Implement the minimum that makes it pass. No speculative extras.

5. Run again. Green, and no other test broke.

6. Refactor. Now, with the test as the safety net. Prefer deleting over abstracting.

Repeat per behaviour. Do not batch five tests then implement; the loop's value is in the failure you read at step 3.

Testing style

Follow marco-code-style for the full picture. The parts that matter most here:

  • Hand-rolled stateful mock factories for services. Build a fake that round-trips: a Map-backed saved-objects client that throws NotFound until create, a management API that tracks enabled so pause→resume actually works. JSDoc each option. jest.mock is for module-mocking your own hooks in component tests, and nothing else.
  • renderHook/act for hooks, render/screen for components.
  • Full variable names here too: rulesClient, not rc.
  • Assert concrete values, not snapshots. expect.objectContaining where partial matching is honest.
  • Async via .rejects/.resolves: await expect(fn()).rejects.toMatchObject({ statusCode: 409 }).
  • Negative assertions pin the contract: expect(service.getStatus).not.toHaveBeenCalled() proves the guard took the cheap path.
  • Shared fixtures as SCREAMING_SNAKE consts: const REQUEST = {} as Request.
  • Fakes cast at the seam with as unknown as T.

Read the full file on GitHub · 81 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. 18d ago Changed · +1 lines afdfc69b0ab4
  2. 1mo ago First seen · 80 lines · 59 tokens per session scan A 735089907eda

Subscribe to this mod's changes

tdd is a skill published in the GitHub repository tonyghiani/ai-essentials (7 stars, last pushed 19d ago), licensed MIT. It adds 59 tokens to every session and 861 once invoked, about $0.0002 per session on Opus 5.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.