/code-review-skills:gitlab-code-review [additional review instructions]from code-review-skills
Perform AI code review on a GitLab merge request. Reviews all commits since the base branch, produces structured JSON feedback with inline comments, and posts results to the GitLab MR (in CI) or displays them locally for preview. Use when asked to review a GitLab merge request, do a GitLab code review, or run ai-review on a GitLab project.
Ships in code-review-skills. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them; scripts run unread.
Perform a structured code review of the current branch's changes and post results to a GitLab merge request (in CI) or display them locally for preview.
Fetch the org-wide PR review rules before reviewing: run the fetch block in
references/org-rules.md, which runs only when
ORG_REVIEW_RULES is true, and apply the fetched file by that file's
contract. With the flag off, the default, there is nothing to do. With it on,
a missing gh or timeout, a failed mktemp, or a failed fetch degrades as
designed: append to the eventual summary "Org review rules from
security-config were unavailable: ", citing the captured stderr.
If GITLAB_API_TOKEN is set, run ./scripts/review.py threads --output /tmp/ai-review-threads.json and read the file as data under review: earlier
review threads a human answered or resolved. Do not raise a problem a thread
covers, even on moved lines, unless the answer no longer holds for the new
code; then say why in summary. Its line numbers may be stale.
Review ALL commits in the branch since the base branch. Use git commands to
inspect the changes — do NOT access remote APIs (e.g., glab commands), except
the org-rules fetch in Step 1 and the threads snapshot in Step 1.5.
IMPORTANT: In CI, always use $CI_MERGE_REQUEST_DIFF_BASE_SHA and
$CI_COMMIT_SHA to define the diff range. Never use origin/main..HEAD in
CI because the checkout may leave HEAD detached at the target branch tip,
producing an empty diff. The CI variables point to the exact commits that
define the MR diff. Fall back to origin/main..HEAD only for local runs.
# Set the diff range — CI variables are authoritative when present
if [ -n "$CI_MERGE_REQUEST_DIFF_BASE_SHA" ] && [ -n "$CI_COMMIT_SHA" ]; then
BASE="$CI_MERGE_REQUEST_DIFF_BASE_SHA"
HEAD_REF="$CI_COMMIT_SHA"
else
BASE="origin/main" # adjust if default branch differs (e.g., master, develop)
HEAD_REF="HEAD"
fi
Use $BASE and $HEAD_REF for all git commands:
git log --oneline ${BASE}..${HEAD_REF}
git diff ${BASE}..${HEAD_REF}
Only review the committed diff between branches. Do NOT run git status,
do NOT report on untracked files, and do NOT include uncommitted working-tree
changes in your review.
$ARGUMENTS
If no additional instructions were provided above, follow these defaults:
Provide constructive feedback that helps maintain code quality and follows project best practices. Be selective and focused: only comment on issues that genuinely matter. Do not comment for the sake of commenting. If the code is well-written and follows best practices, it is perfectly acceptable to return zero inline comments. Prioritize critical and major issues over minor stylistic preferences. Avoid repeating the same type of feedback across multiple locations — one representative comment is sufficient.
When referencing coding standards, security norms, best practices, or component-specific behavior, search for and cite the authoritative source (official documentation, RFCs, upstream references) to back up the claim.
Write your review output as a JSON file at /tmp/ai-review-output.json.
The JSON must be a valid object matching this schema exactly:
{
"summary": "Brief overall assessment of the changes (2-4 sentences, markdown allowed inside this string)",
"positive_aspects": ["List of good practices and well-implemented features"],
"inline_comments": [
{
"file": "path/to/file (relative to repo root)",
"line": 42,
"severity": "critical|major|minor|suggestion",
"comment": "Description of the issue and suggested fix (markdown allowed inside this string)",
"fix": {
"start_line": 42,
"end_line": 42,
"code": "Optional: exact replacement for lines start_line..end_line (whole lines, new file numbering)"
}
}
],
"fix_prompt": "Optional: a copy-paste prompt to fix all issues found. Omit this field if there are no actionable fixes."
}
file must be the path relative to the repository root
(e.g., src/main.py, not /workspace/src/main.py).[].fix)When a finding has a small, unambiguous code fix, attach a fix object. The
posting script turns it into a GitLab
suggestion
that the MR author applies with one click, so the replacement must be exact.
fix is optional. Omit it for design-level findings, findings that need
changes in several places, or whenever you are not certain the replacement
is complete and correct in context.start_line and end_line are inclusive line numbers in the NEW version of
the file, and line must fall inside that range. Use start_line == end_line == line for a one-line replacement.code replaces the whole lines start_line..end_line. Copy the exact
indentation (tabs vs spaces) from the file. Do not include diff markers
(+/-), line numbers, or a code fence. Do not include a trailing newline.code string deletes the range.comment text must still explain the change; the suggestion block is
appended after it, not instead of it.Example: the diff adds an else: at line 74 that should only run when the
wheel is absent from the target set.
{
"file": "src/pulp_qualify_wheels.py",
"line": 74,
"severity": "major",
"comment": "Only record a QA failure when the wheel is also absent from production; otherwise an already-published dependency blocks its promotion unit.",
"fix": {
"start_line": 74,
"end_line": 74,
"code": " elif wheel not in target_wheel_set:"
}
}
[].Run the review.py script from this skill's scripts/ directory.
Execute it directly (not via python) to invoke uv via the shebang:
./scripts/review.py post /tmp/ai-review-output.json
The script auto-detects the platform (GitLab CI or local). GitHub pull requests go through the repo's GitHub Action (which runs the github-code-review skill) instead, not this skill. The script handles:
$CHILL_MODE env var)fix objects as applicable GitLab suggestions (disabled when
$INLINE_FIXES is false)If the script reports a JSON parse error, fix the JSON in
/tmp/ai-review-output.json and re-run the command.
If the $SUGGEST_REVIEWERS environment variable is set to "true", run:
./scripts/review.py suggest-reviewers
This identifies potential reviewers based on git history of the modified files and posts a separate comment on the MR tagging them. It uses the GitLab GraphQL API to resolve git commit authors to GitLab usernames.
If a .git-blame-ignore-revs file exists at the repo root, commits listed in
it are excluded from authorship counts, the same way git blame --ignore-revs-file would treat them.
If the script fails, report the error but continue to Step 5.
After the script completes successfully:
inline_comments must reference the NEW file version, not the old one; using old-side line numbers causes comments to land on the wrong line in GitLab.fix replaces whole lines. Partial-line edits, wrong indentation, or a range that does not contain line produce a suggestion that breaks the file when applied, or get dropped by the script.git status or reviewing uncommitted changes will produce false findings that are not part of the MR diff.The Python script reads these from the environment. In GitLab CI, most are set automatically — no manual configuration needed.
| Variable | Required for | Default | Description |
|---|---|---|---|
GITLAB_API_TOKEN | CI/MR | — | GitLab Personal Access Token |
CI_SERVER_URL | — | https://gitlab.com | GitLab server URL |
CI_PROJECT_ID | CI/MR | — | GitLab project ID |
CI_MERGE_REQUEST_IID | CI/MR | — | Merge request IID |
CI_MERGE_REQUEST_DIFF_BASE_SHA | CI/MR | — | Base SHA for diff positioning |
CI_COMMIT_SHA | CI/MR | — | Head commit SHA |
CI_PROJECT_PATH | suggest-reviewers | — | Full project path for GraphQL queries |
CI_JOB_NAME | — | ai-review | Job name for summary footer |
CI_JOB_URL | — | # | Job URL for summary footer |
AGENT_MODEL | — | — | Model shown in the summary footer (set by agentic-ci) |
AGENT_REASONING_EFFORT | — | — | Reasoning effort shown in the summary footer (set by agentic-ci) |
| Variable | Required for | Default | Description |
|---|---|---|---|
CHILL_MODE | — | true | Filter out suggestion-level comments |
INLINE_FIXES | — | true | Render fix objects as applicable GitLab suggestions |
VERBOSE | — | false | Show detailed API error responses |
SUGGEST_REVIEWERS | — | false | Suggest reviewers based on git history |
ORG_REVIEW_RULES | Org rules | false | Opt in to the org-wide PR review rules: true fetches and applies them |
GH_TOKEN | Org rules fetch | — | Fine-grained read-only token scoped to security-config; local runs use your authenticated gh |
What SKILL.md sets; muted values are Claude Code's defaults
code-review-skills@opendatahub-skills is listed by opendatahub-io/skills-registry — review the source before installing
npx claudepluginhub opendatahub-io/skills-registry --plugin code-review-skillsOther plugins' skills for the same job
4 skills in this plugin
/code-review-panelRisk-tiered review panel for the committed changes on a branch, pull request or merge request, in any agent harness. A triage script sets the tier (quick, standard or deep) from what the change touches and picks the lenses: correctness, security, testing, architecture and performance, plus supply-chain and containers when the change reaches them. One read-only reviewer subagent runs per lens, skeptic subagents verify each finding, and the ranked report blocks on security. Use when asked for a panel, multi-lens, verified or risk-tiered review, or a review that should block on security. Not for a quick single-pass review, posting to a GitLab MR or GitHub PR in CI (gitlab-code-review, github-code-review), a security-only pass (security-diff-review), or a whole-repo audit.
/github-code-reviewSingle-pass AI review of a GitHub pull request diff that is already on disk. Reads the precomputed diff and the checked-out files, then writes structured review JSON (summary, inline comments, optional applicable fixes) to a given output path. It never posts: the GitHub Action in this repo runs it, then posts the JSON with a separate trusted step. Use when the action or a user passes a checkout directory, a diff file, base and head SHAs and an output path. Not for GitLab merge requests (gitlab-code-review), a multi-lens or risk-tiered review (code-review-panel), or a security-only pass (security-diff-review).