cursor-agent

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Cursor Agent

Cursor Agent

Delegate a task to Cursor's headless CLI agent (
cursor-agent
). Use this to get a second opinion from a non-Claude model on code reviews, plan critiques, text/copy review, or general Q&A.
将任务委托给Cursor的无头CLI Agent(
cursor-agent
)。可用于在代码审查、规划评估、文本/文案审核或通用问答场景中,获取来自非Claude模型的第二意见。

Inputs

输入参数

  • $task
    : The task to hand to cursor-agent. Usually a review or question prompt. If the user adds a model hint (e.g. "with Opus", "using GPT", "pomocí Sonnetu"), extract it and pass via
    --model
    .
  • $task
    : 要交给cursor-agent的任务。通常是审查或问题提示。如果用户添加了模型提示(例如“with Opus”、“using GPT”、“pomocí Sonnetu”),请提取该提示并通过
    --model
    参数传递。

Goal

目标

Run cursor-agent headless, surface its output to the user, and add a brief Claude TL;DR so the user doesn't have to re-read a wall of text.
以无头模式运行cursor-agent,向用户展示其输出,并添加一段简短的Claude TL;DR(摘要),避免用户需要重新阅读大段文本。

Steps

步骤

1. Parse the task

1. 解析任务

Extract from
$task
and the surrounding conversation:
  • Model hint — look for phrasing like:
    • "Opus" / "claude" →
      --model claude-opus-4-7-medium
    • "Sonnet" →
      --model claude-4.6-sonnet-medium
    • "GPT" / "GPT-5" / "Codex" →
      --model gpt-5.3-codex
    • "Gemini" →
      --model gemini-3.1-pro
    • "Auto" →
      --model auto
    • Nothing mentioned → omit
      --model
      (cursor uses its default:
      composer-2-fast
      )
  • Mode hint:
    • "plan" / "plan mode" / "navrhni" →
      --mode plan
    • "write" / "edit" / "implement" / "headless" → omit
      --mode
      (cursor can write)
    • Otherwise →
      --mode ask
      (read-only, default)
  • Is this a review? If the task mentions "review", "check", "verify", "second opinion", or references a branch/PR/diff, enrich the prompt (step 2).
