test-driven-development

test-driven-development is a skill for Claude Code from thoughtbot/rails-consultant. It costs 68 tokens per session (3,940 once invoked), scanned A, original, MIT.

A strict test-first workflow for Ruby on Rails applications. TDD means writing a failing test, adding the smallest code that makes it pass, then improving the code.

In plain words
What is it for?
Use it when adding features, fixing bugs, refactoring, or changing how a Rails application behaves.
Why use it?
It helps catch incorrect behavior early and keeps changes tied to clearly described results.

Skill for Claude Code

Written for Claude Code: disable-model-invocation in frontmatter.

Part of the rails-consultant plugin — 12 skills shipped together

Good fit Use it when adding features, fixing bugs, refactoring, or changing how a Rails application behaves.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/thoughtbot/rails-consultant/test-driven-development
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 thoughtbot/rails-consultant --skill test-driven-development
Clone the repo
git clone --depth 1 https://github.com/thoughtbot/rails-consultant

Made for: Claude Code.

Or install rails-consultant, the plugin that ships this one along with the rest of its 12 skills.

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-driven-development

README.md
[![agentmods](https://agentmods.dev/badge/skills/thoughtbot/rails-consultant/test-driven-development/github.svg)](https://agentmods.dev/skills/thoughtbot/rails-consultant/test-driven-development)
Your own site
<a href="https://agentmods.dev/skills/thoughtbot/rails-consultant/test-driven-development"><img src="https://agentmods.dev/badge/skills/thoughtbot/rails-consultant/test-driven-development/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 test-driven-development

Your own site · 80×15
<a href="https://agentmods.dev/skills/thoughtbot/rails-consultant/test-driven-development"><img src="https://agentmods.dev/badge/skills/thoughtbot/rails-consultant/test-driven-development.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 68 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 3,940 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. Third-party audits
  • NVIDIA SkillSpector pass 7 Sept 2026
How audits are shown
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.00068 $0.03940
Opus 5.5 $0.00027 $0.01576
Sonnet 5.5 $0.00014 $0.00788
Haiku 4.5 $0.00007 $0.00394

Measured 1mo ago against content hash 03dcf33a19b9, method: parsed. Prices are Anthropic first-party input rates as of 2026-10-07, from the pricing page.

Security

Grade A, and why

test-driven-development 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 1mo 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-driven-development/SKILL.md · 494 lines

How it starts

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

Test-Driven Development (TDD)

Overview

Write the test first. Watch it fail. Write minimal code to pass.

Core principle: If you didn't watch the test fail, you don't know if it tests the right thing.

Violating the letter of the rules is violating the spirit of the rules.

The Iron Law

NO PRODUCTION CODE WITHOUT A FAILING TEST FIRST

Write code before the test? Delete it. Start over.

No exceptions:

  • Don't keep it as "reference"
  • Don't "adapt" it while writing tests
  • Don't look at it
  • Delete means delete

Implement fresh from tests. Period.

Outside-In Development

Start every feature with a high-level test that describes behavior from the user's perspective. Run it, read the failure, and let that failure dictate your next move. As failures push you down the stack, write a new failing test at each layer you drop into — never write code for a layer without a failing test at that layer demanding it.

Read examples/outside-in-testing.md for a walkthrough of the philosophy and examples/testing-pyramid.md for how test types combine into an optimal suite.

One Change, One Run

After every change — writing a test, adding a route, creating a file, implementing a method — run the affected test immediately:

bundle exec rspec spec/features/guest_searches_for_items_spec.rb

The failure message is your instruction for what to do next. Don't batch changes and don't guess ahead: one change, one run, read the failure, decide. If you made two changes before running, you no longer know which one the test is reacting to.

Drop Down by Writing the Next Failing Test

A failure rarely means "write this exact line." It usually means "the layer below isn't there yet." When the active test's failure points to a layer that has behavior of its own — a controller action, an endpoint, a model method — drop down and write a failing test at that layer before building it.

Think of it as a stack of failing tests:

  • The active test is the one whose failure you're reading right now.
  • Its failure points to a missing lower layer → write a new failing test at that layer. It becomes the active test.
  • Drive that test with Red-Green-Refactor. If it forces you down another level, push another failing test.
  • When the active test goes green, pop it: rerun the test one layer up. Its next failure drives the next move.

Read the full file on GitHub · 494 lines

Files

What ships with it

3 files beside SKILL.md in the same directory: the scripts, references and assets a skill reads on demand. Not counted in the per-session cost; read them before you install if any of them is executable.

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. 1mo ago First seen · 494 lines · 68 tokens per session scan A 03dcf33a19b9

Subscribe to this mod's changes

test-driven-development is a skill published in the GitHub repository thoughtbot/rails-consultant (26 stars, last pushed 1mo ago), licensed MIT. It adds 68 tokens to every session and 3,940 once invoked, about $0.0003 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-30.

Related

Other skills, from other repositories

craft-pest

Testing Craft CMS 5 plugins and modules with Pest — test isolation, database safety, and the markhuot/craft-pest-core harness. ALWAYS load when writing, running, fixing, or reviewing tests for a Craft plugin or module, and whenever a suite touches a real Craft install. Covers why rollback is opt-in, tests/Pest.php +…

michtio/craftcms-claude-skills · 175 tokens

abd-test

ABD Testing agent: auto-detects the test framework, writes tests matching project style, runs the suite, and records a test artifact.

RealDougEubanks/ClaudeMarketplace · 31 tokens

phx-verify

Verify Elixir/Phoenix changes — compile, format, and test in one loop. Use after implementation, before PRs, or after fixing bugs.

oliver-kriska/claude-elixir-phoenix · 36 tokens

rails-8-upgrade

Upgrade a Rails 7 app to Rails 8 safely, and catch the subtle test-suite flake it introduces. Use when bumping Rails 7.x to 8.x (or auditing readiness), when planning a Ruby/Rails version bump, or when Rails 8 tests fail intermittently with "undefined method 'loginpath'/'rootpath'" / pass on serial but flake on…

davidteren/hotwire-codex-skills · 120 tokens

generate-tasks

Phase 3 of 5 — slices the ARCH doc into verification-ready task specs (tdd/test-after/ui/checklist), emitted as a separate TASKS- - .md file alongside ARCH for the implement skill. Use only when the user asks to run Phase 3 or generate tasks from an ARCH doc — never trigger automatically.

foyzulkarim/skills · 74 tokens

unity-testing

Unity 6 testing guide. Use when writing unit tests, integration tests, or doing TDD with Unity Test Framework. Covers Edit Mode and Play Mode tests, NUnit attributes ([Test], [UnityTest], [SetUp], [TearDown]), testing MonoBehaviours and coroutines, and CI/CD integration. Based on Unity 6.3 LTS documentation.

IdoCohen560/claude-unity-game-studio · 78 tokens