tdd
Use when building any T3 feature or bugfix, recommended for T2 on the affected path — write the failing test before the implementation, one behavior at a…
Skill by AbdurRafay2004
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/abdurrafay2004-tdd
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, writing
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/tdd
What's inside
- Skill name
tdd- Description
- Use when building any T3 feature or bugfix, recommended for T2 on the affected path — write the failing test before the implementation, one behavior at a time, through public interfaces.
- License
- MIT
- Instructions
- 150 lines in SKILL.md · view on GitHub
Files (2)
- SKILL.md
- mocking.md · references/
SKILL.md (first lines)
# TDD
Part of the **Build** phase — see the `workflow` skill for tiers and sequencing.
**Tier rule:** mandatory for T3 (money, auth, user data, migrations);
recommended for T2 on the affected path; skipped for T1 (copy/styling). Within
its tier, the discipline is absolute: **no production code without a failing
test first.** Bug fixes always get a failing test reproducing the bug, at any
tier — a fix without a test doesn't stick.
## Philosophy
Tests verify **behavior through public interfaces**, not implementation
details. Code can change entirely; tests shouldn't.
**Good tests** are integration-style: they exercise real code paths through
public APIs and read like a specification — "user can checkout with valid
cart" tells you exactly what capability exists. They survive refactors because
they don't care about internal structure.
**Bad tests** are coupled to implementation: they mock internal collaborators,
test private methods, or verify through side channels (querying the database
directly instead of using the interface). The warning sign: the test breaks
when you refactor but behavior hasn't changed.
**Core proof:** if you didn't watch the test fail, you don't know it tests the
right thing. A test written after the code passes immediately — and passing
immediately proves nothing.
## Anti-pattern: horizontal slices
**Do not write all tests first, then all implementation.** Bulk-written tests
test *imagined* behavior — the shape of data structures rather than
user-facing behavior — and become insensitive to real changes.
```
WRONG (horizontal): RED: test1..test5 → GREEN: impl1..impl5
RIGHT (vertical): test1→impl1, test2→impl2, test3→impl3 ...
```
Vertical slices via **tracer bullets**: one test → one implementation →
repeat. Each test responds to what the previous cycle taught you.
## Workflow
### 1. Plan the behaviors
Read the nearest `CONTEXT.md` / `.handoff/context/` so test names match the
project's domain language. Then, before any code:
- Confirm with the user what interface changes are needed.
- Confirm which behaviors to test — **you can't test everything**; focus on
critical paths and complex logic, not every edge case. (This is the PM
decision: which failures are expensive?)
- Look for deep-module opportunities — small interface, deep implementation
(see `design`).
- List behaviors, not implementation steps.
### 2. Tracer bullet
Write ONE test confirming ONE thing about the system. Watch it fail. Write
minimal code to pass. This proves the path works end-to-end.
### 3. Incremental loop
For each remaining behavior: RED → verify it fails for the right reason →
GREEN → verify it passes → next.
- One test at a time; only enough code to pass the current test.
- Don't anticipate future tests; no speculative features.
- **Verify RED is mandatory.** If the new test passes immediately, it's
testing existing behavior — fix the test. If it errors (rather than fails),
fix the error until it fails correctly.
- **Verify GREEN completely:** the new test passes, all other tests still
pass, output pristine. Test fails → fix the code, not the test.
### 4. Refactor (only on green)
Extract duplication, improve names, deepen modules (move complexity behind
simple interfaces). Run tests after each refactor step. **Never refactor while
RED.** Don't add behavior.
## Good vs bad tests
```typescript
// ✅ Clear name, real behavior, one thing
test('retries failed operations 3 times', async () => {
let attempts = 0;
const operation = () => {
attempts++;
if (attempts < 3) throw new Error('fail');
return 'success';
};
const result = await retryOperation(operation);
expect(result).toBe('success');
expect(attempts).toBe(3);
});
// ❌ Vague name, tests the mock, not the code
test('retry works', async () => {
const mock = jest.fn()
.mockRejectedValueOnce(new Error())
.mockResolvedValueOnce('success');
await retryOperation(mock);
expect(mock).toHaveBeenCalledTimes(2);
});
```
- One behavior per test; "and" in the name means split it.
- Real code over mocks — mock only what's unavoidable (network, clock, true
externals). If you must mock everything, the code is too coupled: inject
dependencies instead. Boundary rules and mock-friendly interface design:
`references/mocking.md`.
- Testing mock behavior instead of real behavior is the classic false
positive: the suite goes green while the product is broken.
## Per-cycle checklist
```From AbdurRafay2004/handoff, MIT.
More from AbdurRafay2004/handoff
- 0.614score
security
AbdurRafay2004
Use for a full security audit — T3 verify gate (money, auth, user data, migrations), pre-launch check, or when the user asks to audit the codebase for…
SkillAFreshness: A★ 4Claude Code +9 - 0.614score
ship
AbdurRafay2004
Use when work is verified and ready to leave the machine — branch/PR/merge/deploy/smoke-check.
SkillAFreshness: A★ 4Claude Code +9 - 0.614score
verify-done
AbdurRafay2004
Use when about to claim work is complete, fixed, or passing — before committing, opening a PR, or telling the user it works.
SkillAFreshness: A★ 4Claude Code +9 - 0.609score
brief
AbdurRafay2004
Use when starting a new feature or product request — clarifies scope and decisions before implementation.
SkillAFreshness: A★ 4Claude Code +9 - 0.609score
browser-qa
AbdurRafay2004
Use to exercise the running app in a real browser — after UI changes, before ship, or when the user asks to QA the site, smoke-test a branch, or check "does…
SkillAFreshness: A★ 4Claude Code +9 - 0.609score
delegate
AbdurRafay2004
Use when a task would flood the main context window — broad searches, verbose test/build output, 2+ independent parallel tasks, or an isolated large workstream.
SkillAFreshness: A★ 4Claude Code +9 - 0.609score
setup
AbdurRafay2004
Scaffold the handoff project-memory system into THIS repository (new or existing) — copies the template tree into .handoff/, then runs a guided discovery pass…
SkillAFreshness: A★ 4Claude Code +9 - 0.609score
plan
AbdurRafay2004
Use when a task is T2/T3 — before building a feature that spans multiple files or carries risk.
SkillAFreshness: A★ 4Claude Code +9 - 0.609score
workflow
AbdurRafay2004
The operating pipeline for all development work — 6 phases (Brief, Plan, Build, Verify, Ship, Learn) with risk tiers that decide how much process a task gets.
SkillAFreshness: A★ 4Claude Code +9 - 0.524score
design
AbdurRafay2004
Use when designing or improving a module's interface, deciding where a seam goes, making code more testable or navigable, or pinning down domain terminology.
SkillCFreshness: C★ 4Claude Code +9 - 0.519score
learn
AbdurRafay2004
Use at the end of T3 work, after an incident/rollback, or when the user asks for a retro — turns what happened into recorded learnings that live in the repo…
SkillCFreshness: C★ 4Claude Code +9 - 0.519score
architecture
AbdurRafay2004
Scan the codebase for architectural friction and propose deepening opportunities as candidate cards, then interrogate the chosen one into a decision.
SkillCFreshness: C★ 4Claude Code +9
Signals
- Stars
- 4
- Forks
- 0
- Open issues
- 0
- Last commit (this folder)
- Jul 11, 2026 (3 months ago)
From GitHub (fetched Oct 24, 2026).
Details
- License
- MIT
- Repository
- github.com/AbdurRafay2004/handoff
- First seen
- Oct 24, 2026
- Last checked
- Oct 24, 2026
- Source
- GitHubgithub-graphql
More from AbdurRafay2004
- 0.614score
verify-done
AbdurRafay2004
Use when about to claim work is complete, fixed, or passing — before committing, opening a PR, or telling the user it works.
SkillAFreshness: A★ 4Claude Code +9 - 0.614score
ship
AbdurRafay2004
Use when work is verified and ready to leave the machine — branch/PR/merge/deploy/smoke-check.
SkillAFreshness: A★ 4Claude Code +9 - 0.614score
security
AbdurRafay2004
Use for a full security audit — T3 verify gate (money, auth, user data, migrations), pre-launch check, or when the user asks to audit the codebase for…
SkillAFreshness: A★ 4Claude Code +9 - 0.609score
brief
AbdurRafay2004
Use when starting a new feature or product request — clarifies scope and decisions before implementation.
SkillAFreshness: A★ 4Claude Code +9 - 0.609score
workflow
AbdurRafay2004
The operating pipeline for all development work — 6 phases (Brief, Plan, Build, Verify, Ship, Learn) with risk tiers that decide how much process a task gets.
SkillAFreshness: A★ 4Claude Code +9 - 0.609score
browser-qa
AbdurRafay2004
Use to exercise the running app in a real browser — after UI changes, before ship, or when the user asks to QA the site, smoke-test a branch, or check "does…
SkillAFreshness: A★ 4Claude Code +9
Cite this page
tdd skill. Agent Mart. https://agentmart.dev/skills/abdurrafay2004-tdd (last updated 2026-10-24)