关于 role-creator
role-creator 是用于编写、更新和排查自定义 Codex Agent 的技能,角色配置保存在独立 TOML 文件中。写入前要求确认角色信息,并验证生成的配置。
主要功能
- 01创建或更新独立 Agent TOML 文件
- 02要求确认角色必填信息
- 03支持全局和项目作用域
- 04验证 TOML 语法及必需字段
- 05提供 Agent 调用示例
适用场景
- 01定义自定义 Codex Agent 角色
- 02更新现有 Agent 配置
- 03排查 Agent 作用域或 TOML 问题
安装
复制下面的命令,在终端中运行。
$
npx skills add https:/ / github.com/ am-will/ codex-skills --skill role-creator安装后在 Claude Code 中输入/role-creator确认已加载。
包含的文件
除 SKILL.md 外,安装时一起下载的参考资料和脚本。
references/role-config-reference.mdscripts/install_role.shvalidate_role.shwrite_role_config.shtemplates/frontend-architecture-role.tomlfull-role-config.tomlminimal-role-config.tomlrestricted-role-config.toml详细介绍
角色创建器
概述
使用此技能,以独立 TOML 文件的形式编写、更新或排查自定义 Codex Agent。
当前行为:
- 每个自定义 Agent 都由一个文件定义:
- 全局:
~/.codex/agents/<agent-name>.toml - 项目:
<project>/.codex/agents/<agent-name>.toml
- 全局:
- Agent 文件是角色配置的唯一真实来源。
~/.codex/config.toml仅用于全局/运行时设置(例如[agents]线程限制),不用于注册单个角色。
不可妥协的输入
写入文件前必须完成第 1 步:
name(由agent_type使用的角色标识符)description(简短、易懂的用途说明)developer_instructionsmodel(除非另有要求,否则建议使用gpt-5.3-codex)model_reasoning_effort(none|minimal|low|medium|high|xhigh)- 角色范围(
global或project) - 输出 TOML 路径(优先使用规范的绝对路径)
- 是否包含
nickname_candidates及其确切值
执行规则:
- 不要推断必需值。
- 在明确确认必需输入之前,不要写入文件。
角色文件规范(当前)
根据 Codex 自定义 Agent 文档(/codex/subagents):
- 必需键:
name、description、developer_instructions。 - 可选键:
nickname_candidates、model、model_reasoning_effort、sandbox_mode、web_search、mcp_servers、skills.config等。 name是启动标识符,也是唯一真实来源。description和developer_instructions用于定义行为和使用边界。nickname_candidates是可选项,仅用于显示。
nickname_candidates 要求:
- 如果提供,必须是包含唯一值的非空列表。
- 允许的字符:ASCII 字母、数字、空格、连字符、下划线。
可选设置的默认策略
- 除非用户要求,否则不要添加沙箱、MCP、网络搜索或模型额外设置。
- 默认情况下,生成的文件应尽量精简。
- 如果用户说“继承默认值”,则省略可选键,不要为其设置显式值。
工作流
- 收集并确认必需输入。
- 确定输出路径:
global→~/.codex/agents/<name>.tomlproject→<project>/.codex/agents/<name>.toml
- 直接创建或更新文件,并包含必需键。
- 验证 TOML 解析结果和必需键。
- 返回可直接运行的示例调用:
{"agent_type":"<name>","message":"<task>"}
命令
# 1) Write a standalone custom-agent file
/home/willr/Applications/skills/skills/role-creator/scripts/write_role_config.sh \
--output ~/.codex/agents/reviewer.toml \
--role-name reviewer \
--description "PR reviewer focused on correctness, security, and risk." \
--model gpt-5.4 \
--reasoning high \
--developer-instructions "Review code like an owner. Lead with concrete findings and residual risks."
# Optional: include nickname candidates for display
/home/willr/Applications/skills/skills/role-creator/scripts/write_role_config.sh \
--output ~/.codex/agents/reviewer.toml \
--role-name reviewer \
--description "PR reviewer focused on correctness, security, and risk." \
--model gpt-5.4 \
--reasoning high \
--developer-instructions "Review code like an owner. Lead with concrete findings and residual risks." \
--nickname-candidates "Atlas,Delta,Echo" \
--sandbox-mode read-only \
--web-search disabled
防护措施
- 如果运行时返回
unknown agent_type,请检查当前作用范围,并确认文件存在于预期路径。 - 首先使用
tomlq或tomlq -C检查语法。 - 角色指令应具有可操作性且范围明确,避免偏离目标。
参考资料
- Codex 子 Agent 文档:
https://developers.openai.com/codex/subagents - 显示昵称:
https://developers.openai.com/codex/subagents#display-nicknames - 可复用模板:
templates/
评论
支持 Markdown