agentleFS
Microsoft AzureKnown publisherAzure/azure-messaging-ai-context/.github/skills/extract-learnings/SKILL.md

extract-learnings

Skill0 starsChanged 21 days agoMITView on GitHub

Extract engineering learnings from PR feedback and save them to general_coding_instructions.md. Use when a PR review cycle is complete or when the user wants to capture team style/preferences/practices.

1 other project uses a version of this.

Adopted by

Most recently taken up by

  • Other versions1 project uses a version of this.

    Word for word · 0

    None found.

    Edited · 0

    None found.

    Wrote their own version · 1

    1. buildomator/buildomator★ 102same name

    How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.

  • In this repository6 other files it gives its agents.

The file

Show its rules and text

We split this skill into the rules it gives an agent

29 rules. About 0 are common, 18 are distinctive, and 11 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈18

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 11

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Very specific:

    All learnings extracted from PR feedback should be saved to general_coding_instructions.md.

    line 11
  2. Very specific:

    Read the current file: Read .github/general_coding_instructions.md to understand its structure and existing content.

    line 19
  3. Distinctive:

    Check for duplicates: Ensure the learning is not already documented.

    line 21
  4. Distinctive:

    Add the learning: Add the learning to the appropriate section.

    line 25
  5. Distinctive:

    Look for patterns in feedback across multiple comments

    line 33
  6. Very specific:

    Use mcp__azure-devops__repo_list_repos_by_project to get repository ID

    line 39
  7. Very specific:

    Use mcp__azure-devops__repo_list_pull_request_threads to fetch all threads

    line 40
  8. Very specific:

    IMPORTANT: Use -ShowResolved YES to include ALL comments (resolved and unresolved) for extracting learnings:

    line 49
  9. Distinctive:

    When Azure DevOps PR threads are too large (>25K tokens), the API response cannot be read directly:

    line 66
  10. Distinctive:

    All statuses (closed threads can still provide value)

    line 88
  11. Distinctive:

    If a learning doesn't fit an existing section, propose a new section.

    line 112
  12. Distinctive:

    Look for these types of learnings in feedback:

    line 116
  13. Very specific:

    Before adding learnings, check if they already exist in .github/general_coding_instructions.md:

    line 175
  14. Distinctive:

    Check if the learning is already documented

    line 180
  15. Distinctive:

    If a learning is already documented, skip it

    line 183
  16. Distinctive:

    Only add learnings that are:

    line 184
  17. Distinctive:

    Before modifying any files, present a numbered list of proposed learnings so the user can select which to keep:

    line 191
  18. Very specific:

    Read the current file: Read .github/general_coding_instructions.md to get the current content

    line 208
  19. Very specific:

    Add the learning: Use the Edit tool to add the learning to the appropriate section

    line 210
  20. Distinctive:

    Create new sections if needed: If no existing section fits, add a new section with a clear heading

    line 211
  21. Distinctive:

    Follow the existing format of the file

    line 212
  22. Distinctive:

    Use code examples with CORRECT/WRONG patterns where applicable

    line 213
  23. Very specific:

    After updating general_coding_instructions.md, create a PR to the azure-messaging-ai-context repository with the changes:

    line 217
  24. Very specific:

    If working in azure-messaging-ai-context repo: Create a branch and PR directly

    line 219
  25. Distinctive:

    Use this summary template to report changes:

    line 224
  26. Distinctive:

    Use markdown headers to organize sections

    line 255
  27. Very specific:

    Use code blocks with language hints (`c, `powershell)

    line 256
  28. Distinctive:

    Use tables for reference information

    line 257
  29. Distinctive:

    Use CORRECT/WRONG patterns with comments

    line 258

≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

Extract learnings about team style, preferences, and engineering practices from PR review comments, then save them to the project's general_coding_instructions.md file.

Target File: general_coding_instructions.md

All learnings extracted from PR feedback should be saved to general_coding_instructions.md. This file contains team-wide coding conventions, style preferences, and best practices.

File location:

  • In azure-messaging-ai-context repo: .github/general_coding_instructions.md
  • In higher-level repos: deps/azure-messaging-ai-context/.github/general_coding_instructions.md

