com um clique
test-driven-development
Use when implementing any feature, bugfix, refactor, or behavior change before writing implementation code. Enforces test-first RED-GREEN-REFACTOR discipline.
Menu
Use when implementing any feature, bugfix, refactor, or behavior change before writing implementation code. Enforces test-first RED-GREEN-REFACTOR discipline.
Use when the user wants to be taught and quizzed on a topic, theme, or concept they name (not the current session), to verify they deeply understand it. For example "teach me about Kafka consumer groups and test me" or "quiz me on this repo's auth flow".
Use when the user wants to be taught and quizzed on the work from the current session, what was just built, decided, debugged, or changed, to verify they deeply understand it. Not for updating agent instruction files; that is capturing-session-learnings.
This skill encodes Emil Kowalski's philosophy on UI polish, component design, animation decisions, and the invisible details that make software feel great.
Use when the user wants to build a multi-slide HTML presentation with slide-type templates, a deck-stage engine, and an optional two-window presenter view for live sharing in Teams, Zoom, or Meet. For one-off single-file slide artifacts, see workbench:crafting-html. For brand theming, see workbench:crafting-design-systems.
Use when the user wants to design the content of a slide presentation, from audience brief through critiqued storyboard. Produces a markdown deck.md with structured per-slide front-matter. For a written prose talk instead of a deck, use writing:writing with format talk. For rendering a deck.md to HTML, use workbench:crafting-presentations.
Draft, review, and finish long form prose, essays, talks, newsletters, memos, and briefings.
| name | test-driven-development |
| description | Use when implementing any feature, bugfix, refactor, or behavior change before writing implementation code. Enforces test-first RED-GREEN-REFACTOR discipline. |
Use this skill before implementation work. It governs each small implementation chunk until the change is complete.
Write the test first. Watch it fail for the expected reason. Write the smallest code that makes it pass. Refactor only after green.
NO PRODUCTION CODE WITHOUT A FAILING TEST FIRST
If implementation code was written before the test, delete that implementation and restart from the test. Do not keep it as reference material.
Use for:
Exceptions require an explicit user decision:
TDD runs as two nested feedback loops, not one.
The outer loop is acceptance-test driven. For each slice of behavior, write a failing acceptance test that exercises the feature from outside the unit boundary. Watch it fail for the right reason. Then drive inner cycles until that acceptance test goes green.
The inner loop is red-green-refactor as described in the next section. It runs many times inside one outer-loop iteration: one inner cycle per unit-level behavior needed to satisfy the acceptance test.
When the acceptance test passes, refactor at the slice boundary if useful, then start the outer loop again with the next slice.
"Acceptance test" here means any test that exercises the slice from outside the unit boundary; an integration test or end-to-end test fits the same role when the project uses that language.
Source: Freeman and Pryce, Growing Object-Oriented Software Guided by Tests, Figure 1.2.
Write the smallest test that expresses one expected behavior.
Requirements:
Run the narrowest useful test command.
Confirm:
If the test passes immediately, it does not prove the new behavior. Fix the test before writing implementation code.
Write only the implementation needed for the failing test.
Do not add:
Run the narrow test again and confirm it passes. Then run the relevant broader test command for the touched area.
If the test fails, fix implementation code first. Only change the test if the expected behavior is wrong.
The third step of the cycle, not an optional polish pass. GREEN intentionally produced the smallest code that worked; REFACTOR is where that intentional sloppiness is paid back on the same cycle, before the next test compounds it.
Refactor passes (each one followed by Verify GREEN):
Rules:
Why this step is mandatory: Kent Beck states the two rules of TDD as "write new code only if you first have a failing test" and "eliminate duplication." The second rule is the REFACTOR step. Skipping it leaves duplication and unclear names in the codebase that the next chunk inherits, and the test safety net that makes refactoring cheap is most valuable in the same cycle that produced the code. Sources: Kent Beck, Test-Driven Development by Example, Section I (the two rules); Freeman and Pryce, Growing Object-Oriented Software Guided by Tests, Section 1.5 (refactoring after green to preserve internal quality).
| Quality | Good | Bad |
|---|---|---|
| Minimal | One behavior. | A test name with "and" covering multiple behaviors. |
| Clear | Name states the expected behavior. | test1 or works. |
| Behavior-focused | Exercises public behavior. | Checks private implementation details. |
| Repeatable | Runs without manual state. | Depends on local setup not created by the test. |
| Excuse | Response |
|---|---|
| "Too simple to test." | Simple code still breaks. Write the small test. |
| "I'll test after." | Tests written after implementation can pass without proving they catch the missing behavior. |
| "I already manually tested it." | Manual checks are not repeatable regression coverage. |
| "The existing code has no tests." | Add the narrowest test around the behavior you are changing. |
| "Keeping the code as reference is harmless." | Reference code biases the test. Delete it and restart test-first. |
| "TDD is slowing me down." | Debugging untested behavior is usually slower than proving it incrementally. |
| "Refactor later." | GREEN intentionally produced code below your bar; REFACTOR pays back the gap on the same cycle. Deferring it accumulates duplication and unclear names that the next chunk inherits, and the test safety net is cheapest to use now. |
Stop and restart the chunk if any of these happen:
When executing a Workbench implementation plan, this skill is invoked as workbench:test-driven-development:
If a chunk is too large to test first, split the chunk. Hard-to-test behavior is usually underspecified or poorly isolated.
Use the test runner documented by the project. In this repository, prefer deterministic filesystem checks for skill structure and run the frontmatter lint after changing any SKILL.md.