Skip to content

Instantly share code, notes, and snippets.

@lexfrei
Created March 12, 2026 16:04
Show Gist options
  • Select an option

  • Save lexfrei/7642871e1909ef2f13fabc38405b5e95 to your computer and use it in GitHub Desktop.

Select an option

Save lexfrei/7642871e1909ef2f13fabc38405b5e95 to your computer and use it in GitHub Desktop.
Claude Code /learn skill — extract session learnings into CLAUDE.md and auto memory
name description disable-model-invocation
learn
Analyze the current session and extract key learnings worth preserving.
true

Analyze the current session and extract key takeaways worth preserving.

Classification

Separate findings into three categories:

Personal (~/CLAUDE.md):

  • General patterns and approaches that work across projects
  • Tool/language insights not specific to this codebase
  • Workflow preferences discovered
  • Errors caused by misunderstanding that were corrected during the session

Project (CLAUDE.md):

  • Architecture decisions specific to this codebase
  • Project-specific conventions and patterns
  • Codebase quirks and gotchas
  • Integration details with project's stack
  • Errors and mistakes fixed during test implementation and runs
  • Insights from code review if available

Memory (auto memory system):

  • User preferences and feedback specific to this project (type: user, feedback)
  • Project status, ongoing initiatives, deadlines (type: project)
  • References to external systems: boards, channels, dashboards (type: reference)
  • Gotchas and lessons learned that are personal experience, not codebase conventions
  • Anything that is project-scoped but should NOT be committed to the repo

Fallback: no project CLAUDE.md

If the project has no CLAUDE.md (or user has no write access to repo):

  • Everything from Project category goes to Memory instead
  • Use memory types: project for architecture/conventions, feedback for gotchas/corrections
  • Do NOT create CLAUDE.md without explicit user request

Process

  1. Read target files before proposing changes (~/CLAUDE.md, CLAUDE.md, MEMORY.md)
  2. Check for duplicates or overlapping content across ALL targets — skip if already covered
  3. Skip findings if found in another file (e.g. project item already in ~/CLAUDE.md globally)
  4. Decide where each item fits best within existing structure (don't create new sections unless nothing fits)
  5. Formulate concisely, matching the style of existing content

Output

Show proposed additions grouped by target:

~/CLAUDE.md:
  - [where in file] addition text

CLAUDE.md:
  - [where in file] addition text

Memory:
  - [type: feedback] description of memory
  - [type: project] description of memory

Ask for confirmation. Accept: "y", "yes", or selective like "only project" / "skip personal" / "only memory".

After confirmation, apply changes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment