Commands vs Rules? How are they different?

The Cursor docs have a section called Commands. It uses md files in .cursor/commands. How is this different than a manually applied mdc file in .cursor/rules? Is it just the shortcut of / instead of @?

1 Like

hi @DMetRev Commands are like templates you can use to avoid typing repeated instructions/prompt. Rules are rules that are not a prompt.

Example:

Command: /explain (file .cursor/commands/explain.md)

Review code and explain how the code works.

Usage: /explain process.js

This would instruct AI to check the file process.js and explain to you how the code there works.

You can use more detailed instructions and this way avoid typing or copy/pasting common tasks.

Rules: they should contain what an AI model must do or should avoid to process your task as you require it. Examples are best practices, or programming related rules that your framework expects to be followed.

How does /explain this code get a different behavior from cursor than @explain.mdc this code?

2 Likes

I think /command is equivalent to please do the tasks followed by @xxx.mdc

1, Rules define the standards or guidelines that Cursor should follow
2, Commands define the specific steps that Cursor should execute

1 Like

@DMetRev the explanation by @PandaZ is correct.

@condor , so it is mostly a cosmetic feature that adds a few words in front of a prompt?

2 Likes

Not at all cosmetic, it avoids retyping or copy/pasting most often used prompts.

Imagine it like a template for prompts. You can have common processes stored as commands and just call them when you need them.

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.