From superclaw
Full macOS automation via Peekaboo and AppleScript - screenshots, UI interaction, app control
How this skill is triggered — by the user, by Claude, or both
Slash command
/superclaw:mac-controlThis skill is limited to the following tools:
The summary Claude sees in its skill listing — used to decide when to auto-load this skill
<Purpose>
<Use_When>
<Do_Not_Use_When>
<Why_This_Exists> Claude Code operates in a terminal but many tasks require interacting with the macOS GUI: verifying a web app looks correct in Safari, filling out system preference dialogs, taking annotated screenshots for documentation, reading text from images, or automating repetitive GUI workflows. Without this skill, users must manually perform these visual tasks and describe results back to Claude. With it, Claude can see, understand, and interact with the full macOS desktop autonomously. </Why_This_Exists>
<Execution_Policy>
Phase 2 - Screenshot Current State: Capture the screen to understand the visual layout
sc_screenshot with optional window parameter for specific appPhase 3 - Map UI Elements: Inspect accessible UI elements for precise targeting
sc_see with optional app parameter[element_id] role: title @ (x,y wxh)Phase 4 - Execute Action: Perform the requested UI interaction
sc_click with element (ID from sc_see) OR x/y coordinatessc_type with text string (types at current cursor position)sc_hotkey with keys string (e.g., "cmd+c", "cmd+shift+s")sc_ocr with optional window to extract text from screensc_osascript with script and optional language ("applescript"|"jxa")sc_notify with title and message for macOS notification centerPhase 5 - App & Window Management: Control application lifecycle and window layout
sc_app_launch with app name (e.g., "Safari", "Terminal")sc_app_quit with app namesc_app_list (no params, returns app name list)sc_app_frontmost (no params, returns focused app name)sc_window_list with app name -> returns indexed window list with positions/sizessc_window_move with app, x, y, optional windowIndexsc_window_resize with app, width, height, optional windowIndexPhase 6 - Verify Result: Confirm the action succeeded
sc_screenshotsc_ocr to verify text appeared/changed as expectedPhase 7 - Report Outcome: Inform the user what was done
<Tool_Usage> Visual Inspection (3 tools):
sc_screenshot -- Capture screen or window; params: window (optional string), format (optional "png"|"jpg"). Returns file path and OCR textsc_see -- Inspect UI element tree via accessibility API; params: app (optional string). Returns element IDs, roles, titles, frame coordinatessc_ocr -- Extract text from screen region; params: window (optional string). Returns recognized text stringInput (3 tools):
sc_click -- Click element or position; params: element (optional string, ID from sc_see), x (optional number), y (optional number). Provide element OR x+ysc_type -- Type text at cursor; params: text (string). Types the full string at current cursor positionsc_hotkey -- Press keyboard shortcut; params: keys (string, e.g. "cmd+c", "cmd+shift+s", "ctrl+alt+delete")App Lifecycle (4 tools):
sc_app_launch -- Launch/activate app; params: app (string, e.g. "Safari")sc_app_quit -- Quit app; params: app (string)sc_app_list -- List running apps; no params. Returns newline-separated app namessc_app_frontmost -- Get focused app; no params. Returns single app name stringWindow Management (3 tools):
sc_window_list -- List app windows; params: app (string). Returns indexed list with name, position, sizesc_window_move -- Move window; params: app (string), x (number), y (number), windowIndex (optional number, default 0)sc_window_resize -- Resize window; params: app (string), width (number), height (number), windowIndex (optional number, default 0)System (2 tools):
sc_osascript -- Execute AppleScript or JXA; params: script (string), language (optional "applescript"|"jxa")sc_notify -- Send macOS notification; params: title (string), message (string)
</Tool_Usage><Escalation_And_Stop_Conditions>
<Final_Checklist>
Peekaboo must be installed and accessible:
# Check if Peekaboo is installed
which peekaboo || brew install peekaboo
# Verify accessibility permissions
peekaboo check-permissions
Required macOS permissions (System Settings > Privacy & Security):
| Problem | Cause | Fix |
|---|---|---|
| sc_see returns empty | No accessibility permission | Grant in System Settings > Privacy > Accessibility |
| sc_screenshot is blank | No screen recording permission | Grant in System Settings > Privacy > Screen Recording |
| sc_click does nothing | Wrong element ID or stale state | Re-run sc_see to refresh element tree, then retry |
| sc_osascript permission error | Automation not allowed | Grant in System Settings > Privacy > Automation |
| sc_app_launch fails | App not installed or wrong name | Use exact app name from /Applications (e.g., "Google Chrome" not "Chrome") |
| Coordinates are wrong | Retina display scaling | Peekaboo handles scaling automatically; if issues persist, check display arrangement in System Settings |
Navigate to URL in Safari:
1. sc_app_launch(app="Safari")
2. sc_hotkey(keys="cmd+l") -- Focus address bar
3. sc_type(text="https://example.com")
4. sc_hotkey(keys="return") -- Navigate
5. Wait 2s for page load
6. sc_screenshot(window="Safari") -- Verify page loaded
Fill a form:
1. sc_see(app="TargetApp") -- Map all form fields
2. sc_click(element="field-1-id") -- Focus first field
3. sc_type(text="value1")
4. sc_hotkey(keys="tab") -- Move to next field
5. sc_type(text="value2")
6. sc_click(element="submit-id") -- Submit
Multi-monitor window arrangement:
1. sc_window_list(app="AppName") -- Get current positions
2. sc_window_move(app="AppName", x=1920, y=0) -- Move to second display
3. sc_window_resize(app="AppName", width=1920, height=1080)
Clipboard operations via AppleScript:
sc_osascript(script='set the clipboard to "copied text"')
sc_osascript(script='return the clipboard')
System information via AppleScript:
sc_osascript(script='do shell script "sw_vers -productVersion"')
sc_osascript(script='tell application "System Events" to get name of every process whose background only is false')
npx claudepluginhub jaminitachi/superclaw --plugin superclawControls macOS GUI applications via mouse automation, keyboard input, screenshots, image recognition, and AppleScript execution.
Automates macOS apps via Apple Events using AppleScript (discovery), JXA (legacy), and PyXA (modern Python). Use when asked to "automate Mac apps", "write AppleScript", "JXA scripting", "osascript automation", or "PyXA Python automation". Foundation skill for all macOS app automation.
Automates macOS desktop testing with Hammerspoon: launch/control apps, manage windows, simulate keyboard/mouse input, and take screenshots.