swiftlysingh

Cursor CLI Agent

開發程式設計v2.1.0
作者:swiftlysingh更新於 2026-05-18共 2 個版本 · 最新版本釋出於 2026-01-13cursor-agent@clawhub_swiftlysingh/cursor-agent
程式碼生成指令碼工具

據 AlphaMoat 統計,截至 2026-10,Cursor CLI Agent 累計下載 17,990 次、獲 18 個星標,按累計下載量在本次參與排名的 10,914 個 AI 技能中排名第 1,569 位,在「開發程式設計」分類(1,069 個)中排名第 109 位。

列表預設按累計下載量排序,也可按星標排序;詳情頁排名按累計下載量計算。

累計下載
1.8萬
星標
18
全站下載量排名
#1,569
全站前 15% · 「開發程式設計」前 11%
平台累計下載星標評論
ClawHub ↗1.3萬17-
SkillHub ↗1.8萬18—

各平台的計數口徑不同,統計時間不一致。

這個技能是做什麼的

涵蓋瀏覽器或 API 金鑰認證、檔案上下文、模型選擇、MCP 配置及非互動結構化輸出。文件要求真實終端,並建議自動化使用 tmux。強制選項會免確認應用改動,應明確選擇,不能視為預設模式。

資料釋出於 2026-10-27

可以用來做什麼

  • 規劃 Cursor CLI 程式碼審查或除錯會話

什麼時候用

  • 評估需要認證及終端環境的 CLI 編碼流程時

示例提示詞

以下是根據技能文件生成的示例,不代表實際執行結果。

整理本倉庫的審查流程,核對認證和終端要求,保持強制自動應用關閉。

月度資料趨勢

累計下載1.8萬
1.1萬1.5萬1.8萬2026-05 · 累計下載 1.2萬2026-06 · 累計下載 1.2萬2026-07 · 累計下載 1.2萬2026-08 · 累計下載 1.3萬2026-09 · 累計下載 1.3萬2026-10 · 累計下載 1.8萬26-0526-0926-10
星標18
1718182026-05 · 星標 182026-06 · 星標 182026-07 · 星標 182026-08 · 星標 182026-09 · 星標 172026-10 · 星標 1826-0526-0926-10

2026-09 起統計方法調整:同名技能按作者分別統計,並覆蓋全部技能。圖中虛線為調整前的月份,與之後的資料不直接比較,也不計算跨越調整的增長。

月份累計下載環比星標
2026-101.8萬—18
2026-091.3萬—17
2026-081.3萬+2.4%18
2026-071.2萬+4.1%18
2026-061.2萬+2.4%18
2026-051.2萬—18

SKILL.md 原文

以下是作者釋出的原始檔案,按純文字顯示,本站未做修改或稽核;其中的連結不可點選,命令請核實後再執行。抓取於 2026-10-23。

6.5 KB · ClawHub v2.1.0
---
name: cursor-agent
version: 2.1.0
description: A comprehensive skill for using the Cursor CLI agent for various software engineering tasks (updated for 2026 features, includes tmux automation guide).
author: Pushpinder Pal Singh
---

# Cursor CLI Agent Skill

This skill provides a comprehensive guide and set of workflows for utilizing the Cursor CLI tool, including all features from the January 2026 update.
展開全部(共 311 行)

## Installation

### Standard Installation (macOS, Linux, Windows WSL)

```bash
curl https://cursor.com/install -fsS | bash
```

### Homebrew (macOS only)

```bash
brew install --cask cursor-cli
```

### Post-Installation Setup

**macOS:**
- Add to PATH in `~/.zshrc` (zsh) or `~/.bashrc` (bash):
  ```bash
  export PATH="$HOME/.local/bin:$PATH"
  ```
- Restart terminal or run `source ~/.zshrc` (or `~/.bashrc`)
- Requires macOS 10.15 or later
- Works on both Intel and Apple Silicon Macs

**Linux/Ubuntu:**
- Restart your terminal or source your shell config
- Verify with `agent --version`

**Both platforms:**
- Commands: `agent` (primary) and `cursor-agent` (backward compatible)
- Verify installation: `agent --version` or `cursor-agent --version`

## Authentication

Authenticate via browser:

```bash
agent login
```

Or use API key:

```bash
export CURSOR_API_KEY=your_api_key_here
```

## Update

Keep your CLI up to date:

```bash
agent update
# or
agent upgrade
```

## Commands

### Interactive Mode

Start an interactive session with the agent:

```bash
agent
```

Start with an initial prompt:

```bash
agent "Add error handling to this API"
```

**Backward compatibility:** `cursor-agent` still works but `agent` is now the primary command.

### Model Switching

List all available models:

```bash
agent models
# or
agent --list-models
```

Use a specific model:

```bash
agent --model gpt-5
```

Switch models during a session:

```
/models
```

