/tstack:agent-delegationfrom tstack
Rules and script for handing work to a subagent or another CLI (OpenCode, Antigravity, Copilot, Codex, Claude). This skill MUST be loaded before dispatching any subagent or CLI, even for a small task, and before changing an existing API's name, signature, usage or behavior. New delegation MUST go through scripts/dispatch.py and its task-local levels, and MUST NOT skip tools based on earlier turns. It MUST NOT be applied to work that is not software engineering. A main agent MUST NOT dispatch through its own CLI. A dispatched worker MUST NOT apply this skill or delegate further. Triggers on: subagent、派工、分工、antigravity、agy、opencode、copilot、codex、誰來寫、用哪個模型、介面變更
Ships in tstack. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them; scripts run unread.
The main agent is the strong model. It writes the skeleton and the expected results of every slot, and it reviews, verifies and commits. The skeleton fixes the scope; weaker models write tests or fill in implementations to the specification. Cost rule for ordinary dispatch: among the tools available for the task's row, dispatch in the order OpenCode → Antigravity (agy) → GitHub Copilot CLI → Codex → Claude. Tests, implementation and chores go first to OpenCode's free models; frontend design goes to agy's Gemini. Copilot always uses Auto and comes after agy. Trade-offs between options, technology selection and single-module design go, in order, to agy's Opus, Codex's GPT-6-or-later sol, and Claude's Opus. Models and handover order for other tasks follow the decision table below. Any CLI can be the main agent, so identify yourself before dispatching. The native CLI help entry points are in references/cli-cheatsheet.md.
For ordinary new dispatch, use scripts/dispatch.py: first run it with no arguments for the overview, or with --help, then read the --help of the relevant subcommands. Use list-types to choose the task type, and list-levels to check that type's levels and how handover to the host works. Split a mixed task first; when classification overlaps with chores or exploration, choose classification.
The main agent provides the host, task type, project directory, role, task and acceptance criteria, files that may be changed, the verification command, and the filtered Project Memory. The memory field is required; fill in an empty array only after checking that no lesson applies. Provide the models actually available and the source used to verify them; do not infer a minimum version from an alias. Implementation tasks also list the test files that MUST NOT be modified. Deep research completes broad exploration first and may experiment only in the designated sandbox. Acceptance review also provides a sandbox directory, and the result may write only inside the sandbox.
The first thing after loading this skill, run:
env | grep -E '^(CLAUDECODE|CODEX_THREAD_ID|ANTIGRAVITY_AGENT|OPENCODE)='
| Host evidence | You are | MUST NOT dispatch to |
|---|---|---|
CLAUDECODE | Claude Code | claude -p |
CODEX_THREAD_ID | Codex | codex exec |
ANTIGRAVITY_AGENT | Antigravity (agy) | agy |
OPENCODE | OpenCode | opencode run |
| The current runtime explicitly identifies itself as GitHub Copilot CLI | GitHub Copilot CLI | copilot -p |
Decide whether the host is Copilot from the current runtime; a login, a model setting or environment variables inherited from another CLI are not proof. When the host is Copilot, use its built-in subagent tool and keep Auto.
Then decide your role:
Every new task starts at level 1 of its task type; retries and fallbacks within the same task continue from that task's existing dispatch records. Levels count only the options that type actually supports. scripts/policy.json is the single source for ordinary dispatch order, model kinds, reasoning effort and number of escalations; the table below is generated by list-types --markdown. Hand over to a later level only with evidence from this task of an actual failure, a command the script reported as not found, or a prohibition at the earlier level; do not carry over quota exhaustion or failure records from other tasks. The host's own level goes to the built-in subagent tool. Only when "Changes to an existing API" below is triggered do the model choice and failure handling of that consultation follow that section, instead of the ordinary dispatch CLI order, model kind limits and the matching pitfall checks. All other work follows the normal flow.
| Task type | Fits these requests | Levels | Handoff order |
|---|---|---|---|
testing | Write tests | 6 | 1. opencode / free → 2. copilot / auto → 3. codex / luna → 4. claude / haiku → 5. claude / sonnet → 6. claude / opus |
implementation | Fill in the implementation, fix bugs from a checklist | 6 | 1. opencode / free → 2. copilot / auto → 3. codex / luna → 4. claude / haiku → 5. claude / sonnet → 6. claude / opus |
frontend | Front-end design, layout, styling | 3 | 1. agy / gemini-flash-medium → 2. copilot / auto → 3. claude / opus |
exploration | Quick read-only exploration, finding files | 5 | 1. opencode / free → 2. agy / gemini-flash-medium → 3. copilot / auto → 4. codex / luna → 5. claude / haiku |
chores | Mechanical prose sections, evidence collection, bulk template rewrites | 5 | 1. opencode / free → 2. agy / gemini-flash-medium → 3. copilot / auto → 4. codex / luna → 5. claude / haiku |
classification | Classification, tagging, qualitative coding | 3 | 1. copilot / auto → 2. codex / luna → 3. claude / haiku |
review | Review a diff, find vulnerabilities, check against the contract | 3 | 1. agy / opus → 2. codex / sol → 3. claude / opus |
acceptance | Acceptance review: operate the result against the original requirements | 3 | 1. agy / opus → 2. codex / sol → 3. claude / opus |
research | The deep level of deep research | 2 | 1. codex / sol → 2. claude / opus |
decision | Option trade-offs, technology choice, single-module design | 3 | 1. agy / opus → 2. codex / sol → 3. claude / opus |
rules | Write skills, prompts, rules and complex architecture | 2 | 1. agy / opus → 2. claude / opus |
The main agent does these itself: writing the skeleton and expected results, reviewing tests, slots not worth dispatching, reading diffs, running tests, committing, and integrating all results of deep research into an overall judgment. It also does itself anything a few tool calls can finish, such as reading one value or one list, and does not dispatch it.
dispatch starts the external CLI in the background; get the result with status --dispatch-id <ID> --wait <seconds>. cli_failed, awaiting_review and native_required all go back to the main agent for judgment and review; a CLI success is not an acceptance pass.status result you have not handled before, or when choosing a model or adjusting reasoning effort.Apply this section only when preparing to change the name, structure, usage or behavior of an existing API or of a program element such as a function, variable, struct or Enum. Do not apply it merely because a task involves an API, general design, review or dispatch. A purely internal implementation change that keeps all of the above unchanged, or a pure addition that does not change any existing name, structure, usage or behavior, follows the normal flow.
When the condition holds, before modifying the affected skeleton, tests or implementation, read references/api-change-consultation.md in full and complete the independent model consultation, the revision of the first draft and the user's confirmation as it describes, then return to implementation.
Before dispatching implementation, the main agent writes the skeleton following the core Skeleton First; every slot has a signature and a list of expected results.
Which slots to dispatch and which to fill yourself follows the workload judgment in the core Skeleton First. Dispatched slots follow this order:
For slots with no test environment, or slots that concern screens, replace the tests with executable verification steps, written by the test agent as commands or a checklist.
The details of each step are in references/dispatch-flow.md; read the matching section only when you reach that step.
cli_failed, a quota is exhausted or a run times out, read "Tool failures" and "CLI not found or failed to launch" and continue to the next level yourself; do not ask the user whether to retry.The main agent does this itself and does not dispatch another agent to review in its place.
git diff, not just the subagent's summary.Every report lists the host and every dispatch in a separate paragraph:
宿主:Claude Code
工具與模型:agy / <actual flash model name> / --mode accept-edits --dangerously-skip-permissions
工具與模型:opencode / <actual free model name> / --agent build --auto
For every dispatch, state the actual tool, model and flags, whether it was new or reused, the agent or session ID, and what it was isolated from. A fallback includes this task's failure evidence, and names every level the script skipped as "not found on this runtime's PATH, installation not verified". Report an actual cache hit only when you have the tool's cache usage evidence. For a new session, state briefly why reuse was not possible. When nothing was dispatched, write "工具與模型:無". At every handover and acceptance, follow the script output's reminder: check lessons, then search for duplicates, record and read back to confirm, following the project-memory flow.
Before every report, check references/pitfalls.md row by row.
agents/test_acceptance.py (opens in a new tab)agents/test_background.py (opens in a new tab)agents/test_contract.py (opens in a new tab)agents/test_dispatch.py (opens in a new tab)agents/test_portability.py (opens in a new tab)agents/test_safety.py (opens in a new tab)references/api-change-consultation.md (opens in a new tab)references/api-change-examples.md (opens in a new tab)references/cli-cheatsheet.md (opens in a new tab)references/dispatch-flow.md (opens in a new tab)references/pitfalls.md (opens in a new tab)references/review-isolation.md (opens in a new tab)references/script-execution.md (opens in a new tab)scripts/dispatch.py (opens in a new tab)scripts/policy.json (opens in a new tab)scripts/windows_runtime.py (opens in a new tab)What SKILL.md sets; muted values are Claude Code's defaults
npx claudepluginhub timlai666/tstack --plugin tstack13 skills in this plugin
/acceptance-reviewCheck finished work against what was originally asked: every requirement is matched to a result that was actually exercised, and the original problem is shown to be solved. This skill MUST be used before reporting substantial work as done or handing it back, and when the user asks whether the result meets the request. Work this conversation produced MUST be checked by an independent reviewer who is not given the implementer's summary. It MUST NOT be used outside software engineering work, and MUST NOT replace diff-review, security-scan or test-and-fix. Triggers on: 驗收、有沒有做到、有沒有符合需求、有沒有解決問題、做完了嗎、acceptance review/diff-reviewReview a code diff. This skill MUST be used when the user provides a diff or asks for a code, PR or MR review, and once before substantial or high-risk code is handed back or opened as a PR or MR. It MUST NOT be skipped because the diff is small. A diff this conversation wrote MUST go to an independent reviewer; only a small, low-risk change gets a lightweight self-review. The same review MUST cover security-relevant changes following security-scan and changed screens following ui-review, and it checks what a change could break elsewhere. It MUST NOT be used for changes limited to documentation, prose, images or formatting. Triggers on: 幫我 review, 看 diff, PR review, MR review, code review, 影響範圍, 看看程式有沒有問題Other plugins' skills for the same job