"/Generate Cursor Rules" Custom Command Workaround!

As you might have noticed, the slash command /Generate Cursor Rules has disappeared. I have extracted the instructions given when running that slash command, and I’ve tried it on multiple chats from different codebases, and they output the same thing, confirming this was the one used before.

  1. Press / and click → Create Command → Name it generate-cursor-rules.
    image
  2. Paste in the contents below
  3. Use the /generate-cursor-rules command!
# Cursor Rules Instructions
To create or edit a rule:
1. Rules should be stored in the `.cursor/rules` directory
5. Rule files must have a `.mdc` extension (e.g., `my-rule.mdc`)
6. To reference a file in your rule, use the format: `[filename.ext](mdc:filename.ext)` where the path is relative to the workspace root
7. Rules use Markdown format with special Cursor-specific extensions
8. Rules will be shown to the AI to help with codebase navigation and understanding
9. Metadata is stored in frontmatter and controls how the rule is used and must be formatted properly.
Metadata properties are:
 - alwaysApply: true/false # Will apply to every request
 - description: string # A description that allows the agent to fetch the rule
 - globs: string # A comma separated list of gitignore style patterns controlling what files this rule will apply to
Usually only one of these types would be set, though it is valid to have globs and a description.

Example rule that is always applied concerning project structure:
```
---
alwaysApply: true
---
# Project Structure Guide The main entry point is
[index.js](mdc:index.js), which loads configuration from
[config.js](mdc:config.js)
```
    

Example rule that only applies to TypeScript and TypeScript React files:
```
---
globs: *.ts,*.tsx
---
Always use semicolons
```

Example rule that is manually applied by the user:
```
---
alwaysApply: false
---
Lots of information about a particular task
```


You must use these instructions to generate new rules or modify existing ones. Use the conversation history to understand the context of the rule(s) you should generate.

6 Likes

Nice! Thanks for contributing.

Thanks for this Resource @hime .

I have two questions if you can answer:

  1. how did you extract this prompt
  2. Why the instruction numbering jumps from 1 to 5?
1 Like