agentleFS
ominou5ominou5/agentic-workflows/Skills/delegate/SKILL.md

delegate

Skill1 starsChanged 6 months agoMITView on GitHub

Turn Claude Code into a multi-model orchestration and delegation system. FIRST discovers which model CLIs and Claude models are available on THIS machine, then builds a customized "right model for the right job" routing config plus opt-in subagents that delegate work to external models (Codex/GPT, Gemini, OpenRouter, Ollama, local, etc.) and report results back. Use when a user wants to set up model delegation, route tasks to cheaper or other-provider models, offload token-hungry work, or orchestrate subagents across providers.

78 other projects use a version of this.

Adopted by

Most recently taken up by

Used with

Projects with it also use state, preview and 10 more.

Other files people use alongside this one.

Files found in the same public projects as a version of this one, more often than they turn up anywhere else. Each project counts once, large collections count for less, and this file's own repository is left out.
  • MicrosoftSkill

    state

    Store and query a Microsoft Managed App's built-in state and file attachments with `ms project state` CLI schema commands and generated TypeScript clients. First, with the user signed in to the CLI, run `ms feature status --name state --json`; if `feature.enabled` is not `true`, recommend an alternative connector or data source.

    Also in 3 projects that use this

  • kv0906Skill

    preview

    Render vault notes as styled HTML and open in browser. Turn markdown docs, decisions, progress reports into readable previews. Use for "/preview docs/project-a/checkout-flow.md", "/preview progress all", "/preview decide auth-approach", or when user wants to see a doc before sharing.

    Also in 3 projects that use this

  • GitHubSkill

    prd

    Generate high-quality Product Requirements Documents (PRDs) for software systems and AI-powered features. Includes executive summaries, user stories, technical specifications, and risk analysis.

    Also in 5 projects that use this

  • nicolasestremSkill

    document

    Create focused documentation for specific components or features

    Also in 3 projects that use this

  • anombyte93Skill

    discover

    Phase 1 of the prd-taskmaster pipeline: brainstorm-driven discovery. Delegates to superpowers:brainstorming in Interactive Mode (one adaptive question at a time), or self-brainstorms in Autonomous Mode when no user is present. Intercepts before the brainstorming chain hands off to writing-plans — this skill owns the exit. Extracts constraints, calibrates scale (Solo / Team / Enterprise), and advances the pipeline to GENERATE.

    Also in 3 projects that use this

  • Microsoft AzureSkill

    skill-authoring

    Write Agent Skills that comply with the agentskills.io specification. WHEN: "create a skill", "new skill", "write a skill", "skill template", "skill structure", "review skill", "skill PR", "skill compliance", "SKILL.md format", "skill frontmatter", "skill best practices". DO NOT USE FOR: general documentation. INVOKES: vally CLI.

    Also in 3 projects that use this

The file

We split this skill into the rules it gives an agent

4 rules. 0 are common, 1 is distinctive, and 3 are very specific to this project.

  • 0

    Common

    Most of the 68 edited versions we read keep these.

  • 1

    Distinctive

    This author's own choices. Worth a look.

  • 3

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Very specific:

    If ~/.claude/CLAUDE.md has no "Model orchestration" section and ~/.claude/agents/ has no delegate wrappers, this skill is unconfigured for …

    line 24
  2. Very specific:

    Follow references/discovery.md.

    line 30
  3. Very specific:

    Write the routing framework from templates/CLAUDE.md into the chosen CLAUDE.md, filled with THIS user's models + priorities.

    line 62
  4. Distinctive:

    Prefer file output over stdout: when a CLI drops output on a non-TTY pipe (some agentic CLIs do): have it write to a file and read the file.

    line 94

“Common” is measured: kept by at least 6 in 10 of the 68 edited versions of this file we could read. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

🔀 /delegate — Multi-Model Orchestration & Delegation

Turn Claude Code into an orchestrator: it hands the right work to the right model — cheap models for bulk, premium for taste, local for private, other providers for breadth — then reports results back. Two ideas underpin it:

  1. Right model for the right job — route by cost / intelligence / taste, and escalate rather than cheap out when output misses the bar.
  2. Delegate via CLIs — Claude Code shells out to model CLIs and reports back; an opt-in subagent wraps each lane.

This skill is self-customizing. It does NOT hardcode one person's model roster. It discovers what you actually have and builds your config around it.


🛑 FIRST RUN — SELF-CUSTOMIZATION (do this before anything else)

If ~/.claude/CLAUDE.md has no "Model orchestration" section and ~/.claude/agents/ has no delegate wrappers, this skill is unconfigured for this machine. Execute the four steps in order. Do not skip discovery and paste a generic roster — the whole point is to fit the user's actual setup.

Step 1 — DISCOVER what is on THIS machine

