Back to Skills

hammerspoon

verified

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 GitHub

Marketplace

plinde-plugins

plinde/claude-plugins

Plugin

hammerspoon

automation

Repository

plinde/claude-plugins
4stars

hammerspoon/skills/hammerspoon/SKILL.md

Last Verified

January 14, 2026

Install Skill

Select agents to install to:

Scope:
npx add-skill https://github.com/plinde/claude-plugins/blob/main/hammerspoon/skills/hammerspoon/SKILL.md -a claude-code --skill hammerspoon

Installation paths:

Claude
.claude/skills/hammerspoon/
Powered by add-skill CLI

Instructions

# 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 = { { 

Validation Details

Front Matter
Required Fields
Valid Name Format
Valid Description
Has Sections
Allowed Tools
Instruction Length:
6086 chars