Get the FREE Ultimate OpenClaw Setup Guide →
npx machina-cli add skill victorgrein/spec-crew/core-build --openclaw
Files (1)
SKILL.md
9.8 KB

Core 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

  1. Define Purpose: Clarify what the crew should accomplish
  2. Identify Agents: Determine roles needed (researcher, analyst, writer, etc.)
  3. Map Tasks: Break work into single-responsibility tasks
  4. Plan Dependencies: Establish context flow between tasks

Configuration Phase

  1. Create agents.yaml: Define agent roles, goals, and backstories
  2. Create tasks.yaml: Define task descriptions and expected outputs
  3. Set Context: Link tasks using context dependencies
  4. 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 template
    • config/agents.yaml - Researcher and analyst agents
    • config/tasks.yaml - Research and analysis tasks
    • crew.py - Full CrewBase class
    • main.py - CLI entry point
    • .env.example - Environment template
    • README.md - Project documentation

Configuration Templates

  • assets/templates/agents-basic.yaml - Starter agent configuration
  • assets/templates/agents-advanced.yaml - All agent parameters
  • assets/templates/tasks-basic.yaml - Starter task configuration
  • assets/templates/tasks-advanced.yaml - All task parameters

Reference Documentation

API Documentation

  • references/api/agents.md - Complete agent attribute reference
  • references/api/tasks.md - Complete task attribute reference
  • references/api/crews.md - Complete crew attribute reference

Guides

  • references/guides/best-practices.md - Design principles and guidelines
  • references/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

  1. Enable verbose mode: verbose: true
  2. Check context dependencies are correct
  3. Validate agent names match exactly
  4. Use markdown formatting for readability
  5. Test with simple inputs first

Mastery Steps

  1. Study Templates: Review assets/starter/ to understand structure
  2. Configure Agents: Use references/api/agents.md for options
  3. Define Tasks: Use references/api/tasks.md for configuration
  4. Validate: Run scripts/validate_crew.py to check for errors
  5. Test: Execute with sample inputs and refine
  6. Iterate: Use patterns from references/guides/patterns.md for 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

  1. Step 1: Scaffold New Project with python scripts/scaffold_crew.py my_crew
  2. Step 2: Configure Agents and Tasks by editing config/agents.yaml and config/tasks.yaml
  3. 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

Add this skill to your agents

Related Skills

Sponsor this space

Reach thousands of developers