desktop / rules
Cursor rule2.5k starsChanged 19 months agoApache-2.0Archived repositoryView on GitHub
Good comment style
Where files are headingNew Cursor rule files have more rules about planning and tracking tasks, and fewer about code style.
Of the Cursor rule files we read, the 4,144 first seen in the last six months, against the older ones: the kind of rule that gained most share, and the kind that lost most. About files like this in general, not this one, and an estimate, since a kind is a pattern in the words.
In this repository5 other files it gives its agents.
- CLAUDE.mdCLAUDE.md
- .cursor/rules/component-creation.mdcCursor rule
- .cursor/rules/conventional-commits.mdcCursor rule
- .cursor/rules/rule-storage.mdcCursor rule
- .cursor/rules/template-system.mdcCursor rule
The file
We split this avoid-unnecessary-comments.mdc into the rules it gives an agent
2 rules. About 0 are common, 2 are distinctive, and 0 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈2
Distinctive · estimate
This author's own choices. Worth a look.
0
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 39
Add noise that reduces readability
- Distinctive: line 47
Instead of adding explanatory comments, prefer:
≈ “Common” is an estimate: at least 1 in 5 of the 6,668 Cursor rule files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
---
description: Good comment style
globs: *
---
# Avoid Unnecessary Comments
A rule to discourage adding excessive or redundant comments to the codebase.
<rule>
name: avoid_unnecessary_comments
description: Prevents redundant, obvious, or excessive comments in code
filters:
# Apply to all code files with common extensions
- type: file_extension
pattern: "\\.(js|jsx|ts|tsx|py|rb|java|c|cpp|cs|go|rs|php|swift|kt)$"
actions:
- type: reject
conditions:
# Look for obvious/redundant comments
- pattern: "(?m)^\\s*(?://|/\\*|#|<!--|--) (?:This|The) \\w+ (?:function|method|class|variable)"
message: "Avoid comments that simply state what a function/method/class/variable is"
# Look for comments that just repeat the code
- pattern: "(?m)^\\s*(?://|/\\*|#|<!--|--) (?:Increment|Decrement|Add|Set|Get|Create|Delete|Update|Remove)"
message: "Avoid comments that just repeat what the code does - use clear naming instead"
- type: suggest
message: |
# Comment Guidelines
## Avoid unnecessary comments:
❌ **Don't add comments that:**
- State the obvious (e.g., `// increment counter`)
- Repeat information clearly visible in the code
- Explain WHAT the code does rather than WHY
- Add noise that reduces readability
✅ **Do add comments when:**
- Explaining WHY something is implemented in a certain way
- Documenting complex business logic or algorithms
- Noting edge cases or non-obvious behavior
- Explaining temporary workarounds (with tickets/issues referenced)
Instead of adding explanatory comments, prefer:
- Clear, descriptive variable and function names
- Small, focused functions with single responsibilities
- Proper code organization and structure
examples:
- input: |
// This function gets the user data
function getUserData() {
return userData;
}
output: |
function getUserData() {
return userData;
}
- input: |
// This implementation uses a cache to avoid expensive recalculations
// when handling high-volume requests in production environments
function getCachedResults(query) {
if (cache.has(query)) {
return cache.get(query);
}
const result = computeExpensiveResult(query);
cache.set(query, result);
return result;
}
output: |
// This implementation uses a cache to avoid expensive recalculations
// when handling high-volume requests in production environments
function getCachedResults(query) {
if (cache.has(query)) {
return cache.get(query);
}
const result = computeExpensiveResult(query);
cache.set(query, result);
return result;
}
metadata:
priority: high
version: 1.0
</rule>Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

