Skip to main content
skill CX Codex

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

Install into Claude Code · Plugin marketplace All methods and platforms ↓
/plugin marketplace add rohitg00/pro-workflow
/plugin install pro-workflow@pro-workflow
Open on GitHub

What 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-workflow

This installs the whole pro-workflow plugin with all its skills

2Skills CLI (Vercel)

npx skills add rohitg00/pro-workflow --skill learn-rule -a claude-code

3Manually: put the files in place

~/.claude/skills/learn-rule/SKILL.md

Copy the whole skill folder; for one project use .claude/skills/learn-rule/

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

Similar skills

All skills for Agent setup: memory, context, orchestration →

From the same set83

The whole set →
debugger debugger is a Claude Code subagent that investigates difficult bugs, failed tests, and runtime errors. It traces the cause before proposing a code change. CX Codex ★ 2,966repo stars auto-setup The auto-setup skill detects your project type and automatically configures linters, type checking, tests, and formatting. Use it when starting work on an unfamiliar codebase. CX Codex +1 ★ 2,966repo stars wiki-query wiki-query queries local markdown wikis indexed by wiki-builder using SQLite FTS5 BM25 retrieval. It delivers top passages with citations so the agent builds on existing notes. CX Codex +1 ★ 2,966repo stars orchestrator orchestrator — a subagent for Claude Code that splits complex builds into three phases: research, plan, implement. Each phase requires approval before the next — use it for features touching 5+ files or needing architecture decisions. CX Codex ★ 2,966repo stars develop Runs structured feature development through research, planning, testing checkpoints, and strict verification before committing. CX Codex +1 ★ 2,966repo stars cost-analyst cost-analyst reviews session token use, spots costly operations, and checks cache hits to suggest concrete ways to lower session costs. CX Codex ★ 2,966repo stars context-engineer context-engineer audits context window usage across project files, tools, and MCP servers. Useful when sessions run slow or hit token compaction too often. CX Codex ★ 2,966repo stars pre-flight-discipline The pre-flight-discipline rule makes Claude Code surface assumptions, limit edits to the request, and verify multi-step work. It fits projects where drive-by changes are a concern. CX Codex +1 ★ 2,966repo stars

Project sponsors

Companies that keep this analytics open