# Teach agents to drive the app Agents learn a CLI from three places: a short skill that says when and how to use it, ` help`, and the errors. Write the skill; the CLI does the rest. ## Contents - The app's agent skill - Where to put it - Permissions - MCP registration ## The app's agent skill Save as `.claude/skills//SKILL.md` in the app's repo. Replace the angle brackets. Keep it under 60 lines: list the five commands used most, and point at `help` for the rest. ```markdown --- name: description: Drive the app on this Mac from the shell with the `` command: . Use when the user asks about their or wants to change them, or names . --- # `` runs commands in the app. Changes show in its window at once. If the app is closed, the command opens it in the background. ## Rules - Always add `--json` and read the JSON. Exit 0 is ok; otherwise read `error.code` and `error.message`, and do what the message says. - Find ids with ` list` or `--search`. An id is 8 characters. - Destructive commands () only report what they would do. Show the user that report and ask before you run it again with `--yes`. - To try something without real data, add `APP_STORE=/tmp/-test.store` in front of the command. ## Main commands | Command | Does | | --- | --- | | ` status --json` | Is the app running, what is open, counts | | ` list [--search T] [--limit N] --json` | Find things | | ` add --title T --json` | Add one | | ` update [--field value] --json` | Change one | | ` open ` | Show a page in the window | Everything else: ` help`, and ` help ` for its options. ``` ## Where to put it | Place | Who sees it | | --- | --- | | `.claude/skills//SKILL.md` in the app's repo | Agents working on the app's code | | `~/.claude/skills//SKILL.md` | Claude Code in any folder: "add milk to my tasks" works everywhere | | `~/.codex/skills//SKILL.md` (or `AGENTS.md`) | Codex | Copy the same file to each place the user wants. Update all of them when a command changes. ## Permissions Claude Code asks before each Bash command. Allow the read commands for the user, in `.claude/settings.json` or `~/.claude/settings.json`: ```json { "permissions": { "allow": ["Bash( status:*)", "Bash( help:*)", "Bash( list:*)", "Bash( show:*)"] } } ``` Leave write and destructive commands out, so the user approves each one. Ask the user before changing their settings. ## MCP registration Only when the user wants MCP (Claude Desktop, or one prompt per tool). Always the full path to the binary inside the app: MCP clients do not read the shell's `PATH`. ```bash claude mcp add --scope user -- ~/Applications/.app/Contents/MacOS/ mcp claude mcp list # shows as connected codex mcp add -- ~/Applications/.app/Contents/MacOS/ mcp ``` Claude Desktop, in `~/Library/Application Support/Claude/claude_desktop_config.json`: ```json { "mcpServers": { "": { "command": "/Users//Applications/.app/Contents/MacOS/", "args": ["mcp"] } } } ``` Restart Claude Desktop after editing. Its logs are in `~/Library/Logs/Claude/mcp-server-.log`. Tools are named like the commands with `_` for spaces (`items_add`), carry `readOnlyHint` and `destructiveHint`, and take the same options as the CLI.