PR Knowledge Extraction

VerifiedSafe

Extracts valuable knowledge from PR comments, reviews, and context files, then saves structured learnings to docs/learnings/. Use after completing a pull request or with the /compound command to document decisions and insights.

Sby Skills Guide Bot
DocumentationIntermediate
6/2/2026
Claude Code
#knowledge-extraction#pr-documentation#learning-docs#automated-documentation

Recommended for

Automated summary

Extracts knowledge from PR review context and saves structured learning documents to docs/learnings/.

Strengths

  • Automates post-PR documentation by extracting valuable feedback
  • Multiple sources (PR comments, context files) are collected in parallel
  • Handles deduplication and cross-references between existing documents

Limitations

  • Requires GitHub CLI (gh) and a Git repository configured
  • Depends on the quality of PR comments for meaningful extraction
  • Only works with the current branch's PR or a manually specified PR number
When to use it

Use this skill after merging a PR or when you want to capture learnings from code review interactions.

When not to use it

Avoid for trivial changes without significant feedback, or when the project doesn't follow .dev/specs/{name}/ structure.

Security analysis

Safe
Quality score92/100

The skill uses Bash only for local file reads and GitHub CLI operations, with no destructive commands, network exfiltration, or execution of arbitrary code. All actions are confined to the workspace and legitimate PR documentation.

No concerns found

How this analysis is made

Examples

Document PR learnings
/compound
Specify PR number
/compound 123
Document from current branch
compound this

name: compound description: | This skill should be used when the user says "/compound", "compound this", "document learnings", "save what we learned", or after completing a PR. Extracts knowledge from PR context and saves to docs/learnings/. allowed-tools:

  • Read
  • Grep
  • Glob
  • Bash
  • Write
  • Edit
  • AskUserQuestion

Compound Skill

Extracts knowledge from PR context and saves structured documentation to docs/learnings/.

Workflow

