Shortcuts
它能做什么
为那些没有其他自动化途径的操作(例如家居设备)构建 macOS 快捷指令,然后从命令行运行它们。它适用于希望自动化只有苹果自家工具才能控制的事项的 Mac 用户。
适用场景
- ✓当你想从命令行控制 HomeKit 设备的时候。
- ✓当你需要自动化没有 API 的原生 Mac 操作的时候。
- ✓当你想查看自己已经设置了哪些快捷指令的时候。
技能链接
https://github.com/danielmiessler/LifeOS/blob/main/LifeOS/install/skills/Shortcuts/SKILL.md复制后粘贴给你的 AI(Claude、ChatGPT 或 Cursor),让它按照说明操作。
使用方法
最简单的方法:复制下面的消息,粘贴给你的 AI。它会读取这个技能并按说明操作。
可直接粘贴的消息
适用于 Claude Code、Codex 或 Cursor:在项目文件夹中运行,即可安装该技能。
下载 SKILL.md,放进智能体的技能文件夹。
可以这样问 AI
“请构建一个 Mac 快捷指令,把客厅恒温器设为 70 度,然后让我在终端中运行它。”
每周 5 个新技能,1 分钟读完。
工作原理
该技能会先通过桌面界面构建一次快捷指令,然后运行它并比较输出结果进行检验。之后的运行就是普通的命令行调用,无需屏幕控制。
技术内容(原始 SKILL.md)
作者在 GitHub 上的英文原文。
Shortcuts
Turn GUI-only macOS Shortcuts into callable LifeOS automation. Shortcuts reaches Apple-only surfaces (HomeKit/Home, native system actions, app intents) that have no other automation path. Computer use is slow and pixel-fragile, while the shortcuts CLI is fast and deterministic but can only run shortcuts, never build them. So each capability is built once (BuildShortcut) and is plain CLI from then on (RunShortcut, through Tools/Shortcuts.ts). This is CLI-first doctrine applied to the no-API problem.
Ideal State
- Each Apple-only capability is built once as a Shortcut under the exact name its consumers call, and is proven by a
runwhose output matches the spec, never by how the editor looks. - Every later use is plain CLI through
Tools/Shortcuts.tsorshortcuts run, with no pixels and no computer use. - A failed run or missing shortcut is diagnosed against the exact registered names, so a case or whitespace mismatch is caught before anything is rebuilt.
Intent Routing
| Intent | Trigger | File |
|---|---|---|
| BuildShortcut | "build a shortcut", "create a shortcut", "set up the X shortcut" | Intents/BuildShortcut.md |
| RunShortcut | "run the X shortcut", "invoke X", any consumer calling a built shortcut | Intents/RunShortcut.md |
| ListShortcuts | "list shortcuts", "what shortcuts exist", "does X exist" | Intents/ListShortcuts.md |
| File | Read when |
|---|---|
Setup.md |
first-time setup, a worked example of adding your own shortcut, and the read-only proof commands |
Gotchas
- Creation is GUI-only: there is no
shortcuts create. TheshortcutsCLI runs, lists, and views, but cannot author. Never claim a shortcut was "built" via CLI. - Name matching is exact, case and spaces included.
shortcuts run "Casa Set Zone 1 Temp"fails silently-ish (nonzero exit) if the registered name iscasa set zone 1 tempor has a trailing space. Confirm withexistsafter building, register the exact string a consumer expects, and on a nonzerorunwith no clear error, diff the target string againstlistbefore rebuilding anything. - Input arrives on stdin; output is whatever the last action returns. The CLI pipes
--inputto the shortcut's stdin and captures the final action's output on stdout; without a final output action, stdout comes back empty.
Data & Config
The skill keeps no per-user data. Shortcut names belong to the consumer that calls them: a home-control skill, for example, builds its thermostat names from thermostat_shortcut_prefix and thermostat_room lines in its own Config.md. There is no config file for this skill. First-time setup, a worked example and a read-only proof: Setup.md.
The frontmatter evals check (list) proves this skill on its own. A consumer that depends on a particular shortcut name can check it with Tools/Shortcuts.ts exists "<name>", which exits 1 when that name is not registered.
Examples
Example 1: Build the thermostat status shortcut
User: "build the thermostat status shortcut"
→ BuildShortcut, authored through Skill("ComputerUse", "Drive") --app Shortcuts
→ "<prefix> Thermostat Status" exists, reads every thermostat through Home actions,
and `bun Tools/Shortcuts.ts run "<prefix> Thermostat Status"` returns
"Zone 1 21 heating, Zone 2 20 idle"
Example 2: A consumer runs a built shortcut
A home-control skill's thermostat script calls `shortcuts run "<prefix> Set Zone 1 Temp"`
with "21" on stdin → RunShortcut path → deterministic, no computer use
Example 3: Check what's there
User: "do my <prefix> shortcuts exist yet?"
→ ListShortcuts: bun Tools/Shortcuts.ts list | rg "<prefix>"
→ the matching names, or a plain "not built yet"
常见问题
每次都需要在屏幕上点击吗?
不需要。快捷指令构建完成后,可以在无屏幕控制的情况下通过命令行运行。
我的快捷指令为什么没有运行?
通常是因为名称不完全匹配,因为名称对大小写和空格很敏感。
它能调用哪些功能?
仅限 Apple 的能力,例如家居设备和原生系统操作。
详情
作者的原始描述
Bridges macOS Shortcuts.app into LifeOS: build a Shortcut once via computer use, then call it as a CLI to reach Apple-only capabilities like HomeKit. USE WHEN build a shortcut, create a shortcut, macOS shortcut, shortcuts app, run a shortcut, automate a native mac task, HomeKit automation that needs a shortcut, thermostat shortcuts, control home from CLI, wrap an Apple-only action, no API for this app. NOT FOR web automation (Interceptor), shell-scriptable tasks (Bash), devices reachable by API (Home / Network).
repo: danielmiessler/LifeOS
热度
- GitHub 星标
- 20k
- 排名
- #10456
- 许可证
- MIT
- 更新时间
- 2026/10/28
评论
- …