https://github.com/jimmypocock/cursor-rules
Best practices for Cursor IDE with AWS, Next.js, and React Native
https://github.com/jimmypocock/cursor-rules
ai-assistant aws cursor cursor-rules nextjs react-native serverless typescript
Last synced: 4 months ago
JSON representation
Best practices for Cursor IDE with AWS, Next.js, and React Native
- Host: GitHub
- URL: https://github.com/jimmypocock/cursor-rules
- Owner: jimmypocock
- License: mit
- Created: 2025-05-01T23:28:42.000Z (8 months ago)
- Default Branch: main
- Last Pushed: 2025-05-01T23:44:22.000Z (8 months ago)
- Last Synced: 2025-05-02T00:25:43.569Z (8 months ago)
- Topics: ai-assistant, aws, cursor, cursor-rules, nextjs, react-native, serverless, typescript
- Language: Shell
- Homepage:
- Size: 0 Bytes
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- awesome-rainmana - jimmypocock/cursor-rules - Best practices for Cursor IDE with AWS, Next.js, and React Native (Shell)
README
# Cursor Rules for AWS Serverless & Modern Applications
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.
## Quick Installation
Add these rules to your existing project with a single command:
```bash
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.
## Overview
This repository contains a collection of configuration files for [Cursor IDE](https://cursor.sh/) 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.
## Key Components
1. **Base Rules** - Core development principles that apply across all projects, including coding conventions, error handling, and security best practices.
2. **TypeScript Rules** - Specific guidelines for TypeScript development, including type definitions, modern features, and organization patterns.
3. **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
4. **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
5. **Mobile Development Rules**:
- **React Native** - Project setup, component architecture, navigation, and performance optimization
- **Expo** - Expo ecosystem integration, EAS services, and deployment strategies
6. **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
## Benefits of This Approach
- **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
## Implementation Details
The rules follow the modern MDC (Markdown Configuration) format introduced in Cursor v0.45+, which allows:
1. **Domain-specific configurations** targeting specific file patterns
2. **Hierarchical rule inheritance** with base rules extended by more specialized ones
3. **Agent-centric instructions** treating the AI as a specialized coding assistant
## Directory Structure
```
.
├── .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
```
## Installation Options
### Option 1: One-Line Installation (Recommended)
The easiest way to add these rules to your project is using our installation script:
```bash
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
### Option 2: Manual Installation
If you prefer a manual approach:
1. Clone this repository:
```bash
git clone https://github.com/jimmypocock/cursor-rules.git
```
2. Copy the rules directory to your project:
```bash
cp -r cursor-rules/.cursor/rules your-project/.cursor/
```
3. Open your project in Cursor IDE.
## Customizing Rules
These rules are designed to be a starting point. You should customize them to match your team's specific needs:
1. Open any `.mdc` file in the `.cursor/rules` directory
2. Modify the rules to match your specific requirements
3. Save the file and Cursor will immediately use the updated rules
## Rule Types
### Base 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
### Technology-Specific Rules
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
## Recommended Attachment Modes
For optimal AI guidance and performance, we recommend configuring these rules with specific attachment modes in Cursor IDE:
### Setting Up Attachment Modes
1. Open Cursor IDE
2. Go to Settings > Rules
3. Find each rule file and set its attachment mode as recommended below
### Recommended Configuration
| 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.
## Team Collaboration
For teams, we recommend:
1. **Centralize Rules** - Maintain rules in a dedicated repository
2. **Review Process** - Establish a process for reviewing and updating rules
3. **Automation** - Use the included GitHub workflow to sync rules across projects
4. **Documentation** - Document why certain rules exist to build understanding
## Validation Tools
This repository includes tools to validate and maintain your cursor rules:
1. **Rule Validator**: Ensures all rule files follow the correct format
```bash
cd .github/scripts
npm install
node validate-rules.js
```
2. **Best Practice Checkers**: Scripts to check for updates to best practices
```bash
node check-aws-best-practices.js
node check-frontend-best-practices.js
node check-mobile-best-practices.js
```
## GitHub Integration
The included GitHub workflow automates:
1. **Validation**: Ensures all rules follow the correct format
2. **Distribution**: Syncs rules to other repositories you maintain
3. **Updates**: Checks for new best practices and creates issues
## Compatibility
- Cursor IDE v0.45 or later (supports MDC format)
- Earlier versions can still use the `.cursorrules` format (deprecated)
## Contributing
We welcome contributions to improve these rules! Please submit a pull request with your suggested changes.
1. Fork the repository
2. Create a feature branch
3. Make your changes
4. Submit a pull request
## License
This project is licensed under the MIT License - see the LICENSE file for details.
## Acknowledgments
- 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