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.
先审查再安装
这个资产需要先审查。复制的指令会要求 Agent dry-run、列出写入项,确认后再继续。
npx -y tokrepo@latest install f38ab5c1-c3f6-4d0c-b055-37dbfb654e31 --target codex先 dry-run,确认写入项后再运行此命令。
What it is
Awesome Cursor Rules MDC is an open-source repository that auto-generates .mdc (Markdown Cursor) rule files for 800+ libraries using Exa search and LLM processing. Each .mdc file teaches Cursor AI the conventions, best practices, and API patterns of a specific library so the editor produces higher-quality suggestions.
The project targets developers who use Cursor as their primary editor and want framework-aware code generation without manually writing custom rules for every dependency.
How it saves time or tokens
Without cursor rules, the AI assistant in Cursor relies on its training data alone, which may be outdated or generic. By loading a .mdc file that encodes the latest API surface and idioms for a library, you reduce the back-and-forth prompting needed to get correct code. Each rule file is compact enough to fit within Cursor's context budget, so it does not waste tokens on irrelevant information. The auto-generation pipeline keeps rules current as libraries evolve.
How to use
- Browse rules at the repository:
github.com/sanjeed5/awesome-cursor-rules-mdc - Find your framework or library in the
rules-mdc/directory - Copy the
.mdcfile into your project's.cursor/rules/directory - Cursor auto-loads the rules on the next session
To generate a custom rule for a library not yet covered:
git clone https://github.com/sanjeed5/awesome-cursor-rules-mdc.git
cd awesome-cursor-rules-mdc
uv run src/generate_mdc_files.py --library 'fastapi'
Example
A generated .mdc file for FastAPI might look like this:
---
description: FastAPI best practices and patterns
globs: ['**/*.py']
alwaysApply: false
---
# FastAPI Rules
- Use Pydantic v2 models for request/response schemas
- Prefer async def for route handlers
- Use Depends() for dependency injection
- Return explicit status codes via status_code parameter
- Use APIRouter for route grouping
Drop this into .cursor/rules/fastapi.mdc and Cursor will apply these conventions whenever you work on Python files in that project.
Related on TokRepo
- Prompt Library — browse curated prompts and rules for various AI coding tools
- AI Tools for Coding — discover more developer productivity tools that integrate with AI editors
Common pitfalls
- Do not place
.mdcfiles outside.cursor/rules/or Cursor will not detect them - Setting
alwaysApply: trueon many rules at once can bloat the context window and degrade suggestion quality - Auto-generated rules may lag behind breaking API changes in fast-moving libraries; verify against official docs after generation
常见问题
An .mdc (Markdown Cursor) file is a rule definition that Cursor AI reads to understand a library's conventions. It contains metadata like glob patterns and a markdown body with coding guidelines. When placed in .cursor/rules/, Cursor applies these rules during code generation.
Clone the repository and run the generation script with the --library flag. The script uses Exa search to gather current documentation and an LLM to distill it into a concise .mdc rule file. For example: uv run src/generate_mdc_files.py --library 'django'.
The .mdc format is specific to Cursor. Other editors like VS Code with Copilot or Windsurf use different rule formats. However, the markdown content inside .mdc files can serve as a reference for writing rules in other formats.
Rules are auto-generated using LLM and search, so they may contain outdated patterns or miss recent API changes. Always cross-check critical rules against the official library documentation, especially for libraries with frequent breaking changes.
The repository is licensed under CC0 (public domain dedication). You can use, modify, and distribute the rule files without restriction or attribution.
引用来源 (3)
- Awesome Cursor Rules MDC GitHub— Repository with 800+ auto-generated .mdc files
- Cursor Docs— Cursor rules documentation and .mdc format specification
- Exa AI— Exa search API used for gathering library documentation
来源与感谢
Created by sanjeed5. Licensed under CC0 1.0.
awesome-cursor-rules-mdc — ⭐ 3,400+
讨论
相关资产
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.
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.
Awesome Cursor Rules (ZH) — .cursorrules Library
Awesome Cursor Rules (ZH) is a bilingual .cursorrules library that helps Cursor users enforce architecture, security, and style constraints across a repo.
lnai — Unified AI Config for Claude, Cursor, Copilot & More
Define AI tool configs once in a .ai/ directory and auto-sync to Claude Code, Cursor, GitHub Copilot, Gemini CLI, Codex, and Windsurf native formats.