| name | amia-github-pr-context |
| description | Use when retrieving PR context including metadata, diff, and changed files for code review planning. Trigger with /review-pr [PR_NUMBER]. Loaded by ai-maestro-integrator-agent-main-agent. |
| license | MIT |
| compatibility | Requires AI Maestro installed. |
| tags | pull-request, code-review, diff-analysis, github-api |
| metadata | {"version":"1.0.0","author":"Emasoft","category":"github"} |
| agent | amia-api-coordinator |
| context | fork |
| user-invocable | false |
GitHub PR Context Skill
Overview
Retrieves comprehensive GitHub Pull Request context (metadata, changed files, diffs) for code review planning and task delegation.
Prerequisites
- GitHub CLI (gh) installed and authenticated (
gh auth status)
- Python 3.8+ available in PATH
- Read access to the target repository
Instructions
- Verify prerequisites: run
gh auth status and python3 --version
- Choose the right script based on what you need:
- Full PR overview →
amia_get_pr_context.py
- Changed files list →
amia_get_pr_files.py
- Code diff →
amia_get_pr_diff.py
- Run with required params: always pass
--pr NUMBER, optionally --repo OWNER/REPO
- For diffs: add
--stat for summary or --files f1.py f2.py for specific files
- Parse output: pipe JSON to
jq; check exit codes (0=ok, 1=bad params, 2=not found, 3=API error, 4=not authed)
Checklist
Copy this checklist and track your progress:
Output
| Script | Output | Key Fields |
|---|
amia_get_pr_context.py | JSON | number, title, state, author, mergeable, files[], labels[], reviewers[] |
amia_get_pr_files.py | JSON array | filename, status, additions, deletions, patch (optional) |
amia_get_pr_diff.py | Diff text or JSON stats | Diff hunks or files_changed, insertions, deletions |
Output discipline: All scripts support --output-file <path>.
Reference Documents
PR Analysis:
- pr-metadata — PR metadata JSON structure and field extraction
-
- PR Metadata JSON Structure
- 1.1 Core identification fields (number, title, state)
- 1.2 Author and assignee information
- 1.3 Branch and merge information
- 1.4 Labels, milestones, and projects
- 1.5 Review and approval status
-
- Extracting Specific Fields
- 2.1 Getting PR title and description
- 2.2 Finding the source and target branches
- 2.3 Checking mergeable status and conflicts
- 2.4 Listing reviewers and their decisions
-
- Common Metadata Queries
- 3.1 Is this PR ready to merge?
- 3.2 Who needs to approve this PR?
- 3.3 What labels are applied?
- diff-analysis — Understanding and analyzing PR diffs
-
- Understanding Diff Output
- 1.1 Unified diff format explanation
- 1.2 File headers and hunks
- 1.3 Addition, deletion, and context lines
-
- File-Level Analysis
- 2.1 Identifying file types by extension
- 2.2 Detecting rename and copy operations
- 2.3 Binary file changes
-
- Change Statistics
- 3.1 Lines added vs deleted
- 3.2 Files by change type (added, modified, deleted)
- 3.3 Estimating review complexity
-
- Filtering and Focusing
- 4.1 Filtering by file path patterns
- 4.2 Ignoring generated files
- 4.3 Focusing on specific directories
Operations:
Extended Guide:
See detailed-guide for full reference:
- When to Use This Skill
- Decision Tree: Which Script to Use
- Exit Codes
- Error Handling
- Integration with Integrator Agent
- Detailed Examples
Error Handling
If a script fails, check the exit code and stderr output. Common issues:
- Exit 1: Invalid parameters or missing arguments
- Exit 2-4: GitHub API errors (auth, not found, rate limit)
See the detailed guide above for detailed error scenarios.
Resources
Full reference: detailed-guide:
- When to Use This Skill
- Decision Tree: Which Script to Use
- Exit Codes
- Error Handling
- Integration with Integrator Agent
- Detailed Examples
- Get Full PR Context
- List Changed Files
- Get Diff
- Extracting Specific Information
Examples
Get PR context and extract files
python3 amia_get_pr_context.py --pr 123
python3 amia_get_pr_context.py --pr 456 --repo owner/repo-name
python3 amia_get_pr_diff.py --pr 123 --stat