tdd-workflow — Claude Code skill: what it does, how to install
A skill that walks the agent through London School TDD: a failing test against mocks, the smallest passing implementation, then refactor. Steps are logged through MCP hooks.
npx skills add ruvnet/ruflo --skill tdd-workflow -a claude-codeWhat tdd-workflow does
The skill runs the agent through London School TDD. First a failing test for the expected behaviour with dependencies mocked, then a run to check it fails for the right reason. After that the smallest implementation that passes, a refactor while tests stay green, then the next behaviour. Mocks sit at module boundaries, tests look at behaviour from outside, names follow should [behavior] when [condition].
It takes one argument, <module-path>. Tool access is narrow: Bash(npx * npm *), Read, Write, Edit, plus two MCP calls. Enough for a test-code-refactor loop, and tight enough that the agent stays in it.
Before the first test it calls mcp__plugin_ruflo-core_ruflo__hooks_pre-task, before reporting mcp__plugin_ruflo-core_ruflo__hooks_post-task. Both hooks come from the ruflo-core plugin's MCP server, so without that server connected those steps do not happen. The skill also insists on observed results: run the target tests and the regression suite after the last edit, record commands, exit codes, whether tests actually ran, and the names of failing tests. Skipped validation counts as failure.
What it helps with
- write the first failing test for a new module
- confirm a red test fails for the right reason
- mock external dependencies at the module boundary
- grow the implementation with the smallest passing change
- record test commands, exit codes and failing test names in the report
Example prompts for the agent
- Run the tdd-workflow loop on
<module-path>, starting from a failing test for the expected behaviour - Use the tdd-workflow skill on
<module-path>and mock dependencies at the module boundary - Take
<module-path>through tdd-workflow until the regression suite is green, then report throughhooks_post-task
How to install tdd-workflow
1Skills CLI (Vercel)
npx skills add ruvnet/ruflo --skill tdd-workflow -a claude-code2Manually: put the files in place
~/.claude/skills/tdd-workflow/SKILL.mdCopy the whole skill folder; for one project use .claude/skills/tdd-workflow/
1Skills CLI (Vercel)
npx skills add ruvnet/ruflo --skill tdd-workflow -a codex2Manually: put the files in place
.agents/skills/tdd-workflow/SKILL.mdFor all projects use ~/.agents/skills/
1Skills CLI (Vercel)
npx skills add ruvnet/ruflo --skill tdd-workflow -a cursor2Manually: put the files in place
.cursor/skills/tdd-workflow/SKILL.mdCursor also reads .agents/skills/ and .claude/skills/
1GitHub CLI
gh skill install ruvnet/ruflo tdd-workflow2Manually: put the files in place
.github/skills/tdd-workflow/SKILL.md1Skills CLI (Vercel)
npx skills add ruvnet/ruflo --skill tdd-workflow -a gemini-cli2Platform CLI
gemini skills install https://github.com/ruvnet/ruflo --path plugins/ruflo-testgen/skills/tdd-workflowManually: put the files in place
.devin/skills/tdd-workflow/SKILL.mdThe legacy .windsurf/skills/ path still works
Skills CLI (Vercel)
npx skills add ruvnet/ruflo --skill tdd-workflow -a opencodeClaude.ai
Zip the folder and upload it in Settings → Capabilities → Skills
Step by step, with commands for each platform: How to install skills in Claude Code: five ways
Questions about tdd-workflow
How do I install tdd-workflow in Claude Code?
Run npx skills add ruvnet/ruflo --skill tdd-workflow -a claude-code. The skill lands at ~/.claude/skills/tdd-workflow/SKILL.md.
What does tdd-workflow do?
It drives a London School loop: failing test with mocks, minimal implementation, refactor, next test. Tests describe behaviour rather than implementation.
Does tdd-workflow need the ruflo-core MCP server?
Yes. It calls mcp__plugin_ruflo-core_ruflo__hooks_pre-task before work starts and mcp__plugin_ruflo-core_ruflo__hooks_post-task before reporting, and both hooks come from that plugin.
Source text
SKILL.md · MIT
---
name: tdd-workflow
description: TDD London School workflow -- mock-first, outside-in test development
argument-hint: "<module-path>"
allowed-tools: Bash(npx * npm *) mcp__plugin_ruflo-core_ruflo__hooks_pre-task mcp__plugin_ruflo-core_ruflo__hooks_post-task Read Write Edit
---
Follow the TDD London School (mock-first) approach:
1. **Write the failing test first** -- define expected behavior with mocked dependencies
2. **Run the test** -- confirm it fails for the right reason
3. **Implement minimal code** -- make the test pass with the simplest solution
4. **Refactor** -- clean up while keeping tests green
5. **Repeat** -- add the next behavior
Before starting: `mcp__plugin_ruflo-core_ruflo__hooks_pre-task({ description: "TDD: FEATURE_NAME" })`
Before reporting the outcome, run the final target tests and the regression suite after the last edit. Record the actual commands, exit codes, whether tests ran, and failing test names. The initial red test is expected during TDD; only the final validation determines success.
Call `mcp__plugin_ruflo-core_ruflo__hooks_post-task` with the observed result, including when the task is abandoned or validation is interrupted. Set `completed`, `targetTestsRan`, and `regressionTestsRan` to true only when observed; use null for missing exit codes. Skipped or unrun validation is not success. Never substitute an expected result for an observed one.
The following example maps those observations to the hook input (tool-call notation):
```javascript
const success = completed && targetTestsRan && regressionTestsRan
&& targetExitCode === 0 && regressionExitCode === 0;
mcp__plugin_ruflo-core_ruflo__hooks_post-task({
taskId: "tdd-FEATURE",
success,
storeResults: true,
task: JSON.stringify({
feature: "FEATURE",
targetCommand, targetExitCode, targetTestsRan,
regressionCommand, regressionExitCode, regressionTestsRan,
failingTestNames,
failureReason: success ? null : failureReason
})
});
```
On failure, report `success: false` and the failing test names in `task`. If the runner failed before identifying tests, or the task was abandoned, state that reason instead of inventing test names.
Principles:
- Mock external dependencies at boundaries
- Test behavior, not implementation
- One assertion per test when possible
- Descriptive names: `should [behavior] when [condition]`
© ruvnet · MIT · ruvnet/ruflo