Airsc miễn phí cho tất cả. Nếu nó giúp bạn, hãy ủng hộ $2–$20.

Ủng hộ
Cursor ruleAn toànReview & chất lượng codeDễ cho người mới

best-cursor-rules

Renvia-code · Renvia-code/best-cursor-rules

Một bộ sưu tập các quy tắc AI của Cursor với Trình hướng dẫn thiết lập tự động tạo ra các hướng dẫn tùy chỉnh, cụ thể theo framework để cải thiện chất lượng mã do AI tạo ra.

Best Cursor Rules là một bộ sưu tập được tuyển chọn gồm 33 quy tắc AI Cursor chất lượng cao thực sự hiệu quả. Bao gồm Trình hướng dẫn thiết lập phân tích dự án của bạn và tự động tạo các quy tắc tùy chỉnh.

12 sao2Giấy phép: CC0-1.0Cập nhật 11 tháng trước0 lượt mở

Xem trước

▍

Bạn có thể làm gì với nó

  • Tự động cấu hình Cursor AI để tuân thủ các phương pháp hay nhất cho một dự án Next.js 15.
  • Hướng dẫn Cursor tạo các thành phần React 19 tuân thủ các tiêu chuẩn mã hóa của dự án bạn.
  • Sử dụng Trình hướng dẫn thiết lập để nhanh chóng áp dụng các quy tắc cụ thể theo framework cho một ứng dụng Vue 3 mới.

Kiểm tra an toàn

An toàn

Không thấy dấu hiệu rủi ro trong các file đã quét.

Quét tự động các file trong repo. Luôn xem lại code trước khi chạy.

Trích từ README

Best Cursor Rules

A curated collection of Cursor AI rules that actually work.

Skip the guesswork. These rules are battle-tested, framework-specific, and ready to drop into your project.


Quick Start

Option A: Use the Setup Wizard (recommended)

  1. Open your project in Cursor (not this repo)
  2. Switch to Plan Mode or Agent Mode
  3. Paste the contents of SETUP-WIZARD.md into the chat
  4. Answer a few questions about your stack
  5. Done! The AI creates your .cursor/rules/ folder automatically

Note: The wizard must be run from inside your actual project directory, not from this repository.

[!TIP] Plan Mode (recommended) — More structured. The AI analyzes your project, asks focused questions, shows you exactly what will be created, then executes after you confirm.

[!TIP] Agent Mode — More conversational. The AI iterates with you and creates files on the fly. Good if you want to adjust things as you go.

💎 Pro Tip

Use the best model you have access to. The wizard does a lot of thinking upfront so you don't have to correct it later. Five minutes with a good model now saves hours of fixes down the road.


Option B: Manual Setup

  1. Create .cursor/rules/ in your project root
  2. Copy the rules you need from the rules/ folder
  3. Update the globs in each file to match your project structure

Available Rules

Frameworks

RuleDescription
nextjs-15.mdcNext.js 15 App Router, Server Components, Server Actions
react-19.mdcReact 19 patterns, hooks, and best practices
vue-3.mdcVue 3 Composition API and script setup
svelte-5.mdcSvelte 5 runes and modern patterns
astro.mdcAstro components and island architecture

Languages

RuleDescription
typescript.mdcStrict TypeScript with modern type patterns
python.mdcPython 3.12+ with type hints and async
go.mdcGo idioms and error handling

Backends

RuleDescription
supabase.mdcAuth, RLS, Edge Functions, Realtime
fastapi.mdcFastAPI routes, Pydantic, async patterns
nodejs.mdcNode.js with Express/Fastify

Styling

RuleDescription
tailwind.mdcTailwind CSS v4 patterns and organization
shadcn-ui.mdcshadcn/ui component patterns

Testing

RuleDescription
vitest.mdcVitest with Testing Library
playwright.mdcE2E testing with page objects

Best Practices

RuleDescription
clean-code.mdcNaming, functions, DRY, SOLID
security.mdcAuth patterns, secrets, validation
ai-security.mdcLLM security, prompt injection, PII filtering
accessibility.mdcARIA, keyboard nav, screen readers

Stack Presets

These combine multiple rules for common technology combinations:

RuleStack
t3-stack.mdcNext.js + tRPC + Prisma + Tailwind
nextjs-supabase.mdcNext.js + Supabase + shadcn/ui
mern-stack.mdcMongoDB + Express + React + Node.js
python-fastapi.mdcFastAPI + PostgreSQL + SQLAlchemy
django-htmx.mdcDjango + HTMX + Tailwind

How the Wizard Works

The Setup Wizard is a special prompt that turns Cursor into a project analyzer:

  1. Detection - It reads your package.json, tsconfig.json, config files, etc.
  2. Questions - Asks 4-6 questions to understand your preferences
  3. Planning - Shows you exactly which rules will be created
  4. Execution - Creates .cursor/rules/ with customized rules

The wizard adapts to your project. Using Supabase? It includes those patterns. TypeScript strict mode? It adjusts accordingly. It's not a one-size-fits-all dump of rules.


Rule Format

Each rule uses the MDC (Markdown + Config) format:

---
description: Brief description for AI context
globs: ["**/*.tsx", "**/*.ts"]
alwaysApply: false
---

# Rule Title

## Section
Content, code examples, tables, etc.
  • description - Helps the AI understand when to apply this rule
  • globs - File patterns that trigger this rule (empty = manual only)
  • alwaysApply - If true, always included regardless of file type

Rules are written to be concise and scannable. No fluff, just patterns and examples.


Contributing

Want to add a rule or fix something? Check out CONTRIBUTING.md.

The short version:

  1. Fork the repo
  2. Add/edit rules in rules/
  3. Follow the format in .cursor/rules/01-rule-format.mdc
  4. Submit a PR

Why This Exists

Cursor's AI is powerful, but it doesn't know your stack. These rules give it the context it needs:

  • "Use Server Components by default" (Next.js 15)
  • "Always enable RLS on tables" (Supabase)
  • "Prefer unknown over any" (TypeScript)

Without rules, you end up correcting the AI constantly. With the right rules, it writes code the way you want it.


Credits

Maintained by Renvia Technologies with contributions from the community.

Licensed under [CC0](./LI

Xem mã nguồn trên GitHub