core-build
npx machina-cli add skill victorgrein/spec-crew/core-build --openclawCore Build
Comprehensive skill for building CrewAI crews with YAML-first architecture.
When To Use
- Create new crew projects
- Configure agents and tasks
- Define process workflows
- Bootstrap crew infrastructure
- Validate crew configurations
- Generate boilerplate code
Quick Start Workflow
1. Scaffold New Project
python scripts/scaffold_crew.py my_crew
2. Configure Agents and Tasks
Edit config/agents.yaml and config/tasks.yaml using the templates.
3. Validate Configuration
python scripts/validate_crew.py my_crew
4. Execute Crew
python my_crew/main.py "your input here"
Detailed Workflow
Design Phase
- Define Purpose: Clarify what the crew should accomplish
- Identify Agents: Determine roles needed (researcher, analyst, writer, etc.)
- Map Tasks: Break work into single-responsibility tasks
- Plan Dependencies: Establish context flow between tasks
Configuration Phase
- Create agents.yaml: Define agent roles, goals, and backstories
- Create tasks.yaml: Define task descriptions and expected outputs
- Set Context: Link tasks using context dependencies
- Configure Tools: Assign appropriate tools to agents
Validation Phase
Run validation to catch errors early:
python scripts/validate_crew.py ./my_crew
Validates:
- YAML syntax and structure
- Required field presence
- Agent reference integrity
- Task context dependencies
- Circular dependency detection
- Type checking
Execution Phase
Use the scaffolded main.py or integrate into your application:
from crew import MyCrewCrew
inputs = {"topic": "your input"}
result = MyCrewCrew().crew().kickoff(inputs=inputs)
Process Selection Guide
Sequential Process
- Tasks execute in order
- Each task can access previous task outputs
- Simple and predictable
Use for: Data pipelines, content creation, research workflows
from crewai import Process
crew = Crew(
process=Process.sequential,
# ...
)
Hierarchical Process
- Manager coordinates task execution
- Dynamic task assignment
- Built-in quality review
Use for: Complex projects, quality-critical work, multi-agent collaboration
from crewai import Process
crew = Crew(
process=Process.hierarchical,
manager_llm="gpt-4",
# ...
)
Common Patterns
Research → Analysis → Report
# agents.yaml
researcher:
role: Research Specialist
goal: Gather comprehensive information
analyst:
role: Data Analyst
goal: Extract insights and patterns
# tasks.yaml
research_task:
description: Research {topic}
agent: researcher
analysis_task:
description: Analyze findings
agent: analyst
context:
- research_task
Multi-Agent Collaboration
Specialized agents working on different aspects simultaneously.
Review Loop Pattern
Iterative improvement with feedback cycles and revisions.
See references/guides/patterns.md for complete pattern library.
Decorator Reference
@CrewBase
Marks the class as a CrewBase configuration class.
@CrewBase
class MyCrew:
agents_config = "config/agents.yaml"
tasks_config = "config/tasks.yaml"
@agent
Defines an agent method that returns an Agent instance.
@agent
def researcher(self) -> Agent:
return Agent(config=self.agents_config['researcher'])
@task
Defines a task method that returns a Task instance.
@task
def research_task(self) -> Task:
return Task(config=self.tasks_config['research_task'])
@crew
Defines the crew method that returns the Crew instance.
@crew
def crew(self) -> Crew:
return Crew(agents=self.agents, tasks=self.tasks)
@before_kickoff
Runs before crew execution starts.
@before_kickoff
def before_kickoff_function(self, inputs):
print(f"Starting with inputs: {inputs}")
return inputs
@after_kickoff
Runs after crew execution completes.
@after_kickoff
def after_kickoff_function(self, result):
print(f"Completed with result: {result}")
return result
Tool Usage
scaffold_crew.py
Scaffolds a new crew project from templates.
# Create in current directory
python scripts/scaffold_crew.py my_crew
# Create in specific directory
python scripts/scaffold_crew.py my_crew --path ./crews
validate_crew.py
Validates crew configuration files.
# Validate a crew
python scripts/validate_crew.py ./my_crew
# With detailed output
python scripts/validate_crew.py ./my_crew --verbose
generate_config.py
Interactive configuration generator.
# Generate interactively
python scripts/generate_config.py
# Choose agent, task, or full crew setup
Asset Templates
Starter Project
assets/starter/- Complete working crew templateconfig/agents.yaml- Researcher and analyst agentsconfig/tasks.yaml- Research and analysis taskscrew.py- Full CrewBase classmain.py- CLI entry point.env.example- Environment templateREADME.md- Project documentation
Configuration Templates
assets/templates/agents-basic.yaml- Starter agent configurationassets/templates/agents-advanced.yaml- All agent parametersassets/templates/tasks-basic.yaml- Starter task configurationassets/templates/tasks-advanced.yaml- All task parameters
Reference Documentation
API Documentation
references/api/agents.md- Complete agent attribute referencereferences/api/tasks.md- Complete task attribute referencereferences/api/crews.md- Complete crew attribute reference
Guides
references/guides/best-practices.md- Design principles and guidelinesreferences/guides/patterns.md- Common crew architecture patterns
External Resources
references/external.md- Official documentation links
Troubleshooting
Common Issues
Missing required fields
Error: Agent 'name' missing required field 'role'
Solution: Add all required fields (role, goal, backstory)
Agent not found
Error: Task references unknown agent 'wrong_name'
Solution: Ensure agent name in tasks.yaml matches agents.yaml
Circular dependency
Error: Circular dependency detected
Solution: Remove the circular reference in task context
YAML syntax error
Error: YAML parse error at line 5
Solution: Check indentation (use 2 spaces) and syntax
Validation Always Passes First
Always run validate_crew.py before execution to catch errors early.
Debugging Tips
- Enable verbose mode:
verbose: true - Check context dependencies are correct
- Validate agent names match exactly
- Use markdown formatting for readability
- Test with simple inputs first
Mastery Steps
- Study Templates: Review
assets/starter/to understand structure - Configure Agents: Use
references/api/agents.mdfor options - Define Tasks: Use
references/api/tasks.mdfor configuration - Validate: Run
scripts/validate_crew.pyto check for errors - Test: Execute with sample inputs and refine
- Iterate: Use patterns from
references/guides/patterns.mdfor complex crews
File Structure
core-build/
├── SKILL.md # This file
├── assets/
│ ├── starter/ # Complete working project
│ │ ├── config/
│ │ │ ├── agents.yaml # Starter agent config
│ │ │ └── tasks.yaml # Starter task config
│ │ ├── crew.py # CrewBase implementation
│ │ ├── main.py # CLI entry point
│ │ ├── .env.example # Environment template
│ │ └── README.md # Project documentation
│ └── templates/ # Standalone templates
│ ├── agents-basic.yaml # Basic agent config
│ ├── agents-advanced.yaml # Advanced agent reference
│ ├── tasks-basic.yaml # Basic task config
│ └── tasks-advanced.yaml # Advanced task reference
├── references/
│ ├── api/ # API documentation
│ │ ├── agents.md # Agent attributes
│ │ ├── tasks.md # Task attributes
│ │ └── crews.md # Crew attributes
│ ├── guides/ # How-to guides
│ │ ├── best-practices.md # Best practices
│ │ └── patterns.md # Architecture patterns
│ └── external.md # Official docs links
└── scripts/ # Executable tools
├── scaffold_crew.py # Project scaffolding
├── validate_crew.py # Configuration validation
└── generate_config.py # Interactive config generator
Coding-Agent Guidelines
- Design crews with contracts over prose; keep prompts out of inline Python constructors
- Enforce single-purpose tasks with explicit expected outputs and context dependencies
- Make process choice explicit and justified for reproducibility
- Produce artifacts that are directly reusable by downstream Flows
- Always validate configurations before execution
- Use templates as starting points, customize for specific needs
- Follow naming conventions: snake_case for files, descriptive names for agents/tasks
- Document assumptions and constraints in task descriptions
- Test with edge cases and validate error handling
Source
git clone https://github.com/victorgrein/spec-crew/blob/main/templates/shared/skills/core-build/SKILL.mdView on GitHub Overview
Core Build is a comprehensive skill for designing CrewAI crews using a YAML-first architecture. It helps you create crews, configure agents and tasks, select processes, bootstrap infrastructure, validate configurations, and generate boilerplate code. This keeps workflows consistent and scalable from scaffold to execution.
How This Skill Works
The skill uses YAML files (agents.yaml and tasks.yaml) to define roles, goals, tasks, and inter-task context, then applies a chosen Process model (sequential or hierarchical) to drive execution. It also provides decorators (CrewBase, @agent, @task, @crew) to wire code to configurations and a scaffold/validate/run cycle to produce validation-ready outputs.
When to Use It
- Create new crew projects
- Configure agents and tasks
- Define process workflows
- Bootstrap crew infrastructure
- Validate crew configurations
Quick Start
- Step 1: Scaffold New Project with python scripts/scaffold_crew.py my_crew
- Step 2: Configure Agents and Tasks by editing config/agents.yaml and config/tasks.yaml
- Step 3: Validate and run the crew: python scripts/validate_crew.py my_crew; python my_crew/main.py "your input here"
Best Practices
- Start with scaffold_crew.py to establish a clean project.
- Keep agents.yaml and tasks.yaml aligned with roles and goals.
- Link tasks with context dependencies to define data flow.
- Choose Process.sequential or Process.hierarchical based on project needs.
- Run validation early and iterate on any dependencies or type checks.
Example Use Cases
- Bootstrapping a new Market Research crew with researchers, analysts, and writers.
- Creating a data-analysis workflow using a sequential process.
- Coordinating multi-agent collaboration on a content-generation task.
- Validating YAML configurations for agent and task definitions.
- Executing a crew with main.py to process live inputs.
Frequently Asked Questions
Related Skills
ansible
chaterm/terminal-skills
Ansible 自动化运维
configuration
chaterm/terminal-skills
OpenClaw 配置管理
configmap-secret
chaterm/terminal-skills
Kubernetes ConfigMap 与 Secret
convex-agents
waynesutton/convexskills
Building AI agents with the Convex Agent component including thread management, tool integration, streaming responses, RAG patterns, and workflow orchestration
flows
victorgrein/spec-crew
This skill should be used when designing CrewAI Flows with typed state management, deterministic routing, and event-driven orchestration. Use it for flow architecture, state transitions, control primitives, and production deployment.
tools-expert
victorgrein/spec-crew
This skill should be used when selecting CrewAI built-in tools, composing agent toolchains, or creating production-ready custom tools with BaseTool or @tool, including schema validation, dependency management, caching, async support, and testing.