Custom skills
You can add your own skills without a change to the server. This example was run on a clean home directory.
Where a skill goes
| Layer | Directory | Scope |
|---|---|---|
| Project | .rule-mcp/skills/<name>/ |
One project |
| User | ~/.rule-mcp/skills/<name>/ |
Your machine |
The user layer wins over the project layer. The project layer wins over the bundled skills. RULE_MCP_HOME moves the user directory.
Add a skill
Make the file ~/.rule-mcp/skills/my-rules/SKILL.md:
---
name: my-rules
description: House rules
exposeTool: true
guardrails: [myco-no-todo]
---
# my-rules
## Rules
- No TODO comments.
Make the file ~/.rule-mcp/skills/my-rules/guardrails/index.js:
export const noTodo = {
id: "myco-no-todo",
label: "No TODO comments",
description: "Code must not hold TODO comments.",
check: (code) => {
const found = code.includes("TODO");
return { pass: !found, failCount: found ? 1 : 0, detail: [], suggestion: "Remove the TODO." };
},
};
Then do a check of the skill:
rule-mcp tools call rule_tool_check --json '{"code":"// TODO","skill":"my-rules"}'
The result includes myco-no-todo and the baseline rules.
Rules for a custom skill
- A custom skill makes a tool only if the frontmatter has
exposeTool: true. Without it, search, check, and the gateway still read the skill. - The
guardrailslist in the frontmatter must match the exports ofguardrails/index.js. The server reports a difference by name. - A skill with a name from the catalog replaces that skill.
- The server runs the code in
guardrails/. Add only code that you trust. - If a rule folder throws an error, the server reports it and continues.
- The
rule://communityresource lists the custom skills.
The file plugin.js has no effect. The server also does not read ~/.agents/skills/ as a skill layer.