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.
先审查再安装
这个资产需要先审查。复制的指令会要求 Agent dry-run、列出写入项,确认后再继续。
npx -y tokrepo@latest install f6072bcc-ce60-4844-9e12-22cf161a75d4 --target codex先 dry-run,确认写入项后再运行此命令。
What it is
The Cursor Rules Collection is a community-curated set of .mdc configuration files for Cursor AI, covering 40+ technology stacks. These rule files teach Cursor your project's coding conventions, architectural patterns, preferred libraries, and naming standards. Instead of repeating instructions in every prompt, you drop a .mdc file into your project and Cursor follows the rules automatically.
Developers using Cursor who want consistent, project-aware code suggestions without manual prompt engineering benefit most. The collection covers frameworks like Next.js, React, Vue, Django, FastAPI, Go, Rust, and many more.
How it saves time or tokens
Without rules files, developers spend tokens re-explaining project conventions in every Cursor session. The .mdc files front-load this context so Cursor generates code that matches your project from the start. A well-configured rules file reduces back-and-forth corrections by 50% or more. The community collection means you do not need to write rules from scratch -- find your tech stack, customize the file, and start coding.
How to use
- Browse the collection and find rules for your tech stack:
git clone https://github.com/PatrickJS/awesome-cursorrules.git
ls awesome-cursorrules/rules/
- Copy the relevant .mdc file to your project's
.cursor/rules/directory:
mkdir -p .cursor/rules
cp awesome-cursorrules/rules/nextjs-typescript.mdc .cursor/rules/
- Open your project in Cursor. The rules are automatically loaded and applied to all AI interactions.
Example
# Example .mdc rule file for Next.js + TypeScript
Code Style
- Use TypeScript strict mode
- Prefer server components by default
- Use 'use client' directive only when needed
- Import from '@/' path alias
Architecture
- App Router (not Pages Router)
- Server Actions for mutations
- Zod for validation
- Tailwind CSS for styling
Naming
- Components: PascalCase
- Files: kebab-case
- API routes: route.ts in app/api/
Testing
- Vitest for unit tests
- Playwright for E2E
- Test files colocated with source
Related on TokRepo
- AI Coding Tools -- Coding agents and developer configuration tools
- Prompt Library -- Curated prompts and system instructions for AI tools
Common pitfalls
- Rules files are only effective in Cursor IDE. They do not transfer to Claude Code, Copilot, or other AI coding tools without conversion to each tool's format.
- Overly specific rules can conflict with each other. Keep rules high-level and focused on conventions rather than dictating exact implementations.
- The community collection is maintained by contributors with varying quality. Review and customize any rule file before adopting it -- do not blindly trust all suggestions.
常见问题
A .mdc file is Cursor's configuration format for AI rules. It uses Markdown with frontmatter to define instructions that Cursor follows during code generation. Rules can specify coding conventions, architecture patterns, preferred libraries, and naming standards.
You can use multiple .mdc files in the .cursor/rules/ directory. Cursor loads all of them. Organize by concern -- one for code style, one for architecture, one for testing. This makes rules modular and reusable across projects.
Yes. The collection is open source on GitHub. Submit a pull request with your .mdc file following the contribution guidelines. Include the tech stack, framework version, and a brief description.
Rules files add context to every Cursor interaction, which increases token usage slightly. However, the reduction in correction prompts typically results in net token savings. Keep rules concise to minimize overhead.
Not directly. Claude Code uses CLAUDE.md and .claude/rules/ files with a different format. The concepts are similar -- both define project conventions for AI agents -- but the file formats and loading mechanisms differ.
引用来源 (3)
- Awesome Cursor Rules GitHub— Community-curated Cursor rules for 40+ tech stacks
- Cursor Documentation— Cursor supports .mdc rule files for AI configuration
- Anthropic Claude Code Documentation— AI coding assistants benefit from project-specific context
来源与感谢
Created by Pontus Ab and community. Licensed under MIT.
cursor.directory — ⭐ 5,000+
讨论
相关资产
Cursor Directory — Community Cursor Rules & AI Prompts
Community-curated directory of Cursor rules, AI coding prompts, and MCP configurations. Browse by framework, copy with one click, and improve your AI coding setup.
Ruler — One Source of Truth for Agent Rules
Ruler centralizes agent instructions in a .ruler/ directory and generates CLAUDE.md, AGENTS.md, Cursor rules, and MCP configs from one config.
ai-prompts — Prompt Rules for Cursor/Copilot/Cline
ai-prompts is an open-source prompts/rules repo for AI coding tools; verified 1,039★ and documents Cursor `.cursor/rules/` and Copilot instruction files.
Awesome Cursor Rules — AI Coding Standards for 30+ Stacks
Curated .cursorrules files for 30+ tech stacks. Drop into your project root so Cursor AI follows your coding standards automatically.