Before Adding Learnings

  1. Read the current file: Read .github/general_coding_instructions.md to understand its structure and existing content.
  2. Check for duplicates: Ensure the learning is not already documented. If it exists, skip it.
  3. Find the right section: Match the learning to an existing section (e.g., Code Style, Error Handling, Testing) or add a new section if needed.
  4. Add the learning: Add the learning to the appropriate section.

Workflow

Step 1: Fetch PR Comments

Fetch all comment threads from the PR:

  • Focus on reviewer comments that indicate style preferences, corrections, or best practices
  • Look for patterns in feedback across multiple comments

For Azure DevOps PRs

URL pattern: https://dev.azure.com/{org}/{project}/_git/{repo}/pullrequest/{id}
  1. Use mcp__azure-devops__repo_list_repos_by_project to get repository ID
  2. Use mcp__azure-devops__repo_list_pull_request_threads to fetch all threads
  3. For each thread, use mcp__azure-devops__repo_list_pull_request_thread_comments if needed

For GitHub PRs

URL pattern: https://github.com/{owner}/{repo}/pull/{number}

Use the pre-built parsing script that fetches and filters comments directly.

IMPORTANT: Use -ShowResolved YES to include ALL comments (resolved and unresolved) for extracting learnings:

pwsh -File .github/scripts/parse_github_pr_comments.ps1 -prUrl "https://github.com/owner/repo/pull/123" -outputDir "cmake" -ShowResolved YES

Then read the output: Read cmake/extract-learnings/github_pr_comments_parsed.txt

The script automatically:

  • Fetches comments via gh api (requires GitHub CLI authenticated)
  • With -ShowResolved YES: Shows ALL comments for learning extraction
  • With -ShowResolved NO: Only shows active/unresolved comments
  • Groups comments by file for easier reading
  • Shows active comment count vs resolved count
  • Writes output to cmake/extract-learnings/github_pr_comments_parsed.txt for easy access

Step 1b: Handle Large Azure DevOps API Responses

When Azure DevOps PR threads are too large (>25K tokens), the API response cannot be read directly:

  1. Save response to file: Let the API response save to tool-results folder (this happens automatically when response is too large)
  2. Use the pre-built parsing script at .github/scripts/parse_pr_threads.ps1
  3. Run with -ShowResolved YES to include ALL threads for learning extraction:
    pwsh -File .github/scripts/parse_pr_threads.ps1 -jsonFile "<path-to-tool-results>" -outputDir "cmake" -ShowResolved YES
  4. Read the output: Read cmake/pr_threads_parsed.txt

The script automatically filters out:

  • Bot comments (MerlinBot, Azure Pipelines)
  • PR-level comments without file context
  • With -ShowResolved YES: Includes closed/resolved threads for learning extraction
  • With -ShowResolved NO: Only shows active threads

Output is written to cmake/pr_threads_parsed.txt for easy access.

Filtering PR Comments

Include:

  • Comments with threadContext (file-specific feedback)
  • All statuses (closed threads can still provide value)
  • Human reviewers (team members)

Exclude:

  • Bot comments (MerlinBot, Azure Pipelines, etc.)
  • PR-level comments without file context
  • System-generated threads (build status, etc.)

Step 2: Categorize Learnings

Match learnings to existing sections in general_coding_instructions.md:

SectionExamples
Function Naming ConventionsNaming patterns, module prefixes, visibility rules
Function Structure GuidelinesOrganization, async callbacks, complexity
Variable Naming ConventionsVariable naming patterns, special types
Result Variable ConventionsInitialization, return patterns
Parameter Validation RulesValidation order, combined checks, logging
Goto Usage RulesPermitted patterns, label naming
Indentation and FormattingSpacing, brace style, alignment
If/Else Formatting RulesMulti-condition, bracing, error chains
Additional ConventionsMockable functions, header order, memory management, pointer casting, error handling, reference counting, async operations, requirements traceability

If a learning doesn't fit an existing section, propose a new section.

Step 3: Identify Specific Patterns

Look for these types of learnings in feedback:

  1. Direct Corrections:
    • "Use X instead of Y"
    • "This should be..."
    • "Wrong pattern, correct is..."
  2. Style Preferences:
    • "We prefer..."
    • "Team convention is..."
    • "Always/Never do..."
  3. Implicit Patterns:
    • Repeated similar corrections across multiple comments
    • Consistent feedback about specific constructs
    • Comments indicating codebase-wide patterns (e.g., "do this everywhere", "same issue")
  4. Best Practices:
    • Performance recommendations
    • Safety/security patterns
    • Thread-safety requirements

