# stack: background and examples

Read by `/multi-agent:stack` when the user asks how stack selection works, what
an argument enables, or why the plugin map is derived.

## How hosts receive stack skills

On Claude Code the marketplace plugins are the ONLY source of stack skills -
nothing is copied into `~/.claude/skills`. A stack that is not enabled is simply
absent from the session. Copilot CLI and Codex CLI have no plugin loader; they
receive a local copy filtered to the enabled stacks at install time, which is why
the command offers to refresh those copies after a change.

Enablement is declarative, per-repo and versioned. There is no SessionStart hook
and no directory shuffling; the old `stack-swap.sh` mechanic is gone.

## Usage examples

```bash
/multi-agent:stack                 # no arg -> native multi-select picker (current state pre-noted)
/multi-agent:stack ios             # SwiftUI toolkit + common
/multi-agent:stack ios backend     # any combination, space-separated
/multi-agent:stack android         # Compose toolkit + common
/multi-agent:stack mobile          # alias: ios + android + common
/multi-agent:stack backend         # Python / Node spec-driven toolkit + common
/multi-agent:stack web             # React / TSX toolkit + common (alias: frontend)
/multi-agent:stack fullstack       # alias: web + backend + common
/multi-agent:stack all             # all four stack toolkits + common
```

## Why the map is derived

`pluginsForStacks()` in `scripts/_stack-routing.mjs` owns the stack to plugin
map, and the command carries no copy: every hand-written copy is a chance to get
the one asymmetry wrong - the detector says `web`, the marketplace ships
`ai-frontend-toolkit`. To preview what a set of arguments enables:

```bash
node -e 'import(process.env.HOME+"/.claude/scripts/_stack-routing.mjs").then(m=>{
  const st=process.argv.slice(1).flatMap(a=>m.expandStackArg(a));
  if(!st.length){console.error("Unknown stack. One of: "+m.KNOWN_STACKS.join(" ")+" mobile fullstack all");process.exit(1);}
  const r=m.pluginsForStacks(st);
  if(r.dropped.length) console.error("not in the marketplace, dropped: "+r.dropped.join(" "));
  console.log(r.plugins.join(" "));
})' "$@"
```

`ai-common-toolkit` and `ai-analyst-toolkit` are in every answer, including the
empty one. Multiple args union their sets, and the aliases (`frontend`,
`mobile`, `fullstack`, `all`) expand in the module so `/multi-agent:stack
mobile` cannot mean one thing here and another in the installer.

The marketplace suffix is appended inside node, not in the shell: `$ON` is a
single string, and re-splitting it in zsh to suffix each name suffixes the whole
string, not each word.

## Apple's Xcode skills

Apple's skills (`xcode-integration@xcode-apple`, linked by the installer from
this Mac's Xcode 27.1+ plugin into `~/.claude/xcode-apple-marketplace`) are the
reference for iPhone Duo and window resizing, SwiftUI, App Intents and the
accessibility audits, and they are the first route for those iOS tasks.

## What stack-toggle.mjs does

`stack-toggle.mjs set` applies the write rules (selection `true`, every other
stack toolkit `false`, `ai-common-toolkit` and `ai-analyst-toolkit` always
`true`, retired `ai-*-engineering-toolkit` keys deleted,
`xcode-integration@xcode-apple` following `ios` when the Apple marketplace is
linked, every other key kept), writes the file atomically and prints the
resulting `enabledPlugins`. The office panel's `POST /v1/stack` calls the same
script.
