Skip to content
alyn
davidondrej

Anti Sleep skill

Keep a Mac awake for a set duration or while a process runs. Use only when the user explicitly invokes /anti-sleep.

$npx skills add davidondrej/skills --skill anti-sleep
View this skill on GitHubdavidondrej/skills/skills/anti-sleep/SKILL.md
Pack stars
4,291
Pack installs
10k
Alyn Score
63/99
Updated
2 h ago
License
MIT
– views – installs via Alyn

davidondrej

Anti Sleep

Install Anti Sleep

Pick your agent. Every command is ready to paste.

$npx skills add davidondrej/skills --skill anti-sleep

The open skills CLI detects your agents (Claude Code, Cursor, Codex and 70+ more) and installs to the right folder. Add -g to install globally.

01

Install it

Run the command above, or upload the folder in Claude.

02

Ask naturally

Describe the task. Your agent loads anti-sleep when the request matches its description.

03

Name it if needed

If it does not trigger, say “use the anti-sleep skill”. In Codex, type $anti-sleep.

The skill itself

SKILL.md

FolderGitHub

Anti-Sleep (macOS caffeinate)

Use the bundled launcher from this skill directory. It creates a one-shot user LaunchAgent using only built-in macOS tools.

Required workflow

Never launch caffeinate with raw &, nohup, disown, or launchctl submit. Temporary execution shells can kill their descendants, and launchctl submit can restart a timed job.

Resolve scripts/anti-sleep.sh relative to this SKILL.md; never assume the user's current directory. Run:

  1. Inspect current state:
scripts/anti-sleep.sh status
  1. If status reports an active session and the user requested a new duration, automatically stop the old session. Never ask for confirmation.
scripts/anti-sleep.sh stop
  1. Start the new timer for the requested duration:
scripts/anti-sleep.sh start 10800    # 3 hours

For a specific process, use start-pid. Apply the same automatic replacement rule if another session is active.

scripts/anti-sleep.sh start-pid <PID>
  1. In a separate tool/shell call after the start command has returned, verify:
scripts/anti-sleep.sh verify

Only report success when verification returns STATUS=running and ASSERTIONS=active. Confirm the PID, flags, and wall-clock expiry. If verification fails, run stop and do not claim the Mac is protected.

Assertion flags

The default is -d -i: keep the display on and prevent idle system sleep. Pass explicit flags after the duration or PID when needed:

Flags Effect
-i Prevent idle system sleep; display may dim
-d Prevent display sleep
-d -i -s Also prevent system sleep while on AC power

None of these stop sleep when the lid closes. For agent runs that must survive a closed lid, see Keep Claude Code running when your laptop is closed.

Example:

scripts/anti-sleep.sh start 10800 -i

Status and stop

scripts/anti-sleep.sh status
scripts/anti-sleep.sh stop

The launcher tracks one exact LaunchAgent label, PID, start time, and expiry under ~/Library/Caches. It never uses broad pkill.

Fallback

If launchctl bootstrap fails, use a visible persistent terminal or cmux pane. Read the cmux skill before interacting with cmux. If no persistent surface is available, tell the user instead of starting an unreliable background job.

caffeinate cannot keep the keyboard backlight on. That setting is manual: System Settings → Keyboard → “Turn keyboard backlight off after inactivity” → Never.

Tips for Anti Sleep

  • • Start a fresh session after installing so your agent picks up the new skill.
  • • This skill ships scripts. Read them before the first run, and run it in a project without secrets first.
  • • It is part of a pack with 30 skills. Install only the ones you need with --skill to keep triggers precise.
  • • If two skills overlap, mention the one you want by name.

Questions about Anti Sleep

What does the Anti Sleep skill do?

Keep a Mac awake for a set duration or while a process runs. Use only when the user explicitly invokes /anti-sleep.

How do I install Anti Sleep?

Run "npx skills add davidondrej/skills --skill anti-sleep" in your project. The skills CLI installs it for Claude Code, Cursor, Codex and 70+ other agents. In Claude on the web, upload the skill folder as a ZIP under Customize > Skills.

Does Anti Sleep work in Cursor and Codex?

Yes. Anti Sleep uses the open SKILL.md format, so it works in Claude Code, Claude, Cursor, OpenAI Codex, Gemini CLI, GitHub Copilot and other agents that support agent skills.

Is Anti Sleep free?

Anti Sleep is open source on GitHub under the MIT license. It is free to install; check the license before commercial use.

Who made Anti Sleep?

Anti Sleep is published by davidondrej in the davidondrej/skills repository, together with 29 other skills.

Similar skills. From other creators.