applescript

A macOS automation skill for AppleScript and JavaScript for Automation (JXA), two scripting systems that control apps and system actions.

In plain words
What is it for?
Use it to control apps such as Finder and Safari, inspect windows, click interface elements, and open or retrieve files.
Why use it?
It helps turn repeated Mac tasks into scripts instead of performing them manually.

Skill for Claude CodeCodex

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add skills/dannote/dot-pi/applescript
Any agent
npx skills add dannote/dot-pi --skill applescript
Clone the repo
git clone --depth 1 https://github.com/dannote/dot-pi

Made for: Claude Code, Codex.

Per session 39 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 1,098 The whole file, excluding the scripts and references it only reads on demand.
Security scan B 1 finding. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5 $0.00039 $0.01098
Opus 5 $0.00019 $0.00549
Sonnet 5 $0.00008 $0.00220
Haiku 4.5 $0.00004 $0.00110

Measured 2d ago against content hash 269083ad248f, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade B, and why

applescript scanned grade B with 1 finding against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 2d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Unrestricted tool accessmediumExcessive agency

A wildcard tool grant or "run any command" leaves no least-privilege boundary at all.

- Terminal, iTerm (can execute arbitrary commands)
skills/applescript/SKILL.md · 195 lines

How it starts

The opening of the file, as written. The whole thing — 195 lines — stays where its author put it; the contents beside it link to each section on GitHub.

AppleScript & JXA Automation

Expert in AppleScript and JavaScript for Automation (JXA) for macOS system scripting.

Execution Methods

# AppleScript one-liner
osascript -e 'tell application "Finder" to activate'

# AppleScript file
osascript script.scpt

# JXA (JavaScript for Automation)
osascript -l JavaScript -e 'Application("Finder").activate()'

# Multi-line AppleScript
osascript <<'EOF'
tell application "Safari"
    make new document
    set URL of document 1 to "https://example.com"
end tell
EOF

Common Patterns

Application Control

-- Activate app
tell application "Safari" to activate

-- Get frontmost app
tell application "System Events" to get name of first process whose frontmost is true

-- List windows
tell application "System Events"
    tell process "Safari"
        get name of every window
    end tell
end tell

-- Click UI elements
tell application "System Events"
    tell process "Safari"
        click button 1 of window 1
    end tell
end tell

File Operations

-- Open file
tell application "Finder"
    open file "Macintosh HD:Users:user:file.txt"
end tell

-- Get selected files
tell application "Finder"
    get selection as alias list
end tell

-- Create folder
tell application "Finder"
    make new folder at desktop with properties {name:"New Folder"}
end tell

Notifications & Dialogs

-- Display notification
display notification "Task complete" with title "Script" sound name "default"

-- Dialog with buttons
display dialog "Continue?" buttons {"Cancel", "OK"} default button "OK"

-- Choose file
choose file with prompt "Select a file:"

-- Choose folder
choose folder with prompt "Select a folder:"

Shell Integration

-- Run shell command (use quoted form for safety!)
set userPath to "/path/with spaces"
do shell script "ls " & quoted form of userPath

-- Get command output
set result to do shell script "date '+%Y-%m-%d'"

-- Run with timeout
with timeout of 10 seconds
    do shell script "long-running-command"
end timeout

Read the full file on GitHub · 195 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 2d ago First seen · 195 lines · 39 tokens per session scan B 269083ad248f

Subscribe to this mod's changes

applescript is a skill published in the GitHub repository dannote/dot-pi (51 stars, last pushed 2d ago), licensed MIT. It adds 39 tokens to every session and 1,098 once invoked, about $0.0002 per session on Opus 5. A static security scan graded it B with 1 finding (unrestricted tool access). No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.

Related

Other skills, from other repositories

anycap-ai-tool-seo

Guide for planning and auditing SEO for AI tool, SaaS, and product-led websites. Powered by AnyCap -- the capability runtime that equips AI agents with web search and web crawl through a single CLI. Use when Codex needs to define SEO ICPs, map search intent to page types, inspect live SERPs, write page briefs for…

anycap-ai/anycap · 151 tokens

anycap-worldcup-predict

World Cup match prediction and pre-match intel for football (soccer) fans: predict who will win and a likely scoreline, backed by structured, verifiable evidence -- player profiles, squad dossiers, current form, head-to-head records, and past-tournament history -- using AnyCap web search and crawl. Weighs FIFA…

anycap-ai/anycap · 275 tokens

anycap-deepresearch

Guide for conducting thorough, multi-source research and producing comprehensive, well-sourced reports. Powered by AnyCap -- the capability runtime that equips AI agents with web search (including AI Grounded citations), web crawl, image generation, cloud storage, and one-click web publishing through a single CLI. Use…

anycap-ai/anycap · 178 tokens

anycap-cli

AnyCap CLI -- create media humans can see and hear (generate images, video, music, and audio), understand media humans share (analyze images, video, audio), access the web (search, crawl), and deliver results humans can use (Drive for shareable file links, Page for hosted web pages). Use whenever a task involves…

anycap-ai/anycap · 169 tokens

pseudo-agentic-automation

Run an authorized browser or native-GUI workflow that requires runtime observation and adaptive interaction rather than a deterministic API, shell command, or existing test runner. Use for dynamic authenticated flows, browser extraction, or native GUI control; exclude ordinary Playwright test execution and…

matt-bat/agent-command-center · 62 tokens

effective-testing-methods

Design, add, or amend tests for changed behavior with surface-appropriate coverage. Use when test design or test-file changes are part of the task; do not activate merely to run an existing test command, and use Playwright only when a browser-visible flow changed.

matt-bat/agent-command-center · 58 tokens