cursor-delegate
Skill2 starsChanged 43 days agoApache-2.0View on GitHub
Delegate code reviews, refactoring, bug fixes, or implementation tasks to the Cursor Agent CLI (`cursor agent` / `agent`). Use when running Cursor as an AK5 worker (claim → run → submit), executing headless/non-interactive code reviews or refactoring, waking Cursor from AK5 WORK_AVAILABLE events, or syncing Cursor output back to AK5 tickets.
2 other projects use a version of this.
Adopted by
Most recently taken up by
- Vanyangyang/cursor-bridgetheir own version, first seen Sep 8, 2026
- amElnagdy/delegate-skillstheir own version, first seen Jul 29, 2026
Other versions2 projects use a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 2
- amElnagdy/delegate-skills★ 2.6ksame name
- Vanyangyang/cursor-bridge★ 84same name
How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.
In this repository6 other files it gives its agents.
- ak5-live-testSkill
- audit-localSkill
- create-prSkill
- releaseSkill
- ak5Skill
- releaseSkill
The file
We split this skill into the rules it gives an agent
5 rules. About 0 are common, 3 are distinctive, and 2 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈3
Distinctive · estimate
This author's own choices. Worth a look.
2
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 11
Use this skill when you need to delegate code review, architecture analysis, bug fixing, or test generation tasks to the Cursor Agent CLI …
- Distinctive: line 48
Before dispatching tasks, verify that the Cursor Agent CLI is installed and authenticated:
- Distinctive: line 137
When you simply need a second-opinion review on current uncommitted changes or recent commits:
- Distinctive: line 199
When crafting prompts for Cursor Agent, follow these guidelines for optimal results:
- Very specific: line 209
Always pass -w (--worktree) when delegating multi-file changes or risky refactors.
≈ “Common” is an estimate: at least 1 in 5 of the 408,460 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Cursor Agent Delegation Skill
Use this skill when you need to delegate code review, architecture analysis, bug fixing, or test generation tasks to the Cursor Agent CLI (cursor agent or agent) within the AK5 Kanban ecosystem.
1. Overview & Architecture
This skill bridges Antigravity (Lead Orchestrator), the AK5 Kanban System (State & Task Tracker), and the Cursor Agent CLI (Autonomous Worker / Reviewer).
┌───────────────────────────────┐
│ Antigravity (Orchestrator) │
└───────────────┬───────────────┘
│ 1. Subtask Delegation / Plan
▼
┌───────────────────────────────────────────────────────────────────┐
│ AK5 Kanban Board (Tickets, Dependencies, Attachments, SSE Events) │
└───────────────┬───────────────────────────────────▲───────────────┘
│ 2. Event stream or CLI trigger │ 4. Comments & Reports
▼ │ Attachments & Status
┌───────────────────────────────────────────────────┴───────────────┐
│ Cursor Agent CLI (`agent -p` / `cursor_delegate.py`) │
│ • Headless execution (Claude 3.7 / Sonnet / GPT-5) │
│ • Local workspace & Git diff inspections │
│ • Isolated Git Worktrees (-w) for safe code modifications │
└───────────────────────────────────────────────────────────────────┘When to Delegate to Cursor Agent:
- Second-Opinion Code Reviews: Independent verification of newly implemented features or PRs.
- Security & Shell Injection Audits: Specialized scrutiny of shell subprocess runners and API payloads.
- Isolated Refactoring: Refactoring code in an isolated git worktree without disturbing current workspace files.
- Autonomous Ticket Execution: Acting as an AK5 worker profile that pulls backlog tickets (
ak5 next/ak5 ticket claim) and submits deliverables.
2. Pre-flight & Environment Verification
Before dispatching tasks, verify that the Cursor Agent CLI is installed and authenticated:
# Check CLI binary resolution
which agent || which cursor
# Verify login status
cursor agent status
# Expected output: ✓ Logged in as <user@domain.com>
# List available models (optional)
agent --list-models[!NOTE] The binary can typically be invoked as either
agentorcursor agent(located at~/.local/bin/agent). Both support the same non-interactive flags.
3. Recommended Execution Methods
There are two ways to invoke Cursor Agent. Always prefer Method 1 (cursor_delegate.py) to avoid CLI quoting issues and empty-output quirks.
Method 1 (Primary & Strongly Recommended): Companion Runner Script
The companion runner at .agents/skills/cursor-delegate/scripts/cursor_delegate.py auto-detects the binary, constructs hardened read-only prompts, captures stdout safely, and handles AK5 ticket synchronization.
# 1. Quick Ad-hoc Code Review (Review uncommitted working tree diff without a ticket)
python3 .agents/skills/cursor-delegate/scripts/cursor_delegate.py \
--title "Review uncommitted working tree changes" \
--mode review
# 2. Full AK5 worker run (claim, review, comment, attach report, submit → agent_review)
AK5_PROFILE=cursor-1 python3 .agents/skills/cursor-delegate/scripts/cursor_delegate.py \
--ticket-id TK-025 \
--title "Code Review for Feature" \
--mode review \
--claim --comment --attach --submit
# 3. Autonomous Fix in an Isolated Git Worktree (-w)
python3 .agents/skills/cursor-delegate/scripts/cursor_delegate.py \
--ticket-id TK-026 \
--title "Fix shlex.quote in command renderer" \
--mode fix \
--worktree \
--commentMethod 2 (Fallback / Direct CLI): Low-Level Invocation
[!CAUTION] CLI Quirk with
--mode planin-pmode: In non-interactive print mode (-p/--mode plancan cause the Cursor Agent CLI to initialize an interactive planning session and exit with empty output (0 bytes). DO NOT useagent -p --mode plan. Instead, omit--mode planand explicitly instruct read-only behavior inside the prompt string:
# ✅ CORRECT Direct Review Pattern (Instruct read-only in the prompt):
agent -p "
You are an autonomous code reviewer.
Review the latest git diff (or uncommitted changes) in the workspace.
DO NOT edit or modify any files.
Provide:
1. Executive Summary
2. Potential Bugs & Security/Edge Cases
3. Actionable Recommendations
" > /tmp/cursor_review.md
# ❌ INCORRECT (May exit with empty output!):
# agent -p --mode plan "Review git diff" > /tmp/cursor_review.md| Goal | Direct CLI Pattern | Notes |
| Read-Only Review | agent -p "Review diff... DO NOT edit files." | Do NOT use --mode plan with -p. |
| Active Fix / Code Edit | agent -p --force "<PROMPT>" | Allows file edits and test execution. |
| Isolated Worktree Fix | agent -p -w --force "<PROMPT>" | Runs in ~/.cursor/worktrees/<repo>/. |
| Model Selection | agent -p --model claude-3.7-sonnet "<PROMPT>" | Overrides default model. |
4. AK5 Task Delegation Workflows
Workflow A: Quick Ad-hoc Workspace Review (No Ticket Required)
When you simply need a second-opinion review on current uncommitted changes or recent commits:
python3 .agents/skills/cursor-delegate/scripts/cursor_delegate.py \
--title "Review current working tree diff" \
--mode reviewWorkflow B: Cursor as an AK5 worker (pull model)
Cursor runs under its own worker profile. A human registers it once and approves the code in the browser:
ak5 login --agent cursor-1 --role worker --caps code-review,py
export AK5_PROFILE=cursor-1Tickets reach the board backlog through triage (ak5 ticket route) or a direct create
(ak5 ticket create --board <BOARD> --spec … --criteria …, or ak5 delegate <PARENT> --title … for a child ticket).
There is no push assignment: Cursor pulls the work.
# 1. Find work (exit 6 = nothing yet)
TICKET=$(ak5 --json next --board proj-core-engine --caps code-review --wait 25 | jq -r .ticket_id)
# 2. Claim, run Cursor, comment, attach the report, submit the deliverable
python3 .agents/skills/cursor-delegate/scripts/cursor_delegate.py \
--ticket-id "$TICKET" \
--mode review \
--claim --comment --attach --submit--claimstops with the CLI exit code if the ticket is taken (3), not claimable by a worker (4), or blocked (5).--submitsends a deliverable (summary= first line of the Cursor output,artifacts= the attached report) and moves the ticket toagent_review. A gatekeeper reviews it next; a human approves it last.--move-tois gone: columns are not a workflow step in v2.
Workflow C: Wake Cursor on new work (ak5 subscribe add)
Register a local daemon subscriber once. The daemon runs --exec whenever the board has claimable work:
ak5 subscribe add proj-core-engine \
--profile cursor-1 \
--events WORK_AVAILABLE \
--exec 'python3 .agents/skills/cursor-delegate/scripts/cursor_delegate.py --ticket-id "$AK5_TICKET_ID" --title "$AK5_TITLE" --mode review --claim --comment --attach --submit'
ak5 subscribe ls[!IMPORTANT] Hook contract:
--execis run literally by the daemon. Event data arrives as$AK5_TICKET_ID,$AK5_TITLE,$AK5_SUMMARY,$AK5_BOARD_ID, or stdin JSON. Curly-brace tokens like{title}are not expanded. The daemon setsAK5_PROFILEto the subscriber's profile (cursor-1here), so the script'sak5calls act as that profile.
WORK_AVAILABLEalso fires for stages a worker cannot claim (for exampleagent_review);--claimthen exits 4 and the run stops without calling Cursor.
6. Prompt Crafting Best Practices
When crafting prompts for Cursor Agent, follow these guidelines for optimal results:
- Target Specific Diffs or Commits:
- Provide concrete references:
Review commit f5a1515 (git show f5a1515)orReview uncommitted changes in backend/src/.
- Provide concrete references:
- Constrain Output Format:
- Request structured sections:
1. Summary,2. Security & Edge Cases,3. Quality & Tests,4. Actionable Steps.
- Request structured sections:
- Specify Tool Access Level:
- For review / audit: use
--mode plan(guarantees zero unintended file edits). - For bug fixes: use
--forceor--yolo(permits editing files and executing tests).
- For review / audit: use
- Isolate Major Refactors:
- Always pass
-w(--worktree) when delegating multi-file changes or risky refactors.
- Always pass
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

