create-mod
它能做什么
这项技能根据标准模板设置一个新的 Claude Code mod,其中的命名和状态规则已预先设定。适用于希望以安全、一致的方式扩展 Claude Code 行为的开发者。
适用场景
- ✓当你想要一个能为 Claude Code 添加面板、命令或钩子的新 mod 的时候。
- ✓当你想为 Claude Code 的行为添加函数钩子的时候。
- ✓当你想要一个遵循已审查的 Ruflo 模板同样规则的 mod 的时候。
技能链接
https://github.com/ruvnet/ruflo/blob/main/plugins/ruflo-plugin-creator/skills/create-mod/SKILL.md复制后粘贴给你的 AI(Claude、ChatGPT 或 Cursor),让它按照说明操作。
使用方法
最简单的方法:复制下面的消息,粘贴给你的 AI。它会读取这个技能并按说明操作。
可直接粘贴的消息
适用于 Claude Code、Codex 或 Cursor:在项目文件夹中运行,即可安装该技能。
下载 SKILL.md,放进智能体的技能文件夹。
可以这样问 AI
“请根据模板创建一个名为 focus-timer 的新 mod,并检查它是否有效。”
每周 5 个新技能,1 分钟读完。
工作原理
这项技能会选择 kebab-case 格式的名称,将模板文件夹复制到目标位置,并将占位名称替换为你的名称。然后它会让状态文件保持预期的格式,并运行检查。
技术内容(原始 SKILL.md)
作者在 GitHub 上的英文原文。
Create Mod
Scaffold a mod the governed way, instead of an ad-hoc one: the template already follows the rules ruflo's own mod (ADR-404) was reviewed against.
Steps
- Name it. kebab-case
<name>. Commands it registers are namespaced<name>-<verb>; never register a built-in's name (/diff,/help) or another plugin's (/ruos*,ruflo-*). - Scaffold from the template with
node plugins/ruflo-plugin-creator/scripts/scaffold-mod.mjs <name> <target-dir>. It copiestemplates/mod/, turns the manifest templateplugin.json.tmplinto.claude-plugin/plugin.json(the template keeps it under a non-manifest name so plugin validators do not mistaketemplates/modfor a second plugin), and replacesmy-modeverywhere (plugin.jsonname, the command,MY_MOD_ACTIVE→<NAME>_ACTIVEin bothhooks/register.tsandhooks/classic.cjs, the status folder). Doing it by hand: copy the folder, moveplugin.json.tmplto.claude-plugin/plugin.json, and make the same replacements. - Keep the status contract.
hooks/status.tswrites.claude-flow/<name>-mod/status.json, the file the console's Mods section reads. The folder must be<name>-mod(lowercase, digits, hyphens, at most 41 characters): the scaffold script already setsSTATUS_PATHto<name>-mod. Fields:version: 1(required, anything else is ignored),summary(one line),modVersion,guard(boolean),calls(a number, not a per-tool object),blocked(number),lastDenied(a short reason, only once the mod has refused something), plusupdatedMs/startedMs. Other fields are not shown.tests/status.test.tsasserts the shape. - Write the behaviour in pure functions taking the
Host(seehooks/host.ts). Inregister.ts, build the host from literal$.noun.method(...)calls only — the engine reads a module's$uses off its source, andclaude plugin validaterefuses$passed around, computed ($[noun]), or deeper than$.noun.method(input). - Keep the rules:
- Observe with
const r = await next(e); …; return r; rewrite withnext({ ...e, … }); answer ({ deny }) only when you mean to stop the chain. - On
tool.check, only ever tighten (the stricter ofawait next(e)and yours); never answerallowof your own. - Wrap every
$call so a refusal degrades instead of failing the turn (admins can withhold any$affordance). - No
$.process.run/$.http.fetchbuilt from event input. Nothing slow on the hot path (about 10 s per dispatch). - Anything that must survive a hot reload goes in
$.store/$.state, not module variables. - Options come from
userConfigin plugin.json, not environment variables.
- Observe with
- Keep the fallback honest.
hooks.jsonis hybrid: the classic command hook runs everywhere, the module only where function hooks are on (Claude Code >= 2.1.287; 2.1.277+ withCLAUDE_CODE_ENABLE_FUNCTION_HOOKS=1). The module sets<NAME>_ACTIVEatsession.start; the classic script exits early when it sees it, so nothing fires twice. - Validate and test:
claude plugin validate <dir> # lists hooked events, $ calls, env reads/writes claude plugin test <dir> # tests/*.test.ts on the engine kit claude -p --plugin-dir <dir> "/<name>-status" # writes .claude-plugin/types/ and proves a live load npx tsc -p <dir> # against those generated types - Ship it in a plugin marketplace (
marketplace.jsonentry), installed with/plugin install <name>@<marketplace>and picked up with/reload-plugins. If ruflo-mods is installed withmodTrust: refuse-risky, a mod usingprocess.run/process.spawn,http.fetch,mcp.call/mcp.connect,session.send,config.set,env.set,fs.write,agent.spawn/agent.register,prompt.submit,session.append,tool.callorcommand.run, or hooking any event in itsRISKY_EVENTS(tool.check,tool.call,prompt.*,agent.spawn,tool.describe,session.append,session.receive,turn.step,skill.prompt,session.compact,prompt.edit,fs.read/fs.stat/fs.exists/fs.list,settings.read,env.get, a hook on any of the calls above (it can rewrite another mod's call),plugin.register,classic.*,*; a glob or a!negation is judged by what it selects), is refused unless its plugin id (<name>@<marketplace>) is inmodTrustAllow— the template setsenv.set(the fallback handshake), so allow-list it by id.
常见问题
哪些名称必须避免?
不要使用内置命令名称(例如 diff 或 help),也不要与其他插件使用的名称重复。
状态文件写在哪里?
这项技能会将其设置在以你的 mod 名称命名的文件夹中,控制台会读取该文件夹。
模板会运行未经审查的代码吗?
这项技能说明模板遵循经过审查的规则,但在使用 mod 之前,你仍应进行测试。
详情
作者的原始描述
Scaffold a Claude Code mod (a plugin with a function-hooks module) from ruflo's governed template, then validate and test it. Use when the user asks for a mod, a function hook, or wants Claude Code to modify itself.
repo: ruvnet/ruflo
热度
- GitHub 星标
- 81k
- 排名
- #1678
- 许可证
- MIT
- 更新时间
- 2026/11/2
评论
- …
同一仓库的更多技能
agent-adaptive-coordinator
81k帮你的智能体在工作量变化时拆分和重新平衡一组 AI 智能体,并选择适合任务的分工方式。
agent-agent
81k教你的智能体把一个大目标拆成有顺序的行动计划,并在情况变化时重新规划。
agent-agentic-payments
81k帮你的智能体管理 AI 购物的消费授权,包括消费上限、时间窗口、商户规则和签名审批。
agent-analyze-code-quality
81k帮你的智能体检查代码质量,找出代码异味、技术债务和重构建议,且不改动文件。