/tslateman-skills:test-firstfrom tslateman-skills
Drive code from a failing test, applying Beck's Test-Driven Development by Example. Use when starting new behavior ("TDD this", "write it test-first", "red green refactor"), when fixing a bug (reproduce before repair), or to audit whether existing tests were ever red. Answers one question, forward or backward: did the test fail first, and for the right reason? Do NOT use to choose which properties a suite needs (that is testing), to audit a whole suite for tests that cannot fail (that is test-review), or to get untested legacy code under test (that is legacy).
Ships in tslateman-skills. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them.
Answers one question: did the test fail first, and for the right reason? A test written after the code it checks is shaped by that code — it encodes the implementation's behavior, bugs included, as the specification. Only a test that has been observed to fail has demonstrated it can fail.
Two modes. Drive: write the failing test, then the code. Audit: take a diff whose tests and implementation arrived together and ask whether any of those tests could ever have been red.
testing.test-review.legacy.refactor, or tidy for smaller moves.Red. Write one test for behavior that does not exist. Run it. Watch it fail.
Green. Write the least code that passes. Not the right code — the passing code. Beck's three routes, in order of increasing cost:
Refactor. Now make it right. This is the step that gets dropped, and dropping it is what turns TDD into a pile of green tests over bad structure. Hand off: tidy for a small cleanup, refactor for a named move.
Then the next test. One at a time.
A test that fails is not automatically red. Read the failure and confirm it is the failure you predicted:
State the expected failure before running. If the observed failure differs from the predicted one, something other than the missing behavior is broken.
Small steps when the ground is unfamiliar; larger steps when you are confident. Beck's rule is that step size is a dial, not a virtue — and the direction to turn it is set by feedback: after a surprise, make the steps smaller until the surprises stop.
Keep a test list. Before starting, write the cases you know you will need. Add to it whenever a new one occurs to you mid-loop, and never chase it immediately. Finish the current cycle, then pick the next item. The list is what keeps one-test-at-a-time from losing the thread.
A bug means a test was missing. The sequence does not change:
Never repair first and add the test afterward. A test written against a fixed implementation has never seen the bug.
Given a diff where tests and implementation landed together, the question is retroactive: could this test ever have been red? Check each test by construction, not by reading it:
assert result passes on any truthy value.test-review.Report per test: could-fail, cannot-fail, or unproven. A suite where nothing fails under mutation is decoration.
code-comments rule holds here as everywhere. A test name carries the intent; never add a comment explaining what a test covers. If the name cannot carry it, the test is doing too much.no-dead-defensiveness rule holds. Do not write a test for a state the contract rules out, and do not add a guard to make a test pass — redefine the contract so the state cannot occur.domain-model rather than mocking around it.The bulk-authoring gotcha is adapted from mattpocock/skills (MIT).
What SKILL.md sets; muted values are Claude Code's defaults
tslateman-skills@tslateman is listed by tslateman/claude-plugins — review the source before installing
npx claudepluginhub tslateman/claude-plugins --plugin tslateman-skills61 skills in this plugin
/adrGenerate Architecture Decision Records that capture the reasoning behind technical decisions. Use when the user asks to "create an ADR", "document a decision", "record why we chose X", or discusses architectural trade-offs worth preserving./arenaSpawn N parallel candidates at the same task, pick a base, graft the strongest parts of the losers into it. Use for /arena, 'arena this', 'throw it in the arena', or when one attempt at a non-trivial artifact would lock in the wrong shape./automagic-problem-discoveryAudit a workspace for recurring friction, pick the highest-leverage one, and build the automation that removes it. Use when the user asks "what should I automate", "what's wasting my time", "find the friction in my workflow", wants a self-improvement pass over their own tooling, or runs this on a recurring loop.