git-pr-reader
Skill4 starsChanged 4 months agoApache-2.0View on GitHub
Unified interface for GitHub PRs and GitLab MRs: read PR/MR data with file filtering, list changed files, get review comments, post inline review comments, reply to existing comment threads, extract line numbers from diffs, validate comments, auto-detect PR/MR for current branch, and get unified diffs. Automatically detects GitHub vs GitLab from URL. Use this skill for analyzing code changes, posting review feedback, and documentation workflows.
- Reads credentials
In this repository53 other files it gives its agents.
- AGENTS.mdAGENTS.md
- CLAUDE.mdCLAUDE.md
- action-commentsSkill
- article-extractorSkill
- docs-convert-gdoc-mdSkill
- docs-orchestratorSkill
- docs-review-content-qualitySkill
- docs-review-modular-docsSkill
- docs-review-securitySkill
- docs-review-styleSkill
- docs-review-technicalSkill
- docs-ticket-readinessSkill
- docs-workflow-code-analysisSkill
- docs-workflow-create-jiraSkill
- docs-workflow-create-merge-requestSkill
- docs-workflow-jira-readySkill
- docs-workflow-pipeline-diagnosticsSkill
- docs-workflow-planningSkill
- docs-workflow-pr-analysisSkill
- docs-workflow-quality-gateSkill
- docs-workflow-requirementsSkill
- docs-workflow-scope-req-auditSkill
- docs-workflow-security-reviewSkill
- docs-workflow-startSkill
- docs-workflow-style-reviewSkill
- docs-workflow-tech-reviewSkill
- docs-workflow-writingSkill
- ibm-sg-audience-and-mediumSkill
- ibm-sg-language-and-grammarSkill
- ibm-sg-legal-informationSkill
- ibm-sg-numbers-and-measurementSkill
- ibm-sg-punctuationSkill
- ibm-sg-referencesSkill
- ibm-sg-structure-and-formatSkill
- ibm-sg-technical-elementsSkill
- jira-readerSkill
- jira-writerSkill
- learn-codeSkill
- lint-with-valeSkill
- mdita-writeSkill
- query-codeSkill
- redhat-docs-tocSkill
- rh-ssg-accessibilitySkill
- rh-ssg-formattingSkill
- rh-ssg-grammar-and-languageSkill
- rh-ssg-gui-and-linksSkill
- rh-ssg-legal-and-supportSkill
- rh-ssg-release-notesSkill
- rh-ssg-structureSkill
- rh-ssg-technical-examplesSkill
- rn-known-issuesSkill
- understand-pull-requestSkill
- validate-plugin-prereqsSkill
The file
We split this skill into the rules it gives an agent
3 rules. About 0 are common, 2 are distinctive, and 1 is very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈2
Distinctive · estimate
This author's own choices. Worth a look.
1
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 21
Validate comments: Check comment line numbers against actual diff content
- Very specific: line 24
Test files (test/, *_test.go, *.spec.ts, etc.)
- Distinctive: line 196
Only fetches file-level diffs, not commit-level history
≈ “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.
Files
Git PR Reader Skill
Unified interface for GitHub Pull Requests and GitLab Merge Requests — read, review, and post comments.
Capabilities
- Auto-detect Git platform: Automatically identifies GitHub vs GitLab from URL
- Read PR/MR data: Fetch title, description, and file-level diffs with smart filtering
- List changed files: Get file paths, statuses, and line counts with optional glob filtering
- Review comments: Fetch existing review comments/discussions, filter bots, include/exclude resolved
- Post review comments: Post inline comments on specific diff lines with duplicate detection and fallback to PR-level comments
- Reply to comments: Reply to existing review comment threads on GitHub PRs and GitLab MRs
- Extract line numbers: Parse diffs to get added/modified line numbers for accurate comment placement
- Validate comments: Check comment line numbers against actual diff content
- Auto-detect PR/MR: Find the open PR/MR for the current git branch (GitHub via
ghCLI, GitLab via API) - Smart file filtering: Exclude irrelevant files using configurable YAML patterns:
- Test files (test/, *_test.go, *.spec.ts, etc.)
- Lock files (package-lock.json, *.lock, Pipfile.lock, etc.)
- CI/CD configs (.gitlab-ci.yml, .github/workflows/, Dockerfile, etc.)
- Build artifacts (dist/, build/, target/, *.class, etc.)
- Generated code (*.pb.go, *.gen.go, etc.)
- Vendor directories (node_modules/, vendor/, etc.)
- Images and binaries (*.png, *.jpg, *.svg, etc.)
Usage
Subcommands
read — Read PR/MR data with diffs and file filtering
uv run --script ${CLAUDE_SKILL_DIR}/scripts/git_pr_reader.py read --url "https://github.com/owner/repo/pull/123"
uv run --script ${CLAUDE_SKILL_DIR}/scripts/git_pr_reader.py read --url "https://gitlab.com/group/project/-/merge_requests/456" --format markdown
uv run --script ${CLAUDE_SKILL_DIR}/scripts/git_pr_reader.py read --url "https://github.com/owner/repo/pull/123" --no-filterinfo — Get PR/MR information
uv run --script ${CLAUDE_SKILL_DIR}/scripts/git_pr_reader.py info https://github.com/owner/repo/pull/123 --jsonfiles — List changed files
uv run --script ${CLAUDE_SKILL_DIR}/scripts/git_pr_reader.py files https://github.com/owner/repo/pull/123
uv run --script ${CLAUDE_SKILL_DIR}/scripts/git_pr_reader.py files https://github.com/owner/repo/pull/123 --filter "*.adoc" --jsoncomments — List review comments
uv run --script ${CLAUDE_SKILL_DIR}/scripts/git_pr_reader.py comments https://github.com/owner/repo/pull/123
uv run --script ${CLAUDE_SKILL_DIR}/scripts/git_pr_reader.py comments https://github.com/owner/repo/pull/123 --include-resolved --jsondiff — Get unified diff
uv run --script ${CLAUDE_SKILL_DIR}/scripts/git_pr_reader.py diff https://github.com/owner/repo/pull/123post — Post review comments
uv run --script ${CLAUDE_SKILL_DIR}/scripts/git_pr_reader.py post https://github.com/owner/repo/pull/123 comments.json
uv run --script ${CLAUDE_SKILL_DIR}/scripts/git_pr_reader.py post https://github.com/owner/repo/pull/123 comments.json --review-type technical
uv run --script ${CLAUDE_SKILL_DIR}/scripts/git_pr_reader.py post https://github.com/owner/repo/pull/123 comments.json --review-type style --dry-runreply — Reply to an existing review comment
# Reply to a GitHub review comment
uv run --script ${CLAUDE_SKILL_DIR}/scripts/git_pr_reader.py reply https://github.com/owner/repo/pull/123 --comment-id 12345 --body "Applied the fix."
# Reply to a GitLab discussion
uv run --script ${CLAUDE_SKILL_DIR}/scripts/git_pr_reader.py reply https://gitlab.com/group/project/-/merge_requests/456 --discussion-id "abc123" --body "Fixed." --signoff "CI bot"
# Dry run
uv run --script ${CLAUDE_SKILL_DIR}/scripts/git_pr_reader.py reply https://github.com/owner/repo/pull/123 --comment-id 12345 --body "Test" --dry-runextract — Extract line numbers from diff
# Find line number for a pattern
uv run --script ${CLAUDE_SKILL_DIR}/scripts/git_pr_reader.py extract https://github.com/owner/repo/pull/123 path/to/file.adoc "pattern"
# Dump all added/modified lines
uv run --script ${CLAUDE_SKILL_DIR}/scripts/git_pr_reader.py extract --dump https://github.com/owner/repo/pull/123 path/to/file.adoc
# Validate a comments JSON file against the diff
uv run --script ${CLAUDE_SKILL_DIR}/scripts/git_pr_reader.py extract --validate https://github.com/owner/repo/pull/123 comments.jsonmetadata — Get combined PR/MR metadata
uv run --script ${CLAUDE_SKILL_DIR}/scripts/git_pr_reader.py metadata https://github.com/owner/repo/pull/123
uv run --script ${CLAUDE_SKILL_DIR}/scripts/git_pr_reader.py metadata https://gitlab.com/group/project/-/merge_requests/456
uv run --script ${CLAUDE_SKILL_DIR}/scripts/git_pr_reader.py metadata https://github.com/owner/repo/pull/123 --diff-output /path/to/diff.patchReturns combined metadata: platform, pr_number, title, description, state, author, base_branch, head_branch, labels, commits, changed_files, and url. With --diff-output, also saves the unified diff to the specified file.
detect — Auto-detect PR/MR for current branch
uv run --script ${CLAUDE_SKILL_DIR}/scripts/git_pr_reader.py detect
uv run --script ${CLAUDE_SKILL_DIR}/scripts/git_pr_reader.py detect --jsonAuthentication
Set in ~/.env (global) or .env in the project root (local override). See docs-skills README for setup:
GITHUB_TOKEN=your-github-pat # required scope: "repo" for private, "public_repo" for public
GITLAB_TOKEN=your-gitlab-pat # required scope: "api"The script loads .env files automatically — do not prepend source ~/.env to bash commands.
Python Library Usage
from git_pr_reader import GitReviewAPI
api = GitReviewAPI.from_url("https://github.com/owner/repo/pull/123")
# Read PR data with filtering
data = api.get_pr_data()
# Get PR info
info = api.get_pr_info()
# Get changed files
files = api.get_changed_files()
# Get combined metadata (author, labels, commits, files, state)
metadata = api.get_metadata()
# Get review comments
comments = api.get_review_comments()
# Post comments
api.post_comments([{"file": "path/to/file.adoc", "line": 42, "message": "Issue description"}])
# Reply to an existing comment
api.reply_to_comment(comment_id=12345, body="Fixed.")
# Extract line numbers from diff
lines = api.extract_line_numbers("path/to/file.adoc")
# Validate comments against diff
results = api.validate_comments(comments_list)Comments JSON Format
[
{"file": "path/to/file.adoc", "line": 42, "message": "Issue: missing title", "severity": "suggestion"},
{"file": "path/to/other.adoc", "line": 10, "message": "Typo in description", "severity": "suggestion"}
]Configuration
File filtering patterns are defined in config/git_filters.yaml. You can customize these patterns for your specific needs.
Dependencies
Dependencies (PyGithub, python-gitlab, pyyaml) are declared via PEP 723 inline metadata and installed automatically by uv run --script.
Integration with Other Skills
This skill works well with:
- jira-reader: Combine JIRA issue context with Git code changes
- jira-writer: Generate release notes from JIRA + Git data, then push back to JIRA
- docs-review-style: Post style review findings as inline PR/MR comments
- docs-review-technical: Post technical review findings as inline PR/MR comments
Limitations
- GitHub API rate limits: 60 requests/hour (unauthenticated), 5000/hour (authenticated)
- GitLab API rate limits: 10 requests/second
- Only fetches file-level diffs, not commit-level history
- Requires public PRs/MRs unless authentication tokens are provided
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
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.

