Analyze recent conversation context and capture learnings to project knowledge files (for project-specific insights) or skills/commands/subagents (for cross-project patterns). Use when the user asks to "capture this learning", "update the docs with this", "remember this for next time", "document this issue", "add this to CLAUDE.md", "save this knowledge", or "update project knowledge". Also triggers after resolving build/setup issues, discovering non-obvious patterns, or completing debugging sessions with valuable insights.
View on GitHubpetekp/agent-skills
explainer
January 25, 2026
Select agents to install to:
npx add-skill https://github.com/petekp/agent-skills/blob/main/skills/capture-learning/SKILL.md -a claude-code --skill capture-learningInstallation paths:
.claude/skills/capture-learning/# Capture Learning Analyze recent conversation context and capture learnings—either to project knowledge files or to skills/commands/subagents for cross-project reuse. ## Core Workflow ### Step 1: Analyze Recent Context Review the current conversation to identify: 1. **Problem encountered** - What went wrong or was confusing? 2. **Root cause** - Why did it happen? 3. **Solution** - How was it resolved? 4. **Prevention** - How to avoid this in the future? Extract concrete, actionable insights—not vague summaries. **Good learning:** ``` When running `npm install` on Node 20+, the `--legacy-peer-deps` flag is required due to React 18 peer dependency conflicts. ``` **Bad learning:** ``` Had some issues with npm install, fixed it eventually. ``` ### Step 2: Determine Learning Scope Before deciding where to capture, ask: **Is this learning project-specific or general?** | Scope | Characteristics | Capture Target | |-------|-----------------|----------------| | **Project-specific** | Involves this codebase's architecture, conventions, dependencies, or local setup | Project knowledge files (`.claude/CLAUDE.md`, `.claude/docs/`) | | **General** | Applies across all projects—language patterns, framework best practices, tool usage, API quirks | Skills, commands, or subagents | **Decision questions:** 1. Would this help in *other* projects using the same language/framework? 2. Is this a general technique vs. this repo's specific implementation? 3. Does an existing skill already cover this domain? **Examples:** | Learning | Scope | Target | |----------|-------|--------| | "This repo uses `ApiError` class for error handling" | Project-specific | `.claude/CLAUDE.md` | | "SwiftUI `matchedGeometryEffect` should only apply to background shapes, not content" | General | `swiftui-excellence` skill | | "Run `npm install --legacy-peer-deps` for this project" | Project-specific | `.claude/CLAUDE.md` | | "React Server Components can't use `useState`" | General | `react-compon