A comprehensive set of rules and best practices for the Cursor IDE to guide AI-assisted development of serverless applications, web frontends, and mobile apps.
Add these rules to your existing project with a single command:
curl -fsSL https://raw.githubusercontent.com/jimmypocock/cursor-rules/main/install.sh | bash
This will download and install only the necessary rule files into your project's .cursor/rules
directory.
This repository contains a collection of configuration files for Cursor IDE that provides context-specific guidance to the AI assistant. These rules help ensure that all code generated by the AI follows consistent patterns, best practices, and architectural principles across your projects.
-
Base Rules - Core development principles that apply across all projects, including coding conventions, error handling, and security best practices.
-
TypeScript Rules - Specific guidelines for TypeScript development, including type definitions, modern features, and organization patterns.
-
AWS Serverless Rules:
- Lambda Functions - Best practices for design, performance, cold start mitigation, and error handling
- DynamoDB - Data modeling principles, key design, query optimization, and cost efficiency
- IAM - Security best practices, least privilege principles, and role design
- CloudFormation/SAM - Infrastructure as code patterns and deployment practices
- GameLift - Game server integration, matchmaking, and fleet management
- Bedrock - Foundation model integration, prompt engineering, and agent design
- SageMaker - ML pipeline design, model deployment, and monitoring
- VPC - Network architecture, security, and connectivity patterns
- EventBridge - Event-driven design, rule configuration, and integration patterns
-
Web Development Rules:
- Next.js - App Router architecture, component design, data fetching, and performance optimization
- React - Component patterns, hooks usage, state management, and performance optimization
-
Mobile Development Rules:
- React Native - Project setup, component architecture, navigation, and performance optimization
- Expo - Expo ecosystem integration, EAS services, and deployment strategies
-
Supporting Tools:
- Installation script for easy adoption
- GitHub workflow for automated maintenance
- Validation tools to ensure rule quality
- Best practice checkers to keep rules updated
- Comprehensive documentation
- Comprehensive Coverage: Rules for all major aspects of modern application development
- Modularity: Each rule file focuses on a specific technology or concept
- Maintainability: Clear organization makes rules easy to update as best practices evolve
- Automation: Tools to validate and distribute rules across projects
- Knowledge Sharing: Captures expert knowledge in a format that benefits the entire team
The rules follow the modern MDC (Markdown Configuration) format introduced in Cursor v0.45+, which allows:
- Domain-specific configurations targeting specific file patterns
- Hierarchical rule inheritance with base rules extended by more specialized ones
- Agent-centric instructions treating the AI as a specialized coding assistant
.
├── .cursor/
│ └── rules/
│ ├── base.mdc # Core development principles
│ ├── typescript.mdc # TypeScript best practices
│ ├── aws-lambda.mdc # Lambda function guidelines
│ ├── aws-dynamodb.mdc # DynamoDB patterns and practices
│ ├── aws-iam.mdc # IAM security best practices
│ ├── aws-sam.mdc # SAM template configuration
│ ├── aws-cloudformation.mdc # CloudFormation best practices
│ ├── aws-vpc.mdc # VPC network architecture
│ ├── aws-gamelift.mdc # GameLift integration patterns
│ ├── aws-bedrock.mdc # Bedrock AI implementation
│ ├── aws-sagemaker.mdc # SageMaker ML development
│ ├── aws-eventbridge.mdc # EventBridge event-driven patterns
│ ├── nextjs.mdc # Next.js application development
│ ├── react.mdc # React component patterns
│ ├── react-native.mdc # React Native mobile development
│ └── expo.mdc # Expo ecosystem integration
├── .github/
│ ├── workflows/
│ │ └── cursor-rules.yml # GitHub workflow for maintenance
│ └── scripts/
│ ├── validate-rules.js # Rule validation script
│ ├── check-aws-best-practices.js # Checks AWS best practices
│ ├── check-frontend-best-practices.js # Checks frontend best practices
│ ├── check-mobile-best-practices.js # Checks mobile best practices
│ └── package.json # Dependencies for scripts
├── install.sh # Installation script
├── LICENSE # MIT License
└── README.md # This file
The easiest way to add these rules to your project is using our installation script:
curl -fsSL https://raw.githubusercontent.com/jimmypocock/cursor-rules/main/install.sh | bash
This script will:
- Download only the necessary rule files
- Create a
.cursor/rules
directory in your project if it doesn't exist - Copy the rules into your project
- Clean up any temporary files
- Detect your project type and provide feedback
If you prefer a manual approach:
-
Clone this repository:
git clone https://github.com/jimmypocock/cursor-rules.git
-
Copy the rules directory to your project:
cp -r cursor-rules/.cursor/rules your-project/.cursor/
-
Open your project in Cursor IDE.
These rules are designed to be a starting point. You should customize them to match your team's specific needs:
- Open any
.mdc
file in the.cursor/rules
directory - Modify the rules to match your specific requirements
- Save the file and Cursor will immediately use the updated rules
The base.mdc
file contains core development principles that apply to all code, regardless of technology:
- Code organization and naming conventions
- Error handling and logging
- Security principles
- Performance optimization
- Documentation standards
Other files contain rules tailored to specific technologies, such as:
- aws-lambda.mdc - Lambda function design and implementation
- aws-dynamodb.mdc - DynamoDB data modeling and access patterns
- nextjs.mdc - Next.js application architecture and components
- react-native.mdc - React Native mobile development
For optimal AI guidance and performance, we recommend configuring these rules with specific attachment modes in Cursor IDE:
- Open Cursor IDE
- Go to Settings > Rules
- Find each rule file and set its attachment mode as recommended below
Rule Type | Recommended Mode | Explanation |
---|---|---|
Core Rules | Always | These fundamental rules should apply to all development |
base.mdc |
Always | Core development principles apply universally |
readme-documentation.mdc |
Always | Documentation standards should be consistent throughout |
Technology-Specific Rules | Auto Attached or Agent Requested | These should only activate when relevant |
AWS service rules | Auto Attached or Agent Requested | Provides AWS guidance only when working with related files |
Web/mobile rules | Auto Attached or Agent Requested | Offers framework-specific advice when in relevant files |
This configuration ensures:
- Consistent Standards: Core best practices are always applied
- Contextual Guidance: Specialized rules appear only when relevant
- Reduced Noise: You won't get AWS advice when working on frontend code
- Better Performance: Reduces context size by only including pertinent rules
To manually override these settings for a specific interaction, you can use the Rules dropdown menu in the chat interface.
For teams, we recommend:
- Centralize Rules - Maintain rules in a dedicated repository
- Review Process - Establish a process for reviewing and updating rules
- Automation - Use the included GitHub workflow to sync rules across projects
- Documentation - Document why certain rules exist to build understanding
This repository includes tools to validate and maintain your cursor rules:
-
Rule Validator: Ensures all rule files follow the correct format
cd .github/scripts npm install node validate-rules.js
-
Best Practice Checkers: Scripts to check for updates to best practices
node check-aws-best-practices.js node check-frontend-best-practices.js node check-mobile-best-practices.js
The included GitHub workflow automates:
- Validation: Ensures all rules follow the correct format
- Distribution: Syncs rules to other repositories you maintain
- Updates: Checks for new best practices and creates issues
- Cursor IDE v0.45 or later (supports MDC format)
- Earlier versions can still use the
.cursorrules
format (deprecated)
We welcome contributions to improve these rules! Please submit a pull request with your suggested changes.
- Fork the repository
- Create a feature branch
- Make your changes
- Submit a pull request
This project is licensed under the MIT License - see the LICENSE file for details.
- Cursor IDE team for creating a fantastic AI-assisted development tool
- AWS for their serverless best practices documentation
- Next.js, React, and React Native communities for their valuable guidance