--- name: learner type: workflow description: "Extracts reusable patterns, preferences, and lessons from the current session and saves them to .claude/memory/ for future use. Use at the end of a session or when the user wants to save patterns for future sessions." argument-hint: "[session summary or learning focus]" level: 7 allowed-tools: Read, Glob, Grep, Write, Edit user-invocable: true effort: 3 when_to_use: "Use at the end of a session when complex problems were solved or novel patterns discovered, to persist reusable heuristics to .claude/memory/ for future sessions." --- # Learner Skill This skill helps Claude Code to automatically distill experiences after solving complex problems and transform them into reusable principles and decision-making heuristics for future use. It consists of two main sections: - **Expertise Base**: Core knowledge about what constitutes a high-quality Skill. - **Workflow**: The systematic procedure used to extract and save a Skill. --- ## 1. Quality Gate Before deciding to extract a new Skill, ALL of the following criteria must be met: - "Could someone easily Google this in 5 minutes?" -> **NO** - "Is this solution necessary and highly specific to the current codebase?" -> **YES** - "Did finding this solution require significant debugging or analysis effort?" -> **YES** A saved Skill SHOULD NOT be a trivial, copy-paste code snippet. It must be a **Mental model / Heuristic** that teaches Claude HOW TO THINK when encountering similar errors. ### Recognition Signals: Only trigger the skill extraction process after: - Solving a complex bug that demanded deep investigation. - Discovering a unique workaround that is specific to this repository. - Uncovering a hidden "gotcha" that wastes significant time if forgotten. --- ## 2. Workflow When the user asks to extract a lesson (e.g., by typing `learner` or requesting a lesson extraction), execute the following steps in order: ### Step 1: Gather Information - **Problem Statement**: The specific error, symptom, error code, file name, and line numbers. - **Solution**: The exact fix provided (e.g., code logic, configuration, workflow changes). - **Triggers**: An array of keywords that will automatically wake up this Skill in the future (e.g., `["TypeError", "auth_controller.ts", "session undefined"]`). ### Step 2: Classification - If the insight is about **Domain Knowledge / Gotcha** -> Save with the suffix `{topic_name}-expertise.md` - If the insight is about an **Operational Procedure** -> Save with the suffix `{topic_name}-workflow.md` ### Step 3: Save the New Skill File - Saving a new Skill MUST ONLY BE DONE in the project-level directory: **Default path:** `.claude/skills/` ### Skill Body Template Any new Skill generated by the Learner must strictly follow this Markdown structure: ````markdown --- name: [Short Skill Name] description: "Extracts reusable patterns, preferences, and lessons from the current session and saves them to .claude/memory/ for future use. Use at the end of a session or when the user wants to save patterns for future sessions." triggers: ["keyword 1", "keyword 2"] --- # The Insight What underlying principle did you just discover? (Focus on the "Mental Model", not merely the line of code). # Why This Matters If this experience is neglected, what errors will the system encounter? What symptoms lead to these errors? # Recognition Pattern How do you know when to apply this experience in practice? What are the signs or triggers? # The Approach How should Claude THINK about this problem? Outline the specific resolution direction. # Example Code (Recommended) Display code snippet strictly to illustrate the principle, not as a blind copy-paste solution. ````