Success criteria: Flags decided, prompt ready.
$task
及上下文对话中提取:
  • 模型提示 — 查找以下表述:
    • "Opus" / "claude" →
      --model claude-opus-4-7-medium
    • "Sonnet" →
      --model claude-4.6-sonnet-medium
    • "GPT" / "GPT-5" / "Codex" →
      --model gpt-5.3-codex
    • "Gemini" →
      --model gemini-3.1-pro
    • "Auto" →
      --model auto
    • 未提及任何模型 → 省略
      --model
      参数(Cursor将使用默认模型:
      composer-2-fast
  • 模式提示
    • "plan" / "plan mode" / "navrhni" →
      --mode plan
    • "write" / "edit" / "implement" / "headless" → 省略
      --mode
      参数(Cursor支持写入操作)
    • 其他情况 →
      --mode ask
      (只读模式,默认值)
  • 是否为审查任务? 如果任务中提到“review”、“check”、“verify”、“second opinion”,或引用了分支/PR/差异,请丰富提示内容(步骤2)。
成功标准:确定好参数,准备好提示语。

2. Enrich the prompt (reviews only)

2. 丰富提示内容(仅审查任务)

If the task is a code review:
  • Identify the diff scope. Try in order: explicit reference in the task (PR number, branch name), current branch vs
    main
    (
    git diff origin/main...HEAD
    ), or uncommitted changes (
    git diff HEAD
    ).
  • Prepend a short instruction to the prompt so cursor-agent knows what to look at:
    "Review the branch
    <name>
    against main. Use
    git diff origin/main...HEAD
    to see the actual changes. Focus on real issues (correctness, edge cases, security); skip nitpicks. Report under ~400 words with
    file:line
    references."
For non-review tasks (ask/plan/text/UI), pass the task as-is.
Success criteria: Final prompt string ready for the CLI.
如果是代码审查任务:
  • 确定差异范围。按以下顺序尝试:任务中明确引用的内容(PR编号、分支名称)、当前分支与
    main
    分支的差异(
    git diff origin/main...HEAD
    ),或未提交的更改(
    git diff HEAD
    )。
  • 在提示语前添加简短说明,让cursor-agent知道需要关注的内容:
    "审查分支
    <name>
    与main分支的差异。使用
    git diff origin/main...HEAD
    查看实际更改。重点关注真实问题(正确性、边缘情况、安全性);忽略琐碎细节。以不超过400字的篇幅报告,并附上
    file:line
    引用。"
对于非审查任务(问答/规划/文本/UI),直接传递原始任务即可。
成功标准:准备好用于CLI的最终提示字符串。

3. Run cursor-agent

3. 运行cursor-agent

Invoke headless via Bash:
bash
cursor-agent -p --output-format text [--mode <mode>] [--model <model>] "<prompt>"
  • Always use
    -p
    (print/headless).
  • Always use
    --output-format text
    unless the task needs structured output.
  • Workspace defaults to pwd — don't pass
    --workspace
    unless the user explicitly asked for a different dir.
  • For runs with only non-write modes (
    --mode ask
    or
    --mode plan
    ), no extra permission flags are needed. For headless write mode, do not silently add
    --force
    or
    --yolo
    ; ask the user first.
  • Pipe to
    tail -n 200
    if you suspect a very long response and want to cap context use. By default, take the full output.
Success criteria: cursor-agent returns (exit 0) with a response. If it errors (auth, model not available), surface the error to the user instead of hiding it.
通过Bash调用无头模式:
bash
cursor-agent -p --output-format text [--mode <mode>] [--model <model>] "<prompt>"
  • 始终使用
    -p
    参数(打印/无头模式)。
  • 始终使用
    --output-format text
    ,除非任务需要结构化输出。
  • 工作区默认为当前目录(pwd)——除非用户明确指定其他目录,否则不要传递
    --workspace
    参数。
  • 对于仅使用非写入模式的运行(
    --mode ask
    --mode plan
    ),无需额外权限参数。对于无头写入模式,不要静默添加
    --force
    --yolo
    参数;需先询问用户。
  • 如果预计响应会很长,可通过管道传递给
    tail -n 200
    以限制上下文使用。默认情况下,保留完整输出。
成功标准:cursor-agent返回(退出码0)并给出响应。如果出现错误(授权问题、模型不可用),请向用户显示错误信息,不要隐藏。

4. Return the output

4. 返回输出

Present to the user in this order:
  1. Cursor's verbatim response — quote it directly so the user hears the other model's voice, including file:line references.
  2. Your short TL;DR — 3–6 bullets at most, separated by a horizontal rule. Highlight what's real vs. noise, and suggest concrete next actions. Do not silently filter cursor's findings; if you disagree with one, call it out explicitly.
Keep the summary tight — the goal is to save the user from re-reading, not to replace cursor's output.
Success criteria: User sees both cursor's raw output and a Claude-curated action list.
按以下顺序向用户展示内容:
  1. Cursor的原始响应 — 直接引用,让用户听到其他模型的输出,包括
    file:line
    引用。
  2. 简短的TL;DR摘要 — 最多3-6个项目符号,用水平线分隔。突出真实问题与无关内容,并建议具体的后续操作。不要静默过滤Cursor的发现;如果您不同意其中某点,请明确指出。
保持摘要简洁——目的是节省用户重新阅读的时间,而非替代Cursor的输出。
成功标准:用户同时看到Cursor的原始输出和Claude整理的操作列表。

Notes

注意事项

  • cursor-agent --list-models
    shows every available model ID. If the user asks for something exotic (e.g. "thinking tier", "max tier"), check the list first.
  • cursor-agent
    reads/writes inside the current workspace like any CLI tool — it is not sandboxed by default. Treat its output the same way you'd treat a teammate's PR comment: trust but verify.
  • This skill is for one-shot delegation. For a longer back-and-forth, the user can run
    cursor-agent
    interactively themselves (no
    -p
    ).
  • cursor-agent --list-models
    命令会显示所有可用的模型ID。如果用户要求使用特殊模型(例如“thinking tier”、“max tier”),请先查看该列表。
  • cursor-agent
    像其他CLI工具一样在当前工作区内读写——默认情况下未沙箱化。对待其输出应如同对待队友的PR评论:信任但需验证。
  • 此技能适用于一次性任务委托。如需更长时间的交互,用户可自行以交互式方式运行
    cursor-agent
    (不使用
    -p
    参数)。