cursor-rules-generator-mcp
v3.4.0
Published
MCP Server for automatically generating production-quality, modular cursor rules in .cursor/rules/ format for any project
Maintainers
Readme
Cursor Rules Generator
Automatically generate production-quality, modular cursor rules with .mdc format and AGENTS.md support
"Empowering developers with official Cursor rules format"
🎯 What is This?
Cursor Rules Generator is an intelligent system that automatically analyzes your codebase and generates comprehensive, organized cursor rules using the official Cursor format with zero manual input.
NEW in v3.1: Full support for the official Cursor rules format with .mdc (MDC) frontmatter metadata and AGENTS.md alternative format!
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 with official
.mdcformat - ✨ MDC Frontmatter - Each rule includes metadata for intelligent application
- 📝 AGENTS.md Support - Optional simple markdown alternative
- 🎭 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 with Official Format
Generates organized structure using official Cursor .mdc format with nested rules:
your-project/
├── AGENTS.md # Optional: Simple markdown alternative
├── frontend/ # 🌳 NEW: Nested rules for frontend
│ └── .cursor/
│ └── rules/
│ └── main.mdc # Frontend-specific rules
├── backend/ # 🌳 NEW: Nested rules for backend
│ └── .cursor/
│ └── rules/
│ └── main.mdc # Backend-specific rules
└── .cursor/
├── rules/ # Topic-specific rules with MDC frontmatter
│ ├── main.mdc # Main entry point with project context
│ ├── architecture.mdc # Each includes metadata for intelligent application
│ ├── code-style.mdc # description: Applied based on context
│ ├── git-workflow.mdc # globs: File patterns (optional)
│ ├── testing.mdc # alwaysApply: Auto-application flag
│ ├── security.mdc
│ └── performance.mdc
├── prompts/ # Modular role-based system (custom extension)
│ ├── 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🌳 Nested Rules: Automatically creates subdirectory-specific rules that apply when working in:
frontend/- UI components, state management, stylingbackend/- API logic, database, authenticationapi/- Endpoint definitions and validationservices/- Business logic layerpackages/- Monorepo package developmentapps/- Monorepo applicationsterraform/- Infrastructure as code (IaC)packer/- Image building automationkubernetes/ork8s/- Container orchestrationansible/- Configuration managementdocker/- Containerizationhelm/- Kubernetes package management
Learn more: https://cursor.com/docs/context/rules | Community: https://cursor.directory/rules
🆕 What's New in v3.4
- 🚀 Technology Folder Support: Detects and creates nested rules for DevOps/infrastructure folders (terraform, packer, kubernetes, ansible, docker, helm)
- 📖 Community Resources: All rules now reference cursor.directory/rules for examples
- 🔧 Comprehensive Templates: Specialized guidelines for each technology with best practices
- 🎯 Smart Detection: Recognizes both standard and shorthand directory names (kubernetes/k8s)
Previous Updates (v3.3)
- 🌳 Nested Rules Support: Automatically generates subdirectory-specific rules for better organization
- 📁 Smart Directory Detection: Identifies frontend/, backend/, api/, and other key directories
- 🎯 Context-Aware Rules: Rules automatically apply when working in specific directories
- 📚 Enhanced Structure: Follows official Cursor nested rules pattern
Previous Updates (v3.2)
- ✨ Official MDC Format: All
.mdcfiles now include frontmatter metadata - 📝 AGENTS.md Support: Optional simple markdown alternative
- 🗑️ Removed Deprecated
.cursorrules: Now uses.cursor/rules/main.mdcas main entry - 📚 Updated Documentation: Aligned with official Cursor documentation
- 🎯 Rule Metadata: Each rule includes
description,globs, andalwaysApplyfields - 🔗 Official Links: References to https://cursor.com/docs/context/rules
🌍 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:
- Optional: Choose a template:
"List available templates" - Automatic: Analyzer scans your codebase
- Smart Merge: Template best practices + your patterns
- 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 cursor rules based on my actual codebase.
# Commit and cleanup
git add .cursor/ AGENTS.md
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:
.cursor/rules/main.mdcwith quick context (main entry point).cursor/rules/with detailed topic files.cursor/prompts/with individual role files (each role has its own file for easy customization!).cursor/quick-reference.mdcwith commands- Optional
AGENTS.mdfor simple setups
🎯 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?
- Read QUICK_START.md - 5-minute setup
- Try in a test project first
- Review generated files
- Explore docs/STRUCTURE_EXAMPLE.md
- Read docs/USER_GUIDE.md for details
Migration from v1.0?
- Review docs/CHANGELOG.md
- Regenerate with v2.0 for modular structure
- 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
- Fork the repository
- Create a feature branch:
git checkout -b feature/your-feature - Make your changes
- Test thoroughly
- Commit:
git commit -m "feat: Your feature description" - 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
- 📧 Email: [email protected]
- 🐙 GitHub: @ankitpro
- 💡 Mission: Making Cursor development more efficient for everyone
"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 cursor rulesTransform 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: 3.4.0
Last Updated: December 10, 2024
Status: ✅ Production Ready
