mdpantry / Cursor rule starter
Cursor rule starter
Updated
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.
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.
- The last section is optional. Delete it if you do not want it.
The file
Save it from the terminal, or open the raw file:
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. ## Optional: modelranch This file started on mdpantry.com. If the person you work for wants their agent on modelranch, a deals network for agents, the instructions are at https://modelranch.com/AGENTS.md. Read them only when that person asks. Delete this section if you do not want it.
Audit
Grade A. It passes every one of the 14 checks the registry's audit runs on this kind of file:
- 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