tdd-workflow — скилл для Claude Code: что делает и как установить
Скилл ведёт агента по циклу London School: падающий тест с замоканными зависимостями, минимальная реализация, рефакторинг. Шаги фиксируются в MCP-хуках.
npx skills add ruvnet/ruflo --skill tdd-workflow -a claude-codeЧто делает tdd-workflow
Скилл ведёт агента по циклу London School. Сначала тест на ожидаемое поведение с замоканными зависимостями, потом запуск: важно убедиться, что он падает по нужной причине. Дальше минимальная реализация, рефакторинг на зелёных тестах, следующий тест. Моки ставятся на границах модуля, тесты смотрят на поведение снаружи, имена по шаблону should [behavior] when [condition].
На вход скилл берёт один аргумент <module-path>. Доступ к инструментам узкий: Bash(npx * npm *), Read, Write, Edit и два вызова MCP. Для цикла тест-код-рефакторинг этого хватает.
Перед первым тестом агент вызывает mcp__plugin_ruflo-core_ruflo__hooks_pre-task, перед отчётом — mcp__plugin_ruflo-core_ruflo__hooks_post-task. Оба хука приходят с MCP-сервером плагина ruflo-core: если он не подключён, эти шаги не выполнятся. Перед отчётом скилл требует прогнать целевые тесты и регрессию после последней правки и записать команды, коды выхода, факт запуска и имена упавших тестов. Пропущенная проверка считается провалом.
Какие задачи решает
- написать первый падающий тест на новый модуль
- убедиться, что красный тест падает именно из-за отсутствующего поведения
- замокать внешние зависимости на границах модуля
- довести модуль до зелёных тестов минимальными правками
- записать команды, коды выхода и имена упавших тестов в отчёт
Примеры запросов агенту
- Пройди по циклу tdd-workflow для
<module-path>, начни с падающего теста на ожидаемое поведение - Используй скилл tdd-workflow на
<module-path>: зависимости замокай на границах модуля - Доведи
<module-path>по tdd-workflow до зелёной регрессии и отметь результат вhooks_post-task
Как установить tdd-workflow
1Через Skills CLI (Vercel)
npx skills add ruvnet/ruflo --skill tdd-workflow -a claude-code2Вручную: положить файлы
~/.claude/skills/tdd-workflow/SKILL.mdПапка скилла целиком; для одного проекта — .claude/skills/tdd-workflow/
1Через Skills CLI (Vercel)
npx skills add ruvnet/ruflo --skill tdd-workflow -a codex2Вручную: положить файлы
.agents/skills/tdd-workflow/SKILL.mdДля всех проектов — ~/.agents/skills/
1Через Skills CLI (Vercel)
npx skills add ruvnet/ruflo --skill tdd-workflow -a cursor2Вручную: положить файлы
.cursor/skills/tdd-workflow/SKILL.mdCursor читает и .agents/skills/, и .claude/skills/
1GitHub CLI
gh skill install ruvnet/ruflo tdd-workflow2Вручную: положить файлы
.github/skills/tdd-workflow/SKILL.md1Через Skills CLI (Vercel)
npx skills add ruvnet/ruflo --skill tdd-workflow -a gemini-cli2Командой платформы
gemini skills install https://github.com/ruvnet/ruflo --path plugins/ruflo-testgen/skills/tdd-workflowВручную: положить файлы
.devin/skills/tdd-workflow/SKILL.mdСтарый путь .windsurf/skills/ тоже читается
Через Skills CLI (Vercel)
npx skills add ruvnet/ruflo --skill tdd-workflow -a opencodeClaude.ai
Упакуйте папку в zip и загрузите в Settings → Capabilities → Skills
По шагам, с командами для каждой платформы: Как установить скилл в Claude Code: пять способов
Вопросы о tdd-workflow
Как установить tdd-workflow в Claude Code?
Выполните npx skills add ruvnet/ruflo --skill tdd-workflow -a claude-code. Скилл появится в ~/.claude/skills/tdd-workflow/SKILL.md.
Что делает tdd-workflow?
Проводит агента по циклу London School: падающий тест с моками, минимальная реализация, рефакторинг, следующий тест. Тесты описывают поведение, а не устройство кода.
Почему без ruflo-core скилл работает не полностью?
Он вызывает mcp__plugin_ruflo-core_ruflo__hooks_pre-task до начала работы и mcp__plugin_ruflo-core_ruflo__hooks_post-task перед отчётом. Эти хуки даёт MCP-сервер плагина ruflo-core.
Исходный текст
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