Follow references/discovery.md. Detect, without assuming:

  • External model CLIs on PATH: codex, gemini, agy, ollama, llm, aider, and any others.
  • Local models: ollama list (if present).
  • Which Claude models this Claude Code can use (current aliases + any versioned models exposed in the picker/config).
  • Provider API keys present — env var NAMES ONLY. Never read, print, echo, or store a key's value.

Report a short table of what's available. That table is the raw material for the routing config.

Step 2 — ASK the user to calibrate (don't invent their economics)

Model rankings are personal — they depend on the user's plans and limits, not list price. Ask:

  1. Which subscriptions/plans do you have? (e.g. a Gemini subscription, a ChatGPT/Codex plan, OpenRouter credits, local GPU.) This decides what is "effectively free" vs metered for them.
  2. Priority when models conflict — cost, or output quality?
  3. Any models to avoid (unproven/untrusted for them), or a hard "never"?
  4. Scope: global config (~/.claude/, every project) or one project (.claude/)? Global is convenient; project-scoped keeps unrelated/brownfield repos unaffected.

Fill the routing table's cost/priority from these answers. Do NOT copy example numbers from the template.

Step 3 — BUILD the customized setup

  • For each CLI found in Step 1, copy the matching template from templates/agents/ into the chosen agents dir. Skip lanes for tools the user does not have.
  • Write the routing framework from templates/CLAUDE.md into the chosen CLAUDE.md, filled with THIS user's models + priorities.
  • Pin wrapper subagents to the user's cheapest proven Claude model (ask which — the wrappers only craft prompts and summarize, so they should be cheap).
  • (Windows) if codex or another tool isn't on PATH, see the shim note in references/provider-setup.md.

Step 4 — VERIFY

Smoke-test one round-trip per configured lane (see references/cli-invocations.md → "Smoke test"). Each lane should return a correct, model-identified answer before you declare the setup done. Report the results.


Core principles (the routing ethos)

  • Defaults, not limits. Judge the OUTPUT, not the price tag. If a cheaper model underdelivers, rerun on a stronger one without asking — escalating costs less than shipping mediocre work.
  • When axes conflict for anything that ships: intelligence > taste > cost.
  • Bulk / mechanical / clear-spec (implementation to spec, data wrangling, migrations, investigation) → cheapest capable model (often a GPT/Codex or a local model).
  • User-facing (UI, copy, API design) or top-quality output → highest-taste model.
  • Reviews → a couple of strong models, optionally one from a different provider for an independent lens.
  • Research / large-context / web → a big-context model (e.g. Gemini).
  • Never route to a model the user flagged as untrusted or "never".

Delegation mechanics (hard-won — full detail in references/cli-invocations.md)

  • Close stdin or many CLIs hang. Append </dev/null (bash / macOS / Linux / Git-Bash) or <nul (Windows cmd). This is the #1 cause of "it just hangs".
  • Prefer file output over stdout when a CLI drops output on a non-TTY pipe (some agentic CLIs do): have it write to a file and read the file.
  • Keep delegation OPT-IN. Subagents should fire only on explicit request and never auto-delegate — this protects governed/brownfield repos from silently routing work to an external model.
  • Dynamic spawns take aliases only. Claude Code's on-the-fly subagent spawn accepts current model aliases; to run a subagent on a versioned model, PIN it in an agent file.
  • Sandbox awareness. Claude Code's tool shell may be sandboxed/isolated from the host: tools installed by the agent may not reach the user's real machine, and interactive logins done in a terminal may not be visible to the agent's shell. Have the user install host tools and authenticate themselves; verify.
  • Report back, don't dump. A wrapper returns a tight synthesis + the model used, not the raw transcript.

Invoking (after setup)

  • Natural language: "delegate this to codex", "have gemini research X", "use a local model for this".
  • Explicit: @codex-delegate, @gemini-research, @model-delegate.

Extending — add a new provider lane

Copy templates/agents/model-delegate.md, swap in the new CLI + flags, keep it opt-in and reliable-stdout, then add a row to your CLAUDE.md routing table. The llm CLI (one tool, many providers) is the lowest-effort way to add breadth.

Credits

Inspired by @theo (t3.gg)'s posts on model-tiering for agent orchestration — keeping a CLAUDE.md section that prioritizes different models for different work, and teaching Claude Code to use Codex (and other CLIs) as delegation fallbacks for token-hungry tasks (implementation, computer-use, codebase analysis) while the primary model orchestrates.

This skill generalizes that idea into a self-discovering setup (it detects each user's own models/CLIs instead of hardcoding a roster) and hardens the CLI delegation with the non-TTY / stdin-hang / versioned-model-pinning / sandbox- isolation / opt-in lessons learned making it reliable in practice.

Download now (ZIP)

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
What did you use it for? e.g. Reviewing pull requests in a Rails app

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.