Skip to content

ankitpro/cursor-rules-generator

Repository files navigation

Cursor Rules Generator

Automatically generate production-quality, modular .cursorrules for any project

Version License

"Empowering developers, one cursor rule at a time"


🎯 What is This?

Cursor Rules Generator is an intelligent system that automatically analyzes your codebase and generates comprehensive, organized cursor rules with zero manual input.

Instead of writing rules manually or using generic templates, this system:

  • πŸ” Scans your repository - Dependencies, structure, code patterns, git workflow, environment variables
  • πŸ“Š Analyzes everything - Compares your patterns against best practices
  • 🎯 Gives you options - Use current patterns, adopt best practices, or hybrid
  • πŸ“ Generates modular structure - Organized files instead of one massive document
  • 🎭 Includes role-based system - Cursor automatically adopts appropriate expert roles

✨ Key Features

πŸ€– Fully Automated

  • One simple prompt - No manual project description needed
  • Intelligent scanning - Detects all technologies, frameworks, patterns
  • Zero placeholders - All values from actual codebase analysis

πŸ“ Modular Structure

Generates organized structure instead of single massive file:

your-project/
β”œβ”€β”€ .cursorrules              # Main entry point (~150 lines)
└── .cursor/
    β”œβ”€β”€ rules/                # Topic-specific detailed rules
    β”‚   β”œβ”€β”€ architecture.mdc
    β”‚   β”œβ”€β”€ code-style.mdc
    β”‚   β”œβ”€β”€ git-workflow.mdc
    β”‚   β”œβ”€β”€ testing.mdc
    β”‚   β”œβ”€β”€ security.mdc
    β”‚   └── performance.mdc
    β”œβ”€β”€ prompts/              # Modular role-based system
    β”‚   β”œβ”€β”€ README.mdc        # Role announcement guide
    β”‚   β”œβ”€β”€ documentation-writer.mdc
    β”‚   β”œβ”€β”€ frontend-developer.mdc
    β”‚   β”œβ”€β”€ backend-developer.mdc
    β”‚   β”œβ”€β”€ software-architect.mdc
    β”‚   β”œβ”€β”€ code-reviewer.mdc
    β”‚   β”œβ”€β”€ qa-engineer.mdc
    β”‚   β”œβ”€β”€ security-analyst.mdc
    β”‚   β”œβ”€β”€ performance-engineer.mdc
    β”‚   └── database-administrator.mdc
    └── quick-reference.mdc   # Commands & patterns

🌍 Universal Support

  • Languages: JavaScript/TypeScript, Python, Go, Rust, Ruby, Java, PHP, Dart, Elixir, Swift
  • Frameworks: React, Vue, Angular, Next.js, FastAPI, Django, Flask, Express, and more
  • Project Types: Web apps, APIs, mobile apps, CLI tools, libraries, microservices

🎭 Role-Based System

Cursor automatically announces and adopts appropriate expert roles:

  • πŸ“ Documentation Writer
  • βš›οΈ Frontend Developer
  • πŸ”§ Backend Developer
  • πŸ—οΈ Software Architect
  • πŸ§ͺ QA Engineer
  • πŸ”’ Security Analyst
  • And more...

🎨 Template Library (NEW in v3.0!)

Start with pre-built templates for popular tech stacks, then let our analyzer customize them for your project:

Available Templates:

Frameworks:

  • βš›οΈ React + TypeScript + Tailwind
  • ⚑ Next.js App Router
  • 🐍 Python FastAPI
  • 🌐 Django REST Framework
  • πŸ’š Vue 3 + TypeScript
  • πŸš€ Express + TypeScript

Full Stacks:

  • 🎯 Full-Stack TypeScript
  • πŸ—οΈ Microservices Architecture

Languages:

  • 🐍 Python Best Practices
  • πŸ¦€ Rust Patterns

DevOps & Cloud (NEW!):

  • πŸ”§ Terraform + AWS
  • ☸️ Kubernetes + Helm
  • 🐳 Docker Compose
  • πŸ”„ GitHub Actions CI/CD

