rule — скилл для Claude Code: правила проекта
Скилл rule для Claude Code превращает повторное исправление в короткое правило проекта и исправляет код, который ему противоречит. После второго одинакового замечания он предлагает записать правило.
MIT 169 установок ★ 69 обновлён 2026-11-14
npx skills add raphaelsalaja/skills --skill rule -a claude-codeЧто делает rule
Скилл читает существующие AGENTS.md, CLAUDE.md и папки с правилами редактора, прежде чем менять код. Для каждого правила он записывает короткую формулировку и пару строк: нарушающую правило и её замену. У правила должно быть одно место хранения; если оно конфликтует с прежним, старое заменяется.
Затем скилл ищет прежние нарушения, исправляет их и перечисляет затронутые файлы. Для проверки правил во всём коде он использует режим audit, а соблюдение правил во время правок относится к scope. В отчёте указываются файл, строка и причина; итоговая сводка содержит число находок и уровень серьёзности. Если файл с правилами прочитать не удалось, он помечается Not verified.
Какие задачи решает
- записать повторное исправление как правило проекта
- заменить противоречащее новому правилу старое правило
- найти и исправить прежние нарушения правила
- проверить кодовую базу на соответствие правилам
Примеры запросов агенту
- Запомни это правило и исправь код, который ему противоречит.
- Я уже дважды исправлял этот стиль. Запиши правило и найди остальные нарушения.
- Проверь проект на соответствие правилам и перечисли найденные нарушения.
Как установить rule
1Через Skills CLI (Vercel)
npx skills add raphaelsalaja/skills --skill rule -a claude-code2Вручную: положить файлы
~/.claude/skills/rule/SKILL.mdПапка скилла целиком; для одного проекта — .claude/skills/rule/
1Через Skills CLI (Vercel)
npx skills add raphaelsalaja/skills --skill rule -a codex2Вручную: положить файлы
.agents/skills/rule/SKILL.mdДля всех проектов — ~/.agents/skills/
1Через Skills CLI (Vercel)
npx skills add raphaelsalaja/skills --skill rule -a cursor2Вручную: положить файлы
.cursor/skills/rule/SKILL.mdCursor читает и .agents/skills/, и .claude/skills/
1GitHub CLI
gh skill install raphaelsalaja/skills skills/rule2Вручную: положить файлы
.github/skills/rule/SKILL.md1Через Skills CLI (Vercel)
npx skills add raphaelsalaja/skills --skill rule -a gemini-cli2Командой платформы
gemini skills install https://github.com/raphaelsalaja/skills --path skills/ruleВручную: положить файлы
.devin/skills/rule/SKILL.mdСтарый путь .windsurf/skills/ тоже читается
Через Skills CLI (Vercel)
npx skills add raphaelsalaja/skills --skill rule -a opencodeClaude.ai
Упакуйте папку в zip и загрузите в Settings → Capabilities → Skills
По шагам, с командами для каждой платформы: Как установить скилл в Claude Code: пять способов
Вопросы о rule
Как установить rule в Claude Code?
Выполни npx skills add raphaelsalaja/skills --skill rule -a claude-code. Файл скилла находится по пути ~/.claude/skills/rule/SKILL.md.
Что делает скилл rule?
Записывает повторное исправление как короткое правило с примером нарушения и замены, затем ищет и исправляет старые нарушения в коде.
Когда rule предлагает записать новое правило?
Когда пользователь прямо просит запомнить указание или сделать его правилом, а также после повторного исправления одного и того же.
Исходный текст
SKILL.md · MIT
--- name: rule description: Turns a repeated correction into a short project rule with the broken and fixed line, then applies it to existing code. --- # Rule This skill turns a correction into a written rule. It writes the rule once in the right file, then fixes the code that already breaks it. ## Twice is a rule When the user says "make it a rule", "always", "never" or "remember this", write it down. When they correct the same thing twice, propose a rule. A rule is a pair, short enough to read before every edit. Following the rules while editing belongs to `scope`. Reviewing a codebase against all of them runs in `audit`. ## 1. Read what exists Read `AGENTS.md`, `CLAUDE.md` and the editor rule folders before acting. Acting against a written rule is `rule-read-before-acting`. ## 2. Write the pair State the rule in one sentence, then the broken line and the line that replaces it. A rule with no example is `rule-write-the-pair`. ## 3. Keep it short One rule is one to three sentences plus its pair. A paragraph of reasoning is `rule-keep-it-short`. ## 4. Give it one home Put the rule in the file that owns its topic. Copying it into a second file is `rule-one-home`. When a new rule contradicts an old one, replace the old one and say so. Two contradicting rules left side by side is `rule-resolve-conflicts`. ## 5. Sweep the code Search for code that breaks the new rule, fix it and list the files. A rule written with old violations left in place is `rule-sweep-existing`. ## The pair Every check is a pair. The broken line sits beside the line that replaces it. | Rule | Broken | Replacement | | --- | --- | --- | | `rule-read-before-acting` | A pill button added in a repo whose rules forbid pills | Rules read first, rounded button | | `rule-write-the-pair` | "Use good casing" | "Labels take Title Case. `Add to library` becomes `Add to Library`" | | `rule-keep-it-short` | A paragraph of reasoning | One sentence and a pair | | `rule-one-home` | One rule in three files | One file, the others point at it | | `rule-resolve-conflicts` | "Use borders" beside "never use borders" | The old rule replaced, the change noted | | `rule-sweep-existing` | The rule added, twelve violations left | The violations fixed and listed | ## Reporting **Severity.** `HIGH` is an edit that breaks a written rule, or two rules that contradict. `MEDIUM` is a rule with no pair, or old violations left after a new rule. `LOW` is a rule longer than it needs. **Format.** One finding per root cause: ``` file:line - [rule-id] what is wrong ``` Then a `Rule | Count | Severity` summary. `Block` when any `HIGH` remains, `Approve` otherwise. Mark every rule file you could not read as `Not verified`.
© raphaelsalaja · MIT · raphaelsalaja/skills