Agent skill

External Model Delegation

by alinaqi in alinaqi/maggy

UserPromptSubmit hook pattern that classifies prompts into six cost tiers and delegates to external model CLIs

MITAuto-check passedDevelopment

Install External Model Delegation

skills CLI
$ npx skills add alinaqi/maggy --skill external-model-delegation -a claude-code

Project install by default; add -g for ~/.claude/skills/.

GitHub CLI
$ gh skill install alinaqi/maggy external-model-delegation --agent claude-code

Project scope by default; add --scope user for a personal install. Needs GitHub CLI 2.90.0 or later (public preview).

Manual copy
$ git clone --depth 1 https://github.com/alinaqi/maggy.git skills-src && mkdir -p .claude/skills && cp -r skills-src/skills/external-model-delegation .claude/skills/external-model-delegation && rm -rf skills-src

Use ~/.claude/skills/ instead of .claude/skills for a personal install. The folder must contain SKILL.md.

Claude Code skills documentation · loads skills from .claude/skills/

Facts

Skill name
external-model-delegation
GitHub stars
707
Token cost
~785 tokens
SKILL.md length
216 words
Files
1
Skills in repo
71
Repo updated
First seen
Licence
MIT

At a glance

UserPromptSubmit hook pattern that classifies prompts into six cost tiers and delegates to external model CLIs

  • Works in 5 steps: Accept prompt as first argument: qwen3… → Support --flash / --pro model flags… → Support --quiet mode flag (kimi) → …
  • Development work in your project
  • SKILL.md covers Tier routing table, Delegation script pattern, Routing hook flow and Classification tiers, plus 1 more section
  • Calls jq, codex and curl; needs API_KEY and EXTERNAL_API_KEY

What it does

External Model Delegation is an agent skill from alinaqi/maggy. UserPromptSubmit hook pattern that classifies prompts into six cost tiers and delegates to external model CLIs

Its SKILL.md is about 790 tokens, which your agent loads only when the skill is triggered. It is a single SKILL.md file with no bundled scripts.

It sits in Development. It works with Qwen, DeepSeek and Kimi. The repository describes itself as: What started as an opinionated Claude Code setup kit is now an autonomous AI engineering command center. The licence is MIT.

When your agent uses it

  • Development work in your project

Example prompts

  • “/external-model-delegation”

Requirements

  • A credential in API_KEY
  • A credential in EXTERNAL_API_KEY

Workflow steps

5 steps, taken from the first numbered list in SKILL.md.

  1. Accept prompt as first argument: qwen3 "what is 2+2"
  2. Support --flash / --pro model flags (deepseek)
  3. Support --quiet mode flag (kimi)
  4. Write response to stdout, errors to stderr
  5. Exit 0 on success, non-zero on error

What it can do on your machine

Read from SKILL.md and the folder at commit 72a456e. It shows what the files ask for, not the result of running them.

  • Tool permissions

    Pre-approves nothing: there is no allowed-tools line, so your agent's usual permission prompts apply.

    From allowed-tools in the SKILL.md frontmatter.

  • Runs code

    Shell commands in SKILL.md call:

    • jq
    • codex
    • curl
    • claude

    From the folder's file list and the shell code blocks in SKILL.md.

  • Network

    No URLs in SKILL.md. Its commands use curl, which can reach the network depending on how they are called.

    From URLs in SKILL.md, links to its own repository left out.

  • Credentials

    Names these keys or tokens, usually read from environment variables:

    • API_KEY
    • EXTERNAL_API_KEY
    • DEEPSEEK_API_KEY
    • OPENAI_API_KEY

    From names ending in _API_KEY, _TOKEN, _SECRET, _KEY or _PASSWORD in SKILL.md.

Context cost

External Model Delegation loads about 785 tokens when it runs. Until then it costs about 34 tokens; SKILL.md has 216 words of instructions outside code blocks.

Always · name and description, kept in context so the agent knows when to use it
~34
When it runs · the whole SKILL.md, loaded when a task matches
~785

