diff --git a/CLAUDE.md b/CLAUDE.md index 97674d0b17..a9cae9db86 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -20,7 +20,7 @@ docs/ → Setup guides for different tools **Define:** interview-me, idea-refine, spec-driven-development **Plan:** planning-and-task-breakdown -**Build:** incremental-implementation, test-driven-development, context-engineering, source-driven-development, doubt-driven-development, frontend-ui-engineering, api-and-interface-design +**Build:** incremental-implementation, test-driven-development, context-engineering, source-driven-development, doubt-driven-development, frontend-ui-engineering, api-and-interface-design, delegation-orchestration **Verify:** browser-testing-with-devtools, debugging-and-error-recovery **Review:** code-review-and-quality, code-simplification, security-and-hardening, performance-optimization **Ship:** git-workflow-and-versioning, ci-cd-and-automation, deprecation-and-migration, documentation-and-adrs, observability-and-instrumentation, shipping-and-launch diff --git a/README.md b/README.md index f31b37f7fc..36ea249027 100644 --- a/README.md +++ b/README.md @@ -45,7 +45,7 @@ Skills also activate automatically based on what you're doing — designing an A **Fastest path — any agent, one command.** The open [skills CLI](https://github.com/vercel-labs/skills) installs into 70+ agents (Claude Code, Cursor, Codex, Copilot, Cline, and more): ```bash -npx skills add addyosmani/agent-skills # install all 24 skills +npx skills add addyosmani/agent-skills # install all 25 skills npx skills add addyosmani/agent-skills --list # browse before installing ``` @@ -218,7 +218,7 @@ Already installed? How you roll the pack out depends on your codebase. The **[Ad ## All 24 Skills -The commands above are entry points. The pack includes 24 skills total — 23 lifecycle skills plus the `using-agent-skills` meta-skill. Each skill is a structured workflow with steps, verification gates, and anti-rationalization tables. You can also reference any skill directly. +The commands above are entry points. The pack includes 25 skills total — 24 lifecycle skills plus the `using-agent-skills` meta-skill. Each skill is a structured workflow with steps, verification gates, and anti-rationalization tables. You can also reference any skill directly. ### Meta - Discover which skill applies @@ -251,6 +251,7 @@ The commands above are entry points. The pack includes 24 skills total — 23 li | [doubt-driven-development](skills/doubt-driven-development/SKILL.md) | Adversarial fresh-context review of every non-trivial decision in-flight - CLAIM → EXTRACT → DOUBT → RECONCILE → STOP, with optional user-authorized cross-model escalation | Stakes are high (production, security, irreversible), working in unfamiliar code, or a confident output is cheaper to verify now than to debug later | | [frontend-ui-engineering](skills/frontend-ui-engineering/SKILL.md) | Component architecture, design systems, state management, responsive design, WCAG 2.1 AA accessibility | Building or modifying user-facing interfaces | | [api-and-interface-design](skills/api-and-interface-design/SKILL.md) | Contract-first design, Hyrum's Law, One-Version Rule, error semantics, boundary validation | Designing APIs, module boundaries, or public interfaces | +| [delegation-orchestration](skills/delegation-orchestration/SKILL.md) | Orchestrator↔subagent contract - model tiering, card-based spawn prompts, evidence-based acceptance, spot-check verification pyramid | Dispatching implementation to subagents, or delegation keeps re-working and burning tokens | ### Verify - Prove it works @@ -347,7 +348,7 @@ Every skill follows a consistent anatomy: ``` agent-skills/ -├── skills/ # 24 skills (23 lifecycle + 1 meta) +├── skills/ # 25 skills (24 lifecycle + 1 meta) │ ├── interview-me/ # Define │ ├── idea-refine/ # Define │ ├── spec-driven-development/ # Define diff --git a/docs/adoption-guide.md b/docs/adoption-guide.md index 77deeae552..c02ec93266 100644 --- a/docs/adoption-guide.md +++ b/docs/adoption-guide.md @@ -65,7 +65,7 @@ Run the lifecycle in order for the project's first real feature: ### Greenfield anti-patterns - **Skipping `/spec` because "it's just a prototype."** Prototypes become products. The spec is the cheapest artifact you'll ever write for this codebase. -- **Loading all 24 skills into every session.** It wastes context and dilutes the ones that matter. Load by phase; let `using-agent-skills` route. +- **Loading all 25 skills into every session.** It wastes context and dilutes the ones that matter. Load by phase; let `using-agent-skills` route. - **Deferring observability until "there's something to observe."** Instrument as you build, retrofitting structured logging is a Path B problem you're choosing to create. --- diff --git a/docs/codex-setup.md b/docs/codex-setup.md index 54b59a62b6..7f32939645 100644 --- a/docs/codex-setup.md +++ b/docs/codex-setup.md @@ -22,7 +22,7 @@ codex plugin add agent-skills@agent-skills ## Usage -After install, invoke a skill in Codex chat with `@` (e.g. `@spec-driven-development`) or just describe the task and let Codex pick the right skill. All 24 skills under `skills/` are available. +After install, invoke a skill in Codex chat with `@` (e.g. `@spec-driven-development`) or just describe the task and let Codex pick the right skill. All 25 skills under `skills/` are available. ## How it works diff --git a/docs/commandcode-setup.md b/docs/commandcode-setup.md index e6aa360e3b..0150adc6e9 100644 --- a/docs/commandcode-setup.md +++ b/docs/commandcode-setup.md @@ -12,7 +12,7 @@ The Command Code binary is available as `cmd` (with aliases `cmdc` on Windows an cmd skills add addyosmani/agent-skills ``` -In an interactive terminal this shows a multi-select so you can choose which of the 24 skills to install. Pipe/non-interactive invocations install all discovered skills. +In an interactive terminal this shows a multi-select so you can choose which of the 25 skills to install. Pipe/non-interactive invocations install all discovered skills. **Install a specific skill:** diff --git a/docs/comparison.md b/docs/comparison.md index 904d270532..2c51daa6f4 100644 --- a/docs/comparison.md +++ b/docs/comparison.md @@ -18,7 +18,7 @@ People often ask how **agent-skills** relates to the two other "skills for codin |---|---|---|---| | **Core idea** | Encode the full senior-engineering lifecycle as skills | A complete development *methodology* built on composable skills | One expert's Claude Code workflow, open-sourced and evolving | | **Organizing principle** | SDLC **phases** (Define to Ship) behind a meta-skill router | A single disciplined loop: brainstorm, plan, execute, review | A curated toolbox of focused, composable commands | -| **Catalog size** | 24 skills spanning the whole lifecycle | ~14 skills, deep on the inner build loop | ~30 skills, grouped into engineering / productivity / in-progress / deprecated | +| **Catalog size** | 25 skills spanning the whole lifecycle | ~14 skills, deep on the inner build loop | ~30 skills, grouped into engineering / productivity / in-progress / deprecated | | **Lifecycle coverage** | Broad: idea refinement, API and UI design, security, performance, CI/CD, observability, deprecation, ADRs, launch | Deep but narrow: TDD, debugging, planning, review, skill authoring | Define and Build heavy: grilling, PRDs, issues, TDD, architecture, bug triage, knowledge management | | **Entry points** | Slash commands mapped 1:1 to phases (`/spec` `/plan` `/build` `/test` `/review` `/code-simplify` `/ship`, plus `/webperf`), with a `/build auto` full-plan mode | Skill-chained pipeline (`brainstorming`, `writing-plans`, `subagent-driven-development`) | Slash commands (`/grill-me`, `/tdd`, `/to-prd`, `/diagnosing-bugs`, `/grill-with-docs`) | | **Distinctive mechanisms** | Anti-rationalization tables and Red Flags in every skill; parallel review **personas** in `/ship`; reference checklists; a **three-tier eval framework** in CI | Subagent-driven development with a task reviewer (spec + quality) and a fix loop; git-worktree isolation; skills-that-write-skills, pressure-tested | The **grilling** primitive (one question at a time, design-tree walking); seam-based TDD; explicit user-invoked vs model-invoked split; issue-tracker integration | diff --git a/evals/cases/delegation-orchestration.json b/evals/cases/delegation-orchestration.json new file mode 100644 index 0000000000..847e1d6a30 --- /dev/null +++ b/evals/cases/delegation-orchestration.json @@ -0,0 +1,43 @@ +{ + "skill_name": "delegation-orchestration", + "trigger": { + "positive": [ + { + "prompt": "I'm about to dispatch this implementation task to a subagent — how should I write the spawn prompt so it does not need re-work?", + "top_k": 3 + }, + { + "prompt": "Write the task cards for this milestone before I hand them off to implementation agents", + "top_k": 3 + }, + { + "prompt": "My subagents keep returning work that fails verification and I keep re-spawning them, and token spend on bulk implementation is climbing", + "top_k": 3 + } + ], + "negative": [ + { + "prompt": "Write a failing test for the date parser before I implement it" + }, + { + "prompt": "Format this file with prettier" + } + ] + }, + "evals": [ + { + "id": 1, + "prompt": "I need to hand an implementation task to a Sonnet subagent. Set up the delegation so it produces committable work without re-briefing.", + "expected_output": "A card-based spawn contract: model tier, cited rules, env-facts, evidence-based acceptance, and an orchestrator-side spot-check plan", + "files": [ + "delegation-orchestration" + ], + "expectations": [ + "Work is placed on the appropriate model tier rather than kept on the top model by default", + "A task card carries the goal, cited rules, steps, and evidence-based acceptance instead of an ad-hoc prompt", + "Acceptance names an exact command and observable, and synthetic substitutes are forbidden", + "The orchestrator spot-checks evidence rather than re-running full gates on unchanged code" + ] + } + ] +} diff --git a/evals/fixtures/delegation-orchestration/milestone-plan.md b/evals/fixtures/delegation-orchestration/milestone-plan.md new file mode 100644 index 0000000000..2eb15fddb0 --- /dev/null +++ b/evals/fixtures/delegation-orchestration/milestone-plan.md @@ -0,0 +1,22 @@ +# Milestone: checkout service — plan items ready to delegate + +The plan is approved. These items are about to be dispatched to implementation +subagents. No task cards have been written yet; the spawn prompts so far are +one-line asks typed from memory. + +Plan items: + +1. Add an idempotency-key column to the `orders` table and enforce it on the + create-order endpoint. +2. Bulk-rename the legacy `custId` field to `customerId` across 40 files. +3. Refactor the payment-retry loop to use the shared backoff helper. + +Environment facts (currently rediscovered by every agent): + +- API runs at `http://localhost:8080`; gate command is `npm run verify`. +- Commit hook requires a Conventional Commits message with a `Refs:` trailer. +- The test DB must be reset with `npm run db:reset` before integration tests. + +Known friction: agents keep verifying against an in-memory stub instead of the +real service, two agents committed at once last week and raced the git index, +and re-briefs are rewritten from scratch on every follow-up. diff --git a/skills/delegation-orchestration/SKILL.md b/skills/delegation-orchestration/SKILL.md new file mode 100644 index 0000000000..ff10fee4e6 --- /dev/null +++ b/skills/delegation-orchestration/SKILL.md @@ -0,0 +1,103 @@ +--- +name: delegation-orchestration +description: Defines the contract between an orchestrating agent and its implementation subagents — model tiering, spawn prompts, evidence-based "done", and verification without re-doing the work. Use when dispatching implementation work to subagents, when preparing task cards for a milestone, when subagent output keeps needing re-work or re-spawns, or when main-model token spend on bulk implementation is growing. +--- + +# Delegation & Orchestration + +## Overview + +The contract between an orchestrating agent and its implementation subagents: who runs on which model, what a spawn prompt must contain, what "done" means, and how the orchestrator verifies without re-doing the work. Every rule here traces to an observed failure mode; none are speculative. + +**Scope split (one source per rule):** this skill owns the *delegation contract*. Multi-agent *topology* (fan-out, pipelines, router anti-patterns) belongs to the shared [`orchestration-patterns`](../../references/orchestration-patterns.md) reference — defer to it for how agents are wired together. For a heavier per-task variant that adds a two-stage review around each subagent, run the loop under a review skill such as [code-review-and-quality](../code-review-and-quality/SKILL.md) on high-risk milestones. + +## When to Use + +- Any implementation task is about to be dispatched to a subagent +- Writing task cards at milestone start (rolling-wave planning) +- A subagent returned work that failed verification, or you're about to re-spawn one +- Reviewing why delegation is burning tokens or requiring repeated prompts + +**When NOT to use:** trivial glue fixes where writing the spec would cost more than writing the code — do those inline, but treat them as the exception. + +## Model tiering + +| Work | Tier | +|---|---| +| Mechanical: doc formatting, config transforms, bulk renames | cheapest model (e.g. Haiku) | +| Implementation, refactors, standard reviews, research/harvest | mid model (e.g. Sonnet) | +| Specs, phase gates, cross-cutting decisions, debug handoffs, final verification | orchestrator — never delegated | + +The orchestrator never implements in bulk. Its jobs: write the contract, spawn, unblock, verify evidence, gate the commit. + +## The spawn contract + +A subagent session is **fresh**: it auto-loads the project's rules files and hooks, but **never sees the orchestrator's chat history**. Everything else must arrive via (a) repo files or (b) the spawn prompt. + +0. **State file first.** Keep a cross-session state file (e.g. `tasks/state.md`): current position, owner-confirmed facts from conversation, environment notes, open items. Read it when resuming in a fresh session; update it at every checkpoint, blocker, and session end. Statuses live in the task checklist; the state file carries the narrative that files otherwise miss. +1. **Card file first.** At milestone start, write one card per task in `tasks/cards/.md` (template below). The spawn prompt becomes: pointer to the card + env-facts + deltas. Files beat prompt text: reusable across resumes, owner-reviewable, survive context compaction, re-readable mid-task. +2. **Cite rules, don't paste them.** Name the 3–5 project rules this task can violate, each with a one-line restatement. Full rule text stays in the project's rules files (the subagent auto-loads them); the citation anchors attention. Pasting whole rulebooks dilutes attention and creates drift. +3. **Point at the pattern.** Reference the project's pattern doc and real reference-implementation files — "copy this, don't improvise." +4. **Env-facts block.** Maintain the project's environment facts (service URLs/ports, gate commands, known machine quirks and their workarounds, commit-hook requirements) in the state file, and paste that block verbatim into every implementation spawn. Agents rediscovering the environment is pure token waste. +5. **Pin API assumptions.** If the task touches a fast-moving or unfamiliar library, put version-pinned API notes or verified snippets in the card, and instruct the agent to confirm against the installed package's types before coding — never from memory. + +## Card template (`tasks/cards/.md`) + +```markdown +# — +## Goal — 2-3 sentences; which plan item this executes +## Binding rules — rule IDs + one-liners; pattern doc + reference files +## Steps — numbered, with code snippets for anything non-obvious +## Acceptance — evidence-based: "DONE means: run <exact command>, observe <exact output/state>". +## Synthetic substitutes are FORBIDDEN — real service/device/pipeline, or STOP and report. +## Verify — gate commands to run before committing +## Commit — exact message (project conventions, trailers) +## Out of scope — what NOT to touch +``` + +## Execution protocol + +- **STOP conditions in every prompt:** "if an API mismatches expectations, a verification fails without an obvious fix, or the environment blocks you — STOP and report; never improvise around a broken assumption, never fight machine state." The orchestrator owns the environment; the agent owns the task. +- **Resume over respawn.** Follow-ups go to the same agent (its transcript persists) — a fix costs a delta, not a re-brief. Respawn only for genuinely new tasks. +- **One committer at a time.** Two concurrently-committing agents race the git index. Parallel spawns are for read-only work (reviews, research) only. +- **Required report format:** verification outcomes (one line each), evidence for each acceptance, commit hash, deviations. Honest deviations are welcome; silent smoothing is a violation. + +## Verification pyramid (orchestrator side) + +Spot-check only — the agent already ran the gates: (1) commit exists + working tree clean; (2) re-run the 1–2 highest-risk evidence commands yourself; (3) skim the diff for rule smells. Never re-run full gates on unchanged code. Escalate to a reviewer-subagent or a full review pass only at milestone checkpoints or for safety-critical work. + +## Common Rationalizations + +| Excuse | Reality | +|---|---| +| "The top model will just do it faster itself" | Bulk implementation on the top tier is the single largest avoidable spend; the contract exists so cheaper models produce the same output | +| "The acceptance is obvious from context" | An agent under debugging pressure will verify against a synthetic stand-in unless the card names the exact command, the exact observable, and forbids substitutes | +| "The agent can figure out the environment" | It will — by burning tool calls on archaeology the orchestrator already did. Paste env-facts | +| "Easier to respawn than explain" | A resume costs a delta message; a respawn costs the whole briefing again | +| "I'll just paste the full rulebook to be safe" | Attention dilutes; the 3–5 rules that matter get lost among the ones that don't | + +## Red Flags + +- A spawn prompt written from scratch when a card file should exist +- Acceptance criteria without an exact command + observable +- An agent debugging Docker/keychain/network state instead of stopping +- Two agents with commit rights running at once +- The orchestrator re-running a full gate suite the agent already ran +- Re-briefing an existing agent from zero instead of messaging it + +## See Also + +- [`orchestration-patterns`](../../references/orchestration-patterns.md) — multi-agent topology (fan-out, pipelines, anti-patterns) this contract sits inside +- [planning-and-task-breakdown](../planning-and-task-breakdown/SKILL.md) — produces the plan items each card executes +- [incremental-implementation](../incremental-implementation/SKILL.md) — the per-slice discipline a subagent follows inside a card +- [documentation-and-adrs](../documentation-and-adrs/SKILL.md) — where environment lessons and recurring traps get recorded + +## Verification + +Before closing a delegated task: + +- [ ] Output verified against the card's evidence-based acceptance (not a paraphrase of it) +- [ ] Commit exists, tree clean, message follows project conventions +- [ ] Deviations reported by the agent were reviewed, not rubber-stamped +- [ ] Any environment lesson learned went into the project's docs (an ADR, a lessons/traps log, or the state file) +- [ ] State file updated if this closed a checkpoint or changed the project's position