Skip to content

d-padmanabhan/cursor-engineering-rules

Repository files navigation

Cursor Engineering Rules

Production-grade Cursor rules for 15+ languages and cloud platforms

License: MIT

Comprehensive, battle-tested Cursor IDE rules for professional software engineering. Curated .mdc files covering languages, cloud platforms, DevOps tools, and engineering patterns.


What's Included

Core Standards

Programming Languages

Cloud Platforms

AI & Machine Learning

DevOps & Infrastructure

Security & Testing

Patterns & Best Practices

Utilities

Scripts

Utility scripts for Cursor maintenance:

# Preview cleanup
./scripts/cursor-maintenance.sh --dry-run

# Run cleanup
./scripts/cursor-maintenance.sh

See scripts/README.md for details.


Cursor Commands

Workflow commands for explicit phase transitions. Type /command in Cursor chat to trigger.

Command Purpose
/init Initialize task - analyze project, detect complexity
/plan Enter planning phase - analyze, design, document approach
/creative Enter creative phase - explore design options for complex tasks
/qa Run QA validation - check dependencies, config, environment
/build Enter implementation phase - write code following approved plan
/review Enter review phase - verify implementation, suggest improvements
/self-review Comprehensive local PR review (compare branch to main)
/quick-review Fast critical issues check (pre-commit validation)
/check-progress Review work progress, propose commit message
/archive Archive task - document lessons learned, update knowledge base

Installation:

# Copy to your project
cp -r /path/to/cursor-engineering-rules/commands .cursor/commands

# Or symlink
ln -s /path/to/cursor-engineering-rules/commands .cursor/commands

Workflow:

Simple:   /init -> /build -> /review
Moderate: /init -> /plan -> /qa -> /build -> /review
Complex:  /init -> /plan -> /creative -> /qa -> /build -> /review -> /archive

See commands/README.md for detailed documentation.


MCP Server

Model Context Protocol (MCP) server for Cursor and other MCP-compatible AI clients.

# Install
cd mcp/cursor-rules-mcp
npm install
npm run build
npm link

# Configure Claude Desktop
# Add to ~/Library/Application Support/Claude/claude_desktop_config.json:
{
  "mcpServers": {
    "cursor-engineering-rules": {
      "command": "cursor-rules-mcp"
    }
  }
}

Features:

  • Fetch workflow guide (Plan/Implement/Review)
  • Fetch specific rules by category/topic
  • List all available rules
  • Just-in-time rule loading (load only what you need)

See mcp/cursor-rules-mcp/README.md for full documentation.


Configuration Approaches

Cursor supports two ways to load rules. Choose based on your needs:

Approach A: Frontmatter-based (No .cursorrules needed)

Rules with alwaysApply: true in their frontmatter load automatically when placed in .cursor/rules/.

Best for: Personal setup, global rules across all projects

# Symlink to your home directory (applies to all projects)
mkdir -p ~/.cursor
ln -s /path/to/cursor-engineering-rules/rules ~/.cursor/rules

# Or symlink per-project
mkdir -p .cursor
ln -s /path/to/cursor-engineering-rules/rules .cursor/rules

Rules that auto-load (alwaysApply: true):

Rule Purpose
010-workflow.mdc Plan/Build/Review workflow
020-agent-audit.mdc Agent audit requirements
100-core.mdc Core coding standards
110-configuration.mdc Configuration management
120-utilities.mdc CLI tools
130-git.mdc Git conventions
310-security.mdc Security best practices
800-markdown.mdc Markdown formatting

Other rules load based on file patterns or explicit request.

Approach B: Explicit .cursorrules file

Use a .cursorrules file for explicit control over which rules load.

Best for: Team projects, project-specific subsets, version-controlled config

# .cursorrules - Option 1: Load all rules from directory
rulesDirectory: .cursor/rules

# .cursorrules - Option 2: Explicit rule list
rules:
  - .cursor/rules/100-core.mdc
  - .cursor/rules/200-python.mdc
  - .cursor/rules/410-aws.mdc

Note

When using .cursorrules, rules with alwaysApply: true still load automatically in addition to your explicit list.

See examples/.cursorrules-example for tech-stack templates.

Multi-Repo Workspaces

For workspaces with many repositories, rules load based on file patterns. Open a .py file and Python rules load; open a .go file and Go rules load. Most repos need zero per-repo configuration.

See Multi-Repo Workspaces for detailed guidance.


Quick Start

Option 1: Use Individual Rules

Copy specific rules to your project:

# Create Cursor rules directory
mkdir -p .cursor/rules

# Copy specific rules you need
cp path/to/cursor-engineering-rules/rules/200-python.mdc .cursor/rules/
cp path/to/cursor-engineering-rules/rules/410-aws.mdc .cursor/rules/

