Last active
March 4, 2025 17:58
-
-
Save brossi/fcaa34babd1f9bb6801fda15e329c1b2 to your computer and use it in GitHub Desktop.
Cursor Rule Template
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!-- CURSOR RULE FILE TYPE: `*.mdc` | |
Notes regarding frontmatter content: | |
- It appears that Cursor prefers only two fields in the frontmatter: `description` and `globs` | |
(Discussion) https://forum.cursor.com/t/optimal-structure-for-mdc-rules-files/52260/10 | |
- "Agent does not see subdirectories of .cursor/rules" | |
(Discussion) https://forum.cursor.com/t/optimal-structure-for-mdc-rules-files/52260/11 | |
Metadata: | |
- `globs` can be defined by single file types (e.g. `*.md` or `specific-rule.mdc`) or it can use brace expansion for multiple file types (e.g. `**/*.{py,js,ts,jsx,tsx,java,rb,go,rs}`) | |
- `version` uses Semantic version numbering | |
- `author` can be singular or an array if multiple contributors exist | |
- `last_update` in the format you need (e.g. "2025-Mar-03 14:30 UTC") | |
- `priority` is used for priority conflict resolution if two or more rules conflict | |
- `tags` can be used for agent categorization | |
- `review_cycle` is optional if you use a scheduled documentation review process | |
- `r_update_freq` used for tracking historical avg. time between updates; requires monitor script | |
BEGIN RULE TEMPLATE --> | |
--- | |
description: ACTION_VERB desired_outcome to ENSURE business_value | |
globs: file_glob_patterns | |
--- | |
# Rule Title | |
<!-- Metadata: Required (for my projects) --> | |
- **version**: Major.Minor.Patch | |
- **Author**: [Name, Agent] | |
- **last_update**: %Y-%b-%d %H:%M %Z | |
- **status**: draft|active|paused|deprecated | |
<!-- Metadata: Optional (for my projects) --> | |
- **priority**: 1-5 | |
- **tags**: [optional, categorization, tags] | |
- **review_cycle**: week|mon|qtr|year|custom | |
- **update_freq**: int units | |
- **related_to**: | |
- [Rule-001-Reference](link_to_related_rule) | |
- [Rule-002-Reference](link_to_related_rule) | |
- **depends_on**: | |
- [Rule-001-Reference](link_to_related_rule) | |
- [Rule-002-Reference](link_to_related_rule) | |
- **replaced_by**: [Rule-****-Reference](link_to_related_rule) | |
## Context | |
- When and where the rule applies | |
- Scope of implementation | |
- Rationale for the rule | |
## Requirements | |
1. Specific, actionable requirement | |
2. Measurable criteria | |
3. Compliance guidelines | |
## Constraints | |
- Technical limitations | |
- Performance considerations | |
- Compatibility requirements | |
## Error Handling | |
- Expected error types | |
- Error response formats | |
- Error recovery strategies | |
## Compliance Checks | |
- Automated validation mechanisms | |
- Specific validation criteria | |
- Enforcement tooling and processes | |
## Performance Impact | |
- Computational overhead | |
- Resource consumption | |
- Scalability implications | |
## Security Considerations | |
- Potential security risks | |
- Mitigation strategies | |
- Compliance standards | |
## Dependencies | |
- Required libraries/tools | |
- Version constraints | |
- Compatibility notes | |
## Examples | |
### Positive Example | |
```language | |
// Compliant code example | |
``` | |
### Negative Example | |
```language | |
// Non-compliant code example | |
``` | |
## Enforcement Mechanisms | |
- Static analysis tools | |
- Code review checklists | |
- Automated validation processes |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment