委派任务

danielvm-git2026-10-28查看 1701复制 1896

将一个复杂任务委托给单个子代理,在合并回来之前分两个阶段审查其工作。顺序执行——一次一个代理,并带有监督。适用于任务复杂且在接受结果之前需要仔细审查时。与 dispatch-agents 不同(此处无并行;审查者在继续之前看到完整 diff)。

Download (.md)

📘如何使用这个技能

  1. 1
    复制技能内容·点击上方「Copy SKILL.md」复制全部内容,或 Download 下载到本地
  2. 2
    打开你的 AI 客户端·支持 Claude Code、Trae、Cursor、ChatGPT、DeepSeek、Kimi 等任意 AI 助手
  3. 3
    粘贴为系统提示/知识文件·Claude Code:放入 .claude/skills/ 目录;普通对话:作为首条消息发送并说「请严格按这份技能文档执行」
  4. 4
    直接提出你的需求·AI 会按技能定义的工作流、格式和约束来处理,无需再解释背景

💡 提示:技能生效后,每次对话只需一句需求,AI 会按 SKILL.md 的流程执行。

SKILL.md3850 chars
---
name: delegate-task
model: sonnet
effort: standard
description: Delegate one complex task to a single subagent, review its work in two stages before merging back. Sequential — one agent at a time, with oversight. Use when a task is complex and requires careful review before the result is accepted. Distinct from dispatch-agents (no parallelism here; reviewer sees full diff before proceeding).
---

<!-- story: e45s30 -->

# Delegate Task
> **HARD GATE** — **HARD GATE** — Delegated work must have clear success criteria and verification commands. The delegate must be able to verify completion independently.


Delegate a single complex task to a subagent with a two-stage review gate before accepting the result. Use when oversight of a single task matters more than speed.

**Distinct from `dispatch-agents`:** This skill runs one subagent sequentially with a mandatory review. `dispatch-agents` runs multiple subagents in parallel without inter-task review gates.

## Subagent depth tiers (e45s30)

Select brief depth from task `risk:` and skill `effort:` before spawning:

| Tier | When | Brief includes |
|------|------|----------------|
| `full_maturity` | P0 stories, multi-file refactors, security work | Full template + CONVENTIONS excerpts + threat model if present |
| `standard` | Default implementation tasks | Goal, scope, out-of-bounds, constraints, verify, prior decisions |
| `minimal_decisive` | Light probes, read-only audits | Goal, verify, explicit file list (≤15 lines total) |

State `depth: <tier>` in the Agent tool description field.

## Process

### 1. Define the task

Before spawning the agent, read `specs/state.yaml` if it exists. Then write a minimal self-contained brief using this template (brief size directly controls token cost and hallucination risk — do not pad):

```
Goal: [one sentence — specific, measurable outcome]
In scope: [explicit file or module list]
Out of bounds: [what NOT to do]
Constraints: [relevant CONVENTIONS.md rules, existing patterns, test requirements]
Verify: [runnable command]
Prior decisions: [relevant entries from specs/state.yaml — omit section if none apply]
```

Do not include full file contents, full conversation history, or decisions unrelated to this task.

### 2. Spawn the subagent (iterative retrieval, max 3 cycles)

Use the Agent tool with a **fresh context** per spawn. Pass prior decisions only via `specs/state.yaml`.

**Cycle:** dispatch → evaluate output vs goal → refine brief → re-spawn if needed (max 3 cycles).

Include in each brief:
- All context the agent needs (it starts cold — no shared state)
- Reference to CONVENTIONS.md constraints
- The verify command it must run before reporting done

### 3. Stage 1 review — output inspection

When the subagent returns, review its report before looking at the diff:
- Did it run the verify command? Did it pass?
- Does it explain what it changed and why?
- Are there any concerns raised by the agent?

If the report raises red flags, ask the subagent for clarification or re-run with adjusted instructions.

### 4. Stage 2 review — diff inspection

Inspect the actual diff:
```bash
git diff main...HEAD
```

Check:
- [ ] Changes are scoped to what was asked — nothing extra
- [ ] No `any`, no `@ts-ignore`, no disabled lint rules
- [ ] Tests added for new behavior
- [ ] CONVENTIONS.md compliance (naming, structure, no gh issue creation)
- [ ] Boy Scout Rule: touched areas are cleaner than before

### 5. Decision

- **Accept**: merge the result into the main working branch
- **Revise**: send back to the subagent with specific feedback
- **Reject**: discard and re-approach differently

**After accepting**, append to `specs/state.yaml` under `## Active Decisions`:
```
**[task short name]**: [what approach the agent chose and why — one sentence]
```

Report the decision and rationale to the user.

来源:skillsdirectory

评论0

登录后参与评论

还没有评论,来抢沙发吧