task-delegation
БесплатноЗапускает вложенные скриптыНе проверенAgent task delegation patterns — spawn protocols, handoff metadata, drain gate, parallel limits, and model selection for multi-agent orchestration
от oimiragieo★ 48 звёзд на GitHubОб этом скилле
Task Delegation Skill
When to Invoke
Skill({ skill: 'task-delegation' });
Use when:
- Spawning subagents to perform work
- Decomposing a complex task into parallel or sequential subtasks
- Implementing handoff metadata between agents
- Verifying pipeline completion via drain gate
- Selecting the right model for a spawned agent
Core Protocol: Spawn → Update → Drain
Every delegation sequence follows three phases:
1. SPAWN — Task({ task_id, subagent_type, prompt })
2. UPDATE — TaskUpdate({ taskId, status: 'in_progress', owner: 'router' }) [immediately after spawn]
3. DRAIN — TaskList() → verify zero in_progress/pending tasks before claiming done
Skipping any phase causes invisible work, stuck tasks, or duplicate execution.
Spawn Template
Every Task() call MUST include a task_id parameter. Missing task_id is hard-blocked by spawn hooks.
Task({
task_id: 'task-7',
subagent_type: 'developer',
prompt: `
## Task ID: task-7
## Agent: developer
### Context
<brief description of what this agent needs to know>
### Objective
<single concrete deliverable>
### Instructions
1. Call TaskUpdate({ taskId: 'task-7', status: 'in_progress' }) IMMEDIATELY.
2. <step-by-step work instructions>
3. Call TaskUpdate({ taskId: 'task-7', status: 'completed', metadata: { summary: '...', filesModified: [...] } }).
### Constraints
- Scope: only files listed above
- Do NOT modify unrelated files
`,
});
Immediate Status Rule
After every Task(...) spawn, immediately call TaskUpdate for that task:
// Spawn the agent
Task({ task_id: 'task-7', subagent_type: 'developer', prompt: '...' });
// Immediately record as in_progress (router-owned until agent picks it up)
TaskUpdate({ taskId: 'task-7', status: 'in_progress', owner: 'router' });
This guarantees task visibility even before the spawned agent emits its first tool call.
Parallel Delegation — Token Budget Limits
NEVER spawn more than 2 heavy agents simultaneously.
Heavy agents: architect, security-architect, code-reviewer, qa, developer, devops
Light agents: researcher, general-assistant, technical-writer
// CORRECT: Max 2 heavy agents in parallel
Task({ task_id: 'task-3', subagent_type: 'developer', prompt: '...' });
Task({ task_id: 'task-4', subagent_type: 'qa', prompt: '...' });
// WRONG: 3+ heavy agents causes context overflow
Task({ task_id: 'task-3', subagent_type: 'developer', prompt: '...' });
Task({ task_id: 'task-4', subagent_type: 'qa', prompt: '...' });
Task({ task_id: 'task-5', subagent_type: 'architect', prompt: '...' }); // DO NOT
For 3+ parallel workstreams, use master-orchestrator to manage sequencing.
Handoff Metadata Protocol
Use structured metadata on TaskUpdate(completed) to enable downstream agents to pick up context without re-reading files:
TaskUpdate({
taskId: 'task-5',
status: 'completed',
metadata: {
summary: 'Implemented JWT auth middleware with refresh tokens',
filesModified: ['src/middleware/auth.ts', 'src/lib/jwt.ts', 'tests/middleware/auth.test.ts'],
outputArtifacts: ['.claude/context/plans/auth-design.md'],
keyDecisions: [
'Used RS256 (asymmetric) over HS256 for key rotation support',
'Refresh tokens stored in Redis with 7-day TTL',
],
discoveredFiles: ['src/auth/legacy-session.ts'], // existing code to reuse/replace
worktreePath: process.env.AGENT_WORKTREE_PATH || process.cwd(),
completedAt: new Date().toISOString(),
},
});
Downstream agents read this via TaskGet({ taskId: 'task-5' }):
const task = TaskGet({ taskId: 'task-5' });
const { keyDecisions, filesModified, discoveredFiles } = task.metadata;
Drain Gate (MANDATORY Before Completion)
Before claiming "pipeline complete", execute all drain-gate checks in order:
// Step 1: Task drain
const tasks = TaskList();
const openTasks = tasks.filter(t => ['in_progress', 'pending', 'blocked'].includes(t.status));
if (openTasks.length > 0) {
// Report open task IDs, continue orchestration
console.log(
'Still open:',
openTasks.map(t => t.id)
);
}
// Step 2: Reflection queue check
// Read .claude/context/runtime/reflection-spawn-request.json
// If any entries exist with status: 'pending', spawn reflection-agent first
// Step 3: Only after steps 1 and 2 pass — write completion summary
Never claim completion with open tasks or unprocessed reflections.
Model Selection
| Task Type | Model | Rationale |
|---|---|---|
| Simple Q&A, research, summarization | haiku | Cost-effective, fast |
| Implementation, bug fixes, tests | sonnet | Balanced capability/cost (default) |
| Architecture, security review, planning | opus | Highe |
Установить task-delegation в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
TaskTaskListTaskCreateTaskUpdateTaskGetВложенные файлы
FAQ
Что делает скилл task-delegation?
Agent task delegation patterns — spawn protocols, handoff metadata, drain gate, parallel limits, and model selection for multi-agent orchestration
Как установить скилл task-delegation?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл task-delegation запускает скрипты?
Да, скилл несёт исполняемые скрипты. Проверь исходник перед установкой.
Похожие скиллы
theme-factory
Toolkit for styling artifacts with a theme. These artifacts can be slides, docs, reportings, HTML landing pages, etc. There are 10 pre-set themes with…
от Anthropicaccess
Manage Discord channel access — approve pairings, edit allowlists, set DM/group policy. Use when the user asks to pair, approve someone, check who's allowed…
от Anthropicconfigure
Set up the Discord channel — save the bot token and review access policy. Use when the user pastes a Discord bot token, asks to configure Discord, asks "how…
от Anthropicaccess
Manage iMessage channel access — approve pairings, edit allowlists, set DM/group policy. Use when the user asks to pair, approve someone, check who's allowed…
от Anthropic