Cursor rules documentation
Documents Cursor editor rules for enforcing consistent formatting and structure in a codebase, with configurable JSON and file-based rules.
What this file does
Documents Cursor editor rules for enforcing consistent formatting and structure in a codebase, with configurable JSON and file-based rules.
When to use it
- Setting up Cursor rules for a team project
- Enforcing heading case and Jira ticket conventions
- Adding custom linting rules to Cursor editor
- Standardizing markdown formatting across a repo
Assumes this stack
Cursor rules documentation
This directory contains rules that Cursor uses to enforce consistent formatting and structure in our codebase.
Rule structure
Rules defined in the config.json follow this structure:
{
"version": 1,
"rules": {
"category": {
"rule_name": {
"enabled": true,
"pattern": "regex_pattern",
"message": "Error message"
}
}
}
}
Additional, more specific rules can be found in the rules directory in either a json or mdc format.
Available rules
Text formatting
- heading_case: Enforces sentence case in headings with specific exceptions
- Applies to:
.md,.txt,.mdxfiles - Exceptions: Technical terms and acronyms
- Applies to:
Jira tickets
- ticket_title: Validates Jira ticket title format
- Optional component in brackets
- Max length: 80 characters
- required_sections: Ensures required sections are present
- templates: Enforces template structure for different ticket types
- labels: Validates that only allowed labels are used
- issue_types: Ensures correct issue type selection
Usage
- Cursor will automatically enforce these rules while editing relevant files; however, if you wish to enable a rule that is not triggered by default, you can do so by
@mentioning it in the chat. - Rules can be toggled using the
enabledflag - Custom error messages will be shown when rules are violated
- Exceptions are handled through the
exceptionsfield in relevant rules
Updating rules
To modify these rules:
- Edit the
config.jsonor the appropriate file in therulesdirectory - Try to follow the existing structure and format where possible
- Ensure valid regex patterns, where applicable
- Include clear error messages
- Test changes before committing
What's inside
1 rule structure example, 2 rule categories with 6 sub-rules, usage and update instructions
Change this for your project
- Replace
adobe/spectrum-csswith your own repository name - Replace
config.jsonpath with your own rules file location - Replace
rulesdirectory path with your own rules directory
Where it goes
Keep it in your repository where the agent or team that needs it will read it.
Related Documents
dbt Core
Defines a complete dbt project setup with layered architecture, SQL style, Jinja best practices, and CI/CD workflow guidance.
HarmonyOS 主题与样式 - Cursor Rules
Defines HarmonyOS theming rules for dark/light mode, page brightness, and screen-on control with code examples.
Cursor Development Environment
Documents a Docker-based dev container setup with test commands and OpenClaw agent configuration for the ClawDrive project.
Journey from Concept to Code: Transforming Cursor into a Devin-like AI Assistant
Documents the creation of aicode.cursorrules, a set of rules that turns Cursor/Windsurf into a Devin-like AI assistant with automated planning and self-evolution.