Skip to content
insight-extraction logo

Insight Extraction Skill

insight-extraction

Extract actionable insights from completed coding sessions. Use when a session completes to capture learnings for future sessions.

oimiragieo/agent-studio0installs43stars

SKILL.md

Full skill instructions

Insight Extraction Skill

Overview

Analyze completed coding sessions and extract structured learnings for the memory system. Insights help future sessions avoid mistakes, follow established patterns, and understand the codebase faster.

Core principle: Extract ACTIONABLE knowledge, not logs. Every insight should help a future session do something better.

When to Use

Always:

  • After completing a coding task
  • After fixing bugs
  • After discovering new patterns
  • After failed attempts (especially valuable)

Exceptions:

  • Trivial changes with no learnings
  • Documentation-only changes

The Iron Law

NO SESSION END WITHOUT INSIGHT EXTRACTION FOR NON-TRIVIAL WORK

Non-trivial sessions should capture learnings before context is lost.

Input Required

To extract insights, you need:

  1. Git diff - What files changed and how
  2. Task description - What was being implemented
  3. Attempt history - Previous tries (if any), what approaches were used
  4. Session outcome - Success or failure

Workflow

Phase 1: Gather Session Data

# Get the diff of changes
git diff HEAD~1 --stat
git diff HEAD~1

# Get commit message
git log -1 --pretty=format:"%s%n%n%b"

# Get list of modified files
git diff HEAD~1 --name-only

Phase 2: Analyze File Insights

For each modified file, extract:

  • Purpose: What role does this file play?
  • Changes made: What was the modification? Focus on the "why" not just "what"
  • Patterns used: What coding patterns were applied?
  • Gotchas: Any file-specific traps?

Good example:

{
  "path": "src/​stores/​terminal-store.ts",
  "purpose": "Zustand store managing terminal session state with immer middleware",
  "changes_made": "Added setAssociatedTask action to link terminals with tasks",
  "patterns_used": ["Zustand action pattern", "immer state mutation"],
  "gotchas": ["State changes must go through actions, not direct mutation"]
}

Bad example (too vague):

{
  "path": "src/​stores/​terminal-store.ts",
  "purpose": "A store file",
  "changes_made": "Added some code",
  "patterns_used": [],
  "gotchas": []
}

Phase 3: Extract Patterns

Only extract patterns that are reusable:

  • Must apply to more than just this one case
  • Include where/​when to apply the pattern
  • Reference a concrete example in the codebase

Good example:

{
  "pattern": "Use e.stopPropagation() on interactive elements inside containers with onClick handlers",
  "applies_to": "Any clickable element nested inside a parent with click handling",
  "example": "Terminal.tsx header - dropdown needs stopPropagation to prevent focus stealing"
}

Phase 4: Document Gotchas

Must be specific and actionable:

  • Include what triggers the problem
  • Include how to solve or prevent it
  • Avoid generic advice ("be careful with X")

Good example:

{
  "gotcha": "Terminal header onClick steals focus from child interactive elements",
  "trigger": "Adding buttons/​dropdowns to Terminal header without stopPropagation",
  "solution": "Call e.stopPropagation() in onClick handlers of child elements"
}

Phase 5: Document Approach Outcome

Capture the learning from success or failure:

  • If succeeded: What made this approach work? What was key?
  • If failed: Why did it fail? What would have worked instead?
  • Alternatives tried: What other approaches were attempted?

This helps future sessions learn from past attempts.

Phase 6: Generate Recommendations

Specific, actionable advice for future work:

  • Must be implementable by a future session
  • Should be specific to this codebase, not generic
  • Focus on what's next or what to watch out for

Good: "When adding more controls to Terminal header, follow the dropdown pattern in this session - use stopPropagation and position relative to header"

Bad: "Write good code" or "Test thoroughly"

Phase 7: Output Structured Insights

Create the structured insight output:

# Session Insights: [Task Name]

## Date

[timestamp]

## Task

[Description of what was being implemented]

## Outcome

[SUCCESS/​FAILURE]

## File Insights

### [file-path]

