src/skills/optional/subagent/SKILL.md
当用户明确要求主脑把一段编码、调研或审查任务委派给 codex / claude-code 这类子代理执行臂,并在完成后回收结果时使用。
npx skillsauth add 42atom/msgcode subagentInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
教主脑如何把复杂任务拆给子代理执行臂,并在完成后自己验收结果。
这里的“子代理”指:
codexclaude-code主脑负责:
不要把子代理当成新的主脑。它只是执行臂。
典型场景:
subagent 合同、也没有 tmux 执行臂可用时不要为了“看起来高级”而强行委派。 也不要因为主脑自己“也能做”,就把本该委派的中大型任务重新揽回自己身上。
msgcode 现在已有最小正式 subagent CLI 主链:
msgcode subagent run codex --goal '...' --watchmsgcode subagent run claude-code --goal '...' --watchmsgcode subagent say <task-id> --message '...'msgcode subagent listmsgcode subagent status <task-id>msgcode subagent stop <task-id>这里要特别看清:
subagent list = 列出当前 workspace 下已有的子代理任务注意:
优先级固定如下:
msgcode subagent run codex --goal '...' --watchmsgcode subagent run claude-code --goal '...' --watchmsgcode subagent say <task-id> --message '...'msgcode subagent listmsgcode subagent status <task-id>msgcode subagent stop <task-id>说明:
SKILL.md 负责教你怎么拆任务、怎么验收先用 help_docs 查当前程序里是否已经存在 subagent:
subagent runsubagent saysubagent listsubagent status--goal / --watch其中:
subagent say <task-id> 用来对正在运行的子代理继续补一句话.msgcode/subagents/<taskId>.messages.ndjsonsubagent list 用来列当前 workspace 下已有任务subagent status <task-id> 用来继续观察某个任务list 误读成“查看有哪些执行臂可安装/可用”如果没有,就说明当前程序版本还没带上这条正式主链。
最低要求:
codex --version 能运行claude --version 能运行(claude-code 在 tmux 执行臂层实际对应的是 claude CLI)如果用户希望获得更强子代理能力,而当前机器没有这些执行臂,要直接提示:
对 claude-code 的安装提示可以明确说:
claude 命令不存在或安装了错误包,按仓库当前 tmux 约定,应安装正确的 Claude Code CLI(例如:npm install -g @anthropic-ai/claude-code),并确保 PATH 中的命令名是 claude对 codex:
codex --version 可用Persona 是人格说明书,告诉子代理"怎么做"。
当前可用 persona(示例):
frontend-builder:前端实现、UI 打磨、交互细节code-reviewer:代码审查、问题发现、改进建议硬约束:
docs/protocol/personas/ 里有没有,再决定用哪个frontend-dev、general-purpose 这类仓库里并不存在的 id读取 persona 文档:
docs/protocol/personas/<persona-id>.md
当前正式 persona:
frontend-buildercode-reviewerapi-builderPersona 告诉子代理:
当前要看清:
msgcode subagent run ... 已正式接上 personadocs/protocol/personas/<persona-id>.md 读取 persona 文档并注入子代理上下文task card 会和 persona 一起进入委派 prompt子代理应该拿到的是一个可独立完成的小任务,不是整段聊天历史。
必须告诉子代理:
来源约束:
每次委派都带唯一 token,方便后续监控、grep 日志、回收结果。
把任务按下面结构交给子代理:
goal:
用一句话描述最终目标
context:
只给完成任务必须知道的背景
cwd:
明确工作目录
constraints:
约束、禁区、风格要求、是否允许联网
acceptance:
至少 2-4 条可验证验收条件
artifacts:
预期产物路径
token:
本轮唯一 token
主脑必须自己盯结果,不要只转述子代理的话。
至少要做这些检查:
msgcode subagent say <task-id> --message '...'taskId,先用 msgcode subagent listsubagent list 的正确用途是:
taskIdrunning / completed / failed / stopped不是:
不要只因为子代理说“完成了”,就向用户宣布完成。
向用户汇报前,至少要回收这些信息:
用户要的是结果,不是 tmux 噪音。
用户说:
让你的子代理 codex 创建一个项目,写一个可直接打开运行的贪吃蛇 HTML 游戏,完成后告诉我项目路径和启动方式。
主脑应该这样理解:
subagent 合同是否存在codex 执行臂已可用goal: 创建贪吃蛇 HTML 游戏cwd: 指定工作目录acceptance:
index.html 存在artifacts: 项目目录、关键文件路径token: 唯一标识index.html 和项目目录是否存在subagent 合同时,假装已经把任务派出去了/backend tmux 整体透传”伪装成“已完成主脑对子代理的正式委派”主脑负责决策、监控、验收;子代理负责执行。
程序合同优先,skill 只负责教你怎么把这件事做对。
data-ai
This skill should be used when the model needs detailed image understanding beyond the system preview summary, and needs a provider-neutral capability index.
development
# todo skill 触发:任务记录、查看待办、标记完成。 优先入口:`~/.config/msgcode/skills/todo/main.sh` 默认 workspace:当前目录 `$PWD`(可被 `--workspace` 覆盖)。 常用: - `bash ~/.config/msgcode/skills/todo/main.sh add "补充测试报告" --json` - `bash ~/.config/msgcode/skills/todo/main.sh list --json` - `bash ~/.config/msgcode/skills/todo/main.sh done <taskId> --json`
development
# thread skill 触发:查看/切换会话线程,读取线程消息。 优先入口:`msgcode thread ...` 常用: - `msgcode thread list --json` - `msgcode thread active --json` - `msgcode thread messages <thread-id> --limit 20 --json` - `msgcode thread switch <thread-id> --json`
development
This skill should be used when the model needs to create, inspect, enable, disable, or remove recurring schedules in msgcode, or when diagnosing schedule state in the current workspace.