# Cursor Rules Collection — Community .mdc Config Rules > Community-curated collection of Cursor AI .mdc rule files for 40+ tech stacks. Drop a rule file into your project and Cursor follows your coding standards automatically. 5,000+ stars. ## Install Paste the prompt below into your AI tool: ## Quick Use 1. Browse rules at [cursor.directory](https://cursor.directory) 2. Pick a rule for your tech stack (React, Python, Go, etc.) 3. Save as `.cursor/rules/my-rule.mdc` in your project root 4. Cursor AI automatically follows the rules in every conversation Example for Next.js + TypeScript: ```bash curl -o .cursor/rules/nextjs.mdc https://raw.githubusercontent.com/pontusab/cursor.directory/main/rules/nextjs-typescript.mdc ``` --- ## Intro Cursor Rules Collection is a community-curated repository of .mdc rule files for 40+ technology stacks with 5,000+ GitHub stars. Each rule file is a structured set of coding conventions, patterns, and best practices that Cursor AI follows automatically when you place it in your project. Instead of repeating "use functional components" or "follow PEP 8" every conversation, write it once as a rule and Cursor remembers forever. Best for teams standardizing AI-generated code across projects. Works with: Cursor AI. Setup time: under 1 minute. --- ## Popular Rules ### Frontend | Rule | Stack | Key Conventions | |------|-------|----------------| | `nextjs-typescript.mdc` | Next.js + TS | App Router, Server Components, Tailwind | | `react-hooks.mdc` | React 18+ | Functional components, custom hooks, Zustand | | `vue-composition.mdc` | Vue 3 | Composition API, Pinia, TypeScript | | `svelte-kit.mdc` | SvelteKit | Runes, TypeScript, form actions | | `tailwind-ui.mdc` | Tailwind CSS | Utility-first, responsive, dark mode | ### Backend | Rule | Stack | Key Conventions | |------|-------|----------------| | `python-fastapi.mdc` | FastAPI | Type hints, Pydantic models, async | | `go-clean.mdc` | Go | Clean architecture, error handling | | `rust-idiomatic.mdc` | Rust | Ownership patterns, error handling | | `node-express.mdc` | Express.js | Middleware patterns, validation | | `django-rest.mdc` | Django REST | Serializers, viewsets, permissions | ### DevOps & Infrastructure | Rule | Stack | Key Conventions | |------|-------|----------------| | `docker-best.mdc` | Docker | Multi-stage builds, security | | `terraform-modules.mdc` | Terraform | Module patterns, state management | | `k8s-production.mdc` | Kubernetes | Resource limits, health checks | ### Rule File Format ```markdown --- description: Next.js 14+ with TypeScript conventions globs: ["**/*.tsx", "**/*.ts"] alwaysApply: false --- # Next.js TypeScript Rules ## Component Patterns - Use functional components exclusively - Extract custom hooks for shared logic - Keep components under 150 lines - Use Server Components by default, Client Components only when needed ## File Naming - Components: PascalCase (UserProfile.tsx) - Utilities: camelCase (formatDate.ts) - API routes: route.ts in app/api/ ## State Management - Server state: React Query / SWR - Client state: Zustand (not Redux) - Form state: React Hook Form + Zod ## Styling - Tailwind CSS utility classes - No inline styles or CSS modules - Use cn() for conditional classes ``` ### Creating Custom Rules ```bash mkdir -p .cursor/rules cat > .cursor/rules/my-project.mdc << 'EOF' --- description: My project conventions globs: ["**/*.ts"] alwaysApply: true --- # Project Rules - Always use snake_case for database columns - API responses use camelCase - All functions must have JSDoc comments EOF ``` ### Key Stats - 5,000+ GitHub stars - 40+ technology stacks covered - 200+ community-contributed rules - Compatible with Cursor AI .mdc format - Browsable at cursor.directory ### FAQ **Q: What are Cursor Rules?** A: Cursor Rules are .mdc files that define coding conventions for Cursor AI. Place them in your project and Cursor follows your standards automatically in every conversation. **Q: Are Cursor Rules free?** A: Yes, the collection is open-source. Cursor AI itself requires a subscription. **Q: Can I use these rules with Claude Code?** A: The .mdc format is Cursor-specific, but the conventions can be adapted into CLAUDE.md or SKILL.md files for Claude Code. --- ## Source & Thanks > Created by [Pontus Ab](https://github.com/pontusab) and community. Licensed under MIT. > > [cursor.directory](https://github.com/pontusab/cursor.directory) — ⭐ 5,000+ Thanks to the community for standardizing AI-generated code quality. --- ## 快速使用 1. 在 [cursor.directory](https://cursor.directory) 浏览规则 2. 选择适合你技术栈的规则 3. 保存为 `.cursor/rules/my-rule.mdc` 4. Cursor AI 自动遵循规则 --- ## 简介 Cursor Rules Collection 是一个社区策划的 .mdc 规则文件集合,覆盖 40+ 技术栈,GitHub 5,000+ stars。每个规则文件定义了编码规范和最佳实践,Cursor AI 放入项目后自动遵循。适合需要跨项目标准化 AI 生成代码的团队。 --- ## 来源与感谢 > Created by [Pontus Ab](https://github.com/pontusab) and community. Licensed under MIT. > > [cursor.directory](https://github.com/pontusab/cursor.directory) — ⭐ 5,000+ --- Source: https://tokrepo.com/en/workflows/f6072bcc-ce60-4844-9e12-22cf161a75d4 Author: Prompt Lab