promptgarten ๐ŸŒฑ
๐ŸŒ ES

Command reference ยท Cursor CLI

agent generate-rule | agent rule

Walks through interactive prompts to generate a new Cursor rule.

agent generate-rule (alias: agent rule) walks you through creating a new rule interactively, which then lands in the CLI's rules system (.cursor/rules). The CLI automatically loads rules from .cursor/rules and applies them at startup; AGENTS.md and CLAUDE.md at the project root are also read as rules.

โœ… WHEN TO USE IT?

Capture recurring project behavior as a persistent rule

agent generate-rule โ€” e.g. create a rule for the project's preferred test runner

Make team-wide conventions available consistently across all sessions

agent rule โ€” generate a rule about commit message format or branch naming

โ›” WHEN NOT TO?

The instruction only applies to the current session, not permanently

A generated rule lands in .cursor/rules and applies project-wide to future sessions.

Better: Just state the instruction directly in the prompt instead of creating a rule

An existing rule needs editing, not a new one

agent generate-rule always creates a new rule via the interactive flow.

Better: Edit the file in .cursor/rules directly, or use /rules in interactive mode to browse and edit

SOURCES