No. 022 Pin the behavior
Write tests for {feature} first, then implement it until…
Write tests for {feature} first, then impl.
- Claude Code
- Codex
- Cursor
- Pin the behavior
write tests for {feature} first, then implement it until they pass
When to use
“Write tests for {feature} first, then implement it until…” fits when the behavior should be pinned by a test, not only by a reading of the diff, because it says “write tests for {feature} first, then implement it until they pass”, after you replace {feature} with names from the repo.
One filled message for “Write tests for {feature} first, then implement it until…” is: write tests for empty-cart total first, then implement it until they pass
When not to use
Leave “Write tests for {feature} first, then implement it until…” unused when you already have the failing test in front of you and you wanted it explained, because “write tests for {feature} first, then implement it until they pass” points the other way
How to run it
Claude Code
Claude Code takes “Write tests for {feature} first, then implement it until…” as one paste at the repo root. Do not also save .claude/commands, or “write tests for {feature} first, then implement it until they pass” replays on the next task.
Codex
Codex takes “Write tests for {feature} first, then implement it until…” as a paste above the task. Leave AGENTS.md unchanged so the next thread does not inherit “write tests for {feature} first, then implement it until they pass”.
Cursor
Cursor should see “Write tests for {feature} first, then implement it until…” only as a chat paste of “write tests for {feature} first, then implement it until they pass” for this turn. A file at .cursor/rules would keep applying after the turn ends.
Comparison
对比待补
This before-and-after was not run on this machine.
Related
- Stage: Pin the behavior
- Same stage: Read {report} and add tests for the lowest-covered files…
来源:Anthropic · https://code.claude.com/docs/en/prompt-library · 2026-12-01