- **Purpose**: [what this file does]
- **Changes**: [what was changed and why]
- **Patterns**: [patterns used]
- **Gotchas**: [things to watch out for]

## Patterns Discovered

### [Pattern Name]

- **Pattern**: [description]
- **Applies to**: [when to use]
- **Example**: [file or code reference]

## Gotchas Discovered

### [Gotcha Name]

- **Issue**: [what to avoid]
- **Trigger**: [what causes it]
- **Solution**: [how to handle]

## Approach Analysis

### What Worked

[Description of successful approach]

### What Failed (if applicable)

[Description of failed approaches and why]

### Alternatives Tried

[List of other approaches attempted]

## Recommendations for Future Sessions

1. [Specific recommendation 1]
2. [Specific recommendation 2]

Save to .claude/​context/​memory/​learnings.md (append).

Handling Edge Cases

Empty or Minimal Diff

If the diff is very small or empty:

  • Still extract file purposes if you can infer them
  • Note that the session made minimal changes
  • Focus on recommendations for next steps

Failed Session

If the session failed:

  • Focus on why it failed - this is the most valuable insight
  • Extract what was learned from the failure
  • Recommendations should address how to succeed next time

Multiple Files Changed

  • Prioritize the most important 3-5 files
  • Skip boilerplate changes (package-lock.json, etc.)
  • Focus on files central to the feature

Verification Checklist

Before completing insight extraction:

  • Git diff analyzed
  • File insights extracted for key files
  • Reusable patterns documented
  • Gotchas documented with triggers and solutions
  • Approach outcome documented
  • Recommendations are specific and actionable
  • Insights saved to memory file

Common Mistakes

Too Vague

Why it's wrong: "Fixed the bug" helps no one.

Do this instead: "Fixed race condition in useEffect by adding cleanup function. Pattern: always return cleanup from async effects."

Generic Advice

Why it's wrong: "Test your code" is not actionable.

Do this instead: "Run npm test src/​stores after changing store logic - the tests catch state management bugs."

Missing Context

Why it's wrong: Future sessions won't understand why.

Do this instead: Include file paths, function names, and specific scenarios.

Integration with Other Skills

This skill works well with:

  • session-handoff: Use insights in handoff documents
  • summarize-changes: Complement change summaries with insights
  • debugging: Extract insights from debugging sessions

Iron Laws

  1. ALWAYS extract insights immediately after task completion — delayed extraction loses context; the "what" can be reconstructed but the "why" evaporates within the session.
  2. NEVER record what was done — only record what was learned; activity logs belong in task metadata, not in the learning system.
  3. ALWAYS check for duplicate insights before writing — appending a near-duplicate insight pollutes the memory index and degrades future retrieval quality.
  4. NEVER write vague insights like "X is good" without concrete context, file path, or example — vague insights are unfindable and unhelpful to future sessions.
  5. ALWAYS tag insights with domain category ([CODE], [WORKFLOW], [SECURITY], etc.) — untagged insights are effectively invisible to agents searching by domain.

Anti-Patterns

Anti-PatternWhy It FailsCorrect Approach
Recording activity ("implemented auth") instead of learningsAgents can reconstruct history from git; they cannot reconstruct tacit knowledgeRecord "why" and "gotcha": "Fiber's CSRF middleware must be before route registration, not after"
Skipping deduplication checkDuplicate entries inflate memory size and confuse retrievalgrep -i "keyword" learnings.md before appending; update existing entry if found
Vague insights without file/​function contextFuture sessions can't locate or apply the insightInclude concrete path: "In .claude/​hooks/​routing/​routing-guard.cjs line 47: exit 0 on parse error"
Extracting only at session endLong sessions lose early context; critical gotchas forgottenExtract after each significant task completion, not just at session boundary
Storing insights only in task metadataTask metadata is not read by future sessions or agentsAlways write to .claude/​context/​memory/​learnings.md with tagged format

Memory Protocol

Before starting: Read .claude/​context/​memory/​learnings.md

After completing:

  • New pattern -> .claude/​context/​memory/​learnings.md
  • Issue found -> .claude/​context/​memory/​issues.md
  • Decision made -> .claude/​context/​memory/​decisions.md

