tdd-patterns

tdd-patterns is a skill for Claude Code from synaptiai/synapti-marketplace. It costs 114 tokens per session (1,713 once invoked), scanned A, original, Apache-2.0.

A guide to test-driven development, or TDD, where you write a failing test, make it pass, and then improve the code. It also sets rules for useful tests and test-runner use.

In plain words
What is it for?
Use it when adding features or fixing bugs to create a failing test first, implement the smallest passing change, refactor safely, and avoid weak or implementation-specific tests.
Why use it?
It helps prove that tests check the intended behavior instead of passing for an unrelated reason.

Skill for Claude Code

Written for Claude Code: allowed-tools in frontmatter. Also seen: agent in frontmatter.

Part of the flow plugin — 31 skills, 21 commands, 9 agents shipped together

Good fit Use it when adding features or fixing bugs to create a failing test first, implement the smallest passing change, refactor safely, and avoid weak or implementation-specific tests.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/synaptiai/synapti-marketplace/tdd-patterns
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 synaptiai/synapti-marketplace --skill tdd-patterns
Clone the repo
git clone --depth 1 https://github.com/synaptiai/synapti-marketplace

Made for: Claude Code.

Or install flow, the plugin that ships this one along with the rest of its 31 skills, 21 commands, 9 agents.

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-patterns

README.md
[![agentmods](https://agentmods.dev/badge/skills/synaptiai/synapti-marketplace/tdd-patterns/github.svg)](https://agentmods.dev/skills/synaptiai/synapti-marketplace/tdd-patterns)
Your own site
<a href="https://agentmods.dev/skills/synaptiai/synapti-marketplace/tdd-patterns"><img src="https://agentmods.dev/badge/skills/synaptiai/synapti-marketplace/tdd-patterns/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-patterns

Your own site · 80×15
<a href="https://agentmods.dev/skills/synaptiai/synapti-marketplace/tdd-patterns"><img src="https://agentmods.dev/badge/skills/synaptiai/synapti-marketplace/tdd-patterns.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 114 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 1,713 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.00114 $0.01713
Opus 5 $0.00057 $0.00856
Sonnet 5 $0.00023 $0.00343
Haiku 4.5 $0.00011 $0.00171

Measured 6d ago against content hash bade84298b26, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-09, from the pricing page.

Security

Grade A, and why

tdd-patterns 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 6d 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.

plugins/flow/skills/tdd-patterns/SKILL.md · 184 lines

How it starts

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

TDD Patterns

Domain skill for test-driven development: Red-Green-Refactor cycle, test quality, and runner discipline.

Iron Law

IF YOU DIDN'T WATCH THE TEST FAIL, YOU DON'T KNOW IF IT TESTS THE RIGHT THING.

A test that has never failed might pass for the wrong reason. The RED phase exists to prove the test is valid.

Red-Green-Refactor Cycle

For each feature or fix, track the TDD cycle with tasks:

TaskCreate("RED: Write failing test for {behavior}", "Minimal test describing desired behavior. MUST fail on first run.")
TaskCreate("GREEN: Implement {behavior}", "Simplest code to make the test pass. No cleverness.")
TaskCreate("REFACTOR: Clean up {behavior}", "Improve quality. All tests must still pass after each step.")

RED: Write a Failing Test

TaskUpdate(RED task, status: "in_progress")

  1. Write the minimal test that describes the desired behavior
  2. Run it — it MUST fail
  3. Verify it fails for the right reason (not a syntax error, not wrong import)

TaskUpdate(RED task, status: "completed")

GREEN: Make It Pass

TaskUpdate(GREEN task, status: "in_progress")

  1. Write the simplest code that makes the test pass
  2. No cleverness. No optimization. No "while I'm here" improvements.
  3. Run the test — it MUST pass now

TaskUpdate(GREEN task, status: "completed")

REFACTOR: Clean Up

TaskUpdate(REFACTOR task, status: "in_progress")

  1. Improve code quality (naming, structure, duplication)
  2. Run ALL tests after each refactor step — they must still pass
  3. No new functionality during refactor — that's a new RED phase

TaskUpdate(REFACTOR task, status: "completed") Use TaskList to confirm the full cycle completed before moving to the next behavior.

The cycle is non-negotiable. RED → GREEN → REFACTOR. Always in this order.

Test Runner Discipline

Always use run mode, never watch mode:

Framework Correct Wrong
Vitest vitest run vitest (watch)
Jest CI=true jest or jest --watchAll=false jest (watch)
Pytest pytest
RSpec rspec guard (watch)

Read the full file on GitHub · 184 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. 6d ago First seen · 184 lines · 114 tokens per session scan A bade84298b26

Subscribe to this mod's changes

tdd-patterns is a skill published in the GitHub repository synaptiai/synapti-marketplace (6 stars, last pushed 1mo ago), licensed Apache-2.0. It adds 114 tokens to every session and 1,713 once invoked, about $0.0006 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-09-03.