Skip to content
stacks
Docs menu

Use stacks with your agent

Install the stacks skill so your coding agent picks a stack, writes the project and loops on verify, and choose which agents a project is set up for.

View as MarkdownOpen in ClaudeOpen in ChatGPT

This page installs the stacks skill, which lets your coding agent pick a stack, write the project and loop on verify from a request in chat. It also covers which agent stacks new launches and how to set a project up for more than one agent.

When you need the skill

You need the skill when you want to start from a chat message such as "start me a Go CLI with tests and CI", because the agent has to know stacks exists.

You don't need it when you run stacks new at a terminal. stacks writes the project and starts your agent with one instruction, read .stacks/BRIEF.md and carry it out, and the brief is the whole task. The Quickstart covers that path.

Install the skill

The skill is one short Markdown file telling an agent when to reach for stacks and how to run it. Claude Code loads it automatically when a request matches its description.

stacks skill install            # ~/.claude/skills/stacks/SKILL.md, for every project
stacks skill install --project  # .claude/skills/ in the current repository only
Terminal

Running it again is safe. An identical file is left alone, and a copy you've edited is kept unless you add --force.

The agent doesn't need stacks installed globally. When stacks isn't on its PATH, the skill tells it to run npx -y @steamfield/stacks@latest, and every brief names the exact command to use for verify.

Install the skill for other agents

Codex, OpenCode and Cursor read instructions from their own places. Print the skill and save it where your agent looks for skills or rules:

stacks skill install --print > SKILL.md
Terminal

An agent can also read stacks guide, which is what stacks prints with no arguments: a shorter version of the same instructions.

Install the skill as a Claude Code plugin

The stacks repository is also a Claude Code plugin marketplace. Its plugin carries the stacks skill and the authoring skill, pinned to the latest release:

claude plugin marketplace add steamfield/stacks
claude plugin install stacks@stacks
Terminal

Install the skill for writing your own stacks

A second skill, stacks-author, teaches an agent to turn a repository into a stack, design a new stack with you, and submit it to the public registry. The plugin includes it. Without the plugin, install it with stacks skill install stacks-author, or have any agent read it through stacks guide author. Write your own stack or fragment covers the process.

How the agent handles a project request

With the skill installed, ask your agent in your own words, for example "set up a TypeScript CLI properly". The agent then:

  1. Runs stacks search "<your words>" --json, compares the strong matches, and reviews the best one with stacks show <id> --json.
  2. Tells you which stack it picked, why, and one tradeoff. If nothing fits well, it says so and offers the closest entries from stacks list --json.
  3. Runs stacks new <stack> <dir> --json. It adds --sandbox when you asked for the quickest local setup.
  4. Reads .stacks/BRIEF.md and follows it, asking you only the decisions the brief says to ask.
  5. Runs stacks verify, fixes what fails, and repeats until the outcome is green. Then it runs stacks verify --all and fixes anything that run turns up.
  6. Works through the brief's after-green list (manual checks, docs) and summarizes: the stack, the decisions it took, anything left undone, and the problems it noted in .stacks/NOTES.md.

For a repository you already have, step 3 is stacks add <fragment...> --json instead, and the agent also merges the files add parked under .stacks/incoming/. Add to an existing repository walks through it.

Changes the agent needs your permission for

The agent never edits the verify steps or .stacks/manifest.json, and if verify reports VerifyChanged it stops and asks you. Only you can accept changed steps, by running stacks verify --accept-changes at your own terminal. stacks refuses that command when it detects an agent.

The agent also won't pick an untrusted entry (one from a project registry inside a repository, or from an unsigned custom index) unless you named it, and it confirms with you first if you did. Registries and trust explains which entries are trusted.

On a first run, stacks prints a short telemetry notice. The skill tells the agent to relay it to you once, including how to turn it off. An agent can turn telemetry off with stacks telemetry disable, but it can't turn it on: stacks telemetry enable needs a person at a terminal. The telemetry page has the details.

Agent output and exit codes

stacks detects an agent from markers such as CLAUDECODE or AI_AGENT, or because stdout isn't a terminal, and prints agent output: the same result as the human text with the progress and log noise removed. With --json the agent gets exactly one JSON object per command, and stacks schema <name> prints the JSON Schema for each.

When a command fails, the exit code tells the agent what to do next:

Exit The agent should
0 Continue. For verify, check the outcome: only green is done
2 Fix the input: a typo in an id, a bad flag, a non-empty target directory
3 Fix the configuration or the manifest
4 Retry later: an upstream service was unavailable
5 Read the verify report on stdout and fix what it names
6 Ask you: something needs a person's permission
130 Nothing; the run was interrupted

Output, JSON and exit codes has the full table and the error envelope.

Which agent launches

At a terminal, new and add launch the first agent from your agents setting that's on your PATH. With none configured, a single installed agent launches without asking, and if several are installed you pick from a numbered list. The search order is Claude Code, Codex CLI, OpenCode, Cursor CLI, Copilot CLI, then the Codex app on macOS. Your pick isn't saved.

Choose explicitly with --launch, or skip launching with --no-launch:

stacks new go-cli my-cli --launch codex
stacks new go-cli my-cli --no-launch
Terminal

Nothing launches under --json, from inside an agent session, without a terminal, or for an untrusted entry. In those cases stacks prints the prompt for you to give your agent.

Set up a project for more than one agent

--agents decides which agents' config files a project gets. It's separate from which agent launches. The default is claude; every target gets AGENTS.md.

stacks new go-cli my-cli --agents claude,codex
Terminal

To make that your default, set "agents": ["claude", "codex"] in ~/.config/stacks/config.json (Configuration).

The adapter files install guardrails, such as hooks that block destructive commands and writes that look like secrets, plus lint-on-write where the agent supports it. How much each agent enforces varies:

Agent What the adapter installs Status
Claude Code (claude) Destructive-command and secret-write hooks, lint-on-write, format-on-stop; CLAUDE.md imports AGENTS.md Proven in real agent runs
Codex (codex) Bash and apply_patch guards once you trust the hooks, workspace-write sandbox, on-request approvals; lint and format are instructions Proven in real agent runs
OpenCode (opencode) Permission and plugin guards, lint-on-write, format-on-idle Unproved: tested offline only
Cursor (cursor) Shell and write guards before each tool call, always-applied rules; lint and format are instructions Unproved: tested offline only

Note

Codex runs project hooks only after you review and trust them through /hooks. Until then, the guards are written but inactive.

When a guard blocks something, the agent should ask you rather than find another way around it.

Next steps