Agent Teams Tutorial
This tutorial walks you from zero to a running Agent Teams pipeline. By the end, you will have a team of AI agents coordinating through a shared task list in Claude Code - defined as a version-controlled YAML file.
Prerequisites
Before you begin, make sure you have:
- Node.js 20+ - verify with
node --version - Claude Code - the Anthropic CLI (install guide)
- Agent Teams enabled - this feature is experimental. Add the following to
.claude/settings.jsonin your project (or your global settings):
{
"env": {
"CLAUDE_CODE_EXPERIMENTAL_AGENT_TEAMS": "1"
}
}Agent Teams requires Claude Code v2.1.32 or later.
1. Create a pipeline
Install skillfold and scaffold a project from the dev-team template:
npm install skillfold
npx skillfold init my-team --template dev-team
cd my-teamThis creates two files:
my-team/
skillfold.yaml
.gitignoreThe template uses skillfold's shared library skills via imports, so no local skill directories are needed.
2. Understand the config
Open skillfold.yaml. The template produces a three-agent pipeline with a review loop:
# yaml-language-server: $schema=node_modules/skillfold/skillfold.schema.json
name: dev-team
imports:
- npm:skillfold/library/skillfold.yaml
skills:
composed:
planner:
compose: [planning, decision-making]
description: "Analyzes the goal and produces a structured plan with key decisions."
engineer:
compose: [planning, code-writing, testing]
description: "Implements the plan by writing production code and tests."
reviewer:
compose: [code-review, testing]
description: "Reviews code for correctness, clarity, and test coverage."
state:
Review:
approved: bool
feedback: string
plan:
type: string
implementation:
type: string
review:
type: Review
team:
flow:
- planner:
writes: [state.plan]
then: engineer
- engineer:
reads: [state.plan]
writes: [state.implementation]
then: reviewer
- reviewer:
reads: [state.implementation]
writes: [state.review]
then:
- when: review.approved == true
to: end
- when: review.approved == false
to: engineerThe config has four sections:
imports
The import pulls in 11 reusable atomic skills from the skillfold library (planning, code-writing, code-review, testing, decision-making, and more). These are the building blocks that get composed into agents.
skills
There are no atomic skill definitions here because the import provides them. The composed section defines three agents, each built from a combination of atomic skills:
- planner - combines
planninganddecision-makingto analyze goals and produce structured plans - engineer - combines
planning,code-writing, andtestingto implement code with tests - reviewer - combines
code-reviewandtestingto review code for correctness and coverage
When compiled, each agent's instructions are the concatenation of its atomic skill bodies. The engineer gets the full text of the planning, code-writing, and testing skills - all the context it needs.
state
The state section defines the data that flows between agents:
Reviewis a custom type withapproved(bool) andfeedback(string) fieldsplan,implementation, andrevieware the state fields agents read from and write to
The compiler validates that every reads and writes reference points to a real state field.
team.flow
The flow defines the execution order and routing:
plannerwrites the plan, then hands off toengineerengineerreads the plan and writes the implementation, then hands off toreviewerreviewerreads the implementation, writes a review, then routes conditionally:- If
review.approved == true, the pipeline ends - If
review.approved == false, it loops back toengineer
- If
The compiler validates that every cycle has an exit condition, preventing infinite loops.
3. Compile for Agent Teams
Compile the pipeline with the agent-teams target:
npx skillfold --target agent-teamsOutput:
skillfold: compiled dev-team
-> .claude/skills/planner/SKILL.md
-> .claude/skills/engineer/SKILL.md
-> .claude/skills/reviewer/SKILL.md
-> .claude/agents/planner.md
-> .claude/agents/engineer.md
-> .claude/agents/reviewer.md
-> .claude/commands/start-team.mdThe --target agent-teams flag generates everything into the .claude/ directory, which is where Claude Code reads its configuration.
4. Explore the output
The compiler generates three types of files:
Skills (.claude/skills/{name}/SKILL.md)
Each composed skill's body is the concatenation of its atomic skills. For example, engineer/SKILL.md contains the full text of the planning, code-writing, and testing skills - merged into a single file with YAML frontmatter.
These files are the detailed instructions that tell each agent how to do its job.
Agents (.claude/agents/{name}.md)
Agent markdown files with frontmatter and structured sections. Here is what a typical agent file looks like:
---
name: engineer
description: Implements the plan by writing production code and tests.
model: inherit
color: green
---
# engineer
Implements the plan by writing production code and tests.
## Reads
- `state.plan`
## Writes
- `state.implementation`
## Instructions
(full composed skill body here)Key fields in the frontmatter:
- model - set to
inheritby default (uses the current model) - color - assigned heuristically based on role (green for implementation, red for review, yellow for planning)
The Reads and Writes sections come from the team flow definition.
Team bootstrap (.claude/commands/start-team.md)
The start-team.md command is the glue that ties everything together. It tells Agent Teams:
- Team Structure - which teammates to spawn and what each one does
- Shared State - a table of state fields with types
- Task Sequence - numbered steps derived from the flow graph, with reads, writes, and conditional routing
- Coordination - how the team lead manages handoffs and evaluates conditions
This file is what makes the difference between manually describing a team every session and having a reproducible, version-controlled definition.
5. Launch the team
Open Claude Code in your project directory and run the start command:
/start-teamAgent Teams reads the bootstrap prompt, creates the team, and begins executing the pipeline. The team lead (Claude) spawns the planner, engineer, and reviewer as teammates, assigns tasks in the defined order, and manages the review loop.
Each teammate automatically loads its agent definition from .claude/agents/{name}.md, which includes its composed skill instructions, reads, and writes.
6. Customize the pipeline
Add an agent
Say you want a designer agent that creates UI mockups before the engineer builds. First, add it to the composed skills:
skills:
composed:
designer:
compose: [planning, code-writing]
description: "Designs UI components and creates implementation specs."
planner:
compose: [planning, decision-making]
description: "Analyzes the goal and produces a structured plan with key decisions."
engineer:
compose: [planning, code-writing, testing]
description: "Implements the plan by writing production code and tests."
reviewer:
compose: [code-review, testing]
description: "Reviews code for correctness, clarity, and test coverage."Then add a state field and wire it into the flow:
state:
# ... existing fields ...
design:
type: string
team:
flow:
- planner:
writes: [state.plan]
then: designer
- designer:
reads: [state.plan]
writes: [state.design]
then: engineer
- engineer:
reads: [state.plan, state.design]
writes: [state.implementation]
then: reviewer
- reviewer:
reads: [state.implementation]
writes: [state.review]
then:
- when: review.approved == true
to: end
- when: review.approved == false
to: engineerRecompile:
npx skillfold --target agent-teamsThe compiler generates the new designer agent files and updates start-team.md with the new task sequence. The git diff shows exactly what changed.
Use custom skills instead of library imports
If the library skills do not fit your needs, define your own atomic skills:
skills:
atomic:
my-planning: ./skills/my-planning
my-coding: ./skills/my-coding
composed:
engineer:
compose: [my-planning, my-coding]
description: "Implements features using our team's conventions."Create skills/my-planning/SKILL.md with your custom instructions:
---
name: my-planning
description: Plan features using our team's process.
---
# Planning
(your custom planning instructions here)You can mix library skills and custom skills in the same composition.
Change the model
Set a model per agent using agentConfig:
skills:
composed:
planner:
compose: [planning, decision-making]
description: "Analyzes the goal and produces a structured plan."
agentConfig:
model: claude-sonnet-4-202505147. Validate before compiling
Use validate to check your config for errors without writing any files:
npx skillfold validateThis catches issues like missing skill references, invalid state paths, unreachable flow nodes, and cycles without exit conditions.
Use list to see a summary of the pipeline:
npx skillfold listUse graph to visualize the flow:
npx skillfold graphThis outputs a Mermaid flowchart you can paste into GitHub, or use --html for an interactive view:
npx skillfold graph --html > pipeline.html8. CI integration
Add a check to your CI pipeline to verify the compiled output stays in sync with the config:
# .github/workflows/check.yml
name: Check pipeline
on: [push, pull_request]
jobs:
check:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 20
- run: npm ci
- run: npx skillfold --target agent-teams --checkThe --check flag compares what the compiler would generate against what is on disk. It exits with code 1 if someone edited the compiled output without updating the config, or updated the config without recompiling.
You can also use the reusable GitHub Action:
- uses: byronxlg/skillfold@main
with:
target: agent-teamsNext steps
- Agent Teams Bridge - deeper explanation of what skillfold solves for Agent Teams
- Getting Started - the full getting-started guide with all features
- Platform Integration - all 12 supported compilation targets
- Running Pipelines - execute pipelines with
skillfold run - Publishing Skills - share your skills via npm