safari-applescript
An Agent Skill for driving Safari on macOS through AppleScript: navigation, reading, forms, uploads, downloads with the page's own session, screenshots.
It exists for the jobs a headless browser cannot do — sites where the user is already signed in — and it treats that access with care: its tool works in a dedicated window, refuses to type into password fields without explicit confirmation, can be confined to a list of domains, and never reads cookies or stored passwords.
Contents
| Path | Purpose |
|---|---|
SKILL.md |
Safety rules, the working loop, what is easy to get wrong, limits |
references/how-it-works.md |
Why each technique is needed (pending navigations, framework inputs, results, dialogs) |
references/applescript-recipes.md |
The nine recipes with a typical sequence |
scripts/safari.mjs |
Command-line tool, JSON output, state kept between invocations |
scripts/recipes/*.applescript |
Standalone osascript programs |
scripts/lib/ |
The engine (shared with the safari-mcp server) |
No dependencies beyond Node.js 20+ and macOS's own osascript, screencapture and sips.
Install
skills install @spboucher/safari-applescript --client claude-code # or codex, cursor, generic-agent-skillsTested
On Safari 27.0 / macOS 27.0: every recipe and the whole command-line flow run against a local fixture site (forms with framework-style inputs, shadow DOM, same-origin iframes, late content, dialogs, cookie-protected downloads, uploads), and the test asserts that the user's own windows are unchanged afterwards. Not tested on older Safari or macOS versions.
Limits
macOS and Safari only. Cross-origin iframes, private windows, Reader, in-tab PDFs and browser
settings are out of reach. Synthetic events are not real input. See SKILL.md.