TOKREPO · 主题包
稳定

Cursor 规则库

Cursor 即装即用 `.mdc` 规则包 — Python / React / Devin 工程师模式 + 从文档自动生成 MDC 的工具。

9 个资产

这个 pack 装了什么

Cursor 的 Project Rules(.cursor/rules/ 下的 .mdc 文件)是给一个代码库锁死风格、架构、流程预期的最高杠杆工具。Cursor 默认安装不带规则;团队要么从零写(慢、漂移),要么每个项目粘贴同样模板(无共享维护)。这个 pack 收齐 九个 .mdc,覆盖多数团队真想要的 80%,加一个从你现有文档生成定制规则的 MDC 生成器。

# 资产 类型 覆盖什么
1 Python 规则 语言 类型 / ruff / pytest / 异步模式
2 React 规则 语言 hooks / TypeScript / 无障碍 / 文件布局
3 Devin 工程师模式 操作手册:先规划 / 外科手术式改 / 不越界
4 MDC 生成器 工具 docs/ 出定制 .mdc
5 Next.js 模式 框架 App Router / server actions / 数据获取
6 Tailwind / shadcn 规则 UI utility-first 约定 / 组件组合
7 API 设计规则 后端 REST/GraphQL 约定 / 错误 envelope
8 测试纪律规则 质量 golden-file / snapshot / mutation 测试
9 安全审查规则 质量 每个 diff 都要标的 OWASP top-10 模式

为什么要装

没有规则的 Cursor agent 是通才。装上规则就是有立场的队友 —— 它已经懂你的栈、习语、护栏。装这个 pack 后团队报的三个具体收益:

  1. 新人 onboarding 从天到小时。新工程师 Cmd-K 出来的代码已经长得像代码库其他部分,因为 Cursor 在读人类入职第一天读的同一份约定文档。
  2. review 疲劳下降。reviewer 不再每个 PR 都揪同样五个风格/架构小问题 —— 规则在生成阶段就抓了。review 聚焦逻辑和取舍,那才是人类增值最多的地方。
  3. AI 越界被限制。Devin 工程师模式规则建立「先规划、最小修改、别重构无关代码」。单这条规则就阻止了 Cursor 最常见的失败:一行 bug 修变成 200 行没要求的「优化」。

一条命令装齐

# 装整个 pack 进当前项目
tokrepo install pack/cursor-rules-library

# 或者只装单个语言 / 框架
tokrepo install python-cursor-rules
tokrepo install react-cursor-rules
tokrepo install devin-engineer-mode

TokRepo CLI 把 .mdc 文件写进 repo 的 .cursor/rules/。Cursor 下次 prompt 就拿到 —— 不用重启。从你现有文档重新生成规则:

tokrepo run mdc-generator --input ./docs --output ./.cursor/rules/project.mdc

常见坑

  • 一条大规则覆盖一切。Cursor 按 glob 范围每次请求加载匹配规则。一个 2000 行的 .mdc 把你每次 prompt 的上下文预算炸掉。按域拆:语言规则一个文件,架构一个,安全一个。
  • 没设 glob 范围。一个后端规则在每个前端文件都触发会浪费 token 还把 agent 带偏。在 frontmatter 用 globs: 把规则限到 **/*.pyapp/**/*.tsx 等。
  • 非 Devin 工具忽略 Devin 工程师模式。这条规则其实不是 Devin 专属 —— 它是通用的「像高级工程师那样」操作手册。在 Cursor / Claude Code / Codex CLI / Cline 一样能跑(用 Skill 生态 pack 的转换器)。
  • 把规则当静态的。栈在演进,规则也得演进。.cursor/rules/ 进版本控制,像别的代码一样在 PR 里 review 改动。文档变时 MDC 生成器能重新发规则。
  • 粘贴跟现实漂移的代码示例。规则说「X 用 fooBar()」结果代码里是 bar_foo(),比没规则更糟。要么示例最少最抽象,要么用 MDC 生成器从真代码生成。

这个 pack 一个不够时

如果你同时用 Cursor 和别的 AI 工具(Claude Code / Codex CLI 等),直接写 .mdc 把你锁死在 Cursor。Skill 生态 pack 让你用规范 skill 格式写一次,给 Cursor 出 .mdc、给 Codex CLI 出 AGENTS.md、给 Claude Code 出 subagent 等。只用 Cursor 就用这个 Cursor 规则库 pack;多工具就转用 skill。

纯 Cursor 重度用户:配合 AI 代码编辑器横评 pack,看 Cursor 跟 Zed / Cody / Continue / Morphic / OpenCode 比哪赢哪输 —— 内部推 Cursor 或决定何时换工具时有用。

安装 · 一行命令
$ tokrepo install pack/cursor-rules-library
丢给 agent,或粘到终端
包内含什么

9 个资产打包就绪

Prompt#01
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.

by TokRepo Curated·389 views
$ tokrepo install awesome-cursor-rules-ai-coding-standards-30-stacks-ca000374
Prompt#02
Cursor Tips — Advanced AI Coding Workflow Guide

