rule-rewriter

rule-rewriter is a skill for Claude Code from naveedharri/benai-skills. It costs 109 tokens per session (1,169 once invoked), scanned A, original, MIT.

A reviewer for CLAUDE.md and other instruction files that finds rules written for older Claude models and rewrites them with the reason behind each rule. CLAUDE.md is a project file that gives coding agents instructions.

In plain words
What is it for?
Use it to audit an instruction or skill file, remove rules the model already handles, and turn one-sided prohibitions into guidance with context. It can also flag instructions for deletion.
Why use it?
Bare commands and outdated checks can be ignored or applied too broadly, making agent behavior less reliable.

Skill for Claude Code

Written for Claude Code: shipped in a Claude Code plugin. Also seen: mentions CLAUDE.md; positional $N argument.

Part of the all-skills plugin — 99 skills shipped together

Good fit Use it to audit an instruction or skill file, remove rules the model already handles, and turn one-sided prohibitions into guidance with context. It can also flag instructions for deletion.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/naveedharri/benai-skills/rule-rewriter
Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

Any agent
npx skills add naveedharri/benai-skills --skill rule-rewriter
Clone the repo
git clone --depth 1 https://github.com/naveedharri/benai-skills

Made for: Claude Code.

Or install all-skills, the plugin that ships this one along with the rest of its 99 skills.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for rule-rewriter

README.md
[![agentmods](https://agentmods.dev/badge/skills/naveedharri/benai-skills/rule-rewriter/github.svg)](https://agentmods.dev/skills/naveedharri/benai-skills/rule-rewriter)
Your own site
<a href="https://agentmods.dev/skills/naveedharri/benai-skills/rule-rewriter"><img src="https://agentmods.dev/badge/skills/naveedharri/benai-skills/rule-rewriter/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for rule-rewriter

Your own site · 80×15
<a href="https://agentmods.dev/skills/naveedharri/benai-skills/rule-rewriter"><img src="https://agentmods.dev/badge/skills/naveedharri/benai-skills/rule-rewriter.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 109 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 1,169 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe. Third-party audits
  • NVIDIA SkillSpector warn 7 Sept 2026
SkillSpector: 1 finding, up to high

These are SkillSpector’s own severities. On a checked sample its high-severity flags on skills were ~96% false positives — a documented command, a public API, a “never do X” rule — so we show them as a caution to read, not a verdict. Why →

  • high Rogue Agent · line 13
    Skill modifies its own code, configuration, or behavior at runtime. Self-modification enables an agent to escalate privileges, disable safety constraints, or install persistent backdoors.
    Fix: Prevent the skill from modifying its own code, SKILL.md, or configuration files. Treat skill files as read-only at runtime.
How audits are shown
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00109 $0.01169
Opus 5 $0.00055 $0.00584
Sonnet 5 $0.00022 $0.00234
Haiku 4.5 $0.00011 $0.00117

Measured 6d ago against content hash 810d243227f8, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-11, from the pricing page.

Security

Grade A, and why

rule-rewriter scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 6d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

plugins/all-skills/skills/rule-rewriter/SKILL.md · 60 lines

How it starts

The opening of the file, as written. The whole thing — 60 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Rule Rewriter

Claude 5 models follow judgment better than they follow rules. A bare "never do X" gets ignored or overfitted; "X breaks because [reason], so avoid it" generalizes. This skill audits an instruction file and rewrites it accordingly.

Grounded in Anthropic's published guidance:

Process

  1. Locate the target. Default to the CLAUDE.md in the current working folder. If the user names a skill or another file, use that. If nothing is found, ask for the path and stop.

  2. Inventory every instruction line. Classify each into exactly one bucket:

    • RETIRED: instructions the model now does by itself. Delete candidates. Examples: "double-check your work", "verify before responding", "think step by step", "be thorough", "always re-read the file", "you are an expert...".
    • ONE-SIDED: rules that state a cost or a command without the counterweight, so the model overfits. Rewrite with both sides.
    • BARE PROHIBITION: "never / always / do not" lines with no reason. Rewrite as judgment plus the why.
    • AGGRESSIVE: "CRITICAL", "YOU MUST", all-caps emphasis written to fix undertriggering on old models. Soften to normal language; Claude 5 overtriggers on these.
    • OBVIOUS: anything the model can see by listing the file system or reading the repo. Delete candidates.
    • KEEP AS HARD RULE: places where being wrong is expensive. Safety, destructive or irreversible actions, client-facing sends, money, permissions. Do not soften these; a hard rule is correct here.
    • KEEP AS GOTCHA: non-obvious project facts the model cannot discover on its own. These are the most valuable lines in the file; leave them alone.

Read the full file on GitHub · 60 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 6d ago First seen · 60 lines · 109 tokens per session scan A 810d243227f8

Subscribe to this mod's changes

rule-rewriter is a skill published in the GitHub repository naveedharri/benai-skills (61 stars, last pushed 7d ago), licensed MIT. It adds 109 tokens to every session and 1,169 once invoked, about $0.0005 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-09-05.

Related

Other skills, from other repositories

project

A single starting point for setting up an AI-assisted project in Claude Cowork. It asks questions about the work, reviews available add-ons, and creates project instructions, custom agents, and connected workflows.

modu-ai/moai-cowork · 475 tokens

doc-html-slide

A renderer that turns presentation content into a single HTML slide deck that opens directly in a browser. It creates a 16:9 slide sequence with navigation, fullscreen viewing, printing to PDF, and speaker-note controls.

modu-ai/moai-cowork · 469 tokens

cs-channel-message

A channel-message writing tool for search ads, advertising, customer relationship messages, and app notifications. It uses the NCM sequence—Need, Channel, Moment, Message, and CTA—to adapt wording to where and when customers see it.

modu-ai/moai-cowork · 470 tokens

design-sync-upload

An uploader for design-system files such as DESIGN.md, tokens, logos, fonts, and images into Claude Design. It can either use an authenticated connection or prepare a folder and guide for manual upload.

modu-ai/moai-cowork · 211 tokens

design-tokens-transformer

A converter for design tokens, which are named values for colors, fonts, spacing, borders, shadows, and motion. It translates one shared token source into CSS variables and Tailwind or shadcn-style theme files, and can convert them back for checking.

modu-ai/moai-cowork · 255 tokens

media-higgsfield-explainer

A Higgsfield workflow for making non-photorealistic narrated explainer videos. It pairs each narration line with a 10-second animated clip and joins the clips into one finished video.

modu-ai/moai-cowork · 236 tokens