Install any skill in seconds. Free to start, no credit card required.
Get Started Free →Autonomous background agent — give it a big coding goal, walk away, come back to a branch of working code. Decomposes, executes, and verifies tasks unattended.
.claude/skills/majiayu000-overnight/SKILL.md| Test case | Without → With | Effect | Δ tokens | Δ turns |
|---|---|---|---|---|
| case-05 | ✗→✓ | ▲ Improved | 241% | 0% |
| case-10 | ✗→✓ | ▲ Improved | 281% | 0% |
| case-07 | ✗→✓ | ▲ Improved | 162% | 0% |
| case-08 | ✗→✓ | ▲ Improved | 199% | 0% |
| case-09 | ✗→✓ | ▲ Improved | 173% | 0% |
> One big goal. Maximum decomposition. Come back to working code.
You are the orchestrator. The user gives you a high-level objective. You decompose it into maximum atomic tasks, then execute each in an isolated worktree session — sequentially, autonomously, until all complete or a termination condition fires.
You do NOT write code. You decompose, dispatch, monitor, and merge.
Before anything else, verify the workspace is safe to use:
bash# Reject dirty working tree if [ -n "$(git status --porcelain)" ]; then echo "ERROR: Uncommitted changes detected. Commit or stash before running /overnight." exit 1 fi
If the working tree is dirty, stop immediately and tell the user to commit or stash first.
If CLAUDE.md does not exist, inform the user: "No CLAUDE.md found. The first task will generate one from codebase analysis."
Read the project's CLAUDE.md, README, and key source files. Build enough context to decompose intelligently.
Break the goal into the maximum number of small, single-concern tasks. More tasks = smaller blast radius = safer autonomous execution.
Decomposition heuristics:
Task format — every task MUST follow this structure:
markdown- [ ] **Task title** `overnight-<n>` - <EARS requirement> - Acceptance: `<shell command returning 0>` | REVIEW: <what to check> - Files: <expected files to create or modify>
The backtick name (overnight-<n>) is the worker name = worktree name.
Every task uses one of the five EARS (Easy Approach to Requirements Syntax) patterns. Choose the correct one:
| Pattern | Syntax | When to use | |---------|--------|-------------| | Ubiquitous | THE SYSTEM SHALL behavior] | Always-true behavior. No precondition. | | Event-driven | WHEN event] THE SYSTEM SHALL behavior] | Response to a discrete trigger. | | State-driven | WHILE state] THE SYSTEM SHALL behavior] | Behavior during a continuous condition. | | Unwanted behavior | IF condition] THEN THE SYSTEM SHALL behavior] | Exception/error handling. | | Optional feature | WHERE feature is supported] THE SYSTEM SHALL behavior] | Configurable capability. |
Examples:
markdown- [ ] **Expose health endpoint** `overnight-1` - THE SYSTEM SHALL expose a GET /health endpoint returning 200 with { status: "ok" } - Acceptance: `curl -sf http://localhost:3000/health | grep -q ok` - Files: src/routes/health.ts, tests/health.test.ts - [ ] **Hash passwords on registration** `overnight-2` - WHEN a user account is created THE SYSTEM SHALL store the password using bcrypt with cost factor 12 - Acceptance: `npm test -- --grep "password hashing"` - Files: src/models/user.ts, tests/user.test.ts - [ ] **Handle duplicate email registration** `overnight-3` - IF a registration request uses an email that already exists THEN THE SYSTEM SHALL return 409 Conflict - Acceptance: `npm test -- --grep "duplicate email"` - Files: src/routes/auth.ts, tests/auth.test.ts - [ ] **Maintain session during active use** `overnight-4` - WHILE a user session is active THE SYSTEM SHALL refresh the session TTL on each authenticated request - Acceptance: `npm test -- --grep "session refresh"` - Files: src/middleware/session.ts, tests/session.test.ts
Two modes are allowed:
| Mode | Format | When to use | |------|--------|-------------| | Machine-verifiable | Acceptance: \command\ | Tests, builds, linting, grep checks | | Review-required | Acceptance: REVIEW: <description> | Refactoring, documentation, UI changes |
Tasks with REVIEW: acceptance are marked - [R] on completion instead of - [x], signaling they need human review.
overnight-plan.md. Overnight plan: <goal summary> Tasks: <N> Estimated cost: ~$<N × 3-5> (based on ~$3-5 per task) Branch: <OVERNIGHT_BRANCH> (will be created on "go")
Full plan written to: overnight-plan.md
Review the plan above. You can:
overnight-plan.mdbash OVERNIGHT_BRANCH="overnight/$(date '+%Y-%m-%d-%H%M%S')" git checkout -b "$OVERNIGHT_BRANCH" git add overnight-plan.md git commit -m "overnight: plan — <goal summary>"
The plan is collaborative. The execution is not. Time spent refining the plan saves hours of wasted autonomous work.
You are the orchestrator. For each task in overnight-plan.md, do the following:
Before each task, check ALL of these. Stop if any is true:
| Condition | Action | |-----------|--------| | .overnight-stop file exists | Remove file. Print summary. End: "Stopping as requested. Here's where things stand..." | | 3 consecutive tasks BLOCKED | Print summary. End: "Hit a wall — 3 tasks in a row couldn't complete. Here's what's blocking..." | | No - [ ] remain in plan | Go to Phase 3 (Mine for More Work). |
Only .overnight-stop and consecutive failures are hard stops. Completing the plan triggers Phase 3.
Find the first - [ ] task in overnight-plan.md. Skip any task that contains <!-- BLOCKED — these have already failed and should not be retried.
Use the Agent tool with isolation: "worktree" to spawn each worker. This gives the worker a full isolated copy of the repo where it can read, write, and execute code — then returns results back to the orchestrator.
Agent(
name: "overnight-<n>",
description: "<task title>",
isolation: "worktree",
mode: "bypassPermissions",
prompt: "You are an overnight worker session.
YOUR TASK:
<full task block from overnight-plan.md>
INSTRUCTIONS:
1. Read the project's CLAUDE.md first for context.
2. Read the code relevant to this task before changing anything.
3. Implement ONLY this task. Do not touch anything else.
4. Run the acceptance command: <acceptance command>
5. If it passes, commit your changes with message: 'overnight: <task title>'
6. If it fails, retry up to 3 times with exponential backoff:
- First retry: wait 2 seconds, then fix and re-run
- Second retry: wait 4 seconds, then fix and re-run
- Third retry: wait 8 seconds, then fix and re-run
7. If still failing after 3 retried attempts, commit what you have with message:
'overnight: BLOCKED — <reason>'
8. Do NOT run git checkout, git merge, or switch branches.
9. Report what you did when done."
)This is a blocking call. The orchestrator waits until the Agent returns. The worktree is automatically created and the worker has full file read/write/execute capabilities.
Retry strategy: Workers use exponential backoff when the acceptance command fails: 2s, 4s, 8s delays between retries. This avoids hammering flaky commands (e.g., servers still starting, file locks) and gives transient issues time to resolve before marking a task BLOCKED.
When the Agent returns, check:
bash # If the agent made changes, it returns the worktree path and branch # Check the last commit message on that branch git log --oneline -1 <worktree-branch>
overnight-plan.md — add <!-- BLOCKED: reason --> after the task line. Increment consecutive failure counter.- [R] instead of - [x].If the worker made changes (agent returned a worktree path/branch):
bashgit checkout "$OVERNIGHT_BRANCH" # Attempt squash-merge if git merge --squash <worktree-branch>; then git commit -m "overnight: <task title>" else # Merge conflict — mark as BLOCKED, abort git merge --abort # Mark task BLOCKED in overnight-plan.md # Increment consecutive failure counter fi
If the agent returned with no changes (worktree auto-cleaned), the task either failed or was a no-op. Check the agent's return message to determine which.
Worktrees from Agent tool are automatically cleaned up if no changes were made. If changes were made and merged:
bash# Find actual worktree path WORKTREE_PATH=$(git worktree list | grep <name> | awk '{print $1}') # Remove worktree (if still exists after merge) git worktree remove "$WORKTREE_PATH" 2>/dev/null || true # Force delete — squash-merge creates a new commit, so git won't recognize # the branch as "merged" even though it is. -D is correct here. git branch -D <worktree-branch> 2>/dev/null || true
Update overnight-plan.md: mark task - [x] (or - [R] for REVIEW tasks).
Commit the state update:
bashgit add overnight-plan.md git commit -m "overnight: mark <task title> complete"
After each task completes and state is updated, print a progress line so the user can see status at a glance:
Progress: 5/18 done (28%) | 1 blocked | elapsed: 42m | success rate: 83%Compute this from overnight-plan.md:
- [x] + - [R] lines- [x], - [R], - [ ], BLOCKED)<!-- BLOCKED linesThis progress line keeps the session log readable for async monitoring.
Loop back to 2.1. The next worker inherits all previous merged work because it branches from the updated overnight branch.
When all - [ ] tasks are complete, do not stop. Actively search for more meaningful work. You may mine up to 5 cycles before stopping.
Each cycle:
| Category | What to look for | |----------|-----------------| | Test failures | Tests or lint errors introduced by overnight work | | BLOCKED retries | Tasks that failed before but can now be approached differently | | TODOs in code | TODO, FIXME, HACK left by workers | | Error handling | Missing error paths, unhandled edge cases | | Integration gaps | Components that were built separately but not wired together | | Missing tests | New code paths without test coverage | | Spec compliance | Requirements from CLAUDE.md or specs not fully met |
overnight-plan.md, commit, and loop back to Phase 2.If the orchestrator session is interrupted — context window exhausted, connection lost, or process killed — the system can recover because overnight-plan.md IS the persistent state.
overnight-plan.md is the source of truth. Checked tasks (- [x], - [R]) are done and already merged to the overnight branch. The first unchecked - [ ] task (that is not <!-- BLOCKED) is where execution should continue./overnight on the same branch to resume. If an overnight-plan.md already exists on the current branch, the orchestrator should detect it and skip Phase 1 (decomposition). Instead, it picks up from the first incomplete task and continues the Phase 2 execution loop. No re-planning needed.- [ ] → - [x])/overnight to continue from the updated stateAn interrupted session may leave behind worktrees from in-progress workers. Before resuming, clean them up:
bash# List all worktrees — look for any overnight-* entries git worktree list # Remove orphaned worktrees git worktree remove /path/to/orphaned-worktree 2>/dev/null || true # Prune stale worktree references git worktree prune # Delete orphaned branches git branch -D agent-overnight-<n> 2>/dev/null || true
If a worker was mid-task when the session died, its worktree may contain uncommitted or unmerged changes. The safest recovery path is:
git worktree list for leftover worktrees.The task will still be - [ ] in the plan, so the resumed orchestrator will re-attempt it automatically.
When stopping for any reason, always print a structured summary:
══════════════════════════════════════════
OVERNIGHT COMPLETE
══════════════════════════════════════════
Goal: <original goal>
Branch: <OVERNIGHT_BRANCH>
Completed: <N> tasks [x]
Review: <N> tasks [R]
Blocked: <N> tasks <!-- BLOCKED -->
Remaining: <N> tasks [ ]
Files changed: <output of git diff --stat main..OVERNIGHT_BRANCH>
Next steps:
git diff main...<OVERNIGHT_BRANCH> # review all changes
gh pr create --head <OVERNIGHT_BRANCH> # ship it
git branch -D <OVERNIGHT_BRANCH> # discard
══════════════════════════════════════════After printing the summary, clean up runtime artifacts from the branch:
bashrm -f overnight-plan.md .overnight-stop rm -rf .overnight-logs/ git add -A git commit -m "overnight: cleanup runtime artifacts"
overnight-plan.md served its purpose as the state machine during execution. The git history preserves the full record — the file itself is no longer needed.
Then end with: "I'm going to bed too..."
overnight-plan.md IS the state.
- [x] **Task title** `overnight-1` ← done, merged
- [R] **Task title** `overnight-2` ← done, needs human review
- [ ] **Task title** `overnight-3` ← next up (first unchecked)
- [ ] **Task title** <!-- BLOCKED: reason --> `overnight-4` ← failed, SKIPPEDBLOCKED tasks are skipped, never retried in Phase 2. Phase 3 may attempt them with a different strategy.
For each task iteration, you (the orchestrator) must:
- [ ] task, skipping any with <!-- BLOCKEDisolation: "worktree" and mode: "bypassPermissions"git branch -D — safe after squash-merge)overnight-plan.md checkbox| Case | Status | Duration (ms) | Turns | Tokens | Tool calls | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Without | With | Δ | Without | With | Δ | Without | With | Δ | Without | With | Δ | ||
case-01 | fail→fail | 4,834 | 9,856 | +104% | 1 | 1 | 0% | 347 | 5,168 | +1389% | 0 | 0 | — |
case-02 | fail→fail | 9,148 | 10,075 | +10% | 1 | 1 | 0% | 338 | 5,094 | +1407% | 0 | 0 | — |
case-03 | fail→fail | 18,873 | 14,751 | -22% | 1 | 1 | 0% | 220 | 5,001 | +2173% | 0 | 0 | — |
case-04 | fail→fail | 12,316 | 2,826 | -77% | 1 | 1 | 0% | 1,247 | 5,308 | +326% | 0 | 0 | — |
case-05 | fail→pass | 13,995 | 8,267 | -41% | 1 | 1 | 0% | 1,592 | 5,426 | +241% | 0 | 0 | — |
case-10 | fail→pass | 8,062 | 3,360 | -58% | 1 | 1 | 0% | 1,437 | 5,475 | +281% | 0 | 0 | — |
case-06 | pass→pass | 14,858 | 9,100 | -39% | 1 | 1 | 0% | 1,802 | 5,546 | +208% | 0 | 0 | — |
case-07 | fail→pass | 17,145 | 11,192 | -35% | 1 | 1 | 0% | 2,247 | 5,897 | +162% | 0 | 0 | — |
case-08 | fail→pass | 14,674 | 8,075 | -45% | 1 | 1 | 0% | 1,809 | 5,416 | +199% | 0 | 0 | — |
case-09 | fail→pass | 11,933 | 10,688 | -10% | 1 | 1 | 0% | 2,177 | 5,952 | +173% | 0 | 0 | — |
case-11 | fail→pass | 11,573 | 7,234 | -37% | 1 | 1 | 0% | 2,089 | 6,172 | +195% | 0 | 0 | — |
case-12 | fail→pass | 19,067 | 8,268 | -57% | 1 | 1 | 0% | 2,475 | 5,352 | +116% | 0 | 0 | — |
case-13 | pass→pass | 15,617 | 3,975 | -75% | 1 | 1 | 0% | 1,961 | 5,547 | +183% | 0 | 0 | — |
case-14 | pass→pass | 12,592 | 10,595 | -16% | 1 | 1 | 0% | 2,194 | 5,942 | +171% | 0 | 0 | — |
case-15 | fail→pass | 15,922 | 5,892 | -63% | 1 | 1 | 0% | 1,775 | 5,924 | +234% | 0 | 0 | — |
case-16 | pass→pass | 7,564 | 9,374 | +24% | 1 | 1 | 0% | 1,271 | 5,678 | +347% | 0 | 0 | — |
case-17 | fail→pass | 6,009 | 10,009 | +67% | 1 | 1 | 0% | 954 | 5,586 | +486% | 0 | 0 | — |
case-18 | fail→pass | 13,137 | 9,105 | -31% | 1 | 1 | 0% | 1,382 | 5,658 | +309% | 0 | 0 | — |
case-19 | pass→pass | 11,517 | 3,523 | -69% | 1 | 1 | 0% | 1,848 | 5,443 | +195% | 0 | 0 | — |
case-20 | fail→pass | 18,002 | 8,201 | -54% | 1 | 1 | 0% | 2,057 | 5,382 | +162% | 0 | 0 | — |
case-21 | fail→pass | 10,048 | 3,337 | -67% | 1 | 1 | 0% | 1,735 | 5,412 | +212% | 0 | 0 | — |
case-22 | pass→fail | 6,743 | 8,407 | +25% | 1 | 1 | 0% | 696 | 5,222 | +650% | 0 | 0 | — |
case-23 | pass→pass | 13,026 | 14,462 | +11% | 1 | 1 | 0% | 1,594 | 5,811 | +265% | 0 | 0 | — |
case-24 | pass→fail | 7,346 | 7,548 | +3% | 1 | 1 | 0% | 1,500 | 5,146 | +243% | 0 | 0 | — |
DecimalAI ran this skill against gemini-3.6-flash twice over the same eval suite — once with the skill loaded and once without — and compared the two runs case by case. 24 cases were attempted, and 20 counted toward the lift figure. The other 4 produced results that are not comparable between the two arms, so they are excluded from the headline rather than averaged into it. The headline lift of +42 percentage points is the difference between those two pass rates over the 20 comparable cases. 2 cases got worse with the skill loaded, and they are included in that figure.
Without the skill loaded, the model failed this case. With it loaded, the same prompt on the same model passed. This is one improved case from the latest verified run; every case, including any that regressed, is in the table above.
Other measured skills in the registry, with their headline benchmark lift.