一键导入
eia-github-pr-context
Use when retrieving PR context including metadata, diff, and changed files for code review planning. Trigger with /review-pr [PR_NUMBER].
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
Use when retrieving PR context including metadata, diff, and changed files for code review planning. Trigger with /review-pr [PR_NUMBER].
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
基于 SOC 职业分类
Quality gate enforcement for PR integration. Use when verifying code through pre-review, review, pre-merge, or post-merge checkpoints. Trigger with /eia-enforce-gates.
Software release management and coordination. Use when creating releases, bumping versions, or rolling back deployments. Trigger with release tasks or /eia-create-release.
Use when managing team tasks through GitHub Projects V2 or synchronizing project state via GraphQL API. Trigger with /sync-projects or when updating project items.
Use when diagnosing CI/CD failures. Trigger with CI failure logs or pipeline errors.
Use when processing parallel PRs. Trigger with git worktree or parallel development requests.
Use when managing GitHub Issues including creation, labels, milestones, assignees, and comments using gh CLI. Trigger with create issue, set labels, assign milestone.
| name | eia-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]. |
| license | Apache-2.0 |
| compatibility | Requires AI Maestro installed. |
| metadata | {"version":"1.0.0","author":"Emasoft","category":"github","tags":"pull-request, code-review, diff-analysis, github-api"} |
| agent | api-coordinator |
| context | fork |
| workflow-instruction | Step 21 |
| procedure | proc-evaluate-pr |
| user-invocable | false |
This skill provides tools to retrieve comprehensive context about GitHub Pull Requests. Use this skill when you need to:
Each script produces structured output for different PR analysis needs:
| Script | Output Format | Key Fields | Use Case |
|---|---|---|---|
eia_get_pr_context.py | JSON | number, title, state, author, mergeable, files[], labels[], reviewers[] | Complete PR overview for review planning |
eia_get_pr_files.py | JSON array | filename, status, additions, deletions, patch (optional) | File-level change tracking |
eia_get_pr_diff.py | Unified diff text or JSON stats | Diff hunks or files_changed, insertions, deletions | Code change inspection |
All JSON outputs are pretty-printed and can be piped to jq for filtering.
Follow these numbered steps to retrieve and analyze GitHub PR context:
Verify prerequisites are met
gh auth status to confirm GitHub CLI authenticationpython3 --version to confirm Python 3.8+ is availableIdentify which information you need
eia_get_pr_context.pyeia_get_pr_files.pyeia_get_pr_diff.pyRun the appropriate script with required parameters
--pr NUMBER (the PR number)--repo OWNER/REPO (defaults to current directory's repo)--stat for summary or --files for specific filesParse the output based on your task
jq or parse in your codeHandle errors appropriately
gh auth loginExtract specific information as needed
Copy this checklist and track your progress:
gh auth status)--pr NUMBER parameter| Scenario | Use This Skill |
|---|---|
| Starting a code review | Yes - get full PR context first |
| Need to know which files changed | Yes - use file listing script |
| Want to see actual code changes | Yes - use diff retrieval script |
| Need PR metadata (author, labels) | Yes - use context script |
| Creating a new PR | No - use git workflow skill instead |
| Commenting on a PR | Partially - get context first, then use gh CLI directly |
Need PR information?
├── Need full context (metadata + files + status)?
│ └── Use: eia_get_pr_context.py
│
├── Need only the list of changed files?
│ └── Use: eia_get_pr_files.py
│
├── Need to see the actual code diff?
│ ├── Want summary statistics only?
│ │ └── Use: eia_get_pr_diff.py --stat
│ ├── Want diff for specific files?
│ │ └── Use: eia_get_pr_diff.py --files file1.py file2.py
│ └── Want full diff?
│ └── Use: eia_get_pr_diff.py
Verify prerequisites:
# Check gh is authenticated
gh auth status
# Check Python version
python3 --version
| Script | Purpose | Key Arguments | Output |
|---|---|---|---|
eia_get_pr_context.py | Full PR metadata and status | --pr NUMBER, --repo OWNER/REPO | JSON with metadata, files, mergeable status |
eia_get_pr_files.py | List changed files | --pr NUMBER, --repo OWNER/REPO, --include-patch | JSON array of files with status |
eia_get_pr_diff.py | Get code diff | --pr NUMBER, --repo OWNER/REPO, --stat, --files | Diff text or JSON stats |
All scripts use standardized exit codes for consistent error handling:
| Code | Meaning | Description |
|---|---|---|
| 0 | Success | Output is valid JSON/text |
| 1 | Invalid parameters | Bad PR number, missing required args |
| 2 | Resource not found | PR does not exist |
| 3 | API error | Network, rate limit, timeout |
| 4 | Not authenticated | gh CLI not logged in |
| 5 | Idempotency skip | N/A for these scripts |
| 6 | Not mergeable | N/A for these scripts |
# Get context for PR #123 in current repo
python3 eia_get_pr_context.py --pr 123
# Get context for PR in specific repo
python3 eia_get_pr_context.py --pr 456 --repo owner/repo-name
# List files changed in PR #123
python3 eia_get_pr_files.py --pr 123
# Include patch/diff for each file
python3 eia_get_pr_files.py --pr 123 --include-patch
# Get full diff
python3 eia_get_pr_diff.py --pr 123
# Get statistics summary only
python3 eia_get_pr_diff.py --pr 123 --stat
# Get diff for specific files only
python3 eia_get_pr_diff.py --pr 123 --files src/main.py tests/test_main.py
For detailed information about PR metadata fields and how to extract specific information, see:
Contents:
For detailed information about interpreting PR diffs and analyzing changes, see:
Contents:
When delegating PR review tasks, use this skill to gather context first:
1. Get PR context with eia_get_pr_context.py
2. Analyze which files changed with eia_get_pr_files.py
3. Delegate file-specific reviews to subagents based on file types
4. Aggregate results and post review summary
| Problem | Cause | Solution |
|---|---|---|
| "gh: command not found" | GitHub CLI not installed | Install with brew install gh or see gh docs |
| "not logged into any GitHub hosts" | gh not authenticated | Run gh auth login |
| "Could not resolve to a PullRequest" | Wrong PR number or repo | Verify PR exists with gh pr view NUMBER |
| Rate limit errors | Too many API calls | Wait for rate limit reset or use --retry |
| Permission denied | No repo access | Verify you have read access to the repository |
For additional troubleshooting, run scripts with --verbose flag for detailed logging.