Learning Prioritization

High Priority (always capture):

  • Comments indicating team-wide conventions (e.g., "do this everywhere", "same issue")
  • Thread-safety/deadlock patterns
  • Memory leak prevention patterns
  • Patterns repeated by multiple reviewers

Medium Priority (capture if generalizable):

  • Style preferences with clear reasoning
  • Performance recommendations
  • Test patterns

Step 4: Formulate Learning Statements

Convert raw feedback into actionable learning statements:

From PR Comment:

"const can't size arrays in MSVC, use #define"

Learning Statement:

#### Array Sizes: Use `#define`, Not `const`
MSVC doesn't support VLAs. Use `#define` macros for array sizes:
```c
// WRONG
const uint32_t size = 3;
TYPE items[size];  // Compiler error!

// CORRECT
#define SIZE 3
TYPE items[SIZE];

### Step 5: Check for Duplicates

Before adding learnings, check if they already exist in `.github/general_coding_instructions.md`:

1. **Read the guidelines file**:
   - Read `.github/general_coding_instructions.md`
   - Understand its structure and existing sections
   - Check if the learning is already documented

2. **Duplicate Detection Rules**:
   - If a learning is already documented, **skip it**
   - Only add learnings that are:
     - Team-specific preferences not already in the file
     - New conventions established through PR feedback
     - Corrections to or clarifications of existing patterns

### Step 6: Present Proposed Changes

Before modifying any files, present a **numbered list** of proposed learnings so the user can select which to keep:

1. **Group learnings by target section** in general_coding_instructions.md
2. **Present each learning as a numbered item**:
  1. [Function Naming] Use snake_case for all internal helpers (Source: PR comment #123)
  2. [Error Handling] Always log all parameters on validation failure (Source: PR comment #456)
  3. [Memory Management] Use malloc_2 for array allocations (Source: PR comment #789)
3. **Ask user to respond with**:
- Specific numbers to keep (e.g., "1, 3")
- "keep all" to apply all proposed changes
4. **Only apply the selected learnings**

### Step 7: Update general_coding_instructions.md

After approval:
1. **Read the current file**: Read `.github/general_coding_instructions.md` to get the current content
2. **Find the target section**: Locate the appropriate section for each learning
3. **Add the learning**: Use the `Edit` tool to add the learning to the appropriate section
4. **Create new sections if needed**: If no existing section fits, add a new section with a clear heading
5. Follow the existing format of the file
6. Use code examples with CORRECT/WRONG patterns where applicable

### Step 8: Create PR to azure-messaging-ai-context

After updating `general_coding_instructions.md`, create a PR to the azure-messaging-ai-context repository with the changes:

1. **If working in azure-messaging-ai-context repo**: Create a branch and PR directly
2. **If working in a higher-level repo**: The changes are in `deps/azure-messaging-ai-context/.github/general_coding_instructions.md`. Create a PR to the [Azure/azure-messaging-ai-context](https://github.com/Azure/azure-messaging-ai-context) repository with the updated file.

### Step 9: Summarize Changes

Use this summary template to report changes:

| Category | Found | New | Skipped (dup) |
|----------|-------|-----|---------------|
| Code Style | X | Y | Z |
| Error Handling | X | Y | Z |
| Testing | X | Y | Z |
| Memory Management | X | Y | Z |

**Added to general_coding_instructions.md:** [numbered list with section name and source thread/comment IDs]

**New sections created:** [list of new section names, if any]

**Skipped (already documented):** [list with location in existing section]

Report:
- Number of new learnings added
- Sections updated (and any new sections created)
- Categories covered

## Guidelines

### What Makes a Good Learning

- **Specific**: "Use `#define` for array sizes" not "Be careful with arrays"
- **Actionable**: Shows what TO DO and what NOT to do
- **Generalizable**: Applies beyond the specific PR/file
- **Documented with examples**: Include code snippets when relevant

### Format Conventions

- Use markdown headers to organize sections
- Use code blocks with language hints (```c, ```powershell)
- Use tables for reference information
- Use CORRECT/WRONG patterns with comments

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.