一键导入
glab-mr-review
Review GitLab merge requests with inline diff comments and suggestions via the glab CLI and GitLab API.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
Review GitLab merge requests with inline diff comments and suggestions via the glab CLI and GitLab API.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
基于 SOC 职业分类
Write, edit, compile, and debug Cherri (.cherri) source files, a language that compiles to Apple Shortcuts for iOS/macOS. Use for .cherri files, the cherri compiler, and building or signing Apple Shortcuts automations.
Set up docs/pages/ directory and files to generate a project landing page with project-page-starter. Use when adding a landing page to a project.
Debug web pages by loading them in an isolated Safari automation session on a connected iOS device, using pymobiledevice3. Use when the user wants to inspect, debug, or run JavaScript against web content in Safari on an iPhone or iPad. Does not attach to or read the user's existing open tabs.
Create a new Claude Code skill tailored to a specific project. Use when the user wants to "create a skill", "new skill", or add a custom /command for their codebase. Analyzes the project first, then builds a complete skill.
Write correct, idiomatic Justfiles with just. Use when creating a Justfile, writing just recipes, adding project tasks, or mentioning "justfile", "just", or ".just".
Create, search, edit, and delete notes in ntropy Markdown vaults; create and manage vaults, views, and templates. Use for any task involving ntropy, a note vault, or .ntropy-vault files.
| name | glab-mr-review |
| description | Review GitLab merge requests with inline diff comments and suggestions via the glab CLI and GitLab API. |
| when_to_use | Review an MR or merge request; post or add review comments on a GitLab MR; code review on a GitLab-hosted repository. |
Use this skill when asked to review a GitLab merge request, add inline code
review comments, or post review summaries. Requires glab CLI authenticated
with the target GitLab instance.
Every finding gets exactly one severity:
The finding categories used during analysis (Bugs, Design concerns, Test gaps, Style/documentation — see references/review-workflow.md) are search lenses, not the severity scale: severity is judged per finding, independent of which category surfaced it.
Follow these steps in order. See reference files for detailed mechanics.
glab api "projects/<ENCODED_PROJECT>/merge_requests/<IID>/discussions" --paginate
Always use --paginate — the API returns 20 discussions per page by default.
Skip findings already raised in open threads; mention prior reviewer context
in the summary only if relevant.
glab mr view <IID> --repo <group/project> --output json \
--jq '{title, author: .author.username, state, diff_refs, project_id: .target_project_id}'
glab mr diff <IID> --repo <group/project> --raw
The mr view call returns title, author, state, diff_refs
(base_sha/head_sha/start_sha) and the numeric project_id in a single
request — no separate SHA-extraction call needed. mr diff --raw produces
pipe-friendly raw diff output; the default renderer is unsuitable for the
line-counting in step 3. Fallback for the raw MR object (GET is the default
method, no --method flag needed):
glab api "projects/<ENCODED_PROJECT>/merge_requests/<IID>"
Count lines from diff hunk headers (@@ -old,count +new,count @@). See
references/gitlab-api-comments.md for the
line-counting rules and which of new_line/old_line to use.
Before posting anything, summarize the analysis using the severity labels (e.g. "Found 7 findings: 2 must address, 3 should address, 2 nits"), then use AskUserQuestion:
Present each finding one-by-one using AskUserQuestion. For each comment:
suggestion block) in the question descriptionAfter all inline comments are decided, present the review summary the same way for approval/skip/revision.
See references/review-workflow.md for the detailed loop mechanics.
ALWAYS use json.dump() — NEVER shell heredocs or echo. Only generate
payloads for comments that were approved in step 5. Include suggestion:-N+M
blocks for concrete fix proposals (see
references/gitlab-api-comments.md for
the range limit and where suggestions are valid).
Create a fresh temp directory first:
TMP_DIR=$(mktemp -d)
Write one file per comment, named mr-review-comment-<n>.json, plus
mr-review-summary.json, into that directory. Inline comment payloads use the
note key (Draft Notes API), not body; the summary payload uses body
(Notes API). See
references/gitlab-api-comments.md for
both payload shapes.
Approved inline comments are staged as draft notes first and published atomically, so the review appears all at once instead of trickling in as each comment is posted:
glab api "projects/<PROJECT_ID>/merge_requests/<IID>/draft_notes" \
--method POST --input "$TMP_DIR/mr-review-comment-1.json" -H 'Content-Type: application/json'
Verify each response is 201 and contains a top-level id.
If a draft note's position is rejected, follow the fallback procedure in
references/gitlab-api-comments.md: retry
once after re-verifying the computed lines and re-fetching diff_refs; if it
still fails, demote that one comment to a plain (position-less) discussion via
the Discussions API and continue staging the rest as drafts.
Once every approved comment is staged (or demoted and posted), publish all staged drafts at once:
glab api "projects/<PROJECT_ID>/merge_requests/<IID>/draft_notes/bulk_publish" \
--method POST -H 'Content-Type: application/json'
To discard a staged draft before publishing (e.g. a comment approved earlier
in the loop is later dropped), use
DELETE projects/<PROJECT_ID>/merge_requests/<IID>/draft_notes/<id>.
Then post the summary via the Notes API:
glab api "projects/<PROJECT_ID>/merge_requests/<IID>/notes" \
--method POST --input "$TMP_DIR/mr-review-summary.json" -H 'Content-Type: application/json'
The summary MUST only reference comments that were actually posted (inline or demoted). If comments were skipped during the approval loop, remove them from the summary. Report which comments were posted inline (via drafts) and which were demoted to plain discussions.
-H 'Content-Type: application/json' header is REQUIRED on every
--input call: glab api --input sends the file as a raw body with no
default Content-Type, so omitting the header fails the request (observed:
HTTP 415).json.dump().group/project -> group%2Fproject.note key for the comment body, NOT body — the
Discussions API uses body. Mixing the two silently produces an empty or
rejected note.| Task | Reference |
|---|---|
| Posting inline comments, SHA extraction, suggestion syntax | references/gitlab-api-comments.md |
| Full review workflow, approval loop, severity categories | references/review-workflow.md |