nakaokarei/swiftautogui/macos-control
Claude Code and agent skill by nakaokarei/swiftautogui
- community
Checking that the SKILL.md file is still in the repository.
Control macOS GUI applications via mouse automation, keyboard input, screenshots, image recognition, and AppleScript execution. Use when you need to interact with macOS app UIs, take screenshots, click buttons, type text, scroll, drag, or locate images on screen.
Install
npx vskill@latest install nakaokarei/swiftautogui/macos-controlSKILL.md
macos-control
The sagui CLI provides mouse control, keyboard input, screenshot capture, image recognition, and screen queries for macOS automation.
Preflight: ensure sagui is installed
Before issuing any sagui command, run:
If the command prints a path, you're ready — continue to the sections below.
If it prints nothing (exit code 1), sagui is not installed. Stop and ask the user for permission to install it before doing anything else. Show them these options and wait for confirmation:
Recommended — Homebrew:
Fallback — build from source (requires Xcode / Swift 6.2+ toolchain; verify with swift --version):
After install, re-run command -v sagui to confirm the binary is reachable, then continue.
Permissions
The first time sagui issues an event or screenshot, macOS will prompt for these permissions. Without them, commands silently fail or return blank screenshots.
- Accessibility — required for
sagui keyandsagui mouse. Enable in System Settings → Privacy & Security → Accessibility for the app running Claude Code (Terminal.app, iTerm, etc.). - Screen Recording — required for
sagui screen screenshot,sagui screen pixel, andsagui screen locate*. Enable in System Settings → Privacy & Security → Screen Recording for the same app.
If a command unexpectedly fails or returns empty output, ask the user to verify both permissions are granted to their terminal app.
This skill is macOS-only — sagui builds on CoreGraphics. On other platforms, tell the user the skill cannot run and stop.
Coordinates
All coordinates use CGWindow coordinate system — logical points with origin at the top-left of the primary display.
- x increases to the right
- y increases downward
- Values are in logical points (not pixels)
Use sagui screen size to get screen dimensions.
Commands
key — Simulate keyboard input
| Subcommand | Arguments | Optional | |
|---|---|---|---|
shortcut | <keys...> (key names) | ||
down | <key> | ||
up | <key> | ||
type | <text> | --interval <seconds> (default: 0) | |
list |
Supported key names
Modifiers: command, shift, rightShift, control, rightControl, option, rightOption, capsLock, function
Letters: a-z
Numbers: zero-nine
Function keys: f1-f20
Arrow keys: upArrow, downArrow, leftArrow, rightArrow
Navigation: home, end, pageUp, pageDown, help
Special: return, returnKey, enter, tab, space, escape, backspace, delete, forwardDelete
Keypad: keypad0-keypad9, keypadDecimal, keypadMultiply, keypadPlus, keypadMinus, keypadDivide, keypadEnter, keypadClear, keypadEquals
Media: volumeUp, volumeDown, mute, brightnessUp, brightnessDown
JIS: jisYen, jisUnderscore, jisEisu, jisKana
mouse — Control mouse cursor
Coordinates are screen points (origin top-left).
| Subcommand | Required | Optional | |
|---|---|---|---|
position | |||
move | --x, --y | ||
move-relative | --dx, --dy | ||
click | --x <point> and --y <point>, --right, --double, --triple | ||
drag | --from-x, --from-y, --to-x, --to-y | ||
scroll | --vertical <clicks>, --horizontal <clicks> |
screen — Screenshots and screen queries
| Subcommand | Required | Optional | |
|---|---|---|---|
size | |||
screenshot | --output <path> (default: screenshot.png), --region <x,y,w,h> | ||
pixel | --x, --y | ||
locate | <image-path> | --confidence <0.0-1.0> | |
locate-center | <image-path> | --confidence <0.0-1.0> |
Image recognition uses Metal-accelerated normalized cross-correlation. Default confidence threshold is 0.95. Lower it for fuzzy matching.
agent — AI-powered automation
| Required | Optional | |||||
|---|---|---|---|---|---|---|
<goal> (string) | --api-key <key> (or OPENAI_API_KEY env), --model <model> (default: gpt-5.6-sol), `--provider <on-device | pcc | openai> (default: on-device), --fallback-on-device (opt-in), --vision-mode <always | automatic | never> (default: always), --max-iterations <n> (default: 20), --delay <seconds> (default: 1.0), --no-screen-context` |
The command prints the selected provider at startup and a concise Reasoning: summary for every step. This summary explains the selected actions; it is not the model's hidden chain of thought.
Workflow
Screenshot + mouse/keyboard interaction
sagui screen size— get screen dimensions.sagui screen screenshot --output /tmp/screen.png— capture current state.- Read the screenshot image to identify target coordinates.
sagui mouse click --x <x> --y <y>— interact at the identified position.sagui key type "text"orsagui key shortcut command a— keyboard input.sagui screen screenshot --output /tmp/verify.png— verify result.
Image-based interaction
sagui screen locate-center target.png— find element position.sagui mouse click --x <x> --y <y>— click the found coordinates atomically.
Notes
- All mouse and keyboard commands require Accessibility permissions.
- Use
sagui --versionwhen reporting issues or checking a CI environment. - Screenshot and image recognition commands require Screen Recording permissions.
key typesupports any Unicode character. Usekey shortcutwith modifier keys for keyboard shortcuts.- Scroll: positive vertical = up, negative = down; positive horizontal = left, negative = right.
- Image recognition confidence defaults to 0.95; lower for fuzzy matching (e.g., 0.8).
- Supported screenshot formats: PNG, JPG/JPEG, GIF, BMP, TIFF (detected from file extension).
Security
- Security scanPassed, 100 of 100Pattern checks on the skill's files.
- Model reviewPassed
Quality evaluation
- Task evaluationNot runNo evaluation yet. Run one in Skill Studio.
Source
- SKILL.md in the repositoryCheckingplugins/swift-auto-gui/skills/macos-control/SKILL.md
Popularity
- Repository stars
- 95
- Repository forks
- 10
- 7-day trend score
- 23
Stars and forks are for the whole GitHub repository, not this skill alone. Not refreshed yet.
Works with
Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.
- Claude Code
- Cursor
- GitHub Copilot
- Windsurf
- Codex
- Gemini CLI
- Cline
- Amp
- Roo Code
- Goose
- Continue
- Kilo Code
- Junie
- Trae
- OpenHands
- Qwen Code
- AI Agent
- Tabnine Chat
- Sourcegraph Cody
- Amazon Q
- Firebase Genkit
- Sweep
- Devin
- Phind
- Mentat
- Claude Desktop
- Aider
- GPT Pilot
- Plandex
- bolt.new
- v0
- Replit Agent
- Anse
- TypingMind
- BetterChatGPT
- LibreChat
- Warp AI
- Pieces
- Fig AI
Embed badge
[](https://verified-skill.com/skills/nakaokarei/swiftautogui/macos-control)