### Session Management

Manage your agent sessions:

- **List sessions:** `agent ls`
- **Resume most recent:** `agent resume`
- **Resume specific session:** `agent --resume="[chat-id]"`

### Context Selection

Include specific files or folders in the conversation:

```
@filename.ts
@src/components/
```

### Slash Commands

Available during interactive sessions:

- **`/models`** - Switch between AI models interactively
- **`/compress`** - Summarize conversation and free up context window
- **`/rules`** - Create and edit rules directly from CLI
- **`/commands`** - Create and modify custom commands
- **`/mcp enable [server-name]`** - Enable an MCP server
- **`/mcp disable [server-name]`** - Disable an MCP server

### Keyboard Shortcuts

- **`Shift+Enter`** - Add newlines for multi-line prompts
- **`Ctrl+D`** - Exit CLI (requires double-press for safety)
- **`Ctrl+R`** - Review changes (press `i` for instructions, navigate with arrow keys)
- **`ArrowUp`** - Cycle through previous messages

### Non-interactive / CI Mode

Run the agent in a non-interactive mode, suitable for CI/CD pipelines:

```bash
agent -p 'Run tests and report coverage'
# or
agent --print 'Refactor this file to use async/await'
```

**Output formats:**

```bash
# Plain text (default)
agent -p 'Analyze code' --output-format text

# Structured JSON
agent -p 'Find bugs' --output-format json

# Real-time streaming JSON
agent -p 'Run tests' --output-format stream-json --stream-partial-output
```

**Force mode (auto-apply changes without confirmation):**

```bash
agent -p 'Fix all linting errors' --force
```

**Media support:**

```bash
agent -p 'Analyze this screenshot: screenshot.png'
```

### ⚠️ Using with AI Agents / Automation (tmux required)

**CRITICAL:** When running Cursor CLI from automated environments (AI agents, scripts, subprocess calls), the CLI requires a real TTY. Direct execution will hang indefinitely.

**The Solution: Use tmux**

```bash
# 1. Install tmux if not available
sudo apt install tmux  # Ubuntu/Debian
brew install tmux      # macOS

# 2. Create a tmux session
tmux kill-session -t cursor 2>/dev/null || true
tmux new-session -d -s cursor

# 3. Navigate to project
tmux send-keys -t cursor "cd /path/to/project" Enter
sleep 1

# 4. Run Cursor agent
tmux send-keys -t cursor "agent 'Your task here'" Enter

# 5. Handle workspace trust prompt (first run)
sleep 3
tmux send-keys -t cursor "a"  # Trust workspace

# 6. Wait for completion
sleep 60  # Adjust based on task complexity

# 7. Capture output
tmux capture-pane -t cursor -p -S -100

# 8. Verify results
ls -la /path/to/project/
```

**Why this works:**
- tmux provides a persistent pseudo-terminal (PTY)
- Cursor's TUI requires interactive terminal capabilities
- Direct `agent` calls from subprocess/exec hang without TTY

**What does NOT work:**
```bash
# ❌ These will hang indefinitely:
agent "task"                    # No TTY
agent -p "task"                 # No TTY  
subprocess.run(["agent", ...])  # No TTY
script -c "agent ..." /dev/null # May crash Cursor
```

## Rules & Configuration

The agent automatically loads rules from:
- `.cursor/rules`
- `AGENTS.md`
- `CLAUDE.md`

Use `/rules` command to create and edit rules directly from the CLI.

## MCP Integration

MCP servers are automatically loaded from `mcp.json` configuration.

Enable/disable servers on the fly:

```
/mcp enable server-name
/mcp disable server-name
```

**Note:** Server names with spaces are fully supported.

## Workflows

### Code Review

Perform a code review on the current changes or a specific branch:

```bash
agent -p 'Review the changes in the current branch against main. Focus on security and performance.'
```

### Refactoring

Refactor code for better readability or performance:

```bash
agent -p 'Refactor src/utils.ts to reduce complexity and improve type safety.'
```

### Debugging

Analyze logs or error messages to find the root cause:

```bash
agent -p 'Analyze the following error log and suggest a fix: [paste log here]'
```

### Git Integration

Automate git operations with context awareness:

```bash
agent -p 'Generate a commit message for the staged changes adhering to conventional commits.'
```

### Batch Processing (CI/CD)

Run automated checks in CI pipelines:

```bash
# Set API key in CI environment
export CURSOR_API_KEY=$CURSOR_API_KEY

# Run security audit with JSON output
agent -p 'Audit this codebase for security vulnerabilities' --output-format json --force

# Generate test coverage report
agent -p 'Run tests and generate coverage report' --output-format text
```

### Multi-file Analysis

Use context selection to analyze multiple files:

```bash
agent
# Then in interactive mode:
@src/api/
@src/models/
Review the API implementation for consistency with our data models
```

