Awesome-omni-skill cursor-agent
Use the Cursor CLI (agent) for software engineering tasks. Includes installation, auth, commands, terminal-based automation, and best practices for AI coding workflows.
git clone https://github.com/diegosouzapw/awesome-omni-skill
T=$(mktemp -d) && git clone --depth=1 https://github.com/diegosouzapw/awesome-omni-skill "$T" && mkdir -p ~/.claude/skills && cp -r "$T/skills/cli-automation/cursor-agent-dustland" ~/.claude/skills/diegosouzapw-awesome-omni-skill-cursor-agent-3b9ff3 && rm -rf "$T"
skills/cli-automation/cursor-agent-dustland/SKILL.md- curl piped into shell
- makes HTTP requests (curl)
Cursor CLI Agent Skill
This skill provides expert knowledge for using the Cursor CLI (
agent / cursor-agent). When the user asks to use this skill or run the Cursor CLI, use your available tools (their descriptions tell you when to call them). The Cursor CLI requires a real terminal (PTY) — the terminal skill provides persistent sessions for this.
Installation & Setup
Install (macOS/Linux/WSL):
curl https://cursor.com/install -fsS | bash
macOS (Homebrew):
brew install --cask cursor-cli
PATH: Add
$HOME/.local/bin to PATH in ~/.zshrc or ~/.bashrc, then source it.
Verify:
agent --version or cursor-agent --version
Authentication
- Interactive:
agent login - API key:
export CURSOR_API_KEY=your_api_key_here
Commands (user-facing)
- Interactive:
oragentagent "Add error handling to this API" - Non-interactive / CI:
oragent -p 'Run tests and report coverage'agent --print 'Refactor this file' - Models:
oragent modelsagent --model gpt-5 - Sessions:
,agent ls
,agent resumeagent --resume="[chat-id]"
Slash commands (inside interactive session)
– switch models/models
– summarize conversation/compress
– edit rules/rules
– custom commands/commands
– MCP/mcp enable|disable [server-name]
Best Practices for AI Coding Tasks
Writing Effective Prompts
The quality of the Cursor agent's output depends heavily on the prompt. Follow these guidelines:
-
Be specific about files and locations:
- BAD: "Fix the bug in the auth module"
- GOOD: "In src/auth/login.ts, the loginUser() function throws an unhandled promise rejection when the database connection times out. Add proper error handling with a try/catch block and return a meaningful error response."
-
Include context about the codebase:
- Mention the framework (React, Next.js, Express, etc.)
- Mention the language (TypeScript strict mode, Python 3.12, etc.)
- Reference relevant patterns: "This project uses the repository pattern for data access"
-
State acceptance criteria:
- "Ensure all existing tests pass after the change"
- "The function should handle null inputs gracefully"
- "Follow the existing code style (no semicolons, 2-space indent)"
-
Git workflow is automatic for coding tasks:
- The tool automatically detects if you're in a git repository
- For coding tasks, it automatically adds instructions to create a branch, commit, push, and create a PR
- You don't need to include these steps in your prompt — just focus on the actual coding task
- Example: "In src/auth/login.ts, add proper error handling to the loginUser() function" — the tool will automatically add branch/PR instructions
-
For multi-step tasks, break them down:
- Run one focused prompt per logical change
- Verify after each step before proceeding
- Use
(non-interactive) for automated workflowsagent -p
Configuring Rules and Context
Cursor agent reads rules from these locations (in order):
— Project-specific rules directory.cursor/rules
— Agent instructions at project rootAGENTS.md
— Claude-specific instructions at project rootCLAUDE.md
— Legacy rules file.cursorrules
Best practice: Create an
AGENTS.md in the project root with:
- Project structure overview
- Coding conventions
- Testing requirements
- Deployment notes
MCP Integration
Cursor agent supports MCP (Model Context Protocol) servers defined in
mcp.json:
- Enable/disable with
in interactive session/mcp - MCP servers can provide additional tools and context
Using Cursor CLI from Automation (Viber / AI agents)
CRITICAL: The Cursor CLI requires a real TTY. Running
agent or agent -p "..." directly from a subprocess or script will hang indefinitely.
Solution: The terminal skill provides persistent terminal sessions. Use terminal_check first to verify the backend is available.
- Check terminal backend (use the terminal skill's
).terminal_check - cursor_agent_run runs the agent inside a terminal session with automatic completion detection.
- For custom flows: create a session with
, send keys withterminal_new_session
, read output withterminal_send_keys
.terminal_read
What does NOT work: Running
agent "task" or agent -p "task" directly from Node/scripts without a PTY — it will hang.
Tool: cursor_agent_run
The
cursor_agent_run tool:
- Runs the Cursor agent in a persistent terminal session with a specified prompt
- Polls for completion instead of blindly waiting a fixed duration
- Returns structured output with status, timing, and captured terminal output
- Supports parallel runs via distinct
valuessessionName
Parameters:
(required): Detailed task prompt — be specific (see best practices above)goal
(optional): Project root directorycwd
(optional): Maximum wait time (default: 120s, polls every 3s)waitSeconds
(optional): Session name for parallel runs (default: 'cursor-agent')sessionName
Return shape:
: boolean — whether the agent completed within the time limitok
: 'completed' | 'timed_out' | 'error'status
: one-line status stringsummary
: last ~100 lines of terminal output (chat-friendly)outputTail
: full captured output (truncated if very large)output
: seconds spentelapsed
: guidance when timed out or erroredhint
Parallel Cursor Agent Runs
For large tasks, run multiple agents in parallel with distinct session names:
cursor_agent_run({ goal: "Fix auth module tests", cwd: "/project", sessionName: "cursor-auth" }) cursor_agent_run({ goal: "Update API documentation", cwd: "/project", sessionName: "cursor-docs" })
Check status of all sessions with
terminal_list.
Recommended Workflows
Issue Fix Workflow
→ Read the full issuegh_get_issue
→ Clone (or pull latest)gh_clone_repo
→ Fix the issue with a prompt describing the issue and requirementscursor_agent_run- Example: "Fix the bug described in issue #123: [issue details]. Ensure all tests pass."
- The tool automatically adds branch creation, commit, push, and PR creation instructions
- No need to manually include git workflow steps in your prompt
Note: The Cursor agent can execute git commands directly. The
cursor_agent_run tool automatically enhances your prompt with git workflow instructions for coding tasks in git repositories, so you can focus on describing what needs to be done rather than how to manage branches and PRs.
Code Review Workflow
agent -p 'Review the changes in the current branch against main. Focus on security and performance.'
Refactor Workflow
agent -p 'Refactor src/utils.ts to reduce complexity and improve type safety. Ensure all tests pass.'
Debug Workflow
agent -p 'Analyze the following error and suggest a fix: [paste error]. The error occurs in src/api/handler.ts.'
Rules & MCP
- Rules load from
,.cursor/rules
,AGENTS.md
.CLAUDE.md - MCP servers from
; enable/disable withmcp.json
in session./mcp