{
"name": "CrewAI Project Rules",
"description": "Standard conventions for CrewAI v0.95.0 projects with examples",
"version": "1.0.0",
"metadata": {
"project_type": "python",
"framework": "crewai",
"maintainer": "CTK Advisors"
},
"rules": [
{
"name": "Project Structure",
"description": "Standard CrewAI project structure",
"pattern": "**/*",
"conventions": [
"Use src/<project_name> for main project code",
"Keep configuration files in config/ directory",
"Store custom tools in tools/ directory",
"Place templates in templates/ directory",
"Use pyproject.toml and poetry for dependency management",
"Include .env.example for environment variables",
"Example structure:",
"```",
"src/",
" └── your_project/",
" ├── config/",
" │ ├── agents.yaml",
" │ ├── tasks.yaml",
" │ └── templates.json",
" ├── tools/",
" │ ├── browser_tools.py",
" │ ├── file_tools.py",
" │ └── search_tools.py",
" ├── templates/",
" ├── crew.py",
" └── main.py",
"```"
]
},
{
"name": "Crew Definitions",
"description": "Guidelines for defining CrewAI crews",
"pattern": "**/crew.py",
"conventions": [
"Use @CrewBase decorator for crew classes",
"Define agents_config and tasks_config as class variables",
"Use @agent decorator for agent definitions",
"Use @task decorator for task definitions",
"Use @crew decorator for crew assembly",
"Example:",
"```python",
"@CrewBase",
"class ExampleCrew:",
" agents_config = 'config/agents.yaml'",
" tasks_config = 'config/tasks.yaml'",
"",
" @agent",
" def expert_agent(self) -> Agent:",
" return Agent(",
" config=self.agents_config['expert'],",
" allow_delegation=False,",
" tools=[SearchTools.search_internet],",
" verbose=True",
" )",
"",
" @task",
" def analyze_task(self) -> Task:",
" return Task(",
" config=self.tasks_config['analyze'],",
" agent=self.expert_agent()",
" )",
"",
" @crew",
" def crew(self) -> Crew:",
" return Crew(",
" agents=self.agents,",
" tasks=self.tasks,",
" process=Process.sequential,",
" verbose=True",
" )",
"```"
]
},
{
"name": "Tool Definitions",
"description": "Conventions for CrewAI tools with examples from the project",
"pattern": "**/tools/*.py",
"conventions": [
"Use @tool decorator with clear description",
"Implement standard tool interface",
"Include proper error handling",
"Group tools by functionality",
"Example browser tool:",
"```python",
"class BrowserTools:",
" @tool('Scrape website content')",
" def scrape_and_summarize_website(website):",
" '''Useful to scrape and summarize website content'''",
" # Implementation",
"```",
"Example file tool:",
"```python",
"class FileTools:",
" @tool('Write File with content')",
" def write_file(data):",
" '''Expects pipe-separated path and content: ./path|content'''",
" try:",
" path, content = data.split('|')",
" # Implementation",
" except Exception:",
" return 'Error with input format'",
"```"
]
},
{
"name": "Configuration Management",
"description": "Guidelines for configuration files",
"pattern": "**/config/*.{yaml,json}",
"conventions": [
"Use YAML for agent and task configurations",
"Use JSON for templates and static data",
"Example agents.yaml structure:",
"```yaml",
"senior_react_engineer:",
" role: Senior React Engineer",
" goal: Build high-quality React components",
" backstory: Expert in React development",
"senior_content_editor:",
" role: Senior Content Editor",
" goal: Create engaging content",
" backstory: Experienced in content creation",
"```",
"Example templates.json structure:",
"```json",
"{",
" \"templates\": {",
" \"basic\": {",
" \"description\": \"Basic landing page\",",
" \"components\": [\"Hero\", \"Features\"]",
" }",
" }",
"}"
]
},
{
"name": "Environment Variables",
"description": "Environment variable structure",
"pattern": "**/.env*",
"conventions": [
"Required variables from project:",
"```",
"BROWSERLESS_API_KEY=your_key_here",
"SERPER_API_KEY=your_key_here",
"OPENAI_API_KEY=your_key_here",
"```",
"Include descriptions in .env.example:",
"```",
"# Browser automation API key",
"BROWSERLESS_API_KEY=",
"",
"# Search API key",
"SERPER_API_KEY=",
"",
"# OpenAI API key for agent interactions",
"OPENAI_API_KEY=",
"```"
]
},
{
"name": "Tool Integration",
"description": "Patterns for tool integration with agents",
"pattern": "**/crew.py",
"conventions": [
"Group related tools in agent definitions",
"Example from project:",
"```python",
"@agent",
"def senior_react_engineer_agent(self) -> Agent:",
" return Agent(",
" config=self.agents_config['senior_react_engineer'],",
" allow_delegation=False,",
" tools=[",
" SearchTools.search_internet,",
" BrowserTools.scrape_and_summarize_website,",
" TemplateTools.learn_landing_page_options,",
" FileTools.write_file",
" ] + self.toolkit.get_tools(),",
" verbose=True",
" )",
"```"
]
},
{
"name": "Testing Conventions",
"description": "Standards for test files and testing practices",
"pattern": "**/tests/**/*.py",
"conventions": [
"Use pytest for testing",
"Name test files with test_ prefix",
"Group tests by functionality",
"Use fixtures for common setup",
"Example test structure:",
"```python",
"import pytest",
"from src.dev_crew.tools import SearchTools",
"",
"@pytest.fixture",
"def search_tool():",
" return SearchTools()",
"",
"def test_search_internet(search_tool):",
" '''Test internet search functionality'''",
" result = search_tool.search_internet('test query')",
" assert result is not None",
" assert isinstance(result, dict)",
"```"
]
},
{
"name": "Type Checking",
"description": "Type annotation and checking standards",
"pattern": "**/*.py",
"conventions": [
"Use type hints for all function parameters and return values",
"Enable strict type checking with mypy",
"Use Optional[] for nullable types",
"Example type usage:",
"```python",
"from typing import Optional, List, Dict",
"",
"def process_search_results(",
" query: str,",
" results: List[Dict[str, str]],",
" max_results: Optional[int] = None",
") -> List[str]:",
" '''Process search results with proper typing'''",
" filtered = results[:max_results] if max_results else results",
" return [result['title'] for result in filtered]",
"```"
]
}
]
}
dockerfile
golang
less
openai
python
react
First Time Repository
Python
Languages:
Dockerfile: 0.9KB
Python: 72.2KB
Created: 1/21/2025
Updated: 1/22/2025