Prompts2026年4月6日·1 分钟阅读

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 就绪

先审查再安装

这个资产需要先审查。复制的指令会要求 Agent dry-run、列出写入项,确认后再继续。

Needs Confirmation · 62/100策略:需确认
Agent 入口
任意 MCP/CLI Agent
类型
Prompt
安装
Single
信任
信任等级:Community
入口
Cursor Rules Collection — Community .mdc Config Rules
先审查命令
npx -y tokrepo@latest install f6072bcc-ce60-4844-9e12-22cf161a75d4 --target codex

先 dry-run,确认写入项后再运行此命令。

TL;DR
A community-curated collection of .mdc rule files that configure Cursor AI for 40+ tech stacks with project-specific conventions.
§01

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.

§02

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.

§03

How to use

  1. Browse the collection and find rules for your tech stack:
git clone https://github.com/PatrickJS/awesome-cursorrules.git
ls awesome-cursorrules/rules/
  1. 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/
  1. Open your project in Cursor. The rules are automatically loaded and applied to all AI interactions.
§04

Example

# Example .mdc rule file for Next.js + TypeScript
§05

Code Style

  • Use TypeScript strict mode
  • Prefer server components by default
  • Use 'use client' directive only when needed
  • Import from '@/' path alias
§06

Architecture

  • App Router (not Pages Router)
  • Server Actions for mutations
  • Zod for validation
  • Tailwind CSS for styling
§07

Naming

  • Components: PascalCase
  • Files: kebab-case
  • API routes: route.ts in app/api/
§08

Testing

  • Vitest for unit tests
  • Playwright for E2E
  • Test files colocated with source
§09

Related on TokRepo

§10

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.

常见问题

What is a .mdc file?+

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.

Do I need one rule file per project?+

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.

Can I contribute my own rules to the collection?+

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.

Do rules files increase token usage?+

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.

Are these rules compatible with Claude Code?+

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)
🙏

来源与感谢

Created by Pontus Ab and community. Licensed under MIT.

cursor.directory — ⭐ 5,000+

讨论

登录后参与讨论。
还没有评论,来写第一条吧。

相关资产