Comprehensive guide to advanced Cursor workflows. Covers Composer, multi-file edits, .cursorrules, codebase indexing, and prompt engineering for 10x AI coding productivity.

by Prompt Lab·138 views
$ tokrepo install cursor-tips-advanced-ai-coding-workflow-guide-b7e65852
Config#03
Cursor Rules: Python — Clean Code with AI

Cursor rules for Python development. Enforces PEP 8 style, type hints, docstrings, pytest patterns, and modern Python 3.12+ idioms.

by Cursor · Anysphere·117 views
$ tokrepo install cursor-rules-python-clean-code-ai-f18133e8
Config#04
Cursor Rules MDC Generator — Auto-Generate from Docs

Auto-generate Cursor .mdc rule files for any library using Exa semantic search and LLM-powered documentation extraction.

by AI Open Source·95 views
$ tokrepo install cursor-rules-mdc-generator-auto-generate-docs-8ced00e7
Config#05
Cursor Rules: React + TypeScript — Component & Hooks Patterns

Cursor rules for React with TypeScript. Enforces functional components, hooks patterns, proper typing, and testing conventions.

by Cursor · Anysphere·96 views
$ tokrepo install cursor-rules-react-typescript-component-hooks-patterns-ac71b14f
Config#06
Devin Cursorrules — Turn Cursor into an AI Engineer

A .cursorrules configuration that gives Cursor/Windsurf Devin-like capabilities: automated planning, self-correction, web browsing, and multi-agent collaboration. 6,000+ GitHub stars.

by AI Open Source·93 views
$ tokrepo install devin-cursorrules-turn-cursor-into-ai-engineer-92824589
Config#07
Awesome Cursor Rules MDC — Auto-Generated .mdc Files

Collection of auto-generated Cursor .mdc rule files for 800+ libraries using Exa search and LLM. Drop into .cursor/rules/ for AI-aware coding standards. CC0, 3,400+ stars.

by AI Open Source·64 views
$ tokrepo install awesome-cursor-rules-mdc-auto-generated-mdc-files-f38ab5c1
Prompt#08
Cursor AI Tips — Reddit Wisdom & Best Practices

Comprehensive Cursor AI guide with keyboard shortcuts, Composer mode tips, .cursorrules examples, Max Mode pricing strategies, model benchmarks, and safety protocols. Curated from Reddit community.

by Prompt Lab·105 views
$ tokrepo install cursor-ai-tips-reddit-wisdom-best-practices-1a138ad3
Prompt#09
Cursor Tab — AI Autocomplete That Predicts Your Next Edit

Cursor's predictive code completion that suggests multi-line edits before you type. Cursor Tab uses context from your codebase and recent changes to predict the next logical edit.

by Prompt Lab·74 views
$ tokrepo install cursor-tab-ai-autocomplete-predicts-your-next-edit-6efaef05
FAQ

常见问题

这些 .mdc 规则免费吗?

免费 —— 九个 pack 都是 MIT 协议,住在 TokRepo 公开注册中心。MDC 生成器是 TokRepo CLI 命令,也免费。你唯一付钱的是 Cursor 订阅,跟这些规则独立。无需注册;公开资产 tokrepo install 不用账号就能用。

比自己写规则强在哪?

如果你已经有项目专属约定写在某处,MDC 生成器一条命令就能从现有文档出定制 .mdc —— 通常比从空白开始好。对语言和框架默认值(Python / React / Next.js)来说,从这个 pack 开始改比从零写快。pack 规则在真代码库实战过;你的微调加在上面。

用 Codex CLI 或 Claude Code 也能用吗?

Cursor .mdc 文件格式是 Cursor 专属。同样内容可以移植到 AGENTS.md(Codex CLI)/ CLAUDE.md 或 subagent(Claude Code)/ .clinerules(Cline)等。两条路:(1) 给 Cursor 装这个 pack 然后给别的工具重写,或者 (2) 用 Skill 生态 pack 按 skill 格式写自动出 .mdc 加其他全部。多工具团队选 (2)。

跟 Skill 生态 pack 啥区别?

这个 pack 出即用 Cursor 规则 —— 装上 Cursor 就工作。Skill 生态出工具:可移植 skill 写一次,转换器出 Cursor .mdc / Codex AGENTS.md 加 12 个其他目标。只用 Cursor 这个 pack 更快。可能以后加别的 AI 工具就从 Skill 生态开始,永远不用重新移植你的约定。

运维坑:规则会拖慢 Cursor 吗?

规则给每个匹配 glob 的 prompt 加 token,每个会话多加几百毫秒和几分钱。解决办法是 glob 范围:别在 TypeScript 文件加载 Python 规则。Cursor 规则 UI 显示某次 prompt 触发了哪些规则 —— 用它找 glob 太宽的规则。范围合理的 9 规则库通常每次 prompt token 成本加不到 2%。

更多主题包

12 个主题包 · 80+ 精选资产

回首页浏览全部精选合集

返回主题包总览