ASSUME INTERRUPTION: If it's not in memory, it didn't happen.

More skills from oimiragieo

cloud-devops-expert logo
oimiragieo/agent-studio

cloud-devops-expert

Cloud and DevOps expert including AWS, GCP, Azure, and Terraform

43 0
View
xlsx logo
oimiragieo/agent-studio

xlsx

Spreadsheet toolkit (.xlsx/.csv). Create/edit with formulas/formatting, analyze data, visualization, recalculate formulas, for spreadsheet processing and analysis.

43 0
View
project-analyzer logo
oimiragieo/agent-studio

project-analyzer

Automated brownfield codebase analysis with weighted keyword scoring, three-stream analysis, and design pattern recognition. Detects project type, frameworks, dependencies, architecture patterns, and generates comprehensive project profile.

43 0
View
readme logo
oimiragieo/agent-studio

readme

Use when creating, updating, or generating README and documentation files for projects and libraries

43 0
View
scientific-writing logo
oimiragieo/agent-studio

scientific-writing

Core skill for the deep research and writing tool. Write scientific manuscripts in full paragraphs (never bullet points). Use two-stage process with (1) section outlines with key points using research-lookup then (2) convert to flowing prose. IMRAD structure, citations (APA/AMA/Vancouver), figure...

43 0
View
android-expert logo
oimiragieo/agent-studio

android-expert

Comprehensive Android development expert covering Jetpack Compose, Kotlin coroutines/Flow, Architecture Components, Hilt DI, Navigation, testing, performance, Material Design 3, and modern Android patterns (MVI, Clean Architecture).

43 0
View
biorxiv-database logo
oimiragieo/agent-studio

biorxiv-database

Efficient database search tool for bioRxiv preprint server. Use this skill when searching for life sciences preprints by keywords, authors, date ranges, or categories, retrieving paper metadata, downloading PDFs, or conducting literature reviews.

43 0
View
omega-gemini-cli logo
oimiragieo/agent-studio

omega-gemini-cli

Use when the user wants to use Google Gemini for analysis, large files or codebases, sandbox execution, or brainstorming. Uses headless Gemini CLI scripts (no MCP). Triggers on "use Gemini", "analyze with Gemini", "large file", "sandbox", "brainstorm with Gemini".

43 0
View
gtars logo
oimiragieo/agent-studio

gtars

High-performance toolkit for genomic interval analysis in Rust with Python bindings. Use when working with genomic regions, BED files, coverage tracks, overlap detection, tokenization for ML models, or fragment analysis in computational genomics and machine learning applications.

43 0
View
service-class-conventions logo
oimiragieo/agent-studio

service-class-conventions

Defines the structure and implementation of service classes, enforcing the use of interfaces, ServiceImpl classes, DTOs for data transfer, and transactional management.

43 0
View
diffdock logo
oimiragieo/agent-studio

diffdock

Diffusion-based molecular docking. Predict protein-ligand binding poses from PDB/SMILES, confidence scores, virtual screening, for structure-based drug design. Not for affinity prediction.

43 0
View
skill-discovery logo
oimiragieo/agent-studio

skill-discovery

How agents discover and use skills. Use to understand skill invocation protocol.

43 0
View

Popular AI tools

Kaiber logo
Video

Kaiber

Generate, edit, and beat-sync AI video with leading models in one workspace.

Paid
View
Vimcal logo
Productivity

Vimcal

The world's fastest calendar for remote work

Free
View

Transform Your Design with AI Designer by ImgCreator.ai

Freemium
View
Akool AI logo
Content & writing

Akool AI

Revolutionizing Video Production with AI-Powered Creativity

Paid
View

Extend an image past the frame and let AI fill the new aspect ratio.

Freemium
View
StarByFace logo
Security

StarByFace

Discover your celebrity doppelgänger with StarByFace!

Free
View
C

ChainClarity explains 700+ crypto whitepapers in plain English, with layered summaries, comparisons, research tools, alerts, and a $4.99 Pro plan.

Freemium
View
Opus Clip logo
Coding & apps

Opus Clip

Opus.ai: Revolutionize Your Web Experience

Free
View