How It Works:

  1. Optional: Choose a template: "List available templates"
  2. Automatic: Analyzer scans your codebase
  3. Smart Merge: Template best practices + your patterns
  4. Result: Best of both worlds!

See TEMPLATES.md for details on each template.


πŸš€ Quick Start

Method 1: MCP Server (Recommended)

Set up once, use everywhere! The MCP server integrates directly with Cursor.

No installation needed - uses npx to run automatically!

# Add to ~/.cursor/mcp.json:
{
  "mcpServers": {
    "cursor-rules-generator": {
      "command": "npx",
      "args": ["-y", "cursor-rules-generator-mcp@latest"],
      "env": {
        "TEMPLATE_REPO_URL": "https://github.com/ankitpro/cursor-rules-generator.git"
      }
    }
  }
}

That's it! Restart Cursor, then use in any project:

"Generate cursor rules for /path/to/my/project"

The MCP server automatically:

  • βœ… Fetches latest templates from GitHub
  • βœ… Analyzes your project
  • βœ… Generates cursor rules
  • βœ… No manual installation required!

πŸ“– Full MCP Setup Guide: MCP_SETUP.md

Method 2: Folder Method (Traditional)

Copy the folder to each project:

# Clone and copy to your project
git clone https://github.com/ankitpro/cursor-rules-generator.git
cp -r cursor-rules-generator /path/to/your/project/
cd /path/to/your/project

# In Cursor:
@cursor-rules-generator

Scan my repository and generate comprehensive .cursorrules based on my actual codebase.

# Commit and cleanup
git add .cursorrules .cursor/
git commit -m "chore: Add cursor rules"
rm -rf cursor-rules-generator

πŸ“š Documentation

File Purpose
README.md Project overview - Start here!
TEMPLATES.md NEW v3.0! Template library guide
CHANGELOG.md v3.0 features and changelog
MCP_SETUP.md MCP Server setup guide
QUICK_START.md 5-minute setup guide (folder method)
docs/USER_GUIDE.md Complete user guide
docs/GENERATOR_TEMPLATE.md Master template (for Cursor AI)
docs/STRUCTURE_EXAMPLE.md Visual example of generated structure
CONTRIBUTING.md Contribution guidelines

πŸ’‘ How It Works

Step 1: Automated Analysis

Cursor scans your repository:

  • πŸ“¦ Dependencies - package.json, requirements.txt, go.mod, etc.
  • πŸ—οΈ Structure - Monorepo, frontend/backend split, folder organization
  • πŸ“ Code Patterns - Naming conventions, error handling, function patterns
  • 🌳 Git Workflow - Branches, commits, versioning
  • βš™οΈ Environment - .env files, configuration
  • πŸ§ͺ Testing - Framework, patterns, coverage

Step 2: Analysis Report

Cursor generates comprehensive report:

πŸ” Repository Analysis Complete

πŸ“¦ Detected Technologies:
- Frontend: React 18.2.0 with TypeScript
- Backend: Node.js 20.x with Express 4.x
- Database: PostgreSQL
- Testing: Jest + React Testing Library

πŸ“ Code Patterns Found:
βœ… Consistent camelCase for functions
⚠️ Mixed error handling (suggest standardization)
❌ No JSDoc comments found

πŸ’‘ Recommendations:
1. Add JSDoc to public APIs
2. Standardize error handling
3. Adopt conventional commits

🎯 Choose:
A) Use current patterns (as-is documentation)
B) Apply best practices (with improvements)
C) Hybrid approach (choose per topic)

Step 3: Modular Generation

Based on your choice, Cursor creates:

  • Main .cursorrules with quick context
  • .cursor/rules/ with detailed topic files
  • .cursor/prompts/ with individual role files (each role has its own file for easy customization!)
  • .cursor/quick-reference.mdc with commands

🎯 Use Cases

For Individual Developers

  • πŸš€ New Projects - Set up quality standards from day one
  • πŸ“š Existing Projects - Document actual patterns and conventions
  • πŸ”„ Multiple Projects - Maintain consistency across repos

