"Keep going until the tests pass" is something I type a lot in my head. There is a command for it.
Set a completion condition and Claude keeps taking turns without you prompting each one.
/goal all tests in test/auth pass and the lint step is clean
After every turn a small fast model checks the condition against the conversation. Not met, and Claude starts another turn. Met, and the goal clears. If the evaluator judges it impossible, it clears too. Plain /goal shows status, and /goal clear removes it.
The evaluator does not run commands or read files. It only judges what Claude has shown in the conversation. So write a condition Claude's own output can prove, such as "npm test exits 0", and add a bound like "or stop after 20 turns".
The difference with an ordinary prompt is who decides that the work is done. Normally Claude decides, and it stops when it thinks it has finished. With a goal, a separate model checks your wording after every turn, so the work does not end just because the first model sounds confident.
It also works headless: claude -p "/goal ..." runs the loop to the end in one go. In Manual mode Claude still asks before tool calls, so use auto mode if you want it unattended.
Further reading: Keep Claude working toward a goal – Claude Code docs, Commands – Claude Code docs, On this site: /copy 2 copies Claude's second-to-last answer, not just the last, On this site: /context shows what is eating your Claude Code context window