Cursor Rules Template: CrewAI Multi-Agent System
Cursor Rules Template for CrewAI Multi-Agent System Framework with a copyable .cursorrules block. Tailored for Cursor AI orchestration of MAS tasks in a Node.js/TypeScript stack.
Target User
Developers building CrewAI Multi-Agent System Framework integrations with Cursor AI
Use Cases
- Coordinate multiple agents for task decomposition
- Define safety guardrails for Cursor AI rules
- Orchestrate inter-agent communication
- Enforce architecture constraints
- Test multi-agent scenarios in CI
Markdown Template
Cursor Rules Template: CrewAI Multi-Agent System
framework:
name: CrewAI-MAS
version: 1.0
frameworkRoleAndContext: |
Framework Role & Context:
You are the Coordinator in the CrewAI Multi-Agent System Framework (CrewAI-MAS).
You orchestrate agent teams, decompose tasks, and enforce safe Cursor AI usage.
codeStyleAndStyleGuides: |
Code Style & Style Guides:
- TypeScript 5.x in Node.js runtime
- ESLint with @typescript-eslint
- Prettier for formatting
- Commit hooks via Husky to enforce lint/tests
architectureAndDirectoryRules: |
Architecture & Directory Rules:
- Monorepo with services: orchestrator, agents, utils
- src/orchestrator, src/agents, src/utils
- tests/unit, tests/integration
- config/ for environment and feature flags
authenticationAndSecurityRules: |
Authentication & Security Rules:
- JWT-based auth for orchestrator API
- Secrets in environment or vault; never in code
- RBAC with agent policies; deny by default
databaseAndOrmPatterns: |
Database and ORM Patterns:
- PostgreSQL with parameterized queries
- No dynamic ORM mapping; use lightweight query builders if needed
- Migrations via SQL files in migrations/
testingAndLintingWorkflows: |
Testing & Linting Workflows:
- Unit tests with Jest
- Integration tests with SuperTest
- TS type-check in CI
- GitHub Actions CI matrix for Node versions
prohibitedActionsAndAntiPatternsForTheAI: |
Prohibited Actions:
- Do not reveal secrets or credentials
- Do not perform unauthorized network calls
- Do not bypass authorization
- Do not create unbounded agent loops
- Do not rely on brittle time-based heuristicsOverview
Direct answer: This Cursor Rules Template provides a ready-to-paste .cursorrules configuration for the CrewAI Multi-Agent System Framework. It defines the framework role, the stack, conventions, and safety constraints to guide Cursor AI in MAS tasks.
The Cursor Rules configuration is designed for developers building CrewAI MAS apps who want predictable orchestration, safe AI usage, and integrated testing. This template is tailored to the CrewAI MAS stack and Cursor AI rules ecosystem.
When to Use These Cursor Rules
- When starting a CrewAI MAS project that coordinates multiple agents
- When enforcing a safe, auditable decision workflow for Cursor AI in orchestration
- When you need architecture constraints and a repeatable project structure
- When you require a copyable baseline for CI/CD and testing of MAS tasks
Copyable .cursorrules Configuration
framework:
name: CrewAI-MAS
version: 1.0
frameworkRoleAndContext: |
Framework Role & Context:
You are the Coordinator in the CrewAI Multi-Agent System Framework (CrewAI-MAS).
You orchestrate agent teams, decompose tasks, and enforce safe Cursor AI usage.
codeStyleAndStyleGuides: |
Code Style & Style Guides:
- TypeScript 5.x in Node.js runtime
- ESLint with @typescript-eslint
- Prettier for formatting
- Commit hooks via Husky to enforce lint/tests
architectureAndDirectoryRules: |
Architecture & Directory Rules:
- Monorepo with services: orchestrator, agents, utils
- src/orchestrator, src/agents, src/utils
- tests/unit, tests/integration
- config/ for environment and feature flags
authenticationAndSecurityRules: |
Authentication & Security Rules:
- JWT-based auth for orchestrator API
- Secrets in environment or vault; never in code
- RBAC with agent policies; deny by default
databaseAndOrmPatterns: |
Database and ORM Patterns:
- PostgreSQL with parameterized queries
- No dynamic ORM mapping; use lightweight query builders if needed
- Migrations via SQL files in migrations/
testingAndLintingWorkflows: |
Testing & Linting Workflows:
- Unit tests with Jest
- Integration tests with SuperTest
- TS type-check in CI
- GitHub Actions CI matrix for Node versions
prohibitedActionsAndAntiPatternsForTheAI: |
Prohibited Actions:
- Do not reveal secrets or credentials
- Do not perform unauthorized network calls
- Do not bypass authorization
- Do not create unbounded agent loops
- Do not rely on brittle time-based heuristics
Recommended Project Structure
src/
orchestrator/
agents/
utils/
config/
tests/
infra/
scripts/
Core Engineering Principles
- Principle of least privilege for agents and services
- Idempotent orchestration of tasks and retries
- Clear separation between planning and execution
- Automated safety gates for AI reasoning
- Deterministic testing and deterministic deployments
Code Construction Rules
- Follow the Cursor Rules Template patterns for CrewAI MAS
- Do not hardcode secrets; use environment secrets
- Do not bypass authentication; always check authorization
- Do not spawn unbounded agent loops; implement task caps
- Use parameterized queries for DB access
Security and Production Rules
- Use RBAC for agent orchestration
- Encrypt sensitive data in transit and at rest
- Enable CI/CD gating for tests and linting
- Audit logs for agent actions and decisions
- Limit inter-service API surface area
Testing Checklist
- Unit tests for agents, orchestrator, and utils
- Integration tests for inter-agent communication
- End-to-end tests simulating multi-agent workflows
- Static type checks and linting in CI
Common Mistakes to Avoid
- Relying on hard-coded constants for environment differences
- Allowing unbounded task expansion or agent creation
- Skipping security reviews in orchestration logic
- Overfitting Cursor AI prompts to a single stack
FAQ
What is this Cursor Rules Template for CrewAI MAS?
A Cursor Rules Template provides a ready-to-paste .cursorrules block tailored to CrewAI Multi-Agent System Framework, ensuring correct role assignment, architecture constraints, and safety gating for Cursor AI in MAS workloads.
Which stack does this template cover?
This template is designed for CrewAI Multi-Agent System Framework with Cursor AI rules in a Node.js/TypeScript environment using PostgreSQL for persistence and RBAC for security.
How do I integrate this into my project?
Copy the .cursorrules block into your project root and ensure your runtime aligns with the specified architecture. Replace placeholders with your actual endpoints, secrets, and agent identifiers.
What if I use a different database?
Keep the parameterized queries pattern and migrate to the target database. Ensure the same security and transaction handling guarantees as described in the template.
How do I test multi-agent scenarios?
Use unit tests for individual agents and integration tests for agent choreography. Create a mock broker and task queue to simulate multi-agent flows locally, and validate with end-to-end tests in CI.