AGENT SKILL

cursor-grok-review

Use when the user requests a Grok review through Cursor, or when another skill such as review-loop runs one.

License 许可
MIT
最近更新
2026-11-15
Stars
★ 0
Forks
0

01 前言 Front Matter

name
cursor-grok-review
description
Use when the user requests a Grok review through Cursor, or when another skill such as review-loop runs one.

02 资源文件 1

03 SKILL.md 正文

Cursor Grok review

Run a local review with the Cursor CLI (cursor-agent). Use the user's selected model and effort; otherwise model {{defaults.model}} and effort {{defaults.effort}}. Cursor names a model and effort together as one id, <model>-<effort>, for example {{defaults.model}}-{{defaults.effort}}; check cursor-agent --list-models if the id is not listed. Review locally; do not post findings or edit the reviewed files.

Prepare

Identify the repository and exact review target from the request: uncommitted changes, a branch against its base, a commit, a plan, or selected files. Record the current commit and git status --short. Create a unique directory under .plans/scratch/ for the prompt, result, log, and Cursor config; exclude it from review. Do not include unrelated user changes unless they are part of the requested target.

Write a self-contained prompt.md with the absolute repository path, an instruction to run every command from there, the exact target, and the git command that shows it (git diff HEAD plus untracked files, git diff <base>...HEAD, or git show <sha>), relevant project instructions, and requirements. Ask for concrete bugs, regressions, and requirements mismatches with severity, file and line, failure scenario, and fix direction. For plans, ask about feasibility and missing decisions. Request an explicit statement if no substantive issues are found, and instruct it to review without edits or tests.

Write $REVIEW_DIR/cursor-config/cli-config.json:

{
  "version": 1,
  "editor": { "vimMode": false },
  "approvalMode": "allowlist",
  "permissions": {
    "allow": ["Read(**)"],
    "deny": ["Write(**)"]
  }
}

The user's own Cursor config may approve every tool, so this separate config replaces it: the file-write tool is rejected and the file-read tool may read anywhere. Cursor also writes session files into this directory, so use a new one for every run.

Review a branch against a base

Cursor has no built-in review. prompt.md holds only the absolute repository path, the instruction to run every command from there, the target, and git diff <base>...<branch>. A custom prompt replaces it.

Run and monitor

Start the command below using the calling tool's background or resumable execution mode, and retain its task or session ID so you can check its status and exit code. Do not set a review runtime limit or a tool timeout that kills the process.

Set REVIEW_REPO, REVIEW_MODEL, REVIEW_EFFORT, and REVIEW_DIR to the absolute repository path, selected model, selected effort, and artifact directory:

REVIEW_WORKSPACE=$(mktemp -d) &&
CURSOR_CONFIG_DIR="$REVIEW_DIR/cursor-config" cursor-agent -p --trust \
  --sandbox enabled --workspace "$REVIEW_WORKSPACE" \
  --model "$REVIEW_MODEL-$REVIEW_EFFORT" \
  --output-format json "$(cat "$REVIEW_DIR/prompt.md")" \
  </dev/null >"$REVIEW_DIR/result.json" 2>"$REVIEW_DIR/run.log"

The reviewer may run any shell command, but only inside Cursor's sandbox, which lets it write to its workspace and temp directories only and blocks network access. The workspace is an empty temp directory outside the repository, so the repository and its git directory stay read-only. Keep json output: text output keeps only the reviewer's last message, and a short message after the report replaces it. Do not go back to an allow-list of shell commands: Cursor rejects ordinary forms such as git diff $(git merge-base …), cd src && git diff, or a pipe to head, and the reviewer then reviews without the diff. Do not use --mode ask either: in print mode it removes the shell tool. This is a static review: the caller remains responsible for tests.

Wait until the review finishes, then report. If the calling tool notifies you when a background command exits, end your turn and wait for that notice. Never start a polling loop or a monitor to watch the review. Without such a notice, check its status with short waits that return control and leave it running.

If the review appears stuck, inspect its process state and logs. A running process alone does not prove progress; silence or elapsed time alone does not prove a hang and must not trigger cancellation. Report what you can establish and keep waiting when the evidence is inconclusive.

When the task exits, check its exit code and report. Report failures promptly and identify any partial output; never present an incomplete review as clean. Do not silently switch models or effort, or loosen the Cursor config or drop the sandbox to make the invocation work.

Assess the result

Read the report with jq -r .result "$REVIEW_DIR/result.json"; it holds every message the reviewer wrote. A report that does not show the reviewer read the target is incomplete: report it as failed, never as clean.

Read the report and verify substantive findings against the source before presenting them. Distinguish confirmed issues from unresolved concerns, name the reviewed target, model, and effort, and state verification gaps. A clean review is not evidence that tests passed. Check the final Git state; do not revert user work.

04 同仓库更多 Skills