# (Optional) Copy workflow templates (tasks, active-context, etc.)
mkdir -p .cursor/rules/templates
cp path/to/cursor-engineering-rules/rules/templates/*.template .cursor/rules/templates/

Option 1.5: Use Setup Scripts (Convenience)

If you keep a shared checkout of this repo, you can bootstrap a workspace with:

/path/to/cursor-engineering-rules/setup-workspace.sh -S -l .

Add to your .cursorrules file:

rules:
  - .cursor/rules/200-python.mdc
  - .cursor/rules/410-aws.mdc

Option 2: Use All Rules (Recommended)

Symlink the entire rules directory:

# From your project root
ln -s /absolute/path/to/cursor-engineering-rules/rules .cursor/rules

Configure .cursorrules:

# Load all rules
rulesDirectory: .cursor/rules

# Or be selective with alwaysApply rules
rules:
  - .cursor/rules/100-core.mdc
  - .cursor/rules/200-python.mdc
  - .cursor/rules/310-security.mdc

Option 3: Cherry-Pick by Technology

Create a custom .cursorrules that includes only relevant rules:

# Python + AWS project
rules:
  - .cursor/rules/100-core.mdc
  - .cursor/rules/130-git.mdc
  - .cursor/rules/200-python.mdc
  - .cursor/rules/410-aws.mdc
  - .cursor/rules/180-terraform.mdc
  - .cursor/rules/310-security.mdc
  - .cursor/rules/300-testing.mdc

Rule Priorities

Rules have alwaysApply flags and priority levels:

  • Always Apply: Core standards (100-core, 130-git, 310-security)
  • High Priority: Language-specific rules for your stack
  • Medium Priority: Platform/tool-specific rules
  • Low Priority: Documentation and utility guides

See rules/INDEX.md for complete categorization.


Features

Production Quality

  • Battle-tested patterns from real-world projects
  • Security-first approach (OWASP Top 10, secret scanning)
  • Performance-focused (benchmarks, optimization patterns)

Comprehensive Coverage

  • 6 programming languages (Python, Go, TypeScript, JavaScript, Rust, Bash)
  • 4 major cloud platforms (AWS, Azure, GCP, Cloudflare)
  • 10+ DevOps tools (Terraform, K8s, Docker, Ansible, Helm, GitHub Actions)
  • AI/ML integration (OpenAI, Claude, Bedrock, Vertex AI)

Code Examples

  • Real-world examples for every pattern
  • Good vs Bad comparisons
  • Common mistakes and anti-patterns
  • Quick reference sections

Modern Standards

  • Latest versions (Python 3.12+, Go 1.25+, Node 22+)
  • Modern patterns (async/await, generics, type safety)
  • Current tools (ripgrep, fd, fzf, just, jq)

Customization

Workspace-Specific Overrides

Use 999-local-overrides.mdc for project-specific rules:

# Copy to your project
cp rules/999-local-overrides.mdc .cursor/rules/999-local-overrides.mdc

# Edit to add project-specific rules
vim .cursor/rules/999-local-overrides.mdc

Creating Custom Rules

Follow the standard format:

---
title: My Custom Rule
description: Project-specific patterns
priority: 900
alwaysApply: false
files:
  include:
    - "**/*.py"
---

# My Custom Rule

## Pattern 1
[Your custom patterns here]

Contributing

Contributions are welcome! Please see .github/CONTRIBUTING.md for guidelines.

Areas for Contribution

  • Additional language support (Java, C#, Ruby, PHP)
  • More cloud platform patterns
  • Industry-specific patterns (fintech, healthcare, etc.)
  • Performance benchmarks
  • Additional code examples

License

MIT License - see LICENSE for details.


Acknowledgments

This project was inspired by and incorporates patterns from:

Thanks to @DaKaZ for suggesting the commands-based workflow approach.


Related Projects

  • dotcursorrules.com - Community directory of framework-specific cursor rules (Next.js, Laravel, React, etc.). Use dotcursorrules for framework recipes and this repo for engineering discipline.
  • ACE-FCA - Advanced Context Engineering for Coding Agents. Excellent methodology on context management, "frequent intentional compaction", and Research -> Plan -> Implement workflows.
  • Cursor Memory Bank - Command-based workflow system using Cursor's /commands feature for progressive rule loading.
  • Shellwright - Playwright for the shell. MCP server for terminal automation, screenshots, and GIF recording. Excellent example of MCP server implementation with PTY session management.
  • eslint-config-airbnb - JavaScript style guide
  • google-styleguides - Google's style guides
  • uber-go-guide - Uber's Go style guide

Note

Three Ways to Load Context: This repo supports multiple approaches:

  1. Rules (.mdc files) - Auto-load based on alwaysApply flags and file patterns
  2. Commands (/plan, /build, etc.) - Explicit phase transitions for progressive disclosure
  3. MCP Server - On-demand rule loading via tool calls

Use all three together for maximum flexibility, or pick what works for your workflow.

About

Engineering rules and best practices for Cursor AI

Resources

License

Contributing

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published