claude-code-autoconfig: Command for Claude Code

.claude/commands/extract-rules.md

extract-rules is a command for Claude Code from design-and-deliver/claude-code-autoconfig. It costs 0 tokens per session (3,585 once invoked), scanned B, original, MIT.

A command that scans Claude configuration and memory files and proposes organized rules for .claude/rules/. These rules tell the coding agent how a project should be handled.

In plain words
What is it for?
Use it to discover possible rules across project configuration, nested folders, .claude files, and memory, then review the proposed rules and any cleanup.
Why use it?
It helps turn scattered instructions in files such as CLAUDE.md and agent notes into a clearer, central rule set, while checking for uncommitted Git changes first.

Command for Claude Code

Written for Claude Code: installed under .claude/. Also seen: reads .claude/ paths; mentions CLAUDE.md; mentions Claude Code.

This is design-and-deliver/claude-code-autoconfig's own configuration. It tells Claude Code how to work on claude-code-autoconfig itself, so it is not a mod to install elsewhere. Copy it as a starting point and replace the rules that are about this project. Everything claude-code-autoconfig configures →

Needs its repository: it reads a path above its own folder, which exists only inside the repository. The line is The business logic lives in the adjacent `../backend-api` project. This project is mostly UI — it sends raw data to the API which does the actual processing..

Reuse

Borrowing it

Nothing to install: this file belongs to design-and-deliver/claude-code-autoconfig. Take a copy, put it at the same path in your own repository, and replace the rules that are about this project with yours.

Copy the file
curl -O https://raw.githubusercontent.com/design-and-deliver/claude-code-autoconfig/main/.claude/commands/extract-rules.md
Clone the repo
git clone --depth 1 https://github.com/design-and-deliver/claude-code-autoconfig

Made for: Claude Code.

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 extract-rules

README.md
[![agentmods](https://agentmods.dev/badge/commands/design-and-deliver/claude-code-autoconfig/extract-rules/github.svg)](https://agentmods.dev/commands/design-and-deliver/claude-code-autoconfig/extract-rules)
Your own site
<a href="https://agentmods.dev/commands/design-and-deliver/claude-code-autoconfig/extract-rules"><img src="https://agentmods.dev/badge/commands/design-and-deliver/claude-code-autoconfig/extract-rules/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 extract-rules

Your own site · 80×15
<a href="https://agentmods.dev/commands/design-and-deliver/claude-code-autoconfig/extract-rules"><img src="https://agentmods.dev/badge/commands/design-and-deliver/claude-code-autoconfig/extract-rules.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 0 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 3,585 The whole file, excluding the scripts and references it only reads on demand.
Security scan B 1 finding. 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.00000 $0.03585
Opus 5.5 $0.00000 $0.01434
Sonnet 5.5 $0.00000 $0.00717
Haiku 4.5 $0.00000 $0.00359

Measured 1mo ago against content hash 114af6b09322, method: parsed. Prices are Anthropic first-party input rates as of 2026-10-07, from the pricing page.

Security

Grade B, and why

extract-rules scanned grade B with 1 finding 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 1mo 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.

Reads agent configuration directoriesmediumAgent snooping

.claude/, .codex/, .gemini/ hold keys, settings and other credentials a mod has no legitimate need for.

5. Auto memory files — memory often contains misplaced imperatives that should be promoted to rules. To find the memory directory, list `~/.claude/projects/` and fuzzy-match against the current project path. The director
.claude/commands/extract-rules.md · 295 lines

How it starts

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

Extract Rules

Scan all Claude configuration artifacts and propose structured rules for .claude/rules/.

Step 0: Git safety check

Before doing anything else, check for uncommitted changes:

git status --porcelain

If there are uncommitted changes, show this warning and wait for confirmation:

Warning: This command will modify files (extract rules from sources and optionally clean up originals). You have uncommitted changes.

Commit your work before proceeding, or type "continue" to proceed anyway.

If the working tree is clean, proceed silently.

Skip this step when --staged is passed — you are mid-commit, and the staged changes are the input.

Step 1: Discover sources

Scan these locations for .md files containing potential rules. Skip any that don't exist — not all projects have all of these:

Read the full file on GitHub · 295 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. 1mo ago Changed · +34 lines 114af6b09322
  2. 2mo ago First seen · 261 lines · 0 tokens per session scan B 6ea40c27884d

Subscribe to this mod's changes

extract-rules is a command published in the GitHub repository design-and-deliver/claude-code-autoconfig (2 stars, last pushed 10d ago), licensed MIT. It costs nothing until one of its globs matches a file; then it loads 3,585 tokens. A static security scan graded it B with 1 finding (reads agent configuration directories). No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-31.