learn-rule
The learn-rule skill captures mistakes and lessons as persistent, reusable rules organized by category (Navigation, Editing, Testing, Git, Quality, Context, Architecture, Performance). It activates when users explicitly request it with phrases like "remember this" or "don't forget," formats the rule with mistake context and correction, waits for user approval before storing, and supports wiki-specific scoping to prevent cross-project contamination. Use this after identifying errors or when establishing important patterns the workflow should internalize for future sessions.
git clone --depth 1 https://github.com/rohitg00/pro-workflow /tmp/learn-rule && cp -r /tmp/learn-rule/skills/learn-rule ~/.claude/skills/learn-ruleSKILL.md
# 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
Analyzes and optimizes context window usage across sessions. Use when context feels bloated, sessions run slow, or approaching compaction limits.
Analyze session token usage and cost patterns. Identify expensive operations and recommend optimizations. Use to understand and reduce session costs.
Specialized debugging agent. Use when facing hard bugs, test failures, or runtime errors that need systematic investigation.
Multi-phase development agent. Research > Plan > Implement with validation gates. Use PROACTIVELY when building features that touch >5 files or require architecture decisions.
Analyze permission denial patterns and generate optimized alwaysAllow/alwaysDeny rules. Use when permission prompts slow down workflow.
Break down complex tasks into implementation plans before writing code. Use when task touches >5 files, requires architecture decisions, or has unclear requirements.
Code review specialist that verifies every finding against actual code before reporting. Use before committing, for PR reviews, or after major changes.
Confidence-gated exploration that assesses readiness before implementation. Scores 0-100 across five dimensions and gives GO/HOLD verdict.