Home › All prompts › Leave Claude Code Running Without It Getting Stuck
Mini pack
Free
Leave Claude Code Running Without It Getting Stuck
By default, Claude Code stops and waits whenever it needs your OK, which wastes the run if you walk away. These 9 free prompts help you find what would get it stuck, allow only what the job needs, skip and note the rest, commit every step, and come back to a clear report.
Find what would stop it before you leave, let it skip what it can't do instead of waiting for you, lose one step at most, and come back to a clear report instead of a stuck screen.
9 prompts in 4 sections. Replace everything in [BRACKETS IN CAPS], then copy and paste into your AI tool.
Claude Code: all 9 prompts are pasted into Claude Code opened in your project. Prompts 1.1, 4.1 and 4.2 start with "Don't change any code" and only read and report; 1.2 and 2.1 show the rule or setting change and wait for your OK; 2.2 and 3.1 start the task with skip-and-note and commit-per-step instructions (3.1 waits for your OK on the step list); 2.3 is a short practice run on a throwaway branch; 3.2 writes a claude -p command but doesn't run it. No prompt uses the mode that skips permission checks. The prompts use allow and deny rules in .claude/settings.local.json, /permissions, permissions.denyInsteadOfPrompting (v2.1.319 or later, user settings only; denies what would wait on a prompt, removes the question and plan-exit tools, still waits on the trust dialog and project MCP approvals), claude -p with --allowedTools, --max-turns, --permission-prompts none and --output-format stream-json, claude -v, /rewind (doesn't track changes made only by terminal commands), /clear and the cache-miss note after a break. Each was checked against Claude Code's settings reference, permissions, permission modes, headless, CLI reference, checkpointing and costs docs and the v2.1.319 changelog entry.
Not repeated here: away-mode deny rules, phone check-ins and "what went wrong" recovery point to Vibe Code From Your Phone (1.2, 1.3, 4.2); everyday rules and hooks to Claude Code Guardrails; usage to Make Your Claude Code Limit Last.
No stats, prices or X claims: the pack quotes no posts or numbers beyond the docs' own version number, and has no affiliate or sponsor copy.
Written for use with Claude Code. Not yet tested against it.
Use this when you have a long task in mind and want to know, before you leave, every point where Claude Code would stop to ask you something. It's for a plain list of the commands, files and questions the task will run into.
Fill in: [THE TASK] (e.g. "add a search bar to the products page and write tests for it"), [HOW LONG I'LL BE AWAY] (e.g. "about 3 hours" or "overnight").
Don't change any code and don't run anything that changes files. I want to leave you working on a task while I'm away, and I need to know where you would stop and wait for me.
The task: [THE TASK]
How long I'll be away: [HOW LONG I'LL BE AWAY]
Please:
1. Read the parts of my project this task touches, so your answer is based on real files.
2. List every command you expect to run, such as installing packages, running tests, building or starting a server. Use the exact command text.
3. For each one, tell me whether it would ask for my permission with my current settings, and why. Check my settings files, not just your guess.
4. List any files outside this project you'd need to read or change.
5. List any question you'd need to ask me, such as a design choice or a name. Give each one a sensible default I can approve now.
6. Mark anything risky, like deleting files, changing the database or pushing to GitHub. Those should stay blocked while I'm away.
7. End with a short table: command, would it ask me (yes/no), safe to allow (yes/no), and why.
If you aren't sure whether something would ask, say so.
Tips to customize: Answer the questions in step 5 right away, and paste your answers into the task when you start it. Then the agent has no reason to stop and ask. Keep the table for Prompt 1.2. You can also run /permissions in Claude Code to see the rules that are already set.
1.2 Allow Only What This Job Needs
Untested: not yet run against a model.
Use this when you know which commands the task needs and want Claude Code to run them without asking. It's for the smallest set of allow rules that covers the job, with risky commands kept blocked.
Fill in: [MY TABLE FROM PROMPT 1.1] (paste it, or list the commands), [THINGS IT MUST NEVER DO] (e.g. "push to GitHub, delete files, run database migrations").
Help me write permission rules for one unattended task. Show me the rules before you save anything.
Commands this task needs: [MY TABLE FROM PROMPT 1.1]
Things you must never do while I'm away: [THINGS IT MUST NEVER DO]
Please:
1. Write allow rules only for the commands marked safe, as narrow as possible. For example, "Bash(npm test *)" instead of "Bash(npm *)". Use the permission rule format from the Claude Code docs.
2. Write deny rules for everything on my never list.
3. Don't add any rule that allows every command, deleting files, pushing, or reading files with secrets, like .env.
4. Explain each rule in one plain line: what it lets you do, and what it doesn't.
5. Tell me honestly what these rules don't cover. For example, the same thing done a different way might not match a rule.
6. After I say OK, put the rules in .claude/settings.local.json so they only apply to me and stay out of git. Keep anything already in that file, and show me the final file.
7. Tell me how to remove these rules when the task is done.
Tips to customize: Claude Code's docs say deny rules block in every permission mode, and that you can put the * after the subcommand, so Bash(npm test *) matches npm test and npm test -- --watch=false. Narrow rules are the point here: if the agent needs something you didn't allow, Prompt 2.2 makes it write that down instead of waiting. For your everyday rules, see Claude Code Guardrails.
Section 2: Never Wait on Me
2.1 Turn On "Deny Instead of Asking"
Untested: not yet run against a model.
Use this when you keep coming back to a session that stopped at a permission question. It's for turning on the setting that makes Claude Code say no to anything that would wait for you, so the rest of the task keeps going.
Fill in: [MY OPERATING SYSTEM] (e.g. "Mac", "Windows" or "Linux").
I want to leave sessions running while I'm away without them stopping at a permission question. Help me turn on the permissions.denyInsteadOfPrompting setting. Explain each step in plain words, and show me any change before you make it.
My operating system: [MY OPERATING SYSTEM]
Please:
1. Check my Claude Code version with claude -v, and tell me whether it's new enough for this setting. Check the settings reference in the Claude Code docs for the minimum version.
2. Explain what the setting does in two or three sentences: what still runs, what gets denied, and what that means for my task.
3. Show me where my user settings file is (~/.claude/settings.json) and what's in it now.
4. Add "denyInsteadOfPrompting": true inside "permissions", keeping everything already in the file. Show me the final file before you save it.
5. Tell me what this setting does NOT stop, so I can deal with those before I leave.
6. Tell me how to turn it off again.
Tips to customize: This setting is new, so check the docs if anything looks different. Claude Code's settings reference says it needs Claude Code v2.1.319 or later, and that it goes in your user settings, not your project, so a repository can't turn it on for you. It denies anything that would wait on a prompt, and the turn carries on. It also removes the tools Claude uses to ask you questions or leave plan mode, so don't start an unattended run in plan mode. It would stay stuck there. The docs also say a session can still wait on the workspace trust question and on approving a project's MCP servers, so answer both before you leave. If you'd rather turn it on for one run only, Prompt 3.2 shows the one-run version.
2.2 The "Needs Me" List: Skip It, Note It, Keep Going
Untested: not yet run against a model.
Use this when you start the unattended task itself. It's for instructions that make Claude handle a blocked step calmly: write it down, skip it, and carry on with everything that doesn't depend on it.
Fill in: [THE TASK] (e.g. "add a search bar to the products page and write tests for it"), [MY DEFAULT ANSWERS] (your answers from Prompt 1.1, step 5, or "none").
I'm leaving now. Work on this task until it's done or until nothing is left that you can do without me.
The task: [THE TASK]
My answers to your questions: [MY DEFAULT ANSWERS]
How to handle anything that gets blocked or denied:
1. Don't try to get around it. Don't run the same thing a different way, and don't change settings or permission rules.
2. Add it to a file called NEEDS-ME.md: what you tried, the exact command or file, why you needed it, and what you'd do once I allow it.
3. Skip it and move on to the next part of the task that doesn't depend on it.
4. If a choice comes up that I didn't answer, pick the safest, simplest option, write your choice in NEEDS-ME.md, and keep going.
5. If you're stuck on the same problem after 2 tries, write it in NEEDS-ME.md and move on.
6. Never delete files, push, or change the database, even if a rule would let you.
When nothing is left that you can do, stop, and make sure NEEDS-ME.md is up to date.
Tips to customize: Step 1 matters most. A denied command is a decision, not a puzzle to solve. If NEEDS-ME.md fills up with the same command every time, that command probably belongs in your allow rules (Prompt 1.2), as long as it's safe. Add NEEDS-ME.md to .gitignore if you don't want it in your project history.
2.3 The Ten-Minute Dress Rehearsal
Untested: not yet run against a model.
Use this when you've set up rules and settings and want to test them before a long run. It's for a short practice run on a tiny slice of the task, so you find the gaps while you're still at your desk.
Fill in: [A SMALL PIECE OF THE TASK] (e.g. "only the search box, no tests yet"), [MY RULES AND SETTINGS] (paste .claude/settings.local.json and the permissions part of ~/.claude/settings.json).
This is a practice run before I leave you alone on a longer task. I'm still here, but act as if I'm not: don't ask me anything, and follow my NEEDS-ME.md instructions if something is blocked.
The small piece of the task: [A SMALL PIECE OF THE TASK]
My current rules and settings: [MY RULES AND SETTINGS]
Please:
1. Do only the small piece of the task. Stop after about 10 minutes of work, or sooner if it's done.
2. Then report: every command you ran, which ones ran without asking, and which ones were denied.
3. For each denied command, tell me whether it's safe to allow, or whether it should stay blocked and why.
4. Tell me anything that would have made you stop and wait if I'd been away.
5. Suggest the smallest change to my rules that would make the full run go smoothly. Don't make the change yourself.
Tips to customize: Do this on a fresh branch, so you can throw away the practice work. If the report shows nothing denied and nothing that would have waited, you're ready for the long run. If it shows the same kind of block twice, fix that before you leave, not after.
Section 3: Lose One Step at Most
3.1 Small Steps, a Commit Each, and a Progress Log
Untested: not yet run against a model.
Use this when you're about to start a long task and want each finished step saved. It's for a plan where every step ends in a commit and a one-line note, so a crash, a block or a wrong turn costs you one step at most.
Fill in: [THE TASK] (e.g. "add a search bar to the products page and write tests for it"), [HOW I CHECK EACH STEP] (e.g. "npm test passes" or "the page loads without errors").
Before you start this task, split it into small steps, and save your progress as you go so nothing is lost if you stop early.
The task: [THE TASK]
How each step gets checked: [HOW I CHECK EACH STEP]
Please:
1. Split the task into steps that each take about 15 to 30 minutes and leave the project working.
2. After each step, run the check. If it passes, commit with a clear message on the current branch. Never push.
3. After each commit, add one line to a file called PROGRESS.md: the time, the step, the commit, and "done" or "skipped (see NEEDS-ME.md)".
4. If a check fails and you can't fix it in 2 tries, undo only that step's changes, write it in PROGRESS.md and NEEDS-ME.md, and move to the next step that doesn't depend on it.
5. Before you start, show me the list of steps and wait for my OK. This is the only time you should wait for me.
Tips to customize: Start on a new branch, such as away/search-bar, so your main branch stays untouched. PROGRESS.md is also how a fresh session picks up where the last one stopped: tell it "read PROGRESS.md and NEEDS-ME.md, then continue from the next step". Claude Code's checkpoints (/rewind) can undo edits too, but its docs say changes made only by terminal commands aren't tracked, so commits are your real save points.
3.2 Start It as One Command With Clear Limits
Untested: not yet run against a model.
Use this when you'd rather start the unattended job from your terminal with one command, instead of leaving a chat window open. It's for building that command with sensible limits, explained line by line.
Fill in: [THE TASK] (e.g. "add a search bar to the products page and write tests for it"), [MAX TURNS] (e.g. "50"), [MY ALLOWED COMMANDS] (e.g. "npm test, npm run build, git add, git commit").
Help me write one terminal command that runs this task with Claude Code while I'm away. Don't run it yet. Explain each part in plain words.
The task: [THE TASK]
The most turns it should take: [MAX TURNS]
Commands it may run without asking: [MY ALLOWED COMMANDS]
Please:
1. Use claude -p, so it runs without the chat window.
2. Add --allowedTools with narrow rules for my allowed commands only.
3. Add --max-turns with my number, so it can't run forever.
4. Add --permission-prompts none, so anything that needs approval is denied instead of waiting.
5. Put my NEEDS-ME.md and PROGRESS.md instructions into the task text.
6. Save Claude's final answer to a file, such as away-run.txt, so I can read it later.
7. Check every flag against the Claude Code CLI reference, and tell me if any of them doesn't exist in my version (check claude -v).
Don't use any flag that skips permission checks.
Tips to customize: Claude Code's docs say a claude -p run with no permission mode set starts in Manual mode, and calls that need approval are denied unless an allow rule or hook approves them. --max-turns and --permission-prompts only apply to -p runs. --permission-prompts none lasts for one run, while the setting from Prompt 2.1 lasts until you turn it off. If you use auto mode (--permission-mode auto), the docs say it reduces permission prompts but doesn't guarantee safety. They also say that in a chat window, auto mode goes back to asking you after it blocks several actions, which is one more reason to turn on the setting from Prompt 2.1.
Section 4: Come Back to Progress
4.1 The "While You Were Away" Report
Untested: not yet run against a model.
Use this when you're back and want to know what happened before you do anything else. It's for a short report built from the progress log, the commits and the "needs me" list, plus the decisions only you can make.
Fill in: [THE TASK] (e.g. "add a search bar to the products page and write tests for it").
Don't change any code. I'm back. Tell me what happened while I was away on this task: [THE TASK]
Read PROGRESS.md, NEEDS-ME.md and the commits on this branch, then give me:
1. Done: each finished step, in one line, with how it was checked.
2. Half done: anything started but not finished, and what's left.
3. Blocked: everything in NEEDS-ME.md, grouped by what I need to do (allow a command, answer a question, or fix something myself).
4. Choices you made for me: each one, and how to change it if I disagree.
5. Anything that looks wrong or risky in the changes, in plain words.
6. What you'd do next, in order, once I've dealt with the blocked items.
Keep it short. If a log is missing or doesn't match the commits, tell me.
Tips to customize: If the chat you'd continue is very long, think about starting fresh instead. Claude Code's docs say your first message after a break longer than the prompt cache lifetime reprocesses your full conversation, which uses more of your limit. A fresh session (/clear) that reads this report, PROGRESS.md and NEEDS-ME.md starts small. For more on usage, see Make Your Claude Code Limit Last.
4.2 Why Did It Stop Early?
Untested: not yet run against a model.
Use this when you come back and the run stopped long before the task was done. It's for finding the real reason in plain words, and the one change that would stop it happening next time.
Fill in: [WHAT I SAW WHEN I CAME BACK] (e.g. "a question asking to run npm install" or "it said it was done but only did step 2"), [HOW I STARTED THE RUN] (e.g. "left a chat open" or paste the command from Prompt 3.2).
Don't change any code or settings. My unattended run stopped early, and I want to know why.
What I saw when I came back: [WHAT I SAW WHEN I CAME BACK]
How I started the run: [HOW I STARTED THE RUN]
Please check these possible causes, using PROGRESS.md, NEEDS-ME.md, the commits, any saved output and my settings files:
1. It was waiting on a permission question or another question for me.
2. It was in plan mode, or waiting on a trust or MCP server question.
3. Too many things were denied, so nothing useful was left to do.
4. It hit the turn limit I set.
5. A long command timed out or was stopped.
6. It decided the task was done when it wasn't.
7. Something else.
For each cause, say "yes", "no" or "can't tell", and why. Then name the most likely cause and the one smallest change for next time: a rule, a setting, a clearer task or a smaller step.
Tips to customize: If you started the run with claude -p and added --output-format stream-json, Claude Code's docs say the final result lists the denied calls, which makes cause 3 easy to check. Then run Prompt 2.3 again with the fix in place before your next long run.
Get new free packs in your inbox
Optional. Every prompt here is free, and you don't need to sign up to use any of them. We email when we add new free packs. Unsubscribe anytime.
Thanks, you're on the list. Watch your inbox for the next prompt drop.