mdpantry / Cursor rule starter
Cursor rule starter
A Cursor project rule is an .mdc file in .cursor/rules: frontmatter that says when the rule applies, then the instructions the agent follows. This starter is set to apply when the agent judges it relevant from its description, with the description and the instructions left for you to write.
Published . Updated .
The file
Email it to myself Download my-rule.mdc Open the raw file
5 blanks for you to fill
- When the agent should use this rule, in the words of the task: for example, adding or changing an API endpoint
- Area this rule covers, for example: API endpoints
- One convention the agent keeps getting wrong, stated as an instruction: for example, validate every request body at the handler before calling a service
- Another, only if it is real: for example, return errors as an object with a code and a message, never a bare string
- file that already does it right, for example service-template.ts
The download is the file alone: put it at .cursor/rules/my-rule.mdc in your project. Or save it from a terminal:
curl -fsSL https://mdpantry.com/s/st_va4hpwfg6jjpipw4/raw --create-dirs -o .cursor/rules/my-rule.mdc
--- description: "<When the agent should use this rule, in the words of the task: for example, adding or changing an API endpoint>" alwaysApply: false --- # `<Area this rule covers, for example: API endpoints>` - `<One convention the agent keeps getting wrong, stated as an instruction: for example, validate every request body at the handler before calling a service>` - `<Another, only if it is real: for example, return errors as an object with a code and a message, never a bare string>` - Follow the existing example in @<file that already does it right, for example service-template.ts> rather than inventing a new pattern.
Which kind of rule?
The first lines of a rule decide when Cursor applies it. Of 484 distinct rules the registry has saved, from 136 public repositories, 41% apply to matching files, 29% to every chat and 29% when the agent reads the description and judges it relevant. This starter is set to the third. Among the 191 rules in repositories with 100 stars or more, 11 use it.
- Applies to matching files
globs200 41% - Applies to every chat
alwaysApply: true141 29% - The agent picks it from the description
description138 29%
To change the kind, swap the first lines of the file for one of these:
Applies to matching files
--- globs: "src/api/**/*.ts" alwaysApply: false ---
Applies to every chat
--- alwaysApply: true ---
The agent picks it from the description
--- description: "Adding or changing an API endpoint" alwaysApply: false ---
Counted by the registry that serves this pantry, with no model in the count, from its saved copies as they stood on : 484 distinct files (identical files count once), each in the first of these it matches: alwaysApply: true, then globs (written inline or as a list), then description. 5 have none of the three and are not shown. Not live GitHub, and not every repository on GitHub, only the ones the registry has found.
If you want your agent on modelranch, a deals network for agents, the instructions are at modelranch.com/AGENTS.md. The file above does not mention it.
What to change
- Keep it in .cursor/rules and keep the .mdc extension: Cursor ignores a plain .md file in that folder. Rename the file to say what it covers.
- Write the description as the situation the rule is for. Cursor's agent reads it to decide whether to pull the rule in.
- To apply it to matching files instead, replace the description with globs, such as src/api/**/*.ts. To apply it to every chat, set alwaysApply to true and remove the description; Cursor ignores globs and description when alwaysApply is true.
- Replace the placeholders in angle brackets. Write down only mistakes the agent actually makes, and point at a file that does it right instead of pasting code into the rule: write the file name straight after the @, with nothing between them.
- Keep each rule short and about one thing; split a long one into several.
Audit
Grade A on the registry's safety audit: all 14 checks passed.
The audit checks that the file is safe to commit, not what an agent does with it. The 14 checks:
- Size between 200 bytes and 200 KB
- No zero-width or bidi control characters
- No instruction hidden inside an HTML comment
- No link to an exfiltration or paste host
- No credential-shaped string
- No instruction to send local credentials anywhere
- No text hidden with inline styles
- No prompt-injection phrasing
- No curl or wget piped into a shell
- No recursive delete of root, home or parent
- No instruction to read or print local credentials
- No base64 blob over 200 characters
- No link to a raw IP address
- No script tag
Other starters
Sources
Cursor rule in the wild
The 3 most-starred public repos the pantry has saved that keep their own Cursor rule, as its saved copies stood on . Each jar is that repo's file, the one nearest its root, to scale with this starter: a jar's height is its length, the honey its written lines. Tap a jar for that repo's whole pantry.
- dietrichgebert/
ponytail 190,846 stars 36 lines - wshobson/
agents 42,464 stars 22 lines - yamadashy/
repomix 29,279 stars 1 line
- my-rule.mdc This starter 10 lines
Commit yours and your repo gets its own shelf at mdpantry.com/<you>/<repo>: swap github.com for mdpantry.com in any public repo's address. Its README can wear the shelf as a badge. This is the badge for dietrichgebert/ponytail: