返回顶部
c

cursor-agentCursor代理

Delegate coding tasks to Cursor Agent CLI. Use when: (1) building/creating new features or apps, (2) reviewing PRs (spawn in temp dir), (3) refactoring large codebases, (4) iterative coding that needs file exploration. NOT for: simple one-liner fixes (just edit), reading code (use read tool), thread-bound ACP harness requests in chat (use sessions_spawn with runtime:"acp"), or any work in ~/clawd workspace (never spawn agents here). Requires a bash tool that supports pty:true.

作者: admin | 来源: ClawHub
源自
ClawHub
版本
V 1.1.0
安全检测
已通过
409
下载量
免费
免费
0
收藏
概述
安装方式
版本历史

cursor-agent

Cursor Agent 技能

使用 Cursor CLI(agent 命令)执行编码任务。支持多种前沿模型(GPT-5、Claude Opus/Sonnet、Gemini、Grok 等)。

⚠️ 需要 PTY 模式!

Cursor Agent 是一个交互式终端应用程序,需要 PTY 才能正常工作。

bash

✅ 正确


bash pty:true command:agent 你的提示词

❌ 错误 - 没有 PTY 会挂起

bash command:agent 你的提示词

Bash 工具参数

参数类型描述
command字符串要执行的 Shell 命令
pty
布尔值 | 必需! 为交互式 CLI 分配伪终端 | | workdir | 字符串 | 工作目录(agent 只能看到此文件夹的上下文) | | background | 布尔值 | 后台运行,返回 sessionId 用于监控 | | timeout | 数字 | 超时时间(秒)(超时后终止进程) | | elevated | 布尔值 | 在主机上运行而非沙箱(如果允许) |

快速开始

bash

检查状态并登录


agent status
agent login

列出可用模型

agent --list-models

快速任务(交互模式)

bash pty:true command:agent 为 API 调用添加错误处理

指定工作目录

bash pty:true workdir:~/Projects/myproject command:agent 构建一个贪吃蛇游戏

模式:workdir + background + pty

对于较长的任务,使用后台模式:

bash

启动后台任务


bash pty:true workdir:~/project background:true command:agent --yolo 重构认证模块

返回 sessionId,使用 process 工具监控

process action:list process action:log sessionId:XXX process action:poll sessionId:XXX

发送输入

process action:submit sessionId:XXX data:yes

终止

process action:kill sessionId:XXX

为什么 workdir 很重要: Agent 会在一个专注的目录中启动,不会四处读取不相关的文件(比如你的 soul.md 😅)。



命令标志参考


标志描述
promptAgent 的初始提示词
--yolo / --force
自动批准所有操作(危险但快速) |
| --model | 指定模型(gpt-5、sonnet-4、opus-4、gemini、grok 等) |
| --workspace | 工作目录 |
| -w, --worktree [name] | 在隔离的 git worktree 中运行 |
| --print | 非交互模式,输出到控制台 |
| --mode | 执行模式:plan(只读规划)、ask(问答) |
| --plan | 规划模式(只读,不修改文件) |
| --cloud | 云模式 |
| --resume | 恢复之前的会话 |
| --trust | 信任工作区(仅限无头模式) |


执行模式

交互模式(默认)

bash bash pty:true workdir:~/project command:agent 构建一个深色模式切换按钮

自动执行模式(--yolo)

bash

自动批准所有操作,快速执行

bash pty:true workdir:~/project command:agent --yolo 重构认证模块

规划模式(--plan)

bash

只读模式,生成计划但不执行

bash pty:true workdir:~/project command:agent --plan 分析代码库结构

问答模式(--mode ask)

bash

仅问答,不修改文件

bash pty:true command:agent --mode ask 解释认证流程如何工作

非交互模式(--print)⭐ 独特功能

Cursor 独特的 --print 模式,非常适合脚本和 CI/CD:

bash

非交互执行,输出到控制台


bash pty:true command:agent --print 生成代码库摘要

JSON 输出(适合解析)

bash pty:true command:agent --print --output-format json 列出所有 API 端点

流式 JSON(实时处理)

bash pty:true command:agent --print --output-format stream-json 分析项目

使用场景:

  • - CI/CD 集成
  • 自动化脚本
  • 批量任务
  • 需要解析结果的场景



Git Worktree 隔离

用于并行处理多个独立任务:

bash

在隔离的 worktree 中运行


bash pty:true workdir:~/project command:agent -w fix-issue-78 修复登录 bug

指定基础分支

bash pty:true workdir:~/project command:agent -w feature-x --worktree-base develop 添加功能 X

并行问题修复

使用 git worktrees 同时修复多个问题:

bash

1. 为每个问题创建 worktrees


git worktree add -b fix/issue-78 /tmp/issue-78 main
git worktree add -b fix/issue-99 /tmp/issue-99 main

2. 在每个 worktree 中启动 agent(后台 + PTY)

bash pty:true workdir:/tmp/issue-78 background:true command:agent --yolo 修复问题 #78:登录 bug。提交并推送。 bash pty:true workdir:/tmp/issue-99 background:true command:agent --yolo 修复问题 #99:API 超时。提交并推送。

3. 监控进度

process action:list process action:log sessionId:XXX

4. 创建 PR

cd /tmp/issue-78 && git push -u origin fix/issue-78 gh pr create --repo user/repo --head fix/issue-78 --title fix: ... --body ...

5. 清理

git worktree remove /tmp/issue-78 git worktree remove /tmp/issue-99

批量 PR 审查

⚠️ 永远不要在 OpenClaw 自己的项目目录中审查 PR!

bash

克隆到临时目录


REVIEW_DIR=$(mktemp -d)
git clone https://github.com/user/repo.git $REVIEW_DIR
cd $REVIEW_DIR && gh pr checkout 130

在规划模式下审查(只读)

bash pty:true workdir:$REVIEW_DIR command:agent --plan 审查此 PR 的安全问题和代码质量

清理

trash $REVIEW_DIR

批量审查多个 PR

bash

获取所有 PR 引用


git fetch origin +refs/pull//head:refs/remotes/origin/pr/

并行启动多个 agent

bash pty:true workdir:~/project background:true command:agent --plan 审查 PR #86。git diff origin/main...origin/pr/86 bash pty:true workdir:~/project background:true command:agent --plan 审查 PR #87。git diff origin/main...origin/pr/87

监控

process action:list

将结果发布到 GitHub

gh pr comment 86 --body <审查内容>

Process 工具(后台任务管理)

操作描述
list列出所有运行中的会话
poll
检查会话是否仍在运行 | | log | 获取会话输出(支持 offset/limit) | | write | 向 stdin 发送原始数据 | | submit | 发送数据 + 换行(模拟回车) | | send-keys | 发送按键 | | paste | 粘贴文本 | | kill | 终止会话 |

模型选择

bash

列出可用模型


agent --list-models

指定模型

bash pty:true command:agent --model opus-4 复杂的重构任务 bash pty:true command:agent --model gpt-5 构建一个 CLI 工具 bash pty:true command:agent --model gemini 分析这个 Python 代码库

完成时自动通知

对于长时间运行的任务,在提示词末尾添加唤醒触发器:

bash
bash pty:true workdir:~/project background:true command:agent --yolo 构建一个待办事项 REST API。

完全完成后,运行:openclaw system event --text \完成:已构建待

标签

skill ai

通过对话安装

该技能支持在以下平台通过对话安装:

OpenClaw WorkBuddy QClaw Kimi Claude

方式一:安装 SkillHub 和技能

帮我安装 SkillHub 和 cursor-cli-agent-1776393912 技能

方式二:设置 SkillHub 为优先技能安装源

设置 SkillHub 为我的优先技能安装源,然后帮我安装 cursor-cli-agent-1776393912 技能

通过命令行安装

skillhub install cursor-cli-agent-1776393912

下载

⬇ 下载 cursor-agent v1.1.0(免费)

文件大小: 4.17 KB | 发布时间: 2026-4-17 15:24

v1.1.0 最新 2026-4-17 15:24
**Changelog for cursor-cli-agent v1.1.0**

- SKILL.md fully translated from Chinese to English for wider accessibility.
- All command explanations, usage patterns, and example scripts updated to English.
- Maintained current command options, flows, and best-practices guidance—no feature changes.
- Documentation sections and formatting improved for clarity and consistency.

Archiver·手机版·闲社网·闲社论坛·羊毛社区· 多链控股集团有限公司 · 苏ICP备2025199260号-1

Powered by Discuz! X5.0   © 2024-2025 闲社网·线报更新论坛·羊毛分享社区·http://xianshe.com

p2p_official_large
返回顶部