Overview
Learn Rule captures mistakes and corrections as persistent learning rules that prevent future errors. It’s the foundation of the self-correction loop — the most powerful pattern in Pro Workflow.After 50 sessions with learn-rule, Claude barely needs correcting. Small corrections compound into big gains.
Trigger
Use when:- The user says “remember this”, “add to rules”, “don’t do that again”
- After a mistake is identified
- During wrap-up when capturing session learnings
- The user corrects Claude’s behavior or output
Workflow
Identify the Lesson
What mistake was made? What should happen instead?Example:
- Mistake: Edited
src/utils.tswhen user meantsrc/lib/utils.ts - Correction: Always confirm full path before editing
Format
Standard Format
Minimal Format (For CLAUDE.md)
Categories
Learn Rule organizes corrections into 8 categories:Navigation
Navigation
Editing
Editing
Code changes, patterns, wrong approachExamples:
[LEARN] Editing: Use early returns instead of nested if statements[LEARN] Editing: Always use async/await, not .then() chains[LEARN] Editing: Read file before editing to preserve formatting
Testing
Testing
Test approaches, coverage gaps, flaky testsExamples:
[LEARN] Testing: Mock external APIs in auth tests to prevent flakiness[LEARN] Testing: Run tests before commit, not after[LEARN] Testing: Use --changed flag to test only affected files
Git
Git
Commits, branches, merge issuesExamples:
[LEARN] Git: Always pull before creating new feature branches[LEARN] Git: Use conventional commit format for consistency[LEARN] Git: Stage specific files by name, never git add .
Quality
Quality
Lint, types, style violationsExamples:
[LEARN] Quality: Run typecheck after adding new interfaces[LEARN] Quality: Fix lint warnings immediately, don't accumulate[LEARN] Quality: Remove console.log before committing
Context
Context
When to clarify, missing requirementsExamples:
[LEARN] Context: Ask about error handling strategy before implementing[LEARN] Context: Clarify scope before touching >5 files[LEARN] Context: Request examples when requirements are vague
Architecture
Architecture
Design decisions, wrong abstractionsExamples:
[LEARN] Architecture: Keep business logic out of React components[LEARN] Architecture: Prefer composition over inheritance[LEARN] Architecture: Don't create abstractions for one-time use
Performance
Performance
Optimization, O(n^2) loops, memoryExamples:
[LEARN] Performance: Use indexes for frequently queried fields[LEARN] Performance: Debounce search input, don't query on every keystroke[LEARN] Performance: Cache expensive computations in useMemo
Example Flows
Example 1: Wrong File Edited
Example 2: Quality Gate Violation
Example 3: Architecture Decision
Example 4: Test Approach
Guardrails
Always Get Approval
Wait for user confirmation before persisting. Never auto-add rules.
Keep Rules Brief
One line, specific and actionable. Bad: “Write good code”. Good: “Use snake_case for database columns”.
Include Context
Add mistake and correction details so the rule makes sense later.
Specific Over Generic
“Confirm path when editing utils.ts” > “Be careful editing files”
Storage Locations
Split Memory (Recommended)
- Keeps CLAUDE.md concise (<60 lines)
- Learnings don’t clutter core instructions
- Easy to review all learnings at once
Monolithic Memory
- Single file to manage
- Simpler for small projects
SQLite Database (Pro Workflow Plugin)
- Searchable with
/search testing - Analytics with
/insights - Cross-project learnings
- Track application frequency
Integration with Pro Workflow
Wrap-Up
Wrap-up prompts for learnings and calls learn-rule
Replay Learnings
Surface relevant rules before starting tasks
Insights
Analytics on most/least applied learnings
Session Handoff
Learnings captured this session included in handoff
Configuration
Add Self-Correction to CLAUDE.md
Configure Storage Location
Best Practices
Capture Immediately
Capture Immediately
Don’t wait until wrap-up. Capture corrections as they happen while context is fresh.
Be Specific
Be Specific
Good: “Mock auth API in tests using jest.mock(’@/lib/auth’)”
Bad: “Write better tests”
Include Why
Include Why
Add the mistake and correction context. Future sessions need to understand the reasoning.
Review Regularly
Review Regularly
Use
/insights to see which learnings are applied vs. stale. Remove outdated rules.Troubleshooting
Learnings Not Being Applied
Check:- Is the learning in the loaded CLAUDE.md or LEARNED.md?
- Is it specific enough to be actionable?
- Run
/replayto explicitly surface relevant learnings
Too Many Learnings
If LEARNED section grows too large:- Move to split memory (LEARNED.md)
- Archive old/stale learnings
- Use SQLite database for searchability
Same Mistake Repeated
If Claude repeats a learned mistake:- Make the rule more specific
- Add more context (mistake + correction)
- Place the rule higher in LEARNED section
- Explicitly mention it: “Remember your rule about X?”
Advanced: Searchable Learnings
With Pro Workflow plugin (SQLite storage):Next Steps
Try Replay Learnings
Surface relevant lessons before starting tasks
View Insights
Analytics on learning patterns and correction trends
Master Wrap-Up
Capture learnings at the end of every session
Explore Pro Workflow
See the complete workflow system