v2/examples/06-tutorials/getting-started/01-first-swarm.md
This tutorial will guide you through creating your first swarm and understanding how Claude Flow works.
npm install -g claude-flow)A swarm is a coordinated group of AI agents working together to complete a task. Each agent has specific capabilities and roles.
Let's create a basic "Hello World" application:
cd examples
../claude-flow swarm create "Build a hello world CLI application" \
--name my-first-swarm \
--output ./output/hello-world
cd ./output/hello-world
ls -la
You should see:
index.js - Main application filepackage.json - Node.js configurationREADME.md - Documentationtest.js - Test file (if tests were requested)npm install # Install any dependencies
npm start # Run the application
Check the swarm logs to see how agents collaborated:
cat ../../logs/swarm-*.log
You'll see agents like:
Try with more specific requirements:
../claude-flow swarm create \
"Build a CLI calculator that supports add, subtract, multiply, divide" \
--agents 3 \
--strategy development \
--name calculator-swarm
--agents 3: Use 3 specialized agents--strategy development: Focus on code creation--name: Give your swarm a memorable nameTry different strategies:
research: For gathering informationanalysis: For code reviewtesting: For test creationoptimization: For performance improvementsUse configuration files:
../claude-flow swarm create "Your task" \
--config ../01-configurations/basic/simple-config.json
Monitor swarm progress:
../claude-flow swarm create "Your task" --monitor
Problem: Swarm takes too long
--timeout 60000 to set limitsProblem: Not enough detail in output
Problem: Want different output structure
You've learned to:
Continue to Tutorial 2: Working with Workflows