test-driven-development
How to change code test first, red then green, and show the proof in the pull request. Use before writing or changing any code, for a feature, a bug fix or a…
от openfabriq★ 40 звёзд на GitHub
Установить test-driven-development в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Об этом скилле
Test-driven development
No code without a test that failed first. A test you never saw fail proves nothing: it may test the wrong thing, or pass whatever the code does.
The cycle, for each acceptance criterion
- Red. Write one small test for one behavior, named after what should happen ("rejects an empty title"). Test through the public functions or what a person sees, with real code; mock only what leaves the machine.
- Watch it fail. Run it with the project's test command. It must fail, not crash, and for the expected reason: the behavior is missing. It passes already? It tests behavior that exists: change the test. It crashes on a typo or an import? Fix that and run it again. Keep the end of the output.
- Green. Write the smallest change that makes it pass. Nothing the test does not ask for: no option, no cleanup of other code.
- Watch it pass, then the whole suite, not only your file: every test green, no new warning. A test of the suite that fails, even one you did not break, is named in the pull request.
- Clean up, tests still green. Then the next criterion.
Code written before its test is not kept "as a reference": delete it and start from the test.
A bug, or a production error
The first test reproduces the bug: the input of the issue, or the one in the stack trace. It fails the way the bug does, then passes with the fix, and stays as the regression test.
Proof in the pull request
For each acceptance criterion: the test, the end of its failing run before the change, and its passing run after. Then the command of the whole suite and its result.
When there is no test to write
Documentation, configuration, generated files, a change nothing can observe: say so in the pull request, criterion by criterion, instead of writing a test that checks nothing.
Excuses that do not hold
| Excuse | Why not |
|---|---|
| "Too simple to test" | Simple code breaks too, and the test takes a minute. |
| "I will add the tests after" | A test written after the code passes at once: it describes the code, not what it should do. |
| "I already tried it by hand" | Nobody can run what you tried again, and the next change breaks it silently. |
| "The test is hard to write" | Then the code is hard to use: simplify its interface. |
| "This code has no tests" | Then your first test is for the behavior you change. |
Adapted from the test-driven-development skill of obra/superpowers (MIT).
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
Без ограничений — скилл может использовать любой инструмент.
FAQ
Что делает скилл test-driven-development?
How to change code test first, red then green, and show the proof in the pull request. Use before writing or changing any code, for a feature, a bug fix or a change a review requested.
Как установить скилл test-driven-development?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл test-driven-development запускает скрипты?
Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.
Похожие скиллы
doc-coauthoring
AnthropicGuide users through a structured workflow for co-authoring documentation. Use when user wants to write documentation, proposals, technical specs, decision…
academy-guide
AnthropicStop and check this skill before finishing any reply to a question about how to use Claude or a Claude product — it recommends matching courses, tutorials…
internal-comms
AnthropicA set of resources to help me write all kinds of internal communications, using the formats that my company likes to use. Claude should use this skill…
skill-development
AnthropicThis skill should be used when the user wants to "create a skill", "add a skill to plugin", "write a new skill", "improve skill description", "organize skill…