TDD Skill
Enforces vertical slice test driven development with tracer bullets.
by AgentVoltv1.0.0Published 1y ago2 installs
Free to sign up · every skill included with AgentVolt Pro
Before & after
Same prompt, same agent — the only difference is the skill.
Prompt“Write a new authentication feature using test-driven development with vertical slices”
Beforegeneric AI agent
For TDD, you'd normally write tests first before implementing the code. You could start with a failing test and then write code to make it pass. Vertical slices mean building small, complete features rather than layers. That's generally a good approach. You might need to decide what framework to use for testing. Would it be better to start with unit tests, integration tests, or end-to-end tests? And should I write all the tests first or add them as I go?
Afterwith TDD Skill
TDD VERTICAL SLICE: OAuth2 Token Refresh
TRACER BULLET 1: END-TO-END TEST (Red)
Write test first, no implementation:
test('POST /auth/refresh returns new access token with valid refresh token', async () => {
const refreshToken = 'old_refresh_token_expires_2026_08_31';
const response = await client.post('/auth/refresh', { refreshToken });
expect(response.status).toBe(200);
expect(response.body.accessToken).toBeDefined();
expect(response.body.expiresIn).toBe(3600);
});
Run test: FAILS (no POST /auth/refresh endpoint)
TRACER BULLET 2: MINIMAL IMPLEMENTATION (Green)
Write only enough code to pass test:
app.post('/auth/refresh', (req, res) => {
res.json({ accessToken: 'dummy_token', expiresIn: 3600 });
});
Run test: PASSES (test is now green)
TRACER BULLET 3: ITERATE (Refactor)
Add next test for edge case:
test('POST /auth/refresh returns 401 with expired refresh token', async () => {
const expiredToken = 'old_refresh_token_expires_2026_07_30';
const response = await client.post('/auth/refresh', { refreshToken: expiredToken });
expect(response.status).toBe(401);
expect(response.body.error).toBe('Refresh token expired');
});
Run test: FAILS (token validation not implemented)
Add validation logic:
app.post('/auth/refresh', (req, res) => {
const { refreshToken } = req.body;
const decoded = jwt.verify(refreshToken, SECRET); // Throws if expired
if (decoded.exp < Date.now() / 1000) {
return res.status(401).json({ error: 'Refresh token expired' });
}
const newToken = jwt.sign({ userId: decoded.userId }, SECRET, { expiresIn: '1h' });
res.json({ accessToken: newToken, expiresIn: 3600 });
});
Run test: PASSES
TRACER BULLET 4: NEXT VERTICAL SLICE
Don't build adjacent features yet (persistence layer, UI, etc.)
Instead, write next end-to-end test for next slice:
test('POST /auth/refresh increments token version (prevent replay attacks)', ...);
test('POST /auth/refresh logs revocation event to audit table', ...);
Each test spawns its own implementation. Build width (features) incrementally, not depth (layers).
WHY THIS WORKS
• Tests remain always-passing (no broken tests accruing)
• Each feature complete and tested before next starts
• No large refactors at the end (refactoring happens per-slice)
• Easy to show progress ("3 features passing" vs "infrastructure 80% done")
WHEN TO STOP SLICING
Stop when:
✓ All user-facing flows have passing tests
✓ Happy path + 2-3 error cases per feature
✓ No more than 20 lines per test function (if test >20 lines, feature too big)
About this skill
name: tdd-skill-matt-pocock description: Use when Enforces vertical slice test driven development with tracer bullets.
TDD Skill
Guides Claude through a test driven development workflow using vertical slices and tracer bullets rather than large speculative builds.
What you get
- SKILL.md within the the original author public skills repo.
Customize your output
- Adaptable to any testing framework or language.
Example output
Test-first, incrementally verified code changes.
Best for
Developers wanting disciplined TDD workflows in Claude Code.
SKILL.md preview
SKILL.md
---
name: tdd-skill-matt-pocock
description: Use this skill to enforce a test-driven development workflow built around vertical slices and tracer bullets rather than large speculative builds.
version: 1.0.0
category: Security & QA / Testing and QA
author: AgentVolt
license: proprietary
tags:
- security-qa
- testing-and-qa
- standard
---
# TDD Skill
Guides development through test-driven development using thin vertical slices and tracer bullets, proving the full path works end-to-end before building it out.
## When to use
… (sign up to view the full skill)Sign up to view, copy, and install the full skill
More development skills
View all Development skills →Pre-mortem Skill
Analyzes your codebase and predicts bugs that have not happened yet but will in production.
Development
Dogfood Skill
Uses an agent browser CLI to walk through your app page by page and capture bugs.
Development
Diagnose Skill
Builds a feedback loop to diagnose bugs systematically instead of guessing.
Development
Business Automation Stack
A connected set of agents that handle the repetitive ops work — follow-ups, summaries, and handoffs.
Development