opencode/skills/gitlab-mr-review/SKILL.md
Review GitLab merge requests by analyzing code changes and posting inline comments. Always shows comments for approval before posting and checks for duplicates. Use when reviewing someone else's MR.
npx skillsauth add msegoviadev/dotfiles gitlab-mr-reviewInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
Use this skill when:
glab auth loginbrew install hurlbrew install jq<SKILLS_DIR>: the root skills directory (e.g., ~/.config/opencode/skills/ for opencode, ~/.claude/skills/ for claude-code)User provides MR via:
https://gitlab.com/user/repo/-/merge_requests/123123Extract:
user%2Frepo)Get the token first (needed for inline comments):
TOKEN=$(glab auth status -t 2>&1 | grep "Token found:" | awk '{print $NF}')
Note: $TOKEN does not persist across separate Bash invocations. When running the hurl
commands in Step 7, inline the token capture directly rather than relying on this variable.
Get MR metadata and commit SHAs (required for inline comments):
# Human-readable summary
glab mr view <iid>
# Get diffRefs (needed for inline comments)
glab api projects/:id/merge_requests/:iid | jq '{iid, title, author: .author.username, state, diffRefs: .diff_refs}'
Get the diff:
glab mr diff <iid>
CRITICAL: Always fetch existing discussions first to avoid duplicates.
glab api projects/:id/merge_requests/:iid/discussions
Parse discussions to identify:
position field for file/line)Review the diff for:
If the user provides a rule set or knowledge vault path (e.g. @/path/to/api-rules/), read all rule files first and cross-reference every finding against the documented rules. Note the specific rule ID (e.g. SCHEMA-003, HTTP-002) for each violation — this is required for Step 5.
Before flagging issues related to external standards, library versions, or specification versions, verify the claim using WebSearch. Do not rely on training knowledge for:
Only raise the concern after confirming it is accurate.
For each finding, prepare:
new_path for additions, old_path for deletions)new_line for additions, old_line for deletions)base_sha, head_sha, start_shaCheck against existing discussions to avoid duplicates.
Rule-based comment references: When a comment is based on a specific documented rule, append a reference footer to the body:
> Reference: [RULE-ID](https://gitlab.com/.../file.md?ref_type=heads#rule-anchor)
/blob/master/ (not /tree/master/) for file links## SCHEMA-003: UPPER_SNAKE_CASE enums → #schema-003-upper_snake_case-enums## HTTP-002: Valid response codes per method → #http-002-valid-response-codes-per-method[RULE-A](url#anchor-a), [RULE-B](url#anchor-b)DO NOT propose:
Show all proposed comments in batch format:
📝 Proposed Inline Comments (3)
━━━ Comment 1 ━━━
📍 File: src/auth.ts
📍 Line: 45
> Consider using a constant for this magic number instead of hardcoding 30.
[Approve] [Reject] [Edit]
━━━ Comment 2 ━━━
📍 File: src/api.ts
📍 Line: 102
> This error case isn't handled. What happens if the API returns null?
[Approve] [Reject] [Edit]
Wait for user to approve/reject each comment.
For approved comments, use hurl with the inline comment template. glab api does not support nested JSON bodies correctly for inline comments.
Templates are located in: ../gitlab-mr-shared/templates/ (relative to this skill's directory)
Resolve the template path based on where gitlab-mr-review/SKILL.md is installed.
For new lines (additions):
hurl <SKILLS_DIR>/gitlab-mr-shared/templates/create-inline-comment.hurl \
--variables-file ~/.config/hurl/gitlab/default.env \
--variable token="$(glab auth status -t 2>&1 | grep 'Token found:' | awk '{print $NF}')" \
--variable project_id=user%2Frepo \
--variable mr_iid=123 \
--variable body="Comment text" \
--variable base_sha=<base_sha> \
--variable head_sha=<head_sha> \
--variable start_sha=<start_sha> \
--variable new_path=src/file.ts \
--variable new_line=45
For old lines (deletions/modifications):
Use create-inline-comment-old.hurl with old_path and old_line instead:
hurl <SKILLS_DIR>/gitlab-mr-shared/templates/create-inline-comment-old.hurl \
--variables-file ~/.config/hurl/gitlab/default.env \
--variable token="$(glab auth status -t 2>&1 | grep 'Token found:' | awk '{print $NF}')" \
--variable project_id=user%2Frepo \
--variable mr_iid=123 \
--variable body="Comment text" \
--variable base_sha=<base_sha> \
--variable head_sha=<head_sha> \
--variable start_sha=<start_sha> \
--variable old_path=src/file.ts \
--variable old_line=20
When a file is entirely new and large, its diff may appear empty in the MR diffs API. Fetch the full content directly from the repository:
# URL-encode the file path (replace / with %2F)
glab api "projects/<project_id>/repository/files/<encoded_path>/raw?ref=<head_sha>"
Example: api/my-service/REST/openapi.yaml → api%2Fmy-service%2FREST%2Fopenapi.yaml
# View MR summary
glab mr view <iid>
# Get MR details with diffRefs
glab api projects/:id/merge_requests/:iid | jq '{iid, title, diffRefs: .diff_refs}'
# Get diff
glab mr diff <iid>
# All discussions
glab api projects/:id/merge_requests/:iid/discussions
# Parse for inline comments only
glab api projects/:id/merge_requests/:iid/discussions | jq '[.[] | .notes[] | select(.position != null) | {path: .position.new_path, line: .position.new_line, body: .body}]'
From MR URL https://gitlab.com/user/repo/-/merge_requests/123:
user/repo → URL-encode: user%2Frepo123Templates are in ../gitlab-mr-shared/templates/ (relative to this skill's directory):
create-inline-comment.hurl - Post inline comment on new file/linecreate-inline-comment-old.hurl - Post inline comment on old file/line (deletions)Resolve the path based on where the skills are installed.
For additional commands, filtering options, and error handling, see:
../gitlab-mr-shared/api-commands.md
User: "Review this MR: https://gitlab.com/user/repo/-/merge_requests/42"
Agent:
user%2Frepo) and MR IID (42)TOKEN=$(glab auth status -t 2>&1 | grep "Token found:" | awk '{print $NF}')glab api projects/user%2Frepo/merge_requests/42 | jq '.diff_refs'glab mr diff 42glab api projects/user%2Frepo/merge_requests/42/discussions to check existinghurldevelopment
Best practices for Remotion - Video creation in React
tools
Interact with Jira using the jira CLI. View, create, transition, assign, and comment on issues. Use when the user mentions Jira, issue keys, sprints, or ticket work.
development
Respond to feedback on your own merge request. Fetches discussions, proposes replies and code changes, and asks for approval before posting anything. Use when addressing review comments on your MR.
development
Read, write, and respond to comments on Confluence pages via the REST API v2. Use when the user wants to fetch page content, search pages, update a page, create a new page, or address comments and suggestions left by others.