cursor-rules

A guide for creating Cursor rules, which are project instructions that shape how the Cursor coding agent works.

In plain words
What is it for?
It helps add correctly named .mdc rule files under .cursor/rules/ and define their descriptions, file patterns, and automatic-application settings.
Why use it?
It prevents rules from being placed in the wrong directory or written with an invalid format.

Cursor rule for Cursor

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add rules/gifflet/cursor-like-pro/cursor-rules
Clone the repo
git clone --depth 1 https://github.com/gifflet/cursor-like-pro

Made for: Cursor.

Per session 0 Nothing until a file matches its globs; then the whole rule loads.
When invoked 575 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
Origin 88% copy Near-identical to another mod in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5 $0.00000 $0.00575
Opus 5 $0.00000 $0.00287
Sonnet 5 $0.00000 $0.00115
Haiku 4.5 $0.00000 $0.00057

Measured 2d ago against content hash ae269796c2a9, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

cursor-rules scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 2d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

Origin

This is a copy

88% identical to cursor-rules — 37 lines differ, which has more behind it and is treated as the original. This page carries a canonical link to it rather than competing with it.

.cursor/rules/cursor-rules.mdc · 97 lines

What it actually says

Cursor Rules Location

How to add new cursor rules to the project

  1. Always place rule files in PROJECT_ROOT/.cursor/rules/:

    .cursor/rules/
    ├── your-rule-name.mdc
    ├── another-rule.mdc
    └── ...
    
  2. Follow the naming convention:

    • Use kebab-case for filenames
    • Always use .mdc extension
    • Make names descriptive of the rule's purpose
  3. Directory structure:

    PROJECT_ROOT/
    ├── .cursor/
    │   └── rules/
    │       ├── your-rule-name.mdc
    │       └── ...
    └── ...
    
  4. Never place rule files:

    • In the project root
    • In subdirectories outside .cursor/rules
    • In any other location
  5. Cursor rules have the following structure:

---
description: Short description of the rule's purpose
globs: optional/path/pattern/**/* 
alwaysApply: false
---
# Rule Title

Main content explaining the rule with markdown formatting.

1. Step-by-step instructions
2. Code examples
3. Guidelines

Example:
```typescript
// Good example
function goodExample() {
  // Implementation following guidelines
}

// Bad example
function badExample() {
  // Implementation not following guidelines
}
  1. Rule Types and Properties:

The rule properties (description, globs, alwaysApply) must be filled according to how the rule will be added to the chat context. Only one of these properties should have a valid/defined value at a time (note that false in alwaysApply is considered empty as it's the default value).

Types of rules:

a) Always Rules:

  • Set alwaysApply: true
  • Leave description and globs empty
  • These rules are automatically added to every chat context

b) Auto Attached Rules:

  • Set globs with a pattern matching the files to be modified
  • Leave description and alwaysApply with default values
  • These rules are automatically added when working with files matching the glob pattern

c) Agent Requested Rules:

  • Set description with a clear purpose of the rule
  • Leave globs and alwaysApply with default values
  • These rules are added when the AI agent recognizes their relevance based on the description

d) Manual Rules:

  • Leave all properties with default values
  • These rules are only added when manually requested by the user
  • Properties should be:
    description: 
    globs: 
    alwaysApply: false
    
Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 2d ago First seen · 97 lines · 0 tokens per session scan A ae269796c2a9

Subscribe to this mod's changes

cursor-rules is a cursor rule published in the GitHub repository gifflet/cursor-like-pro (17 stars, last pushed 1y ago), licensed MIT. It costs nothing until one of its globs matches a file; then it loads 575 tokens. A static security scan graded it A with 0 findings. It is 88% identical to cursor-rules, differing in 37 lines, and is treated as a copy.