test-driven-development
Use when implementing deterministic, reusable code where regressions would warrant a CI red light.
Skill by btseytlin
Install
Works with Claude Code, Claude apps, Codex, Cursor, Gemini CLI, GitHub Copilot, VS Code, OpenCode, Goose, Windsurf. Read the repository before you give any tool access to your data.
npx agentmarket install skill/btseytlin-test-driven-development
Asks which of your tools to add it to (Claude Code, Codex, Cursor, VS Code, Windsurf, Gemini CLI, Claude Desktop) and shows the change first. See https://agentmart.dev/cli.
Get the weekly diff
The weekly diff: one email a week with new agent tools, notable updates and grade changes, plus security alerts for tools you follow. Double opt-in, one-click unsubscribe.
About
Use cases: testing, devops
Reviews
Write a reviewNo reviews yet. Installed it? Reviews come from verified installers only. How reviews work
Permissions
What this skill can do and what it asks for, from its SKILL.md. Checked Oct 25, 2026.
- Tools
- No tools found
- Secrets
- None asked for
- Install scripts
- None found
Network hosts it talks to 1
codeload.github.com· found in install command
Files it touches
~/.claude/skills/test-driven-development
What's inside
- Skill name
test-driven-development- Description
- Use when implementing deterministic, reusable code where regressions would warrant a CI red light. Enforces RED-GREEN-REFACTOR. Applicability rule and skip conditions inside.
- License
- WTFPL
- Instructions
- 126 lines in SKILL.md · view on GitHub
Files (1)
- SKILL.md
SKILL.md (first lines)
# Test-Driven Development
Write the test first. Watch it fail. Write minimal code to pass. Refactor. Repeat.
**Core principle:** if you didn't watch the test fail, you don't know whether it tests the right thing.
## Applicability — invoke only when all three hold
<applies-when>
1. The code produces specific outputs for specific inputs (deterministic I/O contract)
2. It is called from more than one place (library code, API method, utility, validator)
3. A regression here would warrant a CI red light
</applies-when>
## Skip conditions — do not invoke when any holds
<skip-when>
- Training a model, hyperparameter tuning, anything stochastic with no "correct" output
- Exploratory data analysis (you're figuring out what's in the data)
- One-off scripts or throwaway prototypes
- Research / experiment code
- UI changes where the real test is "does it look right"
</skip-when>
The decision is recorded during `up:udesign` as `TDD: yes` or `TDD: no (reason)`.
## Iron law when applicable — no production code without a failing test first
Wrote code before the test? Delete it. Start over from the test. Don't "adapt" what you wrote — the test will be shaped by the code instead of shaping it.
## Phase 1 — RED: write a failing test
- One behavior per test
- Clear name describing the behavior
- Real code path where possible; mocks only when genuinely unavoidable
```python
def test_retry_succeeds_after_two_failures():
attempts = 0
def op():
nonlocal attempts
attempts += 1
if attempts < 3:
raise RuntimeError("fail")
return "success"
assert retry(op, max_attempts=3) == "success"
assert attempts == 3
```
## Phase 2 — Verify RED: run it, confirm it fails for the right reason
<required>
- It fails (not an import/syntax error)
- The failure reason is "feature missing", not a typo
- The error message matches what you expected
</required>
Test passed immediately? You're testing behavior that already exists. Fix the test.
## Phase 3 — GREEN: minimal code to pass
```python
def retry(op, max_attempts):
for i in range(max_attempts):
try:
return op()
except Exception:
if i == max_attempts - 1:
raise
raise RuntimeError("unreachable")
```
Don't add features, options, or "while I'm here" changes. Just pass the test.
## Phase 4 — Verify GREEN: run it, confirm it passes, nothing else broke
Run the new test and the existing suite. If either fails: back to GREEN (not RED — don't change the test).
## Phase 5 — REFACTOR: clean up with tests green
Names, duplication, helpers. Keep tests green. Don't add behavior in this step. Then loop back to RED for the next test.
## Good tests
<good-test>
- Minimal — one behavior per test. If "and" appears in the name, split.
- Clear — name describes what it checks.
- Real — exercises actual code, not mocks pretending to be code.
</good-test>
## Red flags — stop and start over
<red-flags>
- You wrote code before the test
- A test passes immediately on first run
- You can't explain why a test failed the way it did
- You're keeping old code "as reference" while writing tests — delete it
- You're "adapting" existing code while writing tests — that's tests-after, not TDD
</red-flags>
## Why order matters
Tests-after answer: *what does this do?*
Tests-first answer: *what should this do?*
Tests-after are biased by the implementation you already wrote. Tests-first force edge-case discovery before you commit to a design.
## When stuck
- Don't know how to test: write the wished-for API in the test first; let it drive the implementation shape
- Test is too complicated: the interface is too complicated; simplify it
- Must mock everything: the code is too coupled; use dependency injection
- Huge setup: extract helpers; if it stays huge, the design is wrong
## For bug fixes
Write a failing test that reproduces the bug. Then RED-GREEN-REFACTOR. The test proves the fix and prevents regression.
## Final ruleFrom btseytlin/ultrapack, WTFPL.
More from btseytlin/ultrapack
- 0.658score
expand
btseytlin
Turn one user criticism into a principle-level fix: find the violated principle, every similar occurrence, and fix the shared cause.
SkillAFreshness: A★ 46Claude Code +9 - 0.658score
uexecute
btseytlin
Use to implement an approved plan.
SkillAFreshness: A★ 46Claude Code +9 - 0.658score
uverify
btseytlin
Use after execute to attack the change and demonstrate how it's broken.
SkillAFreshness: A★ 46Claude Code +9 - 0.658score
make
btseytlin
Orchestrate the full Ultrapack workflow in Codex and Pi: create or resume a task file, design, plan, execute, verify, review, and validate the observable goal.
SkillAFreshness: A★ 46Claude Code +9 - 0.655score
udesign
btseytlin
Use before any creative work — features, components, behavior changes.
SkillAFreshness: A★ 46Claude Code +9 - 0.618score
attack-loop
btseytlin
Run a bounded implement-attack-repair loop for a user-specified task.
SkillBFreshness: B★ 46Claude Code +9 - 0.618score
handsoff
btseytlin
Contract for hands-off mode — the ultrapack workflow variant that minimizes user prompts after Design, takes the safest reversible path, and logs every…
SkillBFreshness: B★ 46Claude Code +9 - 0.618score
qplan
btseytlin
Quickly design and plan, wait for plan approval, then execute sequential phases with focused verification and a manual try.
SkillBFreshness: B★ 46Claude Code +9 - 0.618score
udocument
btseytlin
Use when writing or editing documentation — project docs, CLAUDE.md, READMEs, SKILL.md, docstrings, inline comments.
SkillBFreshness: B★ 46Claude Code +9 - 0.618score
ureview
btseytlin
Use after verify passes for the future maintainer's audit — sit in the chair of the person who'll touch this code in 3-6 months and ask "what will bite us…
SkillBFreshness: B★ 46Claude Code +9 - 0.618score
git-worktrees
btseytlin
Use when a task needs an isolated checkout.
SkillBFreshness: B★ 46Claude Code +9 - 0.615score
udebug
btseytlin
Use on any bug, test failure, or unexpected behavior before proposing a fix.
SkillBFreshness: B★ 46Claude Code +9
Signals
- Stars
- 46
- Forks
- 12
- Open issues
- 1
- Last commit (this folder)
- Aug 1, 2026 (2 months ago)
From GitHub (fetched Oct 24, 2026).
Details
- License
- WTFPL
- Repository
- github.com/btseytlin/ultrapack
- First seen
- Oct 24, 2026
- Last checked
- Oct 24, 2026
- Source
- GitHubgithub-graphql
More from btseytlin
- 0.658score
uverify
btseytlin
Use after execute to attack the change and demonstrate how it's broken.
SkillAFreshness: A★ 46Claude Code +9 - 0.658score
expand
btseytlin
Turn one user criticism into a principle-level fix: find the violated principle, every similar occurrence, and fix the shared cause.
SkillAFreshness: A★ 46Claude Code +9 - 0.658score
uexecute
btseytlin
Use to implement an approved plan.
SkillAFreshness: A★ 46Claude Code +9 - 0.658score
make
btseytlin
Orchestrate the full Ultrapack workflow in Codex and Pi: create or resume a task file, design, plan, execute, verify, review, and validate the observable goal.
SkillAFreshness: A★ 46Claude Code +9 - 0.655score
udesign
btseytlin
Use before any creative work — features, components, behavior changes.
SkillAFreshness: A★ 46Claude Code +9 - 0.618score
attack-loop
btseytlin
Run a bounded implement-attack-repair loop for a user-specified task.
SkillBFreshness: B★ 46Claude Code +9
Cite this page
test-driven-development skill. Agent Mart. https://agentmart.dev/skills/btseytlin-test-driven-development (last updated 2026-10-24)