Estimates: characters ÷ 4, the usual rule of thumb; real counts depend on the model's tokenizer. Scripts and assets cost tokens only if the agent reads them.

Safety

Auto-check passed

The automated check found no risky patterns in SKILL.md.

Automated static check — not a guarantee. Review scripts before installing. It scans the text of SKILL.md for risky patterns (piping downloads into a shell, reading credential files, hidden Unicode, destructive commands); files beside SKILL.md are not scanned.

SKILL.md

The full file from alinaqi/maggy at commit 72a456e, republished under its MIT licence (© alinaqi). 216 words, ~785 tokens.

Download SKILL.mdSave it as .claude/skills/external-model-delegation/SKILL.md (or your agent's skills folder).
name
external-model-delegation
description
UserPromptSubmit hook pattern that classifies prompts into six cost tiers and delegates to external model CLIs
when-to-use
When configuring or debugging prompt-based delegation to qwen3, deepseek, kimi, or codex
user-invocable
false
effort
medium

External Model Delegation Pattern

A UserPromptSubmit hook classifies every user prompt into one of six cost/performance tiers. The hook injects additionalContext instructing Claude to run a specific delegation script and return the output.

Tier routing table

TierDelegation commandCost
QWENqwen3 "prompt"$0 (local Ollama)
DEEPSEEK_FLASHdeepseek --flash "prompt"$0.14 / $0.28 per M tokens
DEEPSEEK_PROdeepseek --pro "prompt"$0.44 / $0.87 per M tokens
KIMIkimi --quiet -p "prompt"$0.60 / $2.50 per M tokens
CODEXcodex execvaries
CLAUDEhandle natively$3-5 / $15-25 per M tokens

Delegation script pattern

Each script is a self-contained executable in ~/bin/ that accepts a prompt and writes the response to stdout:

~/bin/
├── qwen3      # Shell: curl to local Ollama API
├── kimi       # Shell: execs Kimi CLI binary
├── deepseek   # Python: httpx to DeepSeek Anthropic-compat API
└── route-task # Shell + qwen3: classifies prompt into tier
Script contract
  1. Accept prompt as first argument: qwen3 "what is 2+2"
  2. Support --flash / --pro model flags (deepseek)
  3. Support --quiet mode flag (kimi)
  4. Write response to stdout, errors to stderr
  5. Exit 0 on success, non-zero on error
Writing a new delegation script
bash
#!/bin/bash
# Minimal delegator template
PROMPT="$1"
API_KEY="${EXTERNAL_API_KEY:-}"
# Call external API, write result to stdout
curl -s https://api.example.com/chat \
  -H "Authorization: Bearer $API_KEY" \
  -d "$(jq -n --arg p "$PROMPT" '{prompt: $p}')" \
  | jq -r '.response'

Routing hook flow

User types prompt
    ↓
UserPromptSubmit hook fires
    ↓
qwen3 classifies into tier (QWEN|DEEPSEEK_FLASH|DEEPSEEK_PRO|KIMI|CODEX|CLAUDE)
    ↓
Hook injects additionalContext: "Run: <delegation-command>"
    ↓
Claude reads context, spawns delegation script, returns output
    ↓
User sees response from the delegated model

Classification tiers

TierTask types
QWENgrep, find, regex, shell, syntax lookups, log reading, short summaries
DEEPSEEK_FLASHSimple code, boilerplate, CRUD, test writing, small fixes, config
DEEPSEEK_PROMulti-file features, refactors, debugging, medium coding, docs
KIMISingle-file review, medium reasoning, commit messages, diff summaries
CODEXBulk generation, mechanical changes across many files
CLAUDEArchitecture, security, complex debugging, system design, quality-critical

Environment

bash
# Required env vars (set in ~/.zshrc)
export DEEPSEEK_API_KEY="sk-..."      # For deepseek delegator
export OPENAI_API_KEY="sk-..."         # For codex CLI
# Ollama must be running locally for qwen3 classification + delegation

© alinaqi, MIT. Rendered from Markdown: HTML in the file is shown as text, images as links, and headings moved down two levels. Raw file

Files

Just SKILL.md in skills/external-model-delegation of alinaqi/maggy.

Open the folder on GitHubat commit 72a456e

Compare with similar skills

External Model Delegation next to the 5 skills that share the most tags, products or categories with it. Stars are the repository's; “used in” counts other GitHub owners with a copy.

External Model Delegation compared with similar skills
SkillStarsUsed inTokensAuto-checkLicenceRepo updated
External Model Delegation this skillalinaqi/maggy707—~785Automated safety check: PassMIT
LLM Pipeline Profiler AnalysisBBuf/AI-Infra-Auto-Driven-SKILLS938—~3.9kAutomated safety check: PassNone
Subagentethanhq/cc-fleet216—~4.9kAutomated safety check: PassApache-2.0
Subagentethanhq/cc-fleet216—~4.3kAutomated safety check: PassApache-2.0
LLM Council on Fireworks AIdair-ai/dair-academy-plugins614—~5kAutomated safety check: NotesMIT
Claude Maintain ModelsKiln-AI/Kiln5.2k—~15kAutomated safety check: NotesCustom licence

Similar skills

  • LLM Pipeline Profiler Analysis

    BBuf/AI-Infra-Auto-Driven-SKILLS

    Breaks LLM torch profiler traces down by forward pass, layer and kernel, with timing tables and Perfetto time ranges for the layers you want to inspect.

    938 GitHub stars~3.9k tokensUpdated 5 days ago
    AI & LLM EngineeringAuto-check passed
  • Subagent

    ethanhq/cc-fleet

    Fan out a one-shot or flat parallel batch of cc-fleet PROVIDER subagents (headless cc-fleet subagent) that return a result — DeepSeek / GLM / Kimi / Qwen / MiniMax, or a Codex/Claude subscription.

    216 GitHub stars~4.9k tokensUpdated 11 days ago
    Agent WorkflowsAuto-check passed
  • Subagent

    ethanhq/cc-fleet

    Run a one-shot or flat parallel batch of provider LLM subagents (headless cc-fleet subagent) that return a result.

    216 GitHub stars~4.3k tokensUpdated 11 days ago
    Agent WorkflowsAuto-check passed
  • LLM Council on Fireworks AI

    dair-ai/dair-academy-plugins

    Has several open-weight models answer a question, rank each other's anonymized answers, then lets a chairman model write the final response through Fireworks AI.

    614 GitHub stars~5k tokensUpdated 2 mo ago
    AI & LLM EngineeringAuto-check: notes
  • Add new AI models to Kiln's mlmodellist.py and produce a Discord announcement.

    5.2k GitHub stars~15k tokensUpdated yesterday
    AI & LLM EngineeringAuto-check: notes
  • A skill your agent uses when a new Ollama Cloud model is announced or available (e.g.

    182 GitHub stars~3.9k tokensUpdated 20 days ago
    AI & LLM EngineeringAuto-check: notes

More from alinaqi/maggy

All 71 skills in this repo
  • Aeo Optimization

    alinaqi/maggy

    AI Engine Optimization - semantic triples, page templates, content clusters for AI citations

    707 GitHub stars~3.7k tokensUpdated 16 days ago
    Auto-check passed
  • Agent Teams

    alinaqi/maggy

    Claude Code Agent Teams - default team-based development with strict TDD pipeline enforcement

    707 GitHub stars~5k tokensUpdated 16 days ago
    Auto-check: notes
  • AI Models

    alinaqi/maggy

    Latest AI models reference - Claude, OpenAI, Gemini, Eleven Labs, Replicate

    707 GitHub stars~4.1k tokensUpdated 16 days ago
    Auto-check passed
  • Android Java

    alinaqi/maggy

    Android Java development with MVVM, ViewBinding, and Espresso testing

    707 GitHub stars~3.9k tokensUpdated 16 days ago
    Auto-check: notes
  • Android Kotlin

    alinaqi/maggy

    Android Kotlin development with Coroutines, Jetpack Compose, Hilt, and MockK testing

    707 GitHub stars~3k tokensUpdated 16 days ago
    Auto-check passed
  • Autonomous Testing

    alinaqi/maggy

    AI-driven testing agent that auto-discovers, generates, executes, evaluates, and fixes tests for any project type

    707 GitHub stars~1.1k tokensUpdated 16 days ago
    Auto-check passed

Categories

Questions about External Model Delegation

What does External Model Delegation do?

UserPromptSubmit hook pattern that classifies prompts into six cost tiers and delegates to external model CLIs. External Model Delegation is an agent skill from alinaqi/maggy.

When should I use External Model Delegation?

External Model Delegation fits situations like: development work in your project.

How do I install External Model Delegation in Claude Code?

Run `npx skills add alinaqi/maggy --skill external-model-delegation -a claude-code`. Or copy the skill folder (skills/external-model-delegation in alinaqi/maggy) into .claude/skills/external-model-delegation in your project. Claude Code loads it when a task matches its description.

How do I install External Model Delegation in Codex?

Run `npx skills add alinaqi/maggy --skill external-model-delegation -a codex`. Or copy the skill folder (skills/external-model-delegation in alinaqi/maggy) into .agents/skills/external-model-delegation in your project. Codex loads it when a task matches its description.

Can I use External Model Delegation in Cursor, Gemini CLI or GitHub Copilot?

Cursor, Gemini CLI, GitHub Copilot and OpenCode also load SKILL.md folders. With the skills CLI, run `npx skills add alinaqi/maggy --skill external-model-delegation -a cursor` (or -a gemini-cli, github-copilot or opencode for the others). To copy it by hand, put the folder in .cursor/skills/external-model-delegation, .gemini/skills/external-model-delegation, .github/skills/external-model-delegation and .opencode/skills/external-model-delegation in your project.

What does External Model Delegation need to run?

Going by SKILL.md and its folder, External Model Delegation needs the command-line tools its instructions call (jq, codex, curl and claude) and credentials named API_KEY, EXTERNAL_API_KEY, DEEPSEEK_API_KEY and OPENAI_API_KEY. Our summary lists: A credential in API_KEY; A credential in EXTERNAL_API_KEY.

Does External Model Delegation access the network?

SKILL.md contains no URLs. Its commands use curl, which can reach the network depending on how they are called. This is read from the text; nothing was executed.

Is External Model Delegation safe to install?

Our automated static check of SKILL.md found no risky patterns, such as piping downloads into a shell, reading credential files or hidden Unicode. It is not a guarantee. Review the folder before installing.

What licence does External Model Delegation use?

External Model Delegation is published under the MIT licence (the repository's licence). It allows redistribution, so the full SKILL.md is shown on this page.

How many tokens does External Model Delegation use?

About 785 tokens (SKILL.md is roughly 3.1k characters). Agents keep only the skill's name and description in context until a task matches; then they load SKILL.md in full.

What are the alternatives to External Model Delegation?

Skills that share tags, products or a category with External Model Delegation: LLM Pipeline Profiler Analysis (BBuf/AI-Infra-Auto-Driven-SKILLS, 938 stars), Subagent (ethanhq/cc-fleet, 216 stars), Subagent (ethanhq/cc-fleet, 216 stars) and LLM Council on Fireworks AI (dair-ai/dair-academy-plugins, 614 stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.

Who maintains External Model Delegation?

alinaqi (a GitHub user) maintains it in alinaqi/maggy, which has 707 GitHub stars. The repository holds 71 skills in this directory. The repository was last updated on September 24, 2026.

Source: alinaqi/maggy on GitHub. Facts on this page come from the repository at the commit we read; the author's words are quoted as theirs.