「開發程式設計」分類下的熱門技能

程式設計大神.Skill開發程式設計

【全棧能力】程式設計大神.Skill:面向複雜真實專案的高階全棧程式設計助手。不止生成程式碼,而是從一句目標接手陌生程式碼庫,拆解需求、補齊實現、追到根因、完成重構、聯調前後端,並把結果推進到能執行、能驗證、能交付。覆蓋 Web、後端、指令碼、iOS、安卓、鴻蒙 ArkUI、微信小程式及其他技術棧,支援中英文工程、疑難 Bug、跨模組任務和長任務續做;用構建、日誌、真實入口、裝置或介面證據說明結果。僅問概念時直接回答,要求落地時持續推進到驗收或明確阻塞。

↓ 1125.9萬★ 82u_42bbb65f
程式設計專家Pro.Skill開發程式設計

程式設計專家 Pro:融合程式設計專家 2.0.3 工程專題與程式設計大神的鴻蒙 ArkTS/ArkUI、微信小程式和小遊戲開發資料。用於專案實現、根因除錯、審查、重構、測試、架構效能分析及多端開發驗證。支援自然語言和 @專題標識,按任務讀取包內知識;只問概念時直接回答。

↓ 626.9萬★ 32user_47d655f0
程式設計專家.Skill開發程式設計

程式設計專家.Skill P8級程式設計助手,25年實戰經驗技能Skill,全棧:Java/Php網站/軟體專案、API設計、Bug診斷、程式碼生成、程式碼審查、重構、測試用例、效能基準、技術選型、文件生成、任務拆解、Spec驅動、Karpathy規範、CMS二次開發、前端設計、MySQL/Mariadb、專案知識圖譜,以及工程紀律層(根因除錯硬閉環、階段導航、事故復盤/SLO、威脅建模/供應鏈安全、生產就緒/漸進式釋出、AI編碼治理、面向Agent程式碼可讀性、LLM應用安全)。支援 @標識 顯式呼叫跳過路由。

↓ 600.7萬★ 378user_741dc82b
dev-expert開發程式設計

程式設計專家.Skill P8級程式設計助手,25年實戰經驗技能Skill,全棧:Java/Php網站/軟體專案、API設計、Bug診斷、程式碼生成、程式碼審查、重構、測試用例、效能基準、技術選型、文件生成、任務拆解、Spec驅動、Karpathy規範、CMS二次開發、前端設計、MySQL/Mariadb、專案知識圖譜,以及工程紀律層(根因除錯硬閉環、階段導航、事故復盤/SLO、威脅建模/供應鏈安全、生產就緒/漸進式釋出、AI編碼治理、面向Agent程式碼可讀性、LLM應用安全)。支援 @標識 顯式呼叫跳過路由。

↓ 528.1萬★ 32user_814dbe54
dev-expert-pro開發程式設計

程式設計專家 Pro:融合程式設計專家 2.0.3 工程專題與程式設計大神的鴻蒙 ArkTS/ArkUI、微信小程式和小遊戲開發資料。用於專案實現、根因除錯、審查、重構、測試、架構效能分析及多端開發驗證。支援自然語言和 @專題標識,按任務讀取包內知識;只問概念時直接回答。

↓ 104.7萬★ -user_814dbe54
程式設計專家 Pro開發程式設計

程式設計專家 Pro:融合程式設計專家 2.0.3 工程專題與程式設計大神的鴻蒙 ArkTS/ArkUI、微信小程式和小遊戲開發資料。用於專案實現、根因除錯、審查、重構、測試、架構效能分析及多端開發驗證。支援自然語言和 @專題標識,按任務讀取包內知識;只問概念時直接回答。

↓ 98.2萬★ 1user_28275a78
程式設計專家.Skill開發程式設計

程式設計專家.Skill P8級程式設計助手,25年實戰經驗技能Skill,全棧:Java/Php網站/軟體專案、API設計、Bug診斷、程式碼生成、程式碼審查、重構、測試用例、效能基準、技術選型、文件生成、任務拆解、Spec驅動、Karpathy規範、CMS二次開發、前端設計、MySQL/Mariadb、專案知識圖譜,以及工程紀律層(根因除錯硬閉環、階段導航、事故復盤/SLO、威脅建模/供應鏈安全、生產就緒/漸進式釋出、AI編碼治理、面向Agent程式碼可讀性、LLM應用安全)。支援 @標識 顯式呼叫跳過路由。

↓ 70.1萬★ 6user_613b33ea
Github開發程式設計

用 gh 命令列工具檢視 GitHub 上的 PR 檢查、工作流執行與 API 查詢的技能。

↓ 48萬★ 714Peter Steinberger

資料月份:2026-10 · 下載/星標數聚合自公開技能註冊庫(ClawHub、SkillHub),按月更新。口徑說明見資料方法。