a-rules-optimizer

a-rules-optimizer is a skill for Claude Code, Codex from imisic/claude-marketplace. It costs 26 tokens per session (11,056 once invoked), scanned A, original, MIT.

A codebase audit tool for checking whether Claude instructions in .claude/rules/ and CLAUDE.md match the project’s actual behavior.

In plain words
What is it for?
Use it to audit instructions, report drift without editing, synchronize stale references, or create a rules directory and rules from scratch.
Why use it?
It finds outdated instructions, missing guidance, and rules that do not cover real review risks, reducing confusion for coding assistants.

Skill for Claude CodeCodex

Written for Claude Code and Codex: disable-model-invocation in frontmatter, but also agents/openai.yaml present. Also seen: reads .claude/ paths; mentions CLAUDE.md; mentions subagents.

Needs its repository: it reads a path above its own folder, which exists only inside the repository. The line is | ../CLAUDE.md (ancestor) | 240 lines | always | TRIM: loads for this project, user unaware |.

Part of the dev-workflow-forge plugin — 4 skills shipped together

Good fit Use it to audit instructions, report drift without editing, synchronize stale references, or create a rules directory and rules from scratch.

Compare 6 skills from other repositories ↓
Install

Getting it into your agent

It runs from inside its repository, so the clone comes first — what it calls does not travel with the file alone.

Clone the repo
git clone --depth 1 https://github.com/imisic/claude-marketplace
agentmods
npx agentmods add skills/imisic/claude-marketplace/a-rules-optimizer

Made for: Claude Code, Codex.

Or install dev-workflow-forge, the plugin that ships this one along with the rest of its 4 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 a-rules-optimizer

README.md
[![agentmods](https://agentmods.dev/badge/skills/imisic/claude-marketplace/a-rules-optimizer/github.svg)](https://agentmods.dev/skills/imisic/claude-marketplace/a-rules-optimizer)
Your own site
<a href="https://agentmods.dev/skills/imisic/claude-marketplace/a-rules-optimizer"><img src="https://agentmods.dev/badge/skills/imisic/claude-marketplace/a-rules-optimizer/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 a-rules-optimizer

Your own site · 80×15
<a href="https://agentmods.dev/skills/imisic/claude-marketplace/a-rules-optimizer"><img src="https://agentmods.dev/badge/skills/imisic/claude-marketplace/a-rules-optimizer.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 26 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 11,056 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.
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.00026 $0.11056
Opus 5 $0.00013 $0.05528
Sonnet 5 $0.00005 $0.02211
Haiku 4.5 $0.00003 $0.01106

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

Security

Grade A, and why

a-rules-optimizer 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 10d ago.

The scan reads SKILL.md. This mod also ships 1 executable file (scripts/verify-rule-globs.js), listed below but not scanned — reading those needs a real analyzer, not pattern matching.

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/dev-workflow-forge/skills/a-rules-optimizer/SKILL.md · 643 lines

How it starts

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

Rules Optimizer

Audit .claude/rules/ and CLAUDE.md against the actual codebase. Creates missing rules, fixes drift, ensures coverage. Works on any project regardless of stack.

Input: optional flags

  • --full: full audit and optimization (default)
  • --audit-only: report drift without making changes
  • --sync: just fix stale references and drift, skip coverage analysis

If no .claude/rules/ directory exists, create it and build rules from scratch. That's the whole point of running this skill.


Core Principles

Rules are instructions, not code examples. Each rule is a declarative statement: "do X", "never Y", "Z must always include W". No code blocks longer than a single line. If a pattern needs showing, use Reference: path/file.py:42.

Rules prevent what reviews catch. Every rule should map to something that would otherwise be flagged during code review. If a rule doesn't prevent a real mistake, it's noise.

Path scoping saves context. Rules scoped to src/web/**/*.py don't load when editing src/core/. Use the narrowest glob that covers the files where the rule matters.

@imports to rule files defeat path-scoping. If CLAUDE.md references a rule file with @.claude/rules/foo.md, that file is force-loaded at session start regardless of its paths: frontmatter. Always reference rule files by name only ("see services.md") so the path scoping the user wrote actually takes effect.

Rules are pointers, not inventories. Anything derivable by ls, grep, or reading one well-known file (base classes, enums, route configs) does not belong in a rule file. Lists of controllers, models, services, helpers, partials, URL routes, directory trees, base-class method signatures, design tokens, all rot the moment the code changes. Replace with one-liners: Inventory: ls app/src/Models/, Methods: read app/src/Core/View.php, Routes: app/config/routes.php. Keep the rule (the "must"/"never"), drop the catalog.

Preserve the user's voice. If rules already exist, the user wrote them from experience. Keep their wording, organization, and emphasis. Only change what has a concrete reason (drift, gap, stale reference).

Read the full file on GitHub · 643 lines

Files

What ships with it

8 files beside SKILL.md in the same directory: the scripts, references and assets a skill reads on demand. Not counted in the per-session cost; read them before you install if any of them is executable.

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. 10d ago First seen · 643 lines · 26 tokens per session scan A d81c612133cf

Subscribe to this mod's changes

a-rules-optimizer is a skill published in the GitHub repository imisic/claude-marketplace (2 stars, last pushed 8d ago), licensed MIT. It adds 26 tokens to every session and 11,056 once invoked, about $0.0001 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-08-31.

Related

Other skills, from other repositories

codex-agent

Use when you want a second-opinion review via Codex CLI, cross-verification after another agent implements changes, debugging help, or alternative implementation proposals. Requires Codex CLI to be installed and authenticated.

majiayu000/spellbook · 45 tokens

project-health-auditor

Comprehensive codebase health analysis. Use when reviewing code quality, identifying technical debt, checking dependencies, or assessing project structure.

majiayu000/spellbook · 31 tokens

review-gate

Use before an agent-produced diff is committed, pushed, opened as a PR, merged, landed, or applied to user files when explicit implementation approval is missing. Trigger for review gate, review pack, approve before landing, diff first then land, human approval, merge gate, commit gate, push gate, or PR readiness.…

majiayu000/spellbook · 95 tokens

pneuma-session

Instructions for renaming an active Pneuma session and replacing its default preview with a useful title and summary. A Pneuma session is one work area inside a larger project.

pandazki/pneuma-skills · 127 tokens

tokf-discover

Find missed token savings by scanning AI coding session files for commands that ran without tokf filtering.

mpecan/tokf · 24 tokens

docs

Use when documentation generally needs to catch up with a branch before pushing or merging, covering internal developer docs, external customer-facing docs, and release notes together — "update the docs", "do a docs pass before I merge", "make sure everything's documented". Prefer this when no single documentation…

The01Geek/prflow · 97 tokens