For Teams

  • πŸ‘₯ Onboarding - New members learn standards progressively
  • πŸ“Š Code Reviews - Standardized patterns for consistent reviews
  • πŸ”„ Collaboration - Share and sync coding standards

For Organizations

  • 🏒 Multi-team Projects - Ensure consistency across teams
  • πŸ“ˆ Quality Standards - Enforce best practices automatically
  • πŸ”§ Maintenance - Easy updates to standards over time

🌟 Examples

React + Node.js Full-Stack

Automatically detects and documents:

  • React hooks patterns
  • Material-UI component usage
  • Express service layer
  • Jest + React Testing Library
  • PostgreSQL parameterized queries

Python FastAPI Backend

Automatically detects and documents:

  • Async/await patterns
  • Type hints usage
  • Pydantic models
  • pytest patterns
  • SQLAlchemy queries

Go Microservices

Automatically detects and documents:

  • Package organization
  • Error handling patterns
  • Testing with table-driven tests
  • Docker deployment
  • gRPC or REST API design

πŸŽ“ Learning Path

New to Cursor Rules?

  1. Read QUICK_START.md - 5-minute setup
  2. Try in a test project first
  3. Review generated files
  4. Explore docs/STRUCTURE_EXAMPLE.md
  5. Read docs/USER_GUIDE.md for details

Migration from v1.0?

  1. Review docs/CHANGELOG.md
  2. Regenerate with v2.0 for modular structure
  3. Migrate custom rules to appropriate files

🀝 Contributing

Contributions are welcome and encouraged! Whether you're fixing bugs, adding features, or improving documentation, your input is valued.

πŸ“š See CONTRIBUTING.md for complete guidelines

Quick Start for Contributors

  1. Fork the repository
  2. Create a feature branch: git checkout -b feature/your-feature
  3. Make your changes
  4. Test thoroughly
  5. Commit: git commit -m "feat: Your feature description"
  6. Push and create a Pull Request

Areas for Contribution

  • 🌍 Add support for more languages/frameworks
  • πŸ“ Create rule templates for common project types
  • πŸ§ͺ Add comprehensive tests
  • πŸ”§ Add CI/CD integration checks
  • πŸ“Š Build rule validation tool
  • 🌐 Create community rule sharing platform
  • πŸ“ Improve documentation and examples

All skill levels welcome! See CONTRIBUTING.md for detailed guidelines.


πŸ‘¨β€πŸ’» Author

Ankit Agarwal

"Born from real-world needs, built for real-world developers."


πŸ“„ License

MIT License - See LICENSE file for details


πŸ™ Acknowledgments

  • Inspired by the Cursor community
  • Based on production experience and best practices from real-world usage
  • Built for developers, by developers

πŸ“ž Support

  • πŸ’¬ GitHub Issues: For bug reports and feature requests
  • πŸ“š Documentation: Comprehensive guides in this repository

πŸš€ Get Started Now

MCP Server (Recommended)

# Add to ~/.cursor/mcp.json:
{
  "mcpServers": {
    "cursor-rules-generator": {
      "command": "npx",
      "args": ["-y", "cursor-rules-generator-mcp@latest"],
      "env": {
        "TEMPLATE_REPO_URL": "https://github.com/ankitpro/cursor-rules-generator.git"
      }
    }
  }
}

# Restart Cursor, then use in any project:
"Generate cursor rules for /path/to/my/project"

Folder Method (Traditional)

# Clone and copy to your project
git clone https://github.com/ankitpro/cursor-rules-generator.git
cp -r cursor-rules-generator /path/to/your/project/

# Open in Cursor:
@cursor-rules-generator
Scan my repository and generate comprehensive .cursorrules

Transform your development workflow with intelligent, automated cursor rules! 🎊


πŸ“¦ Installation Scripts

  • ./install-mcp.sh - Automated MCP server setup
  • ./verify-setup.sh - Verify installation is correct

Version: 2.0.0
Last Updated: November 10, 2025
Status: βœ… Production Ready

About

No description, website, or topics provided.

Resources

License

Contributing

Stars

Watchers

Forks

Sponsor this project

Packages

No packages published