RuleStack

Configs

Stacks

Compare

Diff

RuleStack

Configs

Stacks

Compare

Diff

Read API

RuleStack

Configs

Stacks

Compare

Diff

Read API

Cursor rules/Best examples

Best Cursor rules examples in 2026

These are ten of the highest-scoring .cursor/rules/*.mdc files in the RuleStack corpus, one per repository, all of them in projects you can clone right now. Every one is a real file at a real path, linked to the commit you can read today; the numbers beside each are counted from the corpus, not estimated. If you only open one, open novuhq/novu — it is four hundred words long and it explains why a test command destroyed a database.

183 repositories ship .cursor/rules1,290 rule files indexed25.7% of the corpusmedian 275 words2026-08-07
Measured — counted from real repositories, nightlyAsserted — read from the vendor docs, dated

The ten, side by side

Ranked by the RuleStack quality score — which rewards runnable commands, explicit prohibitions, architecture context and section coverage, and penalises length — with a 500-star floor, then cut to one file per repository. Length, command counts and glob counts are measured from the file itself on the last corpus run.

The ten, in the order below — sections covered and score measured 2026-08-07
RepositoryFormatStackCoversScoreChanged
novuhq/novu.cursor/rules/safe-api-tests.mdc · 39kCursor rulestypescriptjavascript+17setupteststyletesting-strategy+488/1006 days ago
langflow-ai/langflow.cursor/rules/docs_development.mdc · 153kCursor rulespythonnode+16setupbuildtestlint-format+797/1006 days ago
apache/superset.cursor/rules/dev-standard.mdc · 74kCursor rulespythonreact+16setuptestlint-formatstyle+777/1003 days ago
coollabsio/coolify.cursor/rules/coolify-ai-docs.mdc · 60kCursor rulesjavascriptphp+6buildteststylearch+592/1006 days ago
koel/koel.cursor/rules/laravel-boost.mdc · 17kCursor rulesphpvue+8buildtestlint-formatstyle+790/1006 days ago
triggerdotdev/trigger.dev.cursor/rules/writing-tasks.mdc · 16kCursor rulestypescriptprisma+18setupbuildarchtypes+564/1006 days ago
dotCMS/core.cursor/rules/e2e-rules.mdc · 949Cursor rulesjavanode+9setupteststylearch+589/1006 days ago
storybookjs/storybook.cursor/rules/spy-mocking.mdc · 91kCursor rulestypescriptjavascript+6teststyletesting-strategydo-not59/1006 days ago
hashintel/hash.cursor/rules/rust-testing-strategy.mdc · 1.6kCursor rulestypescriptrust+16testlint-formatstyletesting-strategy81/1006 days ago
imazen/imageflow.cursor/rules/ci.mdc · 4.4kCursor rulesrustcsharp+2setupbuildtestarch+379/1006 days ago

What each one does that the others do not

  • 1. novuhq/novu

    safe-api-tests.mdcTypeScript39k stars231 words4 commandsno globsscore 88

    The best argument for the format on this page, and the shortest file on the list. It exists because running mocha from `apps/api` without `NODE_ENV=test` drops the developer's MongoDB, and the rule says so in the first line — then explains the mechanism (`.mocharc.json` loads `e2e/setup.ts`, which calls `dropDatabase()`), lists the safe commands, and lists the forbidden ones with the exact invocation. It also does the thing almost nothing else in the corpus does: it states that this is not hypothetical and has already happened in the repo. Write your rules about the mistakes that cost you a day, not about your code style.

    Read .cursor/rules/safe-api-tests.mdc on GitHub Sections, commands and score
  • 2. langflow-ai/langflow

    docs_development.mdcPython153k stars878 words6 commands6 globsscore 97

    The highest-scoring Cursor rule we index, and the textbook Apply to Specific Files rule: `alwaysApply: false` with six glob patterns that all point inside `docs/`. Nothing in it loads while you are working on the Python package, which is the whole point of the format. The body is a documentation runbook — Node version, the exact `npm run start` from the `docs` directory, the directory layout with a line on what each folder is for.

    Read .cursor/rules/docs_development.mdc on GitHub Sections, commands and score
  • 3. apache/superset

    dev-standard.mdcPython74k stars617 wordsno commands7 globsscore 77

    Opens with a section titled what NOT to do, listing migrations that are actively in flight: no `any` types, no new JavaScript files, Enzyme fully removed, Cypress a last resort. That is the highest-value thing a rule can carry, because a model trained on the repo's history will reproduce the pattern being migrated away from. It is also a live example of the frontmatter trap below — it sets `alwaysApply: true` and declares seven glob patterns, and Cursor's documentation says the globs are ignored.

    Read .cursor/rules/dev-standard.mdc on GitHub Sections, commands and score
  • 4. coollabsio/coolify

    coolify-ai-docs.mdcPHP60k stars690 words5 commands1 globsscore 92

    An index, not a document. The rule is always applied, so it is written to stay small: a map of the `.ai/` directory, a decision tree keyed on what you are working on, and the commands for each. The detail lives in files the agent reads on demand. This is the pattern to copy when your instructions are genuinely long — pay for the routing table on every request, not for the content.

    Read .cursor/rules/coolify-ai-docs.mdc on GitHub Sections, commands and score
  • 5. koel/koel

    laravel-boost.mdcPHP17k stars2,068 words11 commandsno globsscore 90

    Pins the exact version of every framework package before it says anything else — php 8.4.20, laravel/framework v12, phpunit v11, vue v3, tailwindcss v4. A model's default answer for a Laravel app is the version that dominated its training data, and a version list is the cheapest possible correction. Generated by Laravel Boost rather than hand-written, which is worth knowing: a good chunk of the corpus's PHP rules come from the same generator.

    Read .cursor/rules/laravel-boost.mdc on GitHub Sections, commands and score
  • 6. triggerdotdev/trigger.dev

    writing-tasks.mdcTypeScript16k stars4,289 words4 commands4 globsscore 64

    The longest file on this list by a wide margin, and the reason it is here is that the length is scoped rather than paid for everywhere: the globs restrict it to `**/trigger/**`, so the cost lands only on the files it is about. Its content is a deprecation wall — the old `client.defineJob` API annotated line by line as breaking — which is exactly the case where verbosity earns its keep.

    Read .cursor/rules/writing-tasks.mdc on GitHub Sections, commands and score
  • 7. dotCMS/core

    e2e-rules.mdcJava949 stars888 words1 commands1 globsscore 89

    One convention, explained properly. The rule is Page Object Model for E2E tests and nothing else, scoped by glob to the one spec directory it applies to, with the directory layout and the rules for what may live in a page object versus a test. The rule that covers one topic for one directory is the format working as designed; most of the corpus instead writes one large always-applied file.

    Read .cursor/rules/e2e-rules.mdc on GitHub Sections, commands and score
  • 8. storybookjs/storybook

    spy-mocking.mdcTypeScript91k stars215 wordsno commands4 globsscore 59

    From the highest-starred repository on this list, and included as much for its shape as its content: a single narrow topic — how to mock in Vitest — with a list of the patterns to use and a matching list of the ones to avoid. Paired lists of do and do-not are the structure that survives contact with a model best. It carries the same frontmatter contradiction as Superset: `alwaysApply: true` alongside a test-file glob.

    Read .cursor/rules/spy-mocking.mdc on GitHub Sections, commands and score
  • 9. hashintel/hash

    rust-testing-strategy.mdcTypeScript1.6k stars470 words4 commands1 globsscore 81

    Every verification command written out in full, including the flags — the clippy invocation with `--all-features --all-targets --workspace --no-deps`, and the OpenAPI regeneration step that has to run when the graph API changes. An agent that has to guess a flag will guess the common one; this is a repository where the common one is wrong.

    Read .cursor/rules/rust-testing-strategy.mdc on GitHub Sections, commands and score
  • 10. imazen/imageflow

    ci.mdcRust4.4k stars1,964 words9 commands2 globsscore 79

    The unusual scope on this list: globs of `*.yml,*.sh`, so the rule loads when someone edits CI rather than application code. It documents the release pipeline — the build matrix, which helper script packs which artifact, which environment variable gates publishing. CI is the part of a repository an agent has least context on and breaks most expensively.

    Read .cursor/rules/ci.mdc on GitHub Sections, commands and score

Browse the rest at every indexed Cursor rule, ranked by score, or narrow to your own stack from the stack index.

Why does my Cursor rule never apply? The frontmatter, almost always

Two frontmatter mistakes account for nearly every Cursor rule that silently does nothing, and neither produces an error. The first is the file extension: Project rules must use the .mdc extension. A plain .md file in .cursor/rules is ignored by the rules system because it has no frontmatter to specify description, globs, and alwaysApply. A rule that is never loaded looks exactly like a rule the model chose to ignore, so this one can cost an afternoon. The second is setting two activation modes at once, which is the subject of the next section. Checked 2026-08-07 against Cursor’s rules documentation .

What do alwaysApply, globs and description actually do, and can you set more than one?

Three frontmatter fields select between four activation modes, and setting alwaysApply: true discards the other two. Cursor’s documentation is explicit about the combination: Always included. Globs and description are ignored. The four modes are Always Apply (alwaysApply: true), Apply Intelligently (alwaysApply: false plus a description the agent reads to decide relevance), Apply to Specific Files (alwaysApply: false plus globs), and Apply Manually (alwaysApply: false with neither, reached by @-mentioning the rule in chat). Checked 2026-08-07.

That combination is common enough in real repositories to be worth naming. Scoping by glob is the majority habit — 871 of the 1,290 Cursor rule files in this corpus declare at least one glob pattern — which is what makes the overlap worth counting. 310 files set alwaysApply: true, and 186 of those (60.0% of them) also declare globs that, per the sentence quoted above, do nothing. Two of the ten files on this page do it: Apache Superset and Storybook. The visible symptom is not a broken rule, it is a context bill — a rule the author believed was scoped to test files is in fact loaded into every request, in every directory, for the life of the repository. If you write globs, set alwaysApply: false next to them, or delete the globs and mean it. Counted 2026-08-07; unlike the adoption figures above, this census is not re-counted nightly.

How many Cursor rule files should a repository have?

Fewer and smaller than one AGENTS.md, and more of them: across 183 repositories the corpus holds 1,290 rule files, an average of 7.0 per repository, with a median length of 275 words and a 90th percentile of 1,180. The contrast with the single-file formats is the point: AGENTS.md runs to a median of 943 words because it has to carry everything at once, while a Cursor rule can be short because a sibling file covers the next topic. Split by topic and scope each one by glob, and no single request pays for all of them. On this page, storybookjs/storybook makes its case in 215 words, while triggerdotdev/trigger.dev takes 4,289 and pays for it only inside its globs.

Does Cursor still read .cursorrules?

Cursor’s current rules documentation does not mention .cursorrules at all — not as supported, not as deprecated, not in any other context. Its stated project rules mechanism is .cursor/rules/*.mdc. The corpus shows the migration largely finished in public code: 27 repositories still carry a .cursorrules file against 183 on .cursor/rules, counted 2026-08-07. If you are writing a new rule today there is no reason to reach for the old file; if you have one, the reason to move is that a single .cursorrules cannot be scoped to a directory. Checked 2026-08-07. Full history on the .cursorrules format page.

Do I need .cursor/rules if I already have an AGENTS.md?

Only for the rules that need to load conditionally — Cursor reads both formats. Its documentation describes AGENTS.md as a simple alternative to .cursor/rules and supports it in the project root and in subdirectories, so a team with one shared instruction file does not need to duplicate it. What AGENTS.md cannot express is activation: there is no way to say “this paragraph only when someone edits a migration”. That is the one thing .cursor/rules adds, and it is the only reason to run both. 69 repositories in the corpus do run both — 37.7% of the Cursor ones, counted 2026-08-07. The practical split: the always-true facts in AGENTS.md, the conditional ones in .mdc files with globs. Side by side on Cursor rules vs AGENTS.md.

What does a good Cursor rule actually contain?

A trap, a command, or a convention — and a glob that says where it applies. Reading across the ten files above, the ones that earn their place carry something the model cannot infer from the code: a command whose default invocation is destructive, a dependency version that differs from the training-data default, a migration in flight so the existing code is the wrong pattern to copy, a flag combination that CI will check and the obvious command will not. The sections that recur in low-scoring rules and add nothing are a restated project description and a directory tree, both of which the agent can read off the repository for free. One measured warning about the median file: only 29.4% of indexed Cursor rules contain a runnable command at all, counted 2026-08-07 — most of this corpus is style preference, which is the part a model was already going to get roughly right.

Sources

Rule files counted

1,2901,290

2026-08-07Adoption, length, glob and command counts on this page are measured from the corpus, not asserted. The frontmatter census in the activation section is the one exception and is stamped with the day it was counted.

Capability claims

1 primary source

2026-08-07Every quotation on this page was read from Cursor’s own documentation on the date stamped, and is registered in the repository’s claim file.
  • Cursor — Rules — source for the four activation modes and their frontmatter, the Always included. Globs and description are ignored. behaviour when alwaysApply is true, the .mdc extension requirement, Cursor reading AGENTS.md in the root and subdirectories, and the absence of any mention of .cursorrules. Read 2026-08-07.

Corpus numbers re-counted nightly; last run 2026-08-07. Method and the raw figures are on the Cursor rules format page and available from the read API. The parallel list for the other big format is best AGENTS.md examples.

RuleStack

Built by

Kynth Studio

Directory

Configs
Stacks
Compare formats
Diff two configs
Best AGENTS.md examples
Best Cursor rules examples
What goes in a CLAUDE.md

Formats

AGENTS.md
CLAUDE.md
Cursor rules
Copilot instructions

Reference

Read API
Corpus health
Privacy Policy
Terms

RuleStack

RuleStack

Built by

Kynth Studio

Directory

Configs
Stacks
Compare formats
Diff two configs
Best AGENTS.md examples
Best Cursor rules examples
What goes in a CLAUDE.md

Formats

AGENTS.md
CLAUDE.md
Cursor rules
Copilot instructions

Reference

Read API
Corpus health
Privacy Policy
Terms

RuleStack

RuleStack

Built by

Kynth Studio

Directory

Configs
Stacks
Compare formats
Diff two configs
Best AGENTS.md examples
Best Cursor rules examples
What goes in a CLAUDE.md

Formats

AGENTS.md
CLAUDE.md
Cursor rules
Copilot instructions

Reference

Read API
Corpus health
Privacy Policy
Terms

RuleStack