learn-rule — Claude Code skill: store lessons from mistakes
learn-rule is a Claude Code skill that turns corrections and surfaced mistakes into categorized rules in permanent memory, carrying them across sessions to prevent repeats.
MIT ★ 2,966 updated 2026-09-29
/plugin marketplace add rohitg00/pro-workflow
/plugin install pro-workflow@pro-workflowWhat learn-rule does
When you say "remember this", "don't forget", "note this", or after a mistake surfaces, the skill proposes recording a lesson as a rule. You confirm — the rule saves to project memory in a single, structured line.
Each rule carries a category (Navigation, Editing, Testing, Git, Quality, Context, Architecture, Performance), the mistake that occurred, and the correct approach. Rules can be scoped to a single wiki within the project using Wiki: <slug>; they load only when that wiki is active, preventing cross-project interference.
The skill requires approval before persisting and enforces one-line rules that are specific and actionable. For example: "Confirm the full path when multiple files share the same name".
What it helps with
- Store a lesson from a mistake so you don't repeat it
- Organize rules by category and retrieve them later
- Bind a rule to a specific wiki and prevent conflicts between projects
- Capture a fix while it's fresh in mind
Example prompts for the agent
- Remember this rule: always verify the full path when multiple files have the same name
- Add to rules: never commit without checking the branch first
- Note that we made a mistake — scope this rule to wiki: database-schema
How to install learn-rule
1Plugin marketplace
/plugin marketplace add rohitg00/pro-workflow/plugin install pro-workflow@pro-workflowThis installs the whole pro-workflow plugin with all its skills
2Skills CLI (Vercel)
npx skills add rohitg00/pro-workflow --skill learn-rule -a claude-code3Manually: put the files in place
~/.claude/skills/learn-rule/SKILL.mdCopy the whole skill folder; for one project use .claude/skills/learn-rule/
1Skills CLI (Vercel)
npx skills add rohitg00/pro-workflow --skill learn-rule -a codex2Manually: put the files in place
.agents/skills/learn-rule/SKILL.mdFor all projects use ~/.agents/skills/
1Skills CLI (Vercel)
npx skills add rohitg00/pro-workflow --skill learn-rule -a cursor2Manually: put the files in place
.cursor/skills/learn-rule/SKILL.mdCursor also reads .agents/skills/ and .claude/skills/
1GitHub CLI
gh skill install rohitg00/pro-workflow skills/learn-rule2Manually: put the files in place
.github/skills/learn-rule/SKILL.md1Skills CLI (Vercel)
npx skills add rohitg00/pro-workflow --skill learn-rule -a gemini-cli2Platform CLI
gemini skills install https://github.com/rohitg00/pro-workflow --path skills/learn-ruleManually: put the files in place
.devin/skills/learn-rule/SKILL.mdThe legacy .windsurf/skills/ path still works
Claude.ai
Zip the folder and upload it in Settings → Capabilities → Skills
Step by step, with commands for each platform: How to install skills in Claude Code: five ways
Questions about learn-rule
How do I install learn-rule in Claude Code?
Run in order: /plugin marketplace add rohitg00/pro-workflow, then /plugin install pro-workflow@pro-workflow, then npx skills add rohitg00/pro-workflow --skill learn-rule -a claude-code. The skill installs to ~/.claude/skills/learn-rule/SKILL.md.
What does learn-rule do?
It transforms a mistake or insight into a short, categorized rule and saves it to project memory. The rule appears in future sessions to help prevent repeating the same errors.
How do I scope a rule to a single wiki?
Add Wiki: <slug> at the end, where slug is the wiki name. The rule loads only when that wiki is in scope, avoiding conflicts across projects.
Source text
SKILL.md · MIT
--- name: learn-rule description: Capture a correction or lesson as a persistent learning rule with category, mistake, and correction. Stores, categorises, and retrieves rules for future sessions. Use after mistakes or when the user says "remember this", "don't forget", "note this", or "learn from this". user-invocable: true --- # Learn Rule Capture a lesson from the current session into permanent memory. ## Trigger Use when the user says "remember this", "add to rules", "don't do that again", or after a mistake is identified. ## Workflow 1. Identify the lesson — what mistake was made? What should happen instead? 2. Format the rule with full context. 3. Propose the addition and wait for user approval. 4. After approval, persist to LEARNED section or project memory. ## Format ``` [LEARN] Category: One-line rule Mistake: What went wrong Correction: How it was fixed ``` ### Wiki-scoped rules Append `Wiki: <slug>` to bind the rule to a single pro-workflow wiki. The rule loads only when that wiki is in scope, avoiding cross-project pollution: ``` [LEARN] Editing: Cite a sources.md row before adding any wiki claim. Wiki: agent-memory ``` The capture hook auto-detects `Wiki: <slug>` and links the learning to that wiki via `learnings_wiki`. ## Categories | Category | Examples | |----------|---------| | Navigation | File paths, finding code, wrong file edited | | Editing | Code changes, patterns, wrong approach | | Testing | Test approaches, coverage gaps, flaky tests | | Git | Commits, branches, merge issues | | Quality | Lint, types, style violations | | Context | When to clarify, missing requirements | | Architecture | Design decisions, wrong abstractions | | Performance | Optimization, O(n^2) loops, memory | ## Example ``` Recent mistake: Edited wrong utils.ts file [LEARN] Navigation: Confirm full path when multiple files share a name. Add to LEARNED section? (y/n) ``` ## Guardrails - Always wait for user approval before persisting. - Keep rules to one line — specific and actionable. - Bad: "Write good code". Good: "Always use snake_case for database columns". - Include the mistake context so the rule makes sense later. ## Output - The proposed `[LEARN]` rule with category - Confirmation after persisting
© Rohit Ghumare · MIT · rohitg00/pro-workflow