Git pr reader
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.From its SKILL.md
npx -y skills add opendatahub-io/docs-skills --skill git-pr-readerAssembled from the repository path, not quoted from the project. Check it against their README if it does not work.
One thing to look at
- 3 stars3 stars. Stars are a popularity signal and not a quality one, but at this level it is likely that nobody has read this closely except its author, and you would be relying on your own review.
SKILL.md
8.3 KB, as published. Nobody here has run it
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-filter
info — Get PR/MR information
uv run --script ${CLAUDE_SKILL_DIR}/scripts/git_pr_reader.py info https://github.com/owner/repo/pull/123 --json
files — 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" --json
comments — 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 --json
diff — Get unified diff
uv run --script ${CLAUDE_SKILL_DIR}/scripts/git_pr_reader.py diff https://github.com/owner/repo/pull/123
post — 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-run
reply — 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-run
extract — 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.json
metadata — 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.patch
Returns 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 --json
Authentication
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