/tapas-engineering-toolkit:tdd-workflowfrom tapas-engineering-toolkit
Use this skill when writing new features, fixing bugs, or refactoring code. Triggers on TDD, test-driven development, writing tests, adding coverage, RED-GREEN-REFACTOR, tracer bullet, or when the user asks to implement a feature with tests. Always invoke before writing any production code — it enforces vertical-slice TDD (one test → one implementation), git checkpoints at each stage, and 80%+ behavior-driven coverage.
Ships in tapas-engineering-toolkit. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them.
Core principle: Tests should verify behavior through public interfaces, not implementation details. Code can change entirely; tests shouldn't.
Good tests exercise real code paths through public APIs. They describe what the system does, not how it does it. "User can checkout with valid cart" tells you exactly what capability exists. These tests survive refactors because they don't care about internal structure.
Bad tests are coupled to implementation — they mock internal collaborators, test private methods, or verify through back-channels (e.g., querying a database directly instead of using the service interface). The warning sign: your test breaks on a refactor but behavior hasn't changed.
See tests.md for examples and mocking.md for mocking guidelines.
Do not write all tests first, then all implementation. This is "horizontal slicing" — treating RED as "write all tests" and GREEN as "write all code."
This produces tests that verify imagined behavior, test the shape of data structures rather than outcomes, and break on refactors that don't change anything the user sees.
Correct approach: Vertical slices via tracer bullets. One test → one implementation → repeat. Because you just wrote the code, you know exactly what behavior matters and how to verify it.
WRONG (horizontal):
RED: test1, test2, test3, test4, test5
GREEN: impl1, impl2, impl3, impl4, impl5
RIGHT (vertical):
RED→GREEN: test1→impl1
RED→GREEN: test2→impl2
RED→GREEN: test3→impl3
Before writing any code:
Use the project's domain glossary so test names and interface vocabulary match the project's language. Respect ADRs in the area you're touching.
You can't test everything. Focus on critical paths and complex logic, not every edge case.
Write ONE test that confirms ONE thing about the system.
RED: Write the test → run it → confirm it fails for the right reason (missing behavior, not syntax error or broken test setup).
If under Git:
git commit -m "test: add reproducer for <feature or bug>"
GREEN: Write the minimal code to pass → run → confirm it passes.
If under Git:
git commit -m "fix: <feature or bug>"
This tracer bullet proves the end-to-end path works.
For each remaining behavior:
RED: Write next test → confirm it fails for the right reason
GREEN: Write minimal code to pass → confirm it passes
Rules:
Git commits follow the same pattern: one commit per confirmed RED, one per confirmed GREEN.
After all tests pass, look for refactor candidates:
Never refactor while RED. Get to GREEN first.
If under Git, commit after refactoring:
git commit -m "refactor: clean up after <feature or bug> implementation"
[ ] Test describes behavior, not implementation
[ ] Test uses public interface only
[ ] Test would survive internal refactor
[ ] Code is minimal for this test
[ ] No speculative features added
[ ] RED confirmed (compiled and executed) before writing implementation
[ ] GREEN confirmed before refactoring
A test that was only written but not compiled and executed does not count as RED.
Valid RED states:
Do not edit production code until RED is confirmed.
Aim for 80%+ coverage as a result of thorough behavior testing — not as a goal in itself. Cover happy paths, error and exception paths, and boundary conditions.
Verify:
npm run test:coverage
# or
go test ./... -cover
# or
uv run pytest --cov
| Type | What it covers | Speed |
|---|---|---|
| Unit | Individual functions, pure logic, no I/O | < 50ms each |
| Integration | API endpoints, DB operations, service wiring | seconds |
| E2E (Playwright) | Critical user flows, browser automation | minutes |
For concrete code patterns, see tests.md. For what and when to mock, see mocking.md.
src/
├── components/
│ └── Button/
│ ├── Button.tsx
│ └── Button.test.tsx # unit tests co-located
├── app/
│ └── api/
│ └── markets/
│ ├── route.ts
│ └── route.test.ts # integration tests
└── e2e/
└── markets.spec.ts # E2E tests
For Go/Python layouts, follow the conventions in architecture.rules or the project's existing structure.
# GitHub Actions
- name: Run Tests
run: npm test -- --coverage
- name: Upload Coverage
uses: codecov/codecov-action@v3
Watch mode during development:
npm test -- --watch
HEAD on the active branchWhat SKILL.md sets; muted values are Claude Code's defaults
npx claudepluginhub sharma-tapas/ai-skills --plugin tapas-engineering-toolkit11 skills in this plugin
/golang-patternsIdiomatic Go patterns, best practices, and conventions for building robust, efficient, and maintainable Go applications./golang-testingGo testing patterns including table-driven tests, subtests, benchmarks, fuzzing, and test coverage. Follows TDD methodology with idiomatic Go practices./grill-meRelentless design interviewer that walks a plan through a full decision tree,
resolving every architectural, data-model, deployment, and edge-case branch
before implementation begins. Context-aware: reads architecture.rules from the
project and any brainstorming output in the current session, then challenges
every decision against that context.
Invoke when the user says "grill me", "challenge my plan", "poke holes in this",
"interview me about my design", "let's harden the plan", "work through the
unknowns", "review my architecture", or "I need to make decisions before writing
the PRD". Also invoke proactively after a brainstorming session when a rough plan
exists but the decisions aren't locked down — this skill is the bridge between
rough idea and a PRD-ready spec.
Never skips branches, never assumes, never writes code. Output: a structured
shared understanding that can go straight into /to-prd.