Skip to content

Learn From PR Agent

Shane Neuville edited this page Jan 29, 2026 · 2 revisions

The Learn From PR Agent extracts lessons from completed PRs and applies improvements to the repository.

How to Use This Agent


When to Invoke

  • "Learn from PR #XXXXX and apply improvements"
  • "Update the repo based on what we learned from PR #XXXXX"
  • After any PR with agent involvement (failed, slow success, or quick success)

When NOT to Invoke

  • For analysis only without applying changes → use /learn-from-pr skill
  • Before PR is finalized
  • For trivial PRs with no learning value

Workflow

Phase 1: Analysis

Run the /learn-from-pr skill workflow to analyze the PR and generate recommendations.

The skill covers three outcome types:

  • Agent failed - What was missing that caused wrong attempts
  • Agent succeeded slowly - What would have gotten to solution faster
  • Agent succeeded quickly - What patterns to reinforce

Phase 2: Apply Changes

For each High or Medium priority recommendation:

Category Action
Instruction file Edit existing or create new .github/instructions/*.instructions.md
Skill enhancement Edit .github/skills/*/SKILL.md
Architecture doc Edit /docs/design/*.md (detailed) or create quick-reference in .github/architecture/
General AI guidance Edit .github/copilot-instructions.md
Code comment Add comment to source file (don't modify behavior)

Before each edit:

  • Read the target file first
  • Check for existing similar content (don't duplicate)
  • Match the existing style/format
  • Find the appropriate section

Skip applying if:

  • Content already exists
  • Recommendation is too vague
  • Would require major restructuring

Phase 3: Report

Present a summary of what was applied and what was skipped.


Difference from Skill

Aspect /learn-from-pr Skill This Agent
Output Recommendations to discuss Applied changes
Mode Analysis only Autonomous
Use when Want to review without applying Want automatic improvements

Failure Modes Analyzed

Agent Failed

Pattern Indicator
Wrong file entirely All attempts in File A, fix in File B
Tunnel vision Only looked at file mentioned in error
Trusted issue title Issue said "crash in X" so only looked at X
Pattern not generalized Fixed one instance, missed others
Didn't search codebase Never found similar code patterns
Missing platform knowledge Didn't know iOS/Android/Windows specifics
Wrong abstraction layer Fixed handler when problem was in core
Misread error message Error pointed to symptom, not cause

Agent Succeeded Slowly

Pattern Indicator
Correct file, wrong approach Found right file but tried wrong fixes first
Needed multiple iterations Each attempt got closer but wasn't quite right
Discovery was slow Eventually found it but search was inefficient
Missing domain knowledge Had to learn something that could be documented

Agent Succeeded Quickly

Pattern Indicator
Good search strategy Found right file immediately
Understood the pattern Recognized similar issues from past
Documentation helped Existing docs pointed to solution
Simple, minimal fix Didn't over-engineer

Constraints

  • Only apply High/Medium priority - Report Low priority without applying
  • Don't duplicate - Check existing content first
  • Match style - Read file before editing
  • Code comments only - Never modify code behavior
  • No linter implementation - File issue instead of building analyzers

File Locations

File Purpose
.github/agents/learn-from-pr.md Agent definition
.github/skills/learn-from-pr/SKILL.md Analysis-only skill

Example

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.

Applied Improvement:

  • 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

Clone this wiki locally