Test-Driven Development
Claude Code can write files and run tests in the same session, making it ideal for TDD. The explicit red-green-refactor phases with test output verification at each step ensures genuine TDD rather than writing tests after implementation.
I want to implement {{featureDescription}} using TDD. **Tech:** {{testFramework}} for testing, {{language}} codebase **Step 1 — Write tests first:** - Create test file at {{testFilePath}} - Write tests for these behaviors: {{expectedBehaviors}} - Include edge cases: {{edgeCases}} - Use descriptive test names: "should {{behavior}} when {{condition}}" - All tests should FAIL initially (red phase) **Step 2 — Run the tests:** - Execute {{testCommand}} and confirm they all fail for the right reasons - Show me the output **Step 3 — Implement the minimum code to pass:** - Write the implementation at {{implFilePath}} - Write only enough code to make the tests pass — no extra features - Run tests again to confirm they all pass (green phase) **Step 4 — Refactor if needed:** - Clean up the implementation while keeping all tests green - Run the full test suite to check for regressions Do each step sequentially. Show me the test output after each phase.
Variables to customize
Why this prompt works
Claude Code can write files and run tests in the same session, making it ideal for TDD. The explicit red-green-refactor phases with test output verification at each step ensures genuine TDD rather than writing tests after implementation.
What you get when you save this prompt
Your workspace unlocks powerful tools to iterate and improve.
AI Optimization
One-click improvement with structure analysis and pattern suggestions.
Version History
Track every edit. Compare versions side-by-side with word-level diffs.
Folders & Tags
Organize your library with nested folders, tags, and drag-and-drop.
$ npm i -g @promptingbox/mcpUse Everywhere
Access prompts from Claude, Cursor, ChatGPT & more via MCP integration.
Your prompts, organized
Save, version, and access your best prompts across ChatGPT, Claude, Cursor, and more.