/aimate:review-prfrom aimate
Reviews GitHub Pull Requests and GitLab Merge Requests with inline comments, approvals, and request-changes. Delegates core analysis to the code-review skill.
Ships in aimate. 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.
None: SKILL.md is the whole skill.
The purpose of this skill is to provide constructive and comprehensive feedback on code changes. The primary goals are:
This workflow is read-first and non-invasive:
This skill supports both GitHub (Pull Requests) and GitLab (Merge Requests). The terms PR and MR are used interchangeably throughout.
Acting on review feedback is the opposite direction and a separate workflow: resolve-pr-feedback validates the threads on a PR/MR, applies the fixes in an isolated worktree, and replies per thread.
{repository_id, pull_request_number} for GitHub, or {project_path, merge_request_iid} for GitLab.This skill depends on the reusable code-review skill for framework-agnostic review analysis, finding classification, and feedback generation.
review-pr owns provider detection, PR/MR metadata retrieval, branch checkout, provider-specific diff retrieval, inline comment positioning, approvals, request-changes state, and cleanup.
code-review owns the core review logic: syntax, logic, security, style/maintainability, documentation/scope analysis, finding schema, severity classification, and provider-neutral report/comment text.
review-pr MUST delegate the core analysis to code-review; this is a hard workflow boundary, not a recommendation.
code-review.code-review output interface.code-review cannot be invoked or loaded in the current environment, stop and tell the user the required dependency is unavailable. Do not continue with a manual review.code-review earlier, remembering its workflow, seeing an obvious issue, reviewing a small PR/MR, or being under time pressure does not satisfy this dependency.Follow these steps in order. Do not skip a step.
Before proceeding:
Detect provider from the URL or user-provided input:
github.com → provider = "github", use {owner, repo, pull_number} as identifiers.gitlab.com or a self-hosted GitLab domain → provider = "gitlab", use {project_path, merge_request_iid} as identifiers.Resolve an authenticated route for the detected provider:
aimate:tool-routing block in AGENTS.md: explicit request, preferred route, then configured fallback. Do not ask again when the fallback works. Without a block, default to authenticated gh and then GitHub MCP for GitHub; GitLab always uses glab and never GitLab MCP.gh auth status --active --hostname <pr-host> or glab auth status --hostname <mr-host>. Never use --show-token. Validate MCP with discovery and one harmless read-only metadata call only when needed.provider_route and mention a fallback briefly in the final report. If neither route works, stop before creating a worktree and point to the relevant login command or Aimate's configure-mcp skill. Never ask for a token in chat.Verify terminal access is available (required for git worktree operations in Step 2).
Verify the code-review dependency can be invoked/loaded. If unavailable, stop and tell the user the required dependency is unavailable.
Store provider — it will gate all provider-specific sub-steps throughout the workflow.
Retrieve all metadata needed for the review using the tools matching provider and provider_route. Prefer the provider CLI's high-level PR/MR commands and use its authenticated api subcommand for missing fields. MCP is supported only for GitHub; use only the matching project server.
GitHub:
base_sha, head_sha) and store the author as author.provider_route (e.g. gh api user or the GitHub MCP session identity) and store it as authenticated_user.is_self_review = (authenticated_user == author). GitHub rejects APPROVE and REQUEST_CHANGES review events submitted by the PR's own author; Steps 7-B and 7-C use this flag to avoid attempting a call the API will reject.base_sha and head_sha for inline comment positioning in Step 7-A.GitLab:
base_sha, start_sha, head_sha).base_sha, start_sha, and head_sha in the diff position object in Step 7-A.For both providers:
Use run_in_terminal to create an isolated worktree — even if the source branch is already checked out locally. The purpose of this isolated worktree is to understand the full codebase, trace control logic across files, and evaluate the true architectural impact of the proposed changes.
git fetch origin {source_branch}
git worktree add .worktrees/pr-review-{pr_mr_number} {source_branch}
Store worktree_path = ".worktrees/pr-review-{pr_mr_number}" for Steps 3–5 and cleanup in Step 8. Read-only enforced — do not modify files in the worktree.
Keep the checked-out worktree read-only and prepare PR/MR-specific context for the code-review dependency:
repository_path = ".worktrees/pr-review-{pr_mr_number}"If you already have a useful codebase baseline from adjacent tools or exploration, store it as review_baseline and pass it to code-review. Otherwise, let code-review gather the baseline from repository_path.
provider_route. Use gh pr diff/gh api, GitHub MCP tools, or glab mr diff/glab api. Do not use raw curl.code-review input interface, including each changed file, its change type, and its added and deleted line counts when available.code-review; it owns generic review ordering, large-review chunking, and dependency tracing.Invoke the code-review skill with this PR/MR-specific input wrapper before doing any review analysis:
submission:
type: pull-request # or merge-request, based on detected provider
title: "{pr_mr_title}"
description: "{pr_mr_description}"
author: "{author}"
source_ref: "{source_branch}"
target_ref: "{target_branch}"
code_input:
diff: "{provider_diff}"
files: "{changed_file_inventory}"
repository_path: ".worktrees/pr-review-{pr_mr_number}"
review_baseline: "{review_baseline}"
review_context:
existing_feedback: "{open_and_resolved_threads}"
constraints: "Review every changed file. Do not modify files. Preserve provider diff coordinates for inline comments."
focus_areas:
- syntax
- logic
- security
- style
- documentation
- maintainability
- scope-consistency
output_target: calling-skill
The code-review dependency MUST:
Store the returned output as code_review_result. code_review_result is the only valid source for:
If code_review_result.clarification_question is present, ask the user that question, end the response, and invoke code-review again with the answer.
If code_review_result.chunking_required is true, execute the core's chunked review protocol, preserving provider diff coordinates and invoking the core for final integration before any publication or review-state action. Store the integrated result as code_review_result, then continue to Step 6. Do not aggregate or reclassify findings in this wrapper.
If the user narrows the scope, run the chunks for the files they kept and list the files left out as unreviewed in Step 6. If they stop, proceed to Step 8 only after they explicitly choose report-only/stop; report that the review is incomplete and list the unreviewed chunks.
Require code_review_result.summary.review_complete: true before offering publication, approval, or request-changes actions. Otherwise report the partial reviewed scope and gaps; do not treat empty totals as a clean review.
Before moving to Step 6, perform this invariant check:
Did I invoke/load code-review for this PR/MR, and are all findings/report/comment bodies copied from code_review_result?
If the answer is not yes, go back and invoke code-review. Do not continue by analyzing the PR/MR yourself.
Present the findings returned by code-review to the user before taking any action.
The report must include:
Render each finding using the canonical chat format defined by code-review. Copy each rendered finding verbatim from code_review_result.report; do not recreate or alter its prefix or content.
If there are no findings, state that explicitly without implying that unresolved review gaps are cleared.
HARD STOP: End the response immediately after presenting the findings and asking the user how they would like to proceed. Provide options naturally: discussing/refining findings, posting comments, approving the PR/MR, or requesting changes. Do NOT call any tools after presenting the report in that same response, and do NOT proceed until the user issues a clear directive in a later turn.
Based on the user's instructions from Step 6, take the appropriate action. All sub-steps below branch on provider and use the already resolved provider_route. Do not ask for the preference again.
Before any publication, approval, or request-changes action, require code_review_result.summary.review_complete: true for the agreed scope, including final integration when chunked. A directive to post does not authorize publishing a successful subset after a chunk failed.
Post all approved findings as visible inline comments on the PR/MR.
Use the comment_bodies map returned by code-review in Step 5 as the body for each inline comment, matched by finding id. Do not re-generate comment text.
Keep summary.residual_gaps in a clearly labelled review summary, not in new findings or optional inline comments. State what remains unverified and what evidence is needed. These gaps do not add to finding totals or the finding-to-comment map.
Before calling any provider-specific comment API, normalize the target anchor for every finding:
If comment submission or publication fails after some comments may already have been created, treat the failure as a potential partial success:
GitHub:
gh api to create one pending review containing the approved inline comments, then submit it. Use gh pr review for approve/request-changes when it supports the requested action. Never use raw curl.owner, repo, pull_number, commit_id (use head_sha), path, line, and body.start_line and line to span the range.line or range still belongs to the PR diff. If the exact target is not commentable on GitHub, move to the nearest stable diff line or fall back to a top-level PR comment.COMMENT, using its summary body for any residual review gaps; the body may be empty when there are none.gh pr comment on CLI or the GitHub top-level issue-comment tool on MCP, indicating the target file and line.GitLab:
glab mr note create <mr> --file <path> --line <line> -m <body> for added or modified lines.--line <start>:<end> for a supported multi-line range and --old-line <line> for a removed line.glab api only when the high-level command cannot represent a required position. For that fallback, provide base_sha, start_sha, and head_sha and map old/new paths and lines correctly. Never use raw curl.glab mr note create and include the target file and line in the body.GitHub rejects APPROVE and REQUEST_CHANGES review events submitted by the PR's own author (see community discussion #8918). When is_self_review is true (Step 1), do not attempt either call in 7-B or 7-C below — check the flag proactively; never rely on the API rejection to discover this. Inform the user up front and offer:
COMMENT-state review instead (via gh pr review --comment or the matching MCP tool with event COMMENT), summarizing the key findings so they stay visible on the PR, orgh/the MCP server as a different account.If the user chooses the COMMENT-state fallback, post it and clearly report in Step 8 that no formal approval/request-changes state was set due to the self-review restriction.
If the user requests approval, confirm there are no unresolved security violations first. If there are, explicitly confirm the user wants to proceed despite the risks.
GitHub: If is_self_review is true, do not attempt APPROVE — follow the GitHub Self-Review Fallback above instead.
Otherwise, submit an approving review through gh pr review --approve or the matching MCP review tool with event APPROVE.
GitLab: Approve the MR through glab mr approve.
Formally mark the PR/MR as requiring changes.
GitHub: If is_self_review is true, do not attempt REQUEST_CHANGES — follow the GitHub Self-Review Fallback above instead.
If is_self_review is false, submit a review through gh pr review --request-changes or the matching MCP review tool with event REQUEST_CHANGES and a summary covering the key findings.
GitLab: Proceed in two distinct steps. Execute these GraphQL operations through authenticated glab api graphql.
Step 1 — Verify reviewer assignment
Query the MR to get the current user's username and the existing reviewers list:
query getMRReviewers($projectPath: ID!, $iid: String!) {
currentUser {
username
}
project(fullPath: $projectPath) {
mergeRequest(iid: $iid) {
reviewers {
nodes {
username
}
}
}
}
}
If the current user is not in the reviewers list, add them using APPEND to preserve existing reviewers:
mutation addSelfAsReviewer(
$projectPath: ID!
$iid: String!
$username: String!
) {
mergeRequestSetReviewers(
input: {
projectPath: $projectPath
iid: $iid
reviewerUsernames: [$username]
operationMode: APPEND
}
) {
mergeRequest {
id
}
errors
}
}
Step 2 — Request changes
Once reviewer assignment is confirmed, submit the request-changes state:
mutation requestChanges($projectPath: ID!, $iid: String!) {
mergeRequestRequestChanges(input: { projectPath: $projectPath, iid: $iid }) {
mergeRequest {
id
}
errors
}
}
Note: mergeRequestRequestChanges requires GitLab 17.10+. On older instances the mutation may not exist — inspect the errors array and inform the user if it fails.
If the user wants no action taken, proceed to Step 8 — Cleanup. If they want to refine, discuss the findings, update them, and repeat Step 6.
Prerequisite: Step 8 must never run in the same response as Step 6. Execute it only after Step 7 is complete, or after the user explicitly says to stop at reporting only.
This step is always executed, regardless of which option was chosen in Step 6.
Remove the git worktree with verification:
git worktree remove .worktrees/pr-review-{pr_mr_number} --force
Report back to the user:
git worktree prune manually.Use the canonical formats defined by code-review. Do not maintain a separate finding template in this skill.
Differences by destination:
code_review_result.report.code_review_result.comment_bodies verbatim.Style rules:
curl for provider API interactions. Use gh, glab, or the matching MCP route. Use git only for local repository/worktree operations.APPROVE and REQUEST_CHANGES reviews submitted by the PR's own author. Check is_self_review (Step 1) before attempting either action in Step 7-B/7-C; never rely on the API rejection to discover this — see the GitHub Self-Review Fallback for the documented COMMENT-state/different-reviewer alternative, analogous to the existing GitLab reviewer-assignment check in Step 7-C.git worktree prune to clean orphaned entries and recover disk space.What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
npx claudepluginhub dawn-technology/aicelerate --plugin aimate22 skills in this plugin
/asvs-auditStatic OWASP ASVS 5.0 Level 1 security audit of a codebase. Checks all 70 Level 1 requirements plus other security issues found on the way, verifies every finding against the code to remove false positives, runs the package manager's dependency audit, and writes a report to docs/. Use this when asked for a security audit, ASVS audit, security compliance review, or a code-level vulnerability scan. It reads code only; it is not a live penetration test./code-reviewReusable review core for structured findings on supplied code or diffs. Invoked by review-pr, review-local, and the pre-push self-review in resolve-pr-feedback; not for reviewing a PR/MR or local working tree directly, use those skills instead./configure-mcpValidate and configure project- or client-specific GitHub, GitLab, Jira/Confluence, Figma, Sentry, and Playwright tooling through a short interactive wizard, choosing CLI or MCP where both support the capability. Use when a user asks to install, set up, configure, repair, change, or onboard Aimate integrations or save project tool routing./estimate-sizeEstimate software tickets and work items with a configurable relative-sizing workflow. Respect dedicated estimators and local project rules, and use the built-in defaults when no local rules are provided./estimate-timeAdd a time estimate in hours to an existing implementation plan. Use when the user asks to estimate a plan or task list, or asks how long the work will take./fetch-ticketReusable ticket reader that resolves a Jira work item, GitHub Issue, or GitLab Issue through the project's saved route and returns it as one provider-neutral ticket with every comment verbatim. Invoked by prepare-ticket and implement-ticket; not for validating or implementing a ticket directly, use those skills instead.Other plugins' skills for the same job