Setup
On first use, follow setup.md to configure activation and safety preferences.
Setup review is read-only.
Any local file creation or modification requires explicit user confirmation.
When to Use
User needs AppleScript automation on macOS for app control, data extraction, or scripted UI actions.
Agent handles script design, safe execution with osascript, output parsing, and troubleshooting.
Requirements
- - macOS with
osascript available. - Target app installed and scriptable when app automation is requested.
- Explicit user confirmation before destructive operations.
Architecture
Memory lives in ~/applescript/. See memory-template.md for structure.
CODEBLOCK0
Quick Reference
Use these files only when the current request needs deeper detail.
| Topic | File |
|---|
| Setup behavior and onboarding | INLINECODE5 |
| Memory structure |
memory-template.md |
| App dictionary workflow |
app-dictionary-workflow.md |
| Script design patterns |
script-patterns.md |
| Destructive-operation guardrails |
safety-checklist.md |
| Debug and recovery steps |
troubleshooting.md |
Data Storage
All local skill data stays in ~/applescript/.
Before creating or changing local files, explain the write and ask for confirmation.
Core Rules
1. Choose Operation Scope Before Writing Any Script
- - Classify request as read-only, reversible write, or destructive write.
- If scope is unclear, ask one disambiguation question before execution.
2. Discover App Vocabulary Before Automation
- - Use dictionary inspection workflow from
app-dictionary-workflow.md before guessing object names. - Do not invent app classes, properties, or commands.
3. Escape Dynamic Input Deterministically
- - Never concatenate raw user text into AppleScript command strings.
- Use safe quoting patterns from
script-patterns.md for every variable.
4. Keep Scripts Bounded and Observable
- - Prefer short scripts with explicit targets and explicit output values.
- Return concise structured output so results can be validated quickly.
5. Read Before Write, Verify After Write
- - For updates and creates, run a pre-read to confirm target identity.
- Run a read-back check after writes and report the final state.
6. Require Two-Step Confirmation for Destructive Actions
- - Apply
safety-checklist.md before delete, bulk edit, or irreversible app actions. - If confirmation is missing, stop and ask explicitly.
7. Fail Loudly With Actionable Recovery
- - On error, capture exact failing command and error text.
- Use
troubleshooting.md to provide next-step fixes instead of generic retries.
Common Traps
- - Guessing app dictionary terms -> script compiles but fails at runtime.
- Injecting unescaped quotes in user values -> syntax errors or wrong command targets.
- Writing without pre-read on duplicate item names -> wrong object modified.
- Running UI automation too early after launching an app -> intermittent failures.
- Treating all errors as permission issues -> repeated failures without progress.
Security & Privacy
Data that stays local:
- - AppleScript snippets, runtime notes, and troubleshooting memory in
~/applescript/. - Command output needed only for requested tasks.
Data that may leave your machine:
- - None by default. This skill focuses on local macOS automation.
This skill does NOT:
- - Read unrelated authentication values.
- Send automation data to third-party APIs.
- Execute destructive app actions without explicit confirmation.
Related Skills
Install with
clawhub install <slug> if user confirms:
- -
macos - macOS command and system operation patterns. - INLINECODE19 - General automation workflow design and reliability strategy.
- INLINECODE20 - Shell scripting helpers for wrapping and testing commands.
- INLINECODE21 - Knowledge capture and structured note workflows.
- INLINECODE22 - Safe file read and write workflows with clear boundaries.
Feedback
- - If useful: INLINECODE23
- Stay updated: INLINECODE24
设置
首次使用时,请按照 setup.md 配置激活和安全偏好设置。
设置审查为只读模式。
任何本地文件的创建或修改都需要用户明确确认。
使用时机
当用户需要在 macOS 上通过 AppleScript 实现应用控制、数据提取或脚本化 UI 操作时。
助手负责脚本设计、使用 osascript 安全执行、输出解析和故障排除。
要求
- - 需使用 macOS 系统且 osascript 可用。
- 请求应用自动化时,目标应用需已安装且支持脚本化。
- 破坏性操作前需获得用户明确确认。
架构
记忆文件存储在 ~/applescript/ 目录下。结构参见 memory-template.md。
text
~/applescript/
├── memory.md # 偏好设置、安全默认值和最后有效模式
├── snippets.md # 可复用的脚本片段
├── failures.md # 错误特征和已知修复方案
└── app-notes.md # 各应用的字典和行为记录
快速参考
仅当当前请求需要更详细信息时使用以下文件。
| 主题 | 文件 |
|---|
| 设置行为和入门指南 | setup.md |
| 记忆结构 |
memory-template.md |
| 应用字典工作流程 | app-dictionary-workflow.md |
| 脚本设计模式 | script-patterns.md |
| 破坏性操作防护措施 | safety-checklist.md |
| 调试和恢复步骤 | troubleshooting.md |
数据存储
所有本地技能数据保存在 ~/applescript/ 目录下。
在创建或修改本地文件前,需说明写入内容并请求确认。
核心规则
1. 编写脚本前先确定操作范围
- - 将请求分类为只读、可逆写入或破坏性写入。
- 若范围不明确,执行前先提出一个澄清问题。
2. 自动化前先了解应用词汇
- - 在猜测对象名称前,使用 app-dictionary-workflow.md 中的字典检查工作流程。
- 不得自行编造应用类、属性或命令。
3. 确定性转义动态输入
- - 切勿将原始用户文本直接拼接到 AppleScript 命令字符串中。
- 对每个变量使用 script-patterns.md 中的安全引用模式。
4. 保持脚本边界明确且可观测
- - 优先使用目标明确、输出值清晰的简短脚本。
- 返回简洁的结构化输出,便于快速验证结果。
5. 先读后写,写后验证
- - 执行更新和创建操作前,先进行预读以确认目标身份。
- 写入后执行回读检查,并报告最终状态。
6. 破坏性操作需两步确认
- - 在执行删除、批量编辑或不可逆应用操作前,应用 safety-checklist.md。
- 若缺少确认,停止操作并明确询问。
7. 失败时明确提示并提供可操作的恢复方案
- - 发生错误时,精确捕获失败命令和错误文本。
- 使用 troubleshooting.md 提供下一步修复方案,而非泛泛重试。
常见陷阱
- - 猜测应用字典术语 → 脚本可编译但运行时失败。
- 用户值中注入未转义的引号 → 语法错误或命令目标错误。
- 未对重复项目名称进行预读就写入 → 修改了错误的对象。
- 启动应用后过早运行 UI 自动化 → 间歇性失败。
- 将所有错误视为权限问题 → 反复失败而无进展。
安全与隐私
本地保存的数据:
- - AppleScript 片段、运行时记录和 ~/applescript/ 中的故障排除记忆。
- 仅用于请求任务的命令输出。
可能离开本机的数据:
- - 默认无。本技能专注于本地 macOS 自动化。
本技能不会:
- - 读取无关的认证值。
- 将自动化数据发送至第三方 API。
- 未经明确确认执行破坏性应用操作。
相关技能
若用户确认,使用 clawhub install
安装:
- - macos - macOS 命令和系统操作模式。
- automate - 通用自动化工作流程设计和可靠性策略。
- bash - 用于封装和测试命令的 Shell 脚本辅助工具。
- notes - 知识捕获和结构化笔记工作流程。
- files - 边界清晰的安全文件读写工作流程。
反馈
- - 如有帮助:clawhub star applescript
- 保持更新:clawhub sync