build-raycast-script-command
Use if authoring or fixing a Raycast Script Command (@raycast.* metadata header) — fields, modes.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
Use if authoring or fixing a Raycast Script Command (@raycast.* metadata header) — fields, modes.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
基于 SOC 职业分类
Use skill if you are exhaustively testing or release-gating martool CLI commands in a source checkout or deployed Coolify container over SSH, without local Docker or provider spend.
Use if driving agent-browser for Chrome/CDP automation, @ref snapshots, tabs, or verification.
Use if testing or debugging an iOS app via agent-device CLI — simulator flows, evidence, bug triage.
Use if supervising Jean agents through MCP and Computer Use for monitoring, recovery, or closure.
Use if auditing or designing a CLI for agent/LLM use — JSON output, exit codes, non-interactive.
Use if auditing or designing an MCP server for agent-readiness — framework, security, context.
| name | build-raycast-script-command |
| description | Use if authoring or fixing a Raycast Script Command (@raycast.* metadata header) — fields, modes. |
Author or repair a Raycast Script Command (a single .sh or .py file with a # @raycast.* metadata header that Raycast discovers from a script directory). This skill is for Script Commands only — not the Raycast Extensions API (@raycast/api, ray build, React <List>/<Detail> views).
Italicized triggers — match any one:
.sh or .py Raycast Script Command from scratch# @raycast.title / # @raycast.mode / # @raycast.argument* metadata blockfullOutput, compact, silent, or inline modes (or fixing refreshTime / packageName)# @raycast.argument* typed arguments to sys.argv[1..3] or $1..$3chmod +x, schemaVersion)Do NOT use this skill for:
@raycast/api, using ray build/ray develop, JSX views, or an extension package.json) — this skill covers Script Commands only.build-chrome-extension.# @raycast.* header and no Raycast integration intent.run-agent-browser).If you see import { ... } from "@raycast/api" or a package.json declaring "raycast": { ... }, this is an extension — exit this skill.
A file is in scope iff all are true:
.sh or .py (other interpreters are possible but rare).#!/bin/bash, #!/usr/bin/env python3, etc.).# @raycast.schemaVersion 1 and # @raycast.title … and # @raycast.mode … directly under the shebang.src/ extension tree.If any of (1)–(4) is missing or contradicted, stop and confirm scope before editing.
Read these before touching the file. Detail lives in references/ — these are the rules you cannot violate.
| Field | Required | Notes |
|---|---|---|
# @raycast.schemaVersion 1 | yes | Constant. Wrong/missing → command never appears. |
# @raycast.title <Human Title> | yes | Shown in Raycast root search. |
# @raycast.mode <fullOutput|compact|silent|inline> | yes | Drives stdout contract. |
# @raycast.icon | optional | Emoji or path; improves discoverability. |
# @raycast.packageName | optional | Group label in Raycast UI. |
# @raycast.refreshTime <Ns|Nm|Nh> | required for inline only | Seconds/minutes/hours. |
# @raycast.argument1..3 | optional | JSON object per argument. See below. |
Deep detail: references/metadata/required-fields.md.
| Mode | Use when | Stdout shown | Failure UX |
|---|---|---|---|
fullOutput | Result is meant to be read (lists, reports, multi-line text) | Full text in a result window | Last line + non-zero exit |
compact | One-line confirmation of an action (toast-style) | Last non-empty stdout line | Last line + non-zero exit |
silent | Pure side effect, no UI | Nothing on success | Last line + non-zero exit |
inline | Dashboard widget refreshed on a timer | First non-empty line, refreshed every refreshTime | First line + non-zero exit |
inline requires # @raycast.refreshTime. No other mode uses it.
Deep detail: references/metadata/mode-selection.md, references/metadata/inline-refresh-and-errors.md.
# @raycast.argument1 { "type": "text", "placeholder": "query" }
# @raycast.argument2 { "type": "password", "placeholder": "secret", "optional": true }
# @raycast.argument3 { "type": "dropdown", "placeholder": "env", "data": [{"title":"Prod","value":"prod"}] }
text, password, dropdown. No select, no file, no number — those are extension-only.sys.argv[1], sys.argv[2], sys.argv[3] (always guard length for optionals)."$1", "$2", "$3" (always quote; check -z for optionals).Deep detail: references/metadata/typed-arguments.md.
A command will not appear in Raycast unless all are true:
chmod +x file.sh / chmod +x file.py).PATH.schemaVersion, title, and mode are all present and parseable..template. (those are intentionally hidden as user-edit-required).Deep detail: references/troubleshooting/discovery-checklist.md.
inline) line of stdout/stderr on failure.jq, gh, requests, etc., detect missing deps first and print a one-line install hint, then exit non-zero. Do not let an opaque command not found reach the user.compact, silent, or inline — they all collapse stdout.Deep detail: references/troubleshooting/runtime-and-output-issues.md, references/foundations/dependencies-and-portability.md.
Inspect the workspace before writing anything:
.py or .sh to convert, or is this greenfield?# @raycast.*? Is it well-formed?@raycast/api, ray build, package.json with "raycast" key)? If yes, exit this skill.references/foundations/language-selection.md and the Defaults below.If the task type is unclear after inspection, read references/foundations/scope-and-fit.md.
Read only the branch-relevant references before writing:
| Task | Read first |
|---|---|
| New Python command | references/foundations/workflow.md → references/python/file-anatomy.md → references/python/implementation-patterns.md → references/metadata/mode-selection.md → references/python/python-recipes.md |
| New Bash command | references/foundations/workflow.md → references/bash/bash-script-patterns.md → references/metadata/mode-selection.md → references/bash/bash-recipes.md |
| Convert existing script | references/foundations/workflow.md → references/metadata/required-fields.md → references/foundations/dependencies-and-portability.md → references/troubleshooting/discovery-checklist.md |
| Choose / fix mode | references/metadata/mode-selection.md → references/metadata/inline-refresh-and-errors.md → references/troubleshooting/runtime-and-output-issues.md |
| Add / fix arguments | references/metadata/typed-arguments.md → references/python/implementation-patterns.md or references/bash/bash-script-patterns.md |
| Command does not appear | references/troubleshooting/discovery-checklist.md → references/metadata/required-fields.md |
| Wrong runtime / output | references/troubleshooting/runtime-and-output-issues.md → references/metadata/mode-selection.md → references/metadata/inline-refresh-and-errors.md |
| Python vs Bash decision | references/foundations/language-selection.md |
| Make it shareable | references/foundations/community-repo-conventions.md → references/foundations/dependencies-and-portability.md |
| Provenance / source audit | references/foundations/source-map.md |
assets/templates/python-script-command.py or assets/templates/bash-script-command.sh — these are seed files, not finished code.# @raycast.* for both Python and Bash (the # line-comment syntax is identical).sys.argv length in Python; quote "$1" and check -z "$2" in Bash.Run the bundled checkers against the actual command file:
scripts/check-raycast-script-metadata.sh path/to/command.{py,sh} — verifies shebang, required metadata, mode legality, refreshTime presence for inline, and typed-argument JSON.scripts/preview-script.sh path/to/command.{py,sh} [args...] — runs the command and previews how Raycast will display its stdout for the declared mode.references/troubleshooting/discovery-checklist.md.references/troubleshooting/runtime-and-output-issues.md.gh, pbcopy, osascript, open), small filesystem actions.fullOutput when the user is meant to read the result.compact for one-line "did the thing" confirmations.silent for pure side-effects (clipboard, app launch, system action) with no useful output.inline only for dashboard-style status widgets (battery, weather, builds) with refreshTime set.Each script has a paired .md doc next to it.
| Script | Purpose | Mutates? |
|---|---|---|
scripts/check-raycast-script-metadata.sh | Validate shebang, required metadata, mode, inline refreshTime, typed-argument JSON. See scripts/check-raycast-script-metadata.md. | No |
scripts/preview-script.sh | Execute the command and preview Raycast's stdout display contract for the declared mode. See scripts/preview-script.md. | No |
| Asset | Purpose |
|---|---|
assets/templates/python-script-command.py | Seed Python command with metadata header, argument scaffolding, dependency check, and exit-code discipline. |
assets/templates/bash-script-command.sh | Seed Bash command with the same scaffolding. |
| File | When to read |
|---|---|
references/foundations/scope-and-fit.md | Deciding whether the task is really a Script Command and not a full Raycast extension. |
references/foundations/workflow.md | End-to-end build flow for creating or converting a command. |
references/foundations/language-selection.md | Choosing between Python and Bash. |
references/foundations/community-repo-conventions.md | Aligning with raycast/script-commands repo conventions for sharing. |
references/foundations/dependencies-and-portability.md | Commands that depend on external tools/packages or must stay portable. |
references/foundations/source-map.md | Provenance for internal references; expanding the skill from original Raycast research. |
references/metadata/required-fields.md | Adding or repairing the metadata header. |
references/metadata/mode-selection.md | Choosing between fullOutput, compact, silent, inline. |
references/metadata/inline-refresh-and-errors.md | Inline refresh cadence, first-line/last-line behavior, failure semantics. |
references/metadata/typed-arguments.md | Adding, changing, or debugging @raycast.argument*. |
references/python/file-anatomy.md | Layout of a Python command file: shebang, header, code regions. |
references/python/implementation-patterns.md | Wiring sys.argv, dependency notes, failure messages, output patterns. |
references/python/python-recipes.md | Concrete copy-shapeable Python command patterns. |
references/bash/bash-script-patterns.md | Building or fixing a Bash-based Script Command. |
references/bash/bash-recipes.md | Concrete copy-shapeable Bash command patterns. |
references/troubleshooting/discovery-checklist.md | Command does not appear in Raycast. |
references/troubleshooting/runtime-and-output-issues.md | Output, refresh, or failure behavior is wrong. |
@raycast/api, AI Extension, or extension Form schemas — those belong to extensions, not Script Commands.select, file, number); only text, password, dropdown.inline without refreshTime.compact, silent, or inline.sys.argv length and quote "$1"/"$2"/"$3".command not found reach the user — precheck deps and fail readably..template. in a final filename unless the command intentionally requires user edits before first use.When the task is finished, report:
$1..$3 / sys.argv[1..3]