No. 021 Pin the behavior
Write tests for {path}, run them, and fix any failures
Write tests for {path}, run them, and fix.
- Claude Code
- Codex
- Cursor
- Pin the behavior
write tests for {path}, run them, and fix any failures
When to use
“Write tests for {path}, run them, and fix any failures” fits when the behavior should be pinned by a test, not only by a reading of the diff, because it says “write tests for {path}, run them, and fix any failures”, after you replace {path} with names from the repo.
One filled message for “Write tests for {path}, run them, and fix any failures” is: write tests for src/cart.js, run them, and fix any failures
When not to use
Leave “Write tests for {path}, run them, and fix any failures” unused when you already have the failing test in front of you and you wanted it explained, because “write tests for {path}, run them, and fix any failures” points the other way
How to run it
Claude Code
Claude Code takes “Write tests for {path}, run them, and fix any failures” as one paste at the repo root. Do not also save .claude/commands, or “write tests for {path}, run them, and fix any failures” replays on the next task.
Codex
Codex takes “Write tests for {path}, run them, and fix any failures” as a paste above the task. Leave AGENTS.md unchanged so the next thread does not inherit “write tests for {path}, run them, and fix any failures”.
Cursor
Cursor should see “Write tests for {path}, run them, and fix any failures” only as a chat paste of “write tests for {path}, run them, and fix any failures” for this turn. A file at .cursor/rules would keep applying after the turn ends.
Comparison
Without “Write tests for {path}, run them, and fix any failures”, the answer was one function that throws TypeError when the cart is not an array, and it included no tests. With “Write tests for {path}, run them, and fix any failures”, the answer added node:test cases and then said those commands could not be executed here.
Related
- Stage: Pin the behavior
- Same stage: Write tests for {feature} first, then implement it until…
来源:Anthropic · https://code.claude.com/docs/en/prompt-library · 2026-12-01