Phase 1: Context Collection

  1. Identify PR number/branch

    • Use PR number if provided as argument
    • Otherwise, find PR from current branch: gh pr view --json number,body,title
    • If no PR exists: Prompt user to enter PR number directly or confirm proceeding without PR
  2. Extract Plan path

    • Find Plan path pattern in PR body: .dev/specs/{name}/PLAN.md
    • Regex: \.dev/specs/[^/]+/PLAN\.md
    • If no Plan path found: Prompt user to enter spec name directly or select from .dev/specs/ directory listing
  3. Derive Context path

    • Extract spec name from Plan path
    • Context directory: .dev/specs/{name}/context/
  4. Parallel collection (run following commands simultaneously, skip if files don't exist)

    # Context files (treat as empty if not found)
    cat .dev/specs/{name}/context/learnings.md 2>/dev/null || echo ""
    cat .dev/specs/{name}/context/decisions.md 2>/dev/null || echo ""
    cat .dev/specs/{name}/context/issues.md 2>/dev/null || echo ""
    
    # PR comments and reviews (collect as JSON for stability)
    gh pr view {pr_number} --json comments,reviews
    

Error Handling:

  • If no context files exist AND no PR comments → Notify user and request manual input
  • At least 1 source required to proceed with document generation

Phase 2: Knowledge Extraction & Classification

2.1 Extract Valuable Feedback from PR Comments

Criteria for valuable feedback:

  • Code improvement suggestions
  • Bug/issue identification
  • Pattern/best practice mentions
  • "This would be better" type advice
  • Comments left with approval

Filter out:

  • Simple questions ("What is this?")
  • Confirmation requests ("Is this correct?")
  • Approval-only comments ("LGTM", "Approved")
  • Bot comments

Extraction keywords:

  • "suggest", "recommend", "better", "instead"
  • "pattern", "practice", "convention"
  • "issue", "bug", "fix"
  • "learned", "TIL", "note"

Extracted information:

  • author
  • body
  • file_path (if inline comment)
  • created_at

2.2 Analyze Context Files

| File | Purpose | |------|---------| | learnings.md | Direct learnings | | decisions.md | Decision rationale | | issues.md | Out of scope issues (for future reference) |

2.3 Synthesize

  1. Assess documentation value from collected sources
  2. Check for duplicates: Search docs/learnings/
  3. Classify problem type - Refer to references/problem-types.md (relative to this skill directory)
  4. Generate tags

Phase 3: Document Generation

  1. Generate YAML frontmatter

    pr_number: {PR_NUMBER}
    date: {YYYY-MM-DD}
    problem_type: {TYPE}
    tags: [{TAGS}]
    plan_path: {PLAN_PATH}
    
  2. Write document using template

    • Template location: templates/LEARNING_TEMPLATE.md (relative to this skill directory)
    • Read template and substitute placeholders
  3. Determine filename

    • Format: {YYYY-MM-DD}-{short-title}.md
    • Example: 2024-01-15-api-error-handling.md
  4. Save

    • Path: docs/learnings/{filename}.md
  5. Add cross-references (if related documents exist)

    • Add new document link to Related section of existing documents

Usage Examples

# Specify PR number
/compound 123

# Use PR from current branch
/compound

Output

Outputs the created document path and summary:

Created: docs/learnings/2024-01-15-api-error-handling.md

Summary:
- Problem Type: error-handling
- Tags: api, typescript, validation
- Sources: learnings.md, 2 PR comments

<!-- TODO: Future extensions --> <!-- - [ ] Session ID based user feedback collection --> <!-- - [ ] CLAUDE.md auto-update suggestions --> <!-- - [ ] Detect existing document UPDATEs --> <!-- - [ ] Auto-categorization by problem_type (docs/solutions/{type}/) -->

From the file to a first result

The download contains exactly the content displayed on this page. This copy may differ from the latest version in the source repository.

View the source and supporting files

This download contains SKILL.md only. Any scripts, references, templates and dependencies are not included. Get the required files from the source, preserving their directory structure, before continuing.

1. Download the file

Download SKILL.md

From the root of a test project, save the file as .skill-downloads/pr-knowledge-extraction-mmk3nhk8/SKILL.md, or use the command below. This folder is for inspecting the skill before installation.

Command for macOS/Linux or WSL: requires a POSIX shell and curl. On Windows without WSL, use the download button and create the folder manually.

mkdir -p '.skill-downloads/pr-knowledge-extraction-mmk3nhk8' && curl --fail --show-error --location 'https://skills-guides.com/api/skills/pr-knowledge-extraction-mmk3nhk8/download' --output '.skill-downloads/pr-knowledge-extraction-mmk3nhk8/SKILL.md.part' && mv '.skill-downloads/pr-knowledge-extraction-mmk3nhk8/SKILL.md.part' '.skill-downloads/pr-knowledge-extraction-mmk3nhk8/SKILL.md'

2. Check prerequisites

Read SKILL.md before using it. If it references scripts or external services, inspect them and prepare the required access in your test environment.

No recognized prerequisites section in this file. This does not mean it is self-contained: libraries, tools and access requirements may be mentioned elsewhere in the content or source repository.

The platforms on this page are catalog indications. The paths below follow tool documentation; they do not prove this skill has been run in those tools. No minimum tool version is confirmed for this listing.

3. Load the skill

After inspection, copy the complete folder into your project using one of the commands below, then open a new tool session. The command stops if a folder with the same name already exists: compare the files before replacing it.

Claude Code
test -f '.skill-downloads/pr-knowledge-extraction-mmk3nhk8/SKILL.md' && test -s '.skill-downloads/pr-knowledge-extraction-mmk3nhk8/SKILL.md' && mkdir -p '.claude/skills' && test ! -e '.claude/skills/compound' && cp -R '.skill-downloads/pr-knowledge-extraction-mmk3nhk8' '.claude/skills/compound'

OpenSkills

OpenSkills must already be installed. The local install/read procedure is checked with OpenSkills 1.5.0, which requires Node.js ≥ 20.6.0. Catalog slugs are not resolved automatically.

Official OpenSkills installation
openskills install './.skill-downloads/pr-knowledge-extraction-mmk3nhk8'

openskills read 'pr-knowledge-extraction-mmk3nhk8'

Reading should display the installed file content and its base directory. It does not run the skill or install its dependencies.

For an agent that reads AGENTS.md, then sync the index. This command changes AGENTS.md: review the diff before using it.

openskills sync

Manual method or another tool: attach SKILL.md to a conversation, or open it in an agent that can read files. Include any required supporting resources. No universal folder is recognized by every tool.

4. Try a first task

Use a short, synthetic input: an API endpoint, a small document or an interface brief. In a new conversation, attach the file or give the agent its path, then adapt this request:

Read .skill-downloads/pr-knowledge-extraction-mmk3nhk8/SKILL.md and apply its instructions to this example: [describe a test input]. Identify any missing files, dependencies or access. Produce the result requested by the skill without inventing data or running unreviewed scripts.

Expected result: output matching the skill instructions, or a precise list of missing prerequisites. A read confirmation alone does not validate a first use. If an external resource is unavailable, that path remains untested.

Related skills