Standby ← Back

guide · claude code playbook

How to run Claude Code overnight — the complete playbook

Kick off a 4-hour refactor at 11 PM, wake up to a green PR at 7 AM. Here's the host setup, the prompt structure, and the safety checks that make it actually work.

The short version

Three things have to be true to run Claude Code overnight successfully:

  1. Your host stays alive. Laptops that sleep will halt the run mid-execution. Use a Mac mini, Windows VPS, or managed cloud desktop.
  2. Your prompt is structured for long autonomy. Break the task into phases. Tell Claude Code to commit every 30 minutes. Ask before destructive changes.
  3. Your safety net is real. Run on a feature branch, never main. Have tests that auto-run. Set spending limits.

Get those three right and a 4-hour overnight refactor is one of the highest-leverage things you can do as a developer in 2026.

Step 1 — Pick the host

Anything that runs Claude Desktop. Options ranked by reliability for overnight runs:

Whichever you pick, configure: power policy to never sleep, Claude Desktop to auto-launch at login, auto-login enabled, Windows Update active hours wide.

Step 2 — Structure the prompt for autonomy

The single biggest difference between an overnight run that finishes vs. one that hangs is how the kickoff prompt is structured. The bones of a good one:

You are going to refactor <target dir> while I sleep.

CONTEXT: <1-paragraph summary of what the code is and why>

GOAL: <1-paragraph specific outcome, e.g. "extract all shared
hooks into src/hooks/, dedupe duplicate utils, add types where
missing, leave tests green">

PLAN: Generate a multi-phase plan before starting work. Show me
the plan in your first response. Do not start coding until I
confirm — oh wait, I'm asleep. Just proceed if the plan looks
reasonable to you, but commit the plan to a PLAN.md at the
root of a new branch before you start.

WORKFLOW:
- Create a new branch named refactor/auto-<today>
- Commit every 30 minutes with a clear message
- Run tests after each phase; if tests fail, fix before
  moving on
- Write status updates to STATUS.md every hour
- Never push to main, never delete files outside <target dir>,
  never modify package.json without noting it in STATUS.md

WHEN DONE: open a PR against main with a summary of changes,
tag <your handle> for review

START: now

This structure is doing several things: (1) gives Claude permission to proceed without you, (2) forces a plan-first workflow so you can debug if it goes wrong, (3) sets safety rails (branch, commit cadence, no destructive ops), (4) leaves a paper trail (STATUS.md, PLAN.md) for the morning.

Step 3 — Safety nets

Three you should never skip:

Step 4 — The morning routine

When you wake up:

  1. Open Claude Desktop on your host (via RDP, Dispatch, or just walk over to the Mac mini). Confirm the agent is alive — not crashed, not at a "are you sure?" prompt.
  2. Check STATUS.md on the branch. If Claude Code is hung, this tells you where.
  3. Open the PR. Review the diff at high level. Run tests locally if there's no CI.
  4. If it looks good: approve, squash, merge.
  5. If it doesn't: ask Claude Code via the same session to fix, or pull the branch locally and finish by hand.

Things that go wrong (and how to fix)

An honest expectation

A well-prompted overnight Claude Code run finishes successfully about 70% of the time today (May 2026). 20% finishes with caveats (some tests failing, partial scope, need to clean up by hand). 10% fails entirely (gets stuck, runs out of budget, host crashes). Those numbers are improving fast as Anthropic ships better long-context agentic behavior.

Even at 70% success, "I shipped a 47-file refactor while sleeping" is one of the highest-leverage moments developers have access to in 2026. The infrastructure side is solved. The remaining variance is in your prompt.

Want this hands-off?

If you're tired of managing the host, Standby is the managed version — a Windows cloud desktop with Claude Desktop, Claude Code, Chrome, Git, and Node pre-installed. You sign in with your own Anthropic account in 10 minutes. We patch the OS, we keep Claude Desktop launched, we monitor uptime. The overnight runs work because the desktop never sleeps.

Related guides

Skip the host setup.

Standby is the cloud desktop your overnight Claude Code runs deserve. $29/mo, 10-minute setup, 99.9% uptime.

See pricing →