learn-from-pr

0
0
Source

Analyzes a completed PR to extract lessons learned from agent behavior. Use after any PR with agent involvement - whether the agent failed, succeeded slowly, or succeeded quickly. Identifies patterns to reinforce or fix, and generates actionable recommendations for instruction files, skills, and documentation.

Install

mkdir -p .claude/skills/learn-from-pr && curl -L -o skill.zip "https://mcp.directory/api/skills/download/5829" && unzip -o skill.zip -d .claude/skills/learn-from-pr && rm skill.zip

Installs to .claude/skills/learn-from-pr

About this skill

Learn From PR

Extracts lessons learned from a completed PR to improve repository documentation and agent capabilities.

Inputs

InputRequiredSource
PR number or Issue numberYesUser provides (e.g., "PR #33352" or "issue 33352")

Outputs

  1. Learning Analysis - Structured markdown with:

    • What happened (problem, attempts, solution)
    • Fix location analysis (attempted vs actual)
    • Failure modes identified
    • Prioritized recommendations
  2. Actionable Recommendations - Each with:

    • Category, Priority, Location, Specific Change, Why It Helps

Completion Criteria

The skill is complete when you have:

  • Gathered PR diff and metadata
  • Analyzed fix location (attempted vs actual)
  • Identified failure modes
  • Generated at least one concrete recommendation
  • Presented findings to user

When to Use

  • After agent failed to find the right fix
  • After agent succeeded but took many attempts
  • After agent succeeded quickly (to understand what worked)
  • When asked "what can we learn from PR #XXXXX?"

When NOT to Use

  • Before PR is finalized (use pr-finalize first)
  • For trivial PRs (typo fixes, simple changes)
  • When no agent was involved (nothing to analyze)

Workflow

Step 1: Gather Data

# Required: Get PR info
gh pr view XXXXX --json title,body,files
gh pr diff XXXXX

Analyze the PR to extract learning:

  1. PR discussion - Comments reveal what was tried
  2. Commit history - Multiple commits may show iteration
  3. Code complexity - Non-obvious fixes suggest learning opportunities
  4. Similar past issues - Search for related bugs

Focus on: "What would have helped an agent find this fix faster?"

Step 2: Fix Location Analysis

Critical question: Did agent attempts target the same files as the final fix?

# Where did final fix go?
gh pr view XXXXX --json files --jq '.files[].path' | grep -v test
ScenarioImplication
Same filesAgent found right location
Different filesMajor learning opportunity - document why

If different files: Answer these questions:

  • Why did agent think that was the right file?
  • What search would have found the correct file?

Step 3: Analyze Outcome

Determine which scenario applies and look for the relevant patterns:

Scenario A: Agent Failed

PatternIndicator
Wrong file entirelyAll attempts in File A, fix in File B
Tunnel visionOnly looked at file mentioned in error
Trusted issue titleIssue said "crash in X" so only looked at X
Pattern not generalizedFixed one instance, missed others
Didn't search codebaseNever found similar code patterns
Missing platform knowledgeDidn't know iOS/Android/Windows specifics
Wrong abstraction layerFixed handler when problem was in core
Misread error messageError pointed to symptom, not cause
Incomplete contextDidn't read enough surrounding code
Over-engineeredComplex fix when simple one existed

Scenario B: Agent Succeeded Slowly (many attempts)

PatternIndicator
Correct file, wrong approachFound right file but tried wrong fixes first
Needed multiple iterationsEach attempt got closer but wasn't quite right
Discovery was slowEventually found it but search was inefficient
Missing domain knowledgeHad to learn something that could be documented

Key question: What would have gotten agent to the solution faster?

Scenario C: Agent Succeeded Quickly

PatternIndicator
Good search strategyFound right file immediately
Understood the patternRecognized similar issues from past
Documentation helpedExisting docs pointed to solution
Simple, minimal fixDidn't over-engineer

Key question: What made this work? Should we reinforce this pattern?

Step 4: Find Improvement Locations

# Discover where agent guidance lives
find .github/instructions -name "*.instructions.md" 2>/dev/null
find .github/skills -name "SKILL.md" 2>/dev/null
ls docs/design/ 2>/dev/null
ls .github/copilot-instructions.md 2>/dev/null
LocationWhen to Add Here
.github/instructions/*.instructions.mdDomain-specific AI guidance (testing patterns, platform rules)
.github/skills/*/SKILL.mdSkill needs new step, checklist, or improved workflow
/docs/design/*.mdDetailed architectural documentation
.github/copilot-instructions.mdGeneral AI workflow guidance
Code commentsNon-obvious code behavior

Step 5: Generate Recommendations

For each recommendation, provide:

  1. Category: Instruction file / Skill / Architecture doc / Inline comment / Linting issue
  2. Priority: High (prevents class of bugs) / Medium (helps discovery) / Low (nice to have)
  3. Location: Exact file path
  4. Specific Change: Exact text to add
  5. Why It Helps: Which failure mode it prevents

Prioritization factors:

  • How common is this pattern?
  • Would future agents definitely hit this again?
  • How hard is it to implement?

Pattern-to-Improvement Mapping (Failures/Slow Success):

PatternLikely Improvement
Wrong file entirelyCheck /docs/design/ for component relationships
Tunnel visionInstruction file: "Always search for pattern across codebase"
Missing platform knowledgePlatform-specific instruction file
Wrong abstraction layerReference /docs/design/HandlerResolution.md
Misread error messageCode comment explaining the real cause
Over-engineeredSkill enhancement: "Try simplest fix first"

Pattern-to-Improvement Mapping (Quick Success - reinforce):

PatternImprovement
Good search strategyDocument the search pattern that worked in skills
Documentation helpedNote which docs were valuable, ensure they stay updated
Recognized patternAdd to instruction files as known pattern

Step 6: Present Findings

Present your analysis covering:

  • What happened and what made it hard
  • Where agent looked vs actual fix location
  • Which patterns applied and evidence
  • Prioritized recommendations with full details (category, priority, location, exact change, why it helps)

Error Handling

SituationAction
PR not foundAsk user to verify PR number
No agent involvement evidentAsk user if they still want analysis
Can't determine failure modeState "insufficient data" and what's missing

Constraints

  • Analysis only - Don't apply changes (use learn-from-pr agent for that)
  • Actionable recommendations - Every recommendation must have specific file path and text
  • Don't duplicate - Check existing docs before recommending new ones
  • Focus on high-value learning - Skip trivial observations
  • Respect PR scope - Don't recommend improvements unrelated to the PR's learnings

Examples

Example: Wrong File Entirely

PR #33352 - TraitCollectionDidChange crash on MacCatalyst

What happened:

  • Issue title: "ObjectDisposedException in ShellSectionRootRenderer"
  • Agent made 11 attempts, ALL in ShellSectionRootRenderer.cs
  • Actual fix was in PageViewController.cs

Failure Mode: Trusted issue title instead of searching for pattern.

Recommendation:

  • Category: Instruction File
  • Location: .github/instructions/ios-debugging.instructions.md
  • Change: "When fixing iOS crashes, search for the PATTERN across all files, not just the file named in the error"
  • Why: Prevents tunnel vision on named file

Example: Slow Success

PR #34567 - CollectionView scroll position not preserved

What happened:

  • Agent took 5 attempts to find fix
  • First 3 attempts were in wrong layer (handler vs core)
  • Eventually found it after reading more context
  • Final fix was simple once the right layer was identified

Pattern: Wrong abstraction layer - fixed handler when problem was in core.

Recommendation:

  • Category: Architecture Doc
  • Location: .github/architecture/handler-vs-core.md
  • Change: Document layer responsibilities - handlers map properties, core handles behavior
  • Why: Helps agent identify correct layer faster

Example: Quick Success

PR #35678 - Button disabled state not updating

What happened:

  • Agent found fix in 1 attempt
  • Searched for "IsEnabled" pattern across codebase immediately
  • Found similar past fix in another control and applied same approach
  • Simple, minimal change

Pattern: Good search strategy - recognized pattern from similar code.

Recommendation:

  • Category: Skill Enhancement
  • Location: .github/skills/try-fix/SKILL.md
  • Change: Add to search strategy: "Search for same property pattern in other controls"
  • Why: Reinforces successful discovery technique

Integration

  • pr-finalize → Use first to verify PR is ready
  • learn-from-pr skill → Analysis only (this skill)
  • learn-from-pr agent → Analysis + apply changes

For automated application of recommendations, use the learn-from-pr agent instead.

You might also like

flutter-development

aj-geddes

Build beautiful cross-platform mobile apps with Flutter and Dart. Covers widgets, state management with Provider/BLoC, navigation, API integration, and material design.

643969

drawio-diagrams-enhanced

jgtolentino

Create professional draw.io (diagrams.net) diagrams in XML format (.drawio files) with integrated PMP/PMBOK methodologies, extensive visual asset libraries, and industry-standard professional templates. Use this skill when users ask to create flowcharts, swimlane diagrams, cross-functional flowcharts, org charts, network diagrams, UML diagrams, BPMN, project management diagrams (WBS, Gantt, PERT, RACI), risk matrices, stakeholder maps, or any other visual diagram in draw.io format. This skill includes access to custom shape libraries for icons, clipart, and professional symbols.

591705

ui-ux-pro-max

nextlevelbuilder

"UI/UX design intelligence. 50 styles, 21 palettes, 50 font pairings, 20 charts, 8 stacks (React, Next.js, Vue, Svelte, SwiftUI, React Native, Flutter, Tailwind). Actions: plan, build, create, design, implement, review, fix, improve, optimize, enhance, refactor, check UI/UX code. Projects: website, landing page, dashboard, admin panel, e-commerce, SaaS, portfolio, blog, mobile app, .html, .tsx, .vue, .svelte. Elements: button, modal, navbar, sidebar, card, table, form, chart. Styles: glassmorphism, claymorphism, minimalism, brutalism, neumorphism, bento grid, dark mode, responsive, skeuomorphism, flat design. Topics: color palette, accessibility, animation, layout, typography, font pairing, spacing, hover, shadow, gradient."

318399

godot

bfollington

This skill should be used when working on Godot Engine projects. It provides specialized knowledge of Godot's file formats (.gd, .tscn, .tres), architecture patterns (component-based, signal-driven, resource-based), common pitfalls, validation tools, code templates, and CLI workflows. The `godot` command is available for running the game, validating scripts, importing resources, and exporting builds. Use this skill for tasks involving Godot game development, debugging scene/resource files, implementing game systems, or creating new Godot components.

340397

nano-banana-pro

garg-aayush

Generate and edit images using Google's Nano Banana Pro (Gemini 3 Pro Image) API. Use when the user asks to generate, create, edit, modify, change, alter, or update images. Also use when user references an existing image file and asks to modify it in any way (e.g., "modify this image", "change the background", "replace X with Y"). Supports both text-to-image generation and image-to-image editing with configurable resolution (1K default, 2K, or 4K for high resolution). DO NOT read the image file first - use this skill directly with the --input-image parameter.

452339

fastapi-templates

wshobson

Create production-ready FastAPI projects with async patterns, dependency injection, and comprehensive error handling. Use when building new FastAPI applications or setting up backend API projects.

304231

Stay ahead of the MCP ecosystem

Get weekly updates on new skills and servers.