This skill should be used when automating macOS with Hammerspoon, configuring window management hotkeys, working with Spoons (plugins), writing Lua configuration in init.lua, or using the hs CLI for scripting and reloading.
View on GitHubplinde/claude-plugins
hammerspoon
January 14, 2026
Select agents to install to:
npx add-skill https://github.com/plinde/claude-plugins/blob/main/hammerspoon/skills/hammerspoon/SKILL.md -a claude-code --skill hammerspoonInstallation paths:
.claude/skills/hammerspoon/# Hammerspoon macOS Automation
Hammerspoon bridges macOS and Lua scripting for powerful desktop automation.
## Directory Structure
```
~/.hammerspoon/
├── init.lua # Main entry point (always loaded on startup)
├── Spoons/ # Plugin directory
│ └── *.spoon/ # Individual Spoon packages
│ └── init.lua # Spoon entry point
└── .gitignore
```
## Configuration Basics
### init.lua - Entry Point
Hammerspoon always loads `~/.hammerspoon/init.lua` on startup:
```lua
-- Enable CLI support (required for hs command)
require("hs.ipc")
-- Load a Spoon
hs.loadSpoon("SpoonName")
-- Configure the Spoon
spoon.SpoonName:bindHotkeys({...})
```
### Loading Spoons
```lua
-- Load and auto-init (default)
hs.loadSpoon("MySpoon")
-- Load without global namespace
local mySpoon = hs.loadSpoon("MySpoon", false)
```
When loaded, Spoons are accessible via `spoon.SpoonName`.
## CLI Usage (hs command)
**Prerequisite:** Add `require("hs.ipc")` to init.lua, then reload manually once.
```bash
# Reload configuration
hs -c 'hs.reload()'
# Show alert on screen
hs -c 'hs.alert("Hello from CLI")'
# Run any Lua code
hs -c 'print(hs.host.locale.current())'
# Get focused window info
hs -c 'print(hs.window.focusedWindow():title())'
```
## Window Management with ShiftIt
ShiftIt is a popular Spoon for window tiling.
### Installation
```bash
# Download from https://github.com/peterklijn/hammerspoon-shiftit
# Extract to ~/.hammerspoon/Spoons/ShiftIt.spoon/
```
### Configuration
```lua
require("hs.ipc")
hs.loadSpoon("ShiftIt")
spoon.ShiftIt:bindHotkeys({
-- Halves
left = { { 'ctrl', 'cmd' }, 'left' },
right = { { 'ctrl', 'cmd' }, 'right' },
up = { { 'ctrl', 'cmd' }, 'up' },
down = { { 'ctrl', 'cmd' }, 'down' },
-- Quarters
upleft = { { 'ctrl', 'cmd' }, '1' },
upright = { { 'ctrl', 'cmd' }, '2' },
botleft = { { 'ctrl', 'cmd' }, '3' },
botright = { { 'ctrl', 'cmd' }, '4' },
-- Other
maximum = { {