/jxa
Reference for writing JXA (JavaScript for Automation) scripts run through `osascript -l JavaScript`. Covers the JavaScriptCore ES5 constraints, `run(argv)`, and the `Application()` bridge.
$ npx -y skills add bendrucker/claude --skill jxa --agent claude-codeHow it fires
How this skill gets triggered: by you, by Claude, or both.
- Fires itselfAuto-invocation. Claude auto-loads it when your prompt matches the work.Auto-invocation is when the right skill fires by itself at the right moment, driven by a FLOW.md router and a hook, instead of you invoking it by name. It is the difference between a skill being installed and a skill actually getting used.Read the full definition →
- You can call itInvoke it directly when you want it.
- Slash command
/jxa
Context preview
The summary Claude sees to decide when to auto-load this skill.
Reference for writing JXA (JavaScript for Automation) scripts run through `osascript -l JavaScript`. Covers the JavaScriptCore ES5 constraints, `run(argv)`, and the `Application()` bridge.
SKILL.md
jxa.SKILL.mdname: mac:jxa
description: Reference for writing JXA (JavaScript for Automation) scripts run through `osascript -l JavaScript`. Covers the JavaScriptCore ES5 constraints, `run(argv)`, and the `Application()` bridge.
JXA
JavaScript for Automation (JXA) automates macOS apps via the `Application()` bridge. It runs on JavaScriptCore (ES5).
Language Constraints
- Use `var` (not `let`/`const`)
- Use for-loops (JXA arrays lack `.map()`, `.filter()`, `.forEach()`)
- Return a JSON string from `run()` (not an object)
// WRONG: JXA arrays don't have .map()
// var names = app.windows().map(function(w) { return w.name(); });
// CORRECT: use a for-loop
var windows = app.windows();
var names = [];
for (var i = 0; i < windows.length; i++) {
names.push(windows[i].name());
}Script Files
Script files define a `function run(argv)` entry point. `osascript` calls it and prints the return value. The function must be named `run`, not `_run`.
#!/usr/bin/env osascript -l JavaScript
function run(argv) {
var finder = Application("Finder");
var items = finder.desktop.items();
var names = [];
for (var i = 0; i < items.length; i++) {
names.push(items[i].name());
}
return JSON.stringify(names);
}Tips
- Use `properties()` for batch reads instead of individual getters
- Use `.whose()` for filtering when the app supports it (pushes work to the app)
- `Application.currentApplication()` accesses the current app context
- Extract sdef for any app: `sdef /Applications/AppName.app`
Read more
name: mac:jxa description: Reference for writing JXA (JavaScript for Automation) scripts run through `osascript -l JavaScript`. Covers the JavaScriptCore ES5 constraints, `run(argv)`, and the `Application()` bridge.
JXA
JavaScript for Automation (JXA) automates macOS apps via the `Application()` bridge. It runs on JavaScriptCore (ES5).
Language Constraints
- Use `var` (not `let`/`const`)
- Use for-loops (JXA arrays lack `.map()`, `.filter()`, `.forEach()`)
- Return a JSON string from `run()` (not an object)
// WRONG: JXA arrays don't have .map()
// var names = app.windows().map(function(w) { return w.name(); });
// CORRECT: use a for-loop
var windows = app.windows();
var names = [];
for (var i = 0; i < windows.length; i++) {
names.push(windows[i].name());
}Script Files
Script files define a `function run(argv)` entry point. `osascript` calls it and prints the return value. The function must be named `run`, not `_run`.
#!/usr/bin/env osascript -l JavaScript
function run(argv) {
var finder = Application("Finder");
var items = finder.desktop.items();
var names = [];
for (var i = 0; i < items.length; i++) {
names.push(items[i].name());
}
return JSON.stringify(names);
}Tips
- Use `properties()` for batch reads instead of individual getters
- Use `.whose()` for filtering when the app supports it (pushes work to the app)
- `Application.currentApplication()` accesses the current app context
- Extract sdef for any app: `sdef /Applications/AppName.app`
My personal plugin marketplace for Claude Code, Anthropic's AI coding assistant.
Repo: bendrucker/claude
Other skills on bendrucker-claude.
cleye
Type-safe CLI argument parsing with cleye, the standard parser for this repo's Bun scripts. Use when writing or editing any script that takes arguments (flags,…
activity
Report real device usage from ActivityWatch. Covers per-app time, window titles, and active vs idle spans. Use when asked "what apps did I use", "how long was…
history
Report shell history from atuin's local capture. Covers what commands ran, when, where, and how they exited. Use when asked "what commands did I run", "what…
bun
Bun runtime patterns. Use when running bun commands, working with package.json/bun.lock, writing TypeScript scripts under Bun, or developing Claude Code…
agent-team
Orchestrating Claude Code agent teams. Use when creating teams, spawning teammates, assigning tasks, configuring teammate modes, or setting up team quality…

