test-driven-development-quick
БесплатноБез исполняемых скриптовНе проверенRuns the red-green-refactor loop with a compact set of rules: one failing test, the minimal code to pass it, cleanup under green. Use for routine test-first…
от jaktestowac★ 124 звезды на GitHubОб этом скилле
Quick TDD
A compact standard for the red-green-refactor loop: enough to keep every change verified, short enough to read in one pass.
Framework-agnostic - match whatever runner and assertion style the project already uses. If none exists, ask which runner to target before the first test.
When to Use
- Build one new behavior test-first.
- Fix a bug by reproducing it with a failing test.
- Add a small branch or rule to code that already has tests.
Escalate to test-driven-development when the feature spans several units, needs an outside-in double loop, enters untested legacy code, or runs long enough to need a cycle log. Use writing-unit-tests when the code already exists and tests are being added after the fact.
Before the First Test
State three things:
- the behavior being built, in the user's vocabulary
- the seam - the public interface a real caller would use, which the tests observe through; name it and get it confirmed rather than assuming it
- the test list - the behaviors to build, smallest and most central first, worked one at a time
The list is a queue, not a batch. Writing all the tests up front verifies imagined behavior and locks in a shape nobody has validated.
Match the project's existing runner, test locations, and naming, and find the command that runs a single test file - the loop only works while observing red and green is cheap.
The Loop
Red
- Write one failing test for the next list entry.
- Run it and read the real output.
- Confirm it fails on the missing behavior - not a typo, missing import, or broken fixture. A mechanical failure is not red: fix it and run again.
- If it passes immediately, stop. Either the behavior exists already or the test asserts nothing.
- Check the expected value came from outside the implementation - the spec, a worked example, a known-good literal. A value recomputed the way the code computes it, or imported from the code's own constants, passes by construction.
Green
Write the simplest thing that passes. Pick by confidence:
- Obvious implementation - you know exactly how it works
- Fake it - return a constant, and let a queued test force the real logic
- Triangulation - add a second test with different data that the constant cannot satisfy
Then run the full suite, not just the new test. Do not clean up yet.
A fake is fine only while a listed test will remove it. A fake with nothing scheduled to kill it is a bug with a passing test.
Substitute only what you do not own - clock, randomness, network, storage. If getting to green needs a mock of your own module, the seam is wrong; say so instead of mocking your way through.
Refactor
Under green only, one change at a time, running the suite after each: remove duplication, fix names, split what grew too big - in the tests as well as the code. Structure only, never behavior. If a refactor goes red, revert it rather than debugging forward.
Commit at green, then take the next entry.
The Rules
- Red before green. No production code without a failing test demanding it.
- Evidence, not assertion. Actually run the tests and quote the real output. Never claim red or green unseen.
- Minimal implementation. Only the code the current test demands - no speculative branches.
- One slice at a time. One behavior, one test, one implementation.
- Refactor only under green, and never mix it with the green step.
- Drive the public seam, never private methods.
- Assert against an independent source of truth, never a value the implementation hands you.
- Never weaken a test to reach green. If an assertion has to change, the specification changed - say so and get it confirmed.
- Match step size to confidence. Repeated failure to reach green means the step was too big - revert to the last green and split the behavior.
Bugs: Reproduce First
- Write a test that fails because of the bug, at a seam that reaches the real failure path.
- Confirm the failure matches the reported symptom, not a different one nearby.
- Shrink it until every remaining element is load-bearing.
- Fix the code until it passes, then re-check the original scenario.
- Keep the test - it is the regression guard. If the bug was intermittent, make the repro deterministic first and say which signal the test locks down.
- Stage the failing test before the fix, so history reads red then green.
Never fix first and test after. A test written after the fix has never been seen catching the bug.
When to Step Out
Say so and stop looping when the behavior needs a real network, database, or browser to prove (integration work), when the change is a pure rename or mechanical migration, when there is no independent source of truth to assert against (config, wiring, straight delegation), or when the design is too open to express as an assertion yet - spike first, throw the spike away, then start cycling.
Do not drive the loop
Установить test-driven-development-quick в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
Без ограничений — скилл может использовать любой инструмент.
FAQ
Что делает скилл test-driven-development-quick?
Runs the red-green-refactor loop with a compact set of rules: one failing test, the minimal code to pass it, cleanup under green. Use for routine test-first work on a single behavior or a small bug fix, and when the request mentions TDD, test-first, red-green-refactor, or writing the test before the code. For multi-unit features, outside-in double loops, legacy code without tests, or a session that needs a written cycle log, use the test-driven-development skill instead.
Как установить скилл test-driven-development-quick?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл test-driven-development-quick запускает скрипты?
Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.
Похожие скиллы
doc-coauthoring
Guide users through a structured workflow for co-authoring documentation. Use when user wants to write documentation, proposals, technical specs, decision…
от Anthropicacademy-guide
Stop 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…
от Anthropicinternal-comms
A 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…
от Anthropicskill-development
This 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…
от Anthropic