night-duty
Skill3 starsChanged 7 months agoMITView on GitHub
Use when someone says 'night duty', 'caffeinate', or 'blind'. Keeps Mac awake or dims screen to zero.
In this repository5 other files it gives its agents.
- morning-coffeeSkill
- progressSkill
- pulse-checkSkill
- brainSkill
- zenSkill
The file
We split this skill into the rules it gives an agent
9 rules. About 0 are common, 8 are distinctive, and 1 is very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈8
Distinctive · estimate
This author's own choices. Worth a look.
1
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 16
If the message contains "caffeinate" (and NOT "night duty") → run Caffeinate Mode directly
- Distinctive: line 17
If the message contains "blind" (and NOT "night duty") → run Blind Mode directly
- Distinctive: line 18
If the message contains "night duty" → run Night Duty Mode (interactive)
- Distinctive: line 22
Run this bash command in the background:
- Very specific: line 34
Use run_in_background: true on the Bash tool so it doesn't block.
- Distinctive: line 72
Ask the user: "Night duty activated.
- Distinctive: line 79
Run caffeinate with the blind-aware watcher:
- Distinctive: line 96
If the user says "stop caffeinate", "kill caffeinate", or "stop night duty":
- Distinctive: line 113
Do NOT ask for confirmation before running bash commands — just execute
≈ “Common” is an estimate: at least 1 in 5 of the 408,460 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
What This Skill Does
Mac utility skill with three modes:
- caffeinate — keeps the Mac awake indefinitely (prevents sleep)
- blind — dims screen to zero, say "restore" to bring it back to ~50%. Keyboard backlight must be dimmed manually (F5 key)
- night duty — asks which of the two (or both) and executes
Detecting the Mode
Determine mode from the user's message:
- If the message contains "caffeinate" (and NOT "night duty") → run Caffeinate Mode directly
- If the message contains "blind" (and NOT "night duty") → run Blind Mode directly
- If the message contains "night duty" → run Night Duty Mode (interactive)
Caffeinate Mode
Run this bash command in the background:
caffeinate -dis &
CAFFEINE_PID=$!
echo $CAFFEINE_PID > /tmp/caffeinate.pid
# Start hourly watcher (no --wait-blind since this is caffeinate-only)
nohup /Users/sarthak/Claude/.claude/scripts/night-duty/watcher.sh > /dev/null 2>&1 &
echo $! > /tmp/night-duty-watcher.pid
echo "Caffeinate running (PID: $CAFFEINE_PID). Hourly reminders active."Use run_in_background: true on the Bash tool so it doesn't block.
Tell the user:
- Mac will stay awake until they say "stop caffeinate" or "kill caffeinate"
- They'll get a macOS notification every hour as a reminder
Blind Mode
Two-step process: dim now, restore when user says "restore".
Step 1 — Dim screen:
osascript -e '
tell application "System Events"
repeat 50 times
key code 145
delay 0.03
end repeat
end tell' && touch /tmp/night-duty-blind && echo "Screen dimmed to zero."Tell the user: "Screen dimmed. Dim your keyboard manually (F5 key). Say 'restore' when you want brightness back."
Step 2 — Restore (when user says "restore", "unblind", or "lights on"):
osascript -e '
tell application "System Events"
repeat 8 times
key code 144
delay 0.05
end repeat
end tell' && rm -f /tmp/night-duty-blind && echo "Brightness restored to ~50%."Night Duty Mode (Interactive)
Ask the user: "Night duty activated. What do you need?"
- Caffeinate — keep Mac awake
- Blind — dim screen to zero
- Both — caffeinate + blind
Then execute the chosen mode(s). If both:
- Run caffeinate with the blind-aware watcher:
caffeinate -dis &
CAFFEINE_PID=$!
echo $CAFFEINE_PID > /tmp/caffeinate.pid
touch /tmp/night-duty-blind
# Start watcher in --wait-blind mode (waits for keypress restore before counting hours)
nohup /Users/sarthak/Claude/.claude/scripts/night-duty/watcher.sh --wait-blind > /dev/null 2>&1 &
echo $! > /tmp/night-duty-watcher.pid
echo "Caffeinate running (PID: $CAFFEINE_PID). Hourly reminders start after screen restores."- Then run blind mode (the
rm -f /tmp/night-duty-blindin the restore step signals the watcher to start counting).
Stopping Caffeinate
If the user says "stop caffeinate", "kill caffeinate", or "stop night duty":
kill $(cat /tmp/caffeinate.pid) 2>/dev/null && rm -f /tmp/caffeinate.pid
kill $(cat /tmp/night-duty-watcher.pid) 2>/dev/null && rm -f /tmp/night-duty-watcher.pid
rm -f /tmp/night-duty-blind
echo "Night duty fully stopped."Notes
- Key code 145 = screen brightness down, key code 144 = screen brightness up (macOS system keys)
- 50 repeats for dimming ensures we hit absolute zero from any starting brightness
- 8 repeats for screen restore brings it to ~50% — user can adjust from there
- Keyboard backlight cannot be controlled programmatically on this Mac — user must dim manually via F5 key
- caffeinate flags: -d (prevent display sleep), -i (prevent idle sleep), -s (prevent system sleep)
- Blind mode is two-step: dim immediately, restore when user says "restore"/"unblind"/"lights on"
- Do NOT ask for confirmation before running bash commands — just execute
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

