Help us improve
Share bugs, ideas, or general feedback.
From claude-auto-context
Extract conventions and implicit knowledge from session data into .claude/rules/local/ files. USE WHEN repeated patterns are found across sessions.
npx claudepluginhub getklaim/claude-auto-context --plugin claude-auto-contextHow this skill is triggered — by the user, by Claude, or both
Slash command
/claude-auto-context:extract-rulesThe summary Claude sees in its skill listing — used to decide when to auto-load this skill
Analyze session data to find implicit conventions, then create glob-scoped rules in `.claude/rules/local/`.
Promotes patterns from MEMORY.md to CLAUDE.md or .claude/rules/ for permanent enforcement via /si:promote. Supports auto-detection, scoped targets, and rule distillation.
Captures lessons from code reviews, error corrections, and convention violations as persistent rules saved to global, project, or category config files. Triggers on /evolve or phrases like 'we should remember this' for recurring patterns.
Extracts reusable rules from developer corrections during a coding session and persists them to CLAUDE.md or memory for future sessions.
Share bugs, ideas, or general feedback.
Analyze session data to find implicit conventions, then create glob-scoped rules in .claude/rules/local/.
Rules = "institutional memory" (Boris Cherny). When Claude makes a mistake, the correction becomes a permanent rule so it never repeats.
For every candidate rule, ask: "Would removing this cause Claude to make mistakes?" If no → don't create it. If yes → create it.
Rules capture what Claude CANNOT discover by reading code, configs, or package.json:
| Category | Example | Why it's a rule |
|---|---|---|
| Past mistake prevention | "Never use enum, always literal unions" | Correction from user, not in any config |
| Non-obvious commands | "Run bun run test:file -- 'glob'" | Can't guess the flag syntax |
| Prohibitions | "Never touch prod DB directly" | Safety rail, not in code |
| Hidden sequencing | "Refresh auth token before API calls" | Order dependency not obvious from code |
| Convention divergence | "Error handling: Result type, not try-catch" | Project chose non-default pattern |
| Gotchas | "File X re-exports from Y — edit Y, not X" | Non-obvious indirection |
| Bad Rule | Why | What to do instead |
|---|---|---|
| "This project uses TypeScript" | tsconfig.json exists | Nothing — Claude reads it |
| "Tests are in tests/" | Discoverable from directory structure | Nothing |
| "Use ES modules" | package.json type:module | Nothing |
| "Write clean code" | Self-evident, every project wants this | Nothing |
| "The API returns JSON" | Discoverable from reading route handlers | Nothing |
| Code style already enforced by linter | ESLint/Prettier handles it deterministically | Hook, not rule |
| Anything in CLAUDE.md already | Duplication wastes tokens | Reference CLAUDE.md |
| Frequently changing information | Goes stale, causes wrong behavior | Keep in code comments |
Key principle (Anthropic official): "Never send an LLM to do a linter's job." If something can be enforced deterministically (format, lint, type-check), it should be a hook, not a rule.
Focus on "User Prompts" section of session data. This is where corrections live:
Session "Tool Activity" is secondary — use it to verify patterns, not as primary extraction source.
---
description: "One-line summary — used for dedup and context display"
paths:
- "src/auth/**"
created: "2026-03-30"
last_validated: "2026-03-30"
---
[Rule in 1-3 sentences. Specific trigger → specific action.]
created: ISO date when the rule was first writtenlast_validated: ISO date when the rule was last confirmed still relevant (set to today on create/update)Size: Each rule file should be under 200 characters body. One rule per file. If you need more detail, you're writing documentation, not a rule.
Bad: 500 chars explaining the history and rationale of why Result type is used. Good: "Error handling: use Result<T, E>, not try-catch. Functions return {ok, error} shape."
.claude/rules/local/ with required description: in frontmattersrc/auth/** over **paths: — applies globallypaths: present): file/directory-specific conventionspaths:): project-wide prohibitions, non-obvious commands, safety railsIf a pattern is not yet strong enough (seen only once), write to .claude-auto-context/pending-observations.json:
[{"pattern_key": "descriptive-key", "session_id": "...", "evidence": "brief desc", "agent_source": "rules-agent"}]
Read existing file first, append entries. Rules require 2+ session evidence.