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.
How this skill is triggered — by the user, by Claude, or both
Slash command
/code-review-skills:gitlab-code-review [additional review instructions][additional review instructions]This skill is limited to the following tools:
The summary Claude sees in its skill listing — used to decide when to auto-load this skill
Perform a structured code review of the current branch's changes and post
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.
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).
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_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).[].[].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, GitHub, or local) and handles:
$CHILL_MODE env var)If the script reports a JSON parse error, fix the JSON in
/tmp/ai-review-output.json and re-run the command.
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.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_JOB_NAME | — | ai-review | Job name for summary footer |
CI_JOB_URL | — | # | Job URL for summary footer |
| Variable | Required for | Default | Description |
|---|---|---|---|
CHILL_MODE | — | true | Filter out suggestion-level comments |
VERBOSE | — | false | Show detailed API error responses |
Creates, edits, and optimizes skills for Claude Code, including drafting, evaluating with test prompts, iterating on performance, and improving skill descriptions for better triggering accuracy.
npx claudepluginhub opendatahub-io/skills-registry --plugin code-review-skills