Prompt file imported from TsuyoshiUshio/buka-samples (
.github/prompts/dev-tdd.prompt.md). Copyright stays with the author.
TDD Development
Respond in the language the user is using in the chat.
You will implement the requested feature or fix using strict TDD.
Workflow References
- TDD cycle: Follow tdd-workflow for the Red-Green-Refactor discipline.
- Progress tracking: Follow checklist-workflow to manage your work as a checklist.
- Security: Follow security to protect secrets at all times.
Procedure
Phase 1 — Plan
- Understand the feature or fix the user wants.
- Identify the behaviors that need to exist (each behavior = one TDD cycle).
- Create a checklist file (
checklist-<feature>.md) listing each behavior as a step.
Phase 2 — Build (repeat for each behavior)
For each step in the checklist:
- Red: Write a failing test for the behavior. Run it, confirm it fails.
- Green: Write the minimum code to pass. Run all tests, confirm they pass.
- Refactor: Clean up. Run all tests, confirm they still pass.
- Lint:
npx eslint --fix <changed-files> - Update checklist: Mark the step as complete in the checklist file.
Phase 3 — Verify
After all behaviors are implemented:
- Run the full test suite:
npm test - Run the linter on the entire project:
npm run lint - Run the vulnerability scan:
npm audit - If any
moderateor higher severity vulnerabilities are found:- Attempt
npm audit fix - If that doesn't resolve it, document the issue and inform the user
- Attempt
- Confirm no secrets are exposed in code or configuration.
- Add a Summary to the checklist file.
Phase 4 — PR Readiness (if pushing)
Before creating a PR, verify the Pre-PR Checklist from AGENTS.md:
- All tests pass
- Lint clean (zero errors)
-
npm audit— no moderate+ vulnerabilities - No
eslint-plugin-securitywarnings - No secrets in code, logs, or chat output
Principles
- Never write production code without a failing test.
- Keep steps small — each TDD cycle should take minutes, not hours.
- If stuck, the step is too big. Break it down further.
- Trust the tests. If they pass, the code works.