wizard
Wizard
Section titled “Wizard”wizard 是一个 Bash 脚本,会带着人一步步完成手动流程。这类流程做起来很繁琐,每次都要向 AI 重新解释也很麻烦。脚本会逐个打开 URL,明确告诉你要点什么、复制什么,收集这些值,把它们写到该去的地方(.env、GitHub secrets),每一步都等你确认,还会显示剩下多少步。它可以用来配置第三方服务、执行一次性迁移,或把项目从一种状态切换到另一种状态。
template.sh 已经解决了让人用起来顺手的问题:逐步显示进度、设置确认关卡、跨平台打开 URL(包括 WSL)、隐藏输入的密钥、幂等地更新 .env,写入 gh secret/gh variable,最后显示总结。你只需要确定流程范围并编写各个步骤。 STAGES 标记上方的库代码在每个 wizard 里都一样,这样才能保持一致:永远不要手动修改它。
默认情况下,wizard 是一次性的。为单次运行创建脚本,存到临时目录或 scripts/ 路径,用完后删除。只有当用户希望把可重复的设置流程留在仓库里时,才提交脚本。
1. 确定流程范围
Section titled “1. 确定流程范围”找出人必须手动完成的每一步,以及过程中要收集的所有值。先读仓库,不要一上来就问:
- 设置类流程:检查
.env、.env.example、.env.*、README、docker-compose*、框架配置和.github/workflows/*。每个secrets.*/vars.*引用都是 wizard 必须生成的值。 - 迁移或状态切换:检查当前状态、目标状态,以及期间不可逆的操作。
然后按顺序列出步骤和每步会产生的值,再请用户确认。用户可以增删或调整顺序。
完成条件: 每一步都有名称。每个收集到的值都明确了(a)人从哪里获取,(b)写到哪里(.env、GitHub secret、两者都写,或不写;有些步骤只是执行操作),以及(c)是否为密钥(输入时隐藏)或公开值。
2. 梳理每一步的操作路径
Section titled “2. 梳理每一步的操作路径”为每一步写出人要遵循的具体路径:要打开哪个 URL,在那里做什么,值在哪里显示,对应填入哪个变量。例如:「Dashboard → Developers → API keys → Reveal test key → copy」。如果你不确定当前界面或具体命令,就说明这一点并询问用户或查文档,绝不要编造可能不存在的步骤。
完成条件: 陌生人照着具体说明就能完成每一步。
3. 编写 wizard
Section titled “3. 编写 wizard”把 template.sh 复制到目标路径。把示例步骤替换成依赖顺序排列的步骤,每一步写一个 stage。使用库里的辅助函数:stage、say/step、open_url、ask/ask_secret、write_env、set_secret/set_var、pause/confirm。把 TOTAL_STAGES 设为所写步骤的数量。
遵循模板的标准:先打开 URL,再询问对应的值;密钥一律用 ask_secret;每个要保存的值都用 write_env 写入;只有 CI 确实需要的值才用 set_secret;执行不可逆操作前先用 confirm 确认。每个 stage 都会清屏,只显示当前步骤:每步只处理一项明确任务,确保人需要的信息不会被滚动内容挤走。不要修改标记上方的库代码。
4. 验证并交接
Section titled “4. 验证并交接”- 运行
bash -n <script>;如果有shellcheck,也运行它。 - 运行
chmod +x <script>。 - 不要自己从头到尾运行脚本:它会打开浏览器,并等待人输入。改为静态检查:第 1 步中提到的每个值都已收集并写到指定位置;每个
set_secret名称都与 CI 中的secrets.*引用完全一致。 - 告诉用户如何运行脚本。如果这是可重复使用的设置流程,就提交脚本并在 README 里添加链接,让下个人直接运行脚本,不用再问 AI。
原文链接和 commit
Section titled “原文链接和 commit”读者可以点名用它,模型也可以自己调用它。它在 Claude Code 插件里。
创建逐步引导人工操作的 Bash wizard,收集所需值并写入配置或 GitHub secrets,适用于服务设置、一次性迁移和状态切换。
Generate an interactive bash wizard that walks a human through steps only they can perform. Use when provisioning infrastructure, setting up credentials or CI secrets, walking an unfamiliar third-party dashboard, or running a one-off migration or cutover. Don't invoke this for steps the agent can perform itself.- 仓库 mattpocock/skills
- 文件
skills/engineering/wizard/SKILL.md - 提交
d81f3a1 - 说明页
docs/engineering/wizard.md - 同目录文件
skills/engineering/wizard/agents/openai.yaml - 同目录文件
skills/engineering/wizard/template.sh
英文 SKILL.md
---name: wizarddescription: Generate an interactive bash wizard that walks a human through steps only they can perform. Use when provisioning infrastructure, setting up credentials or CI secrets, walking an unfamiliar third-party dashboard, or running a one-off migration or cutover. Don't invoke this for steps the agent can perform itself.---
# Wizard
A **wizard** is a bash script that walks a human, step by step, through a manual procedure that's tedious to do by hand and tedious to re-explain to an AI every time. It opens each URL, says exactly what to click and copy, captures the values, writes them where they belong (`.env`, GitHub secrets), confirms at every stage, and shows how many stages are left. It might configure third-party services, run a one-off migration, or move the project from one state to another.
The delightful UX is already solved by [template.sh](template.sh): stage-by-stage progress, confirmation gates, cross-platform URL opening (including WSL), hidden secret entry, idempotent `.env` upserts, `gh secret`/`gh variable` writes, and a closing summary. **Your job is only to scope the procedure and author its stages.** The library above the `STAGES` marker is identical in every wizard; that consistency is the point: never hand-edit it.
A wizard is ephemeral by default: built for one run, saved to a scratch or `scripts/` path, deleted when the job's done. Commit it only when the user wants a repeatable setup path that should live in the repo.
## Process
### 1. Scope the procedure
Work out every manual step the human must take and every value that gets captured along the way. Read the repo first, don't ask cold:
- For setup: `.env`, `.env.example`, `.env.*`, `README`, `docker-compose*`, framework config, and `.github/workflows/*` (every `secrets.*` / `vars.*` reference is a value the wizard must produce).- For a migration or transition: the current state, the target state, and the irreversible actions between them.
Then show the user the ordered list of stages and the values each produces, and confirm: they may add, drop, or reorder.
**Done when:** every stage is named in order, and for each captured value you know (a) where the human gets it, (b) where it's written (`.env`, a GitHub secret, both, or nowhere; some stages are pure actions), and (c) whether it's secret (hidden entry) or public.
### 2. Map each stage's journey
For each stage, write the precise path a human follows: which URL to open, what to do there, where a value is shown, which variable it fills: e.g. "Dashboard → Developers → API keys → Reveal test key → copy". Where you don't actually know the current UI or the exact command, say so and ask the user or check the docs: never invent steps that may not exist.
**Done when:** every stage traces to concrete instructions a stranger could follow.
### 3. Author the wizard
Copy `template.sh` to the target path. Replace the example stage with one `stage` per step, in dependency order. Use the library helpers: `stage`, `say`/`step`, `open_url`, `ask`/`ask_secret`, `write_env`, `set_secret`/`set_var`, `pause`/`confirm`. Set `TOTAL_STAGES` to the number of stages you wrote.
Hold the bar the template sets: open the URL before asking for its value, use `ask_secret` for anything secret, `write_env` every persisted value, `set_secret` only the values CI actually needs, and `confirm` before any irreversible action. Each `stage` clears the screen so only the current step is visible: keep a stage to one focused task so nothing the human needs scrolls away. Don't touch the library above the marker.
### 4. Verify and hand off
- `bash -n <script>`; run `shellcheck` if available.- `chmod +x <script>`.- Don't run it end-to-end yourself: it opens browsers and blocks on human input. Trace it statically instead: every value from step 1 is captured and lands where step 1 said, and every `set_secret` name exactly matches a `secrets.*` reference in CI.- Tell the user how to run it. If it's a repeatable setup path, commit it and link it from the README so the next person runs the script instead of asking an AI.非官方学习站,与 Matt Pocock 和 AI Hero 没有隶属关系。本站不提供可安装的中文技能包。
技能原文采用 MIT 许可。Copyright (c) 2026 Matt Pocock