hammerspoon
Skill2 starsChanged 2 months agoMITView on GitHub
Operate macOS via Hammerspoon, either one-off `hs -c` Lua (launch, quit, or focus apps and browser tabs; volume, wifi, caffeinate, alerts, clipboard) or persistent hotkeys, watchers, and menubar items in ~/.hammerspoon. Use when asked to control an app, tab, or Mac system state, keep the Mac awake, or write a Hammerspoon module. Not for web page content.
In this repository27 other files it gives its agents.
- agent-guardrailsSkill
- benchmark-checklistSkill
- blast-radiusSkill
- blog-reviewSkill
- code-reviewSkill
- create-verification-skillSkill
- datavizSkill
- grill-meSkill
- grok-repoSkill
- html-lessonSkill
- karpathy-planningSkill
- mechanism-vizSkill
- obsidian-captureSkill
- obsidian-searchSkill
- paper-searchSkill
- readbackSkill
- repo-evalSkill
- route-skillSkill
- sherlockSkill
- show-meSkill
- sketch-conceptSkill
- skill-curatorSkill
- test-writingSkill
- tla-modelSkill
- web-recapSkill
- write-docsSkill
- write-skillSkill
The file
We split this skill into the rules it gives an agent
3 rules. About 0 are common, 0 are distinctive, and 3 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈0
Distinctive · estimate
This author's own choices. Worth a look.
3
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 39
Verify after save: hs -q -c 'return "alive"' (reload takes ~1-2s), then check for load errors with hs -q -c 'return …
- Very specific: line 43
Prefer :kill() (graceful quit) over :kill9().
- Very specific: line 44
Never open modal dialogs (hs.dialog) or trigger alerts in other apps — they block event processing.
≈ “Common” is an estimate: at least 1 in 5 of the 350,495 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
hammerspoon
Host scope: mini/macOS. Keep this skill disabled on joi/Linux; shared source may remain in the repository. Do not sync activation links between hosts or switch to SSH merely because the local host lacks Hammerspoon. Remote actions follow the session's host-authorization policy.
One-off action = one hs -q -c '<lua>' call. Lasting behavior (hotkeys, watchers, menubar) = a module in ~/.hammerspoon/. Recipes: REFERENCE.md.
Readiness
hs -q -c 'return "ok"' must print ok. If not:
- exit 69 / "can't access message port" → Hammerspoon not running (
open -a Hammerspoon) orhs.ipcnot loaded → ensurerequire("hs.ipc")is in~/.hammerspoon/init.lua; the pathwatcher auto-reloads config, retry after ~2s. hsbinary missing → tell the user to runhs.ipc.cliInstall("/opt/homebrew")in the Hammerspoon console.- Window/app calls silently no-op →
hs -c 'return hs.accessibilityState()'must be true; if false, user grants it in System Settings → Privacy & Security → Accessibility.
One-off mode
hs -q -c 'hs.application.launchOrFocus("Obsidian") return "ok"'
hs -q -t 15 -c '<anything touching AppleScript or many windows>' # default IPC timeout is 4s; busy main loop can also cause one-off "receive timeout" — retryreturnthe final value or you get no output; tables print as addresses —return hs.json.encode(tbl)(hs.geometryrects need.table; NaN values make encode silently return nil —tostring()is the safe fallback).- Single-quote the shell argument, double quotes inside Lua. Multiline: heredoc
hs -q <<'EOF' ... EOForhs -q /path/file.lua(path must start with~,./, or/). - Exit codes: 65 = Lua error (message on stderr), 69 = not running / ipc missing.
- One-shot state dies: timers, watchers, and callbacks created via
hs -care GC'd after the call and never fire — anything that must persist or fire later is persistent mode. - Sequencing: async state (focus change, tab load) won't settle inside one chunk, and
hs.timer.usleepblocks Hammerspoon itself. Act in one call,sleepin the shell, read state in the next call.
Persistent mode
For hotkeys/watchers/menubar items: write ~/.hammerspoon/<name>.lua, add require("<name>") to ~/.hammerspoon/init.lua. Read ~/.hammerspoon/AGENTS.md first — it has the house conventions.
- Anchor timers/watchers/menubar objects in globals or module-level vars, or GC destroys them silently.
- The pathwatcher reloads config on every file save — write complete files (Write, not incremental edits), and expect
hs.reload()to wipe all interactive globals. - Verify after save:
hs -q -c 'return "alive"'(reload takes ~1-2s), then check for load errors withhs -q -c 'return hs.console.getConsole()' | tail -20.
Safety
- Prefer
:kill()(graceful quit) over:kill9(); confirm with the user before quitting apps that may hold unsaved work. - Never open modal dialogs (
hs.dialog) or trigger alerts in other apps — they block event processing. hs.executeblocks Hammerspoon's main loop (freezes all its hotkeys/menubar); prefer running shell commands directly, orhs.taskfrom a module.hs.eventtap.keyStrokes/clicks go to whatever is focused — only use when the user asked for exactly that.
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.

