balakit / rules
Cursor rule1 starsChanged 2 months agoMITView on GitHub
Guidelines for code comments and documentation — document the why, not the what
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 1,533 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 repository103 other files it gives its agents.
- AGENTS.mdAGENTS.md
- CLAUDE.mdCLAUDE.md
- .cursor/rules/base.mdcCursor rule
- .cursor/rules/changelog.mdcCursor rule
- .cursor/rules/release.mdcCursor rule
- .cursor/rules/seo-ai-search.mdcCursor rule
- .cursor/rules/testing.mdcCursor rule
- agent-readySkill
- authoring-skills-and-rulesSkill
- blinded-evalSkill
- cloakbrowser-fallbackSkill
- deep-deliberationSkill
- design-rationaleSkill
- dissectSkill
- documentation-writerSkill
- everything-seoSkill
- executeSkill
- generating-app-verifySkill
- inceptionSkill
- kit-workflowsSkill
- marketing-psychologySkill
- media-genSkill
- nlm-skillSkill
- opinionSkill
- proving-change-safetySkill
- refreshing-app-verifySkill
- release-deploySkill
- seo-auditSkill
- startup-marketing-brainSkill
- subsystem-walkthroughSkill
- unmatched-workflowSkill
- agent-readySkill
- authoring-skills-and-rulesSkill
- blinded-evalSkill
- cloakbrowser-fallbackSkill
- deep-deliberationSkill
- design-rationaleSkill
- dissectSkill
- documentation-writerSkill
- everything-seoSkill
- executeSkill
- generating-app-verifySkill
- inceptionSkill
- kit-workflowsSkill
- marketing-psychologySkill
- media-genSkill
- nlm-skillSkill
- opinionSkill
- proving-change-safetySkill
- refreshing-app-verifySkill
- release-deploySkill
- seo-auditSkill
- startup-marketing-brainSkill
- subsystem-walkthroughSkill
- unmatched-workflowSkill
- agent-readySkill
- authoring-skills-and-rulesSkill
- blinded-evalSkill
- cloakbrowser-fallbackSkill
- deep-deliberationSkill
- The first 60 shown.
The file
We split this comments.mdc into the rules it gives an agent
8 rules. About 0 are common, 8 are distinctive, and 0 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈8
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 17
If removing the comment wouldn't confuse a future reader, delete it.
- Distinctive: line 39
Every part of a module's public surface — exported functions, types, classes, constants — gets a documentation comment in your language's …
- Distinctive: line 42
Document a parameter only when its name isn't self-explanatory.
- Distinctive: line 43
Document the return only when it isn't obvious from the function name.
- Distinctive: line 44
Document every error/exception the function can raise as part of its contract.
- Distinctive: line 45
Add an example for non-trivial public APIs and shared utilities.
- Distinctive: line 46
Don't duplicate what the language already expresses — let the type system, signatures, and tooling do their job.
- Distinctive: line 50
When documentation strings are generated into a public API surface (OpenAPI/Swagger, SDK docs, generated reference sites, schema …
≈ “Common” is an estimate: at least 1 in 5 of the 3,030 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: Guidelines for code comments and documentation — document the why, not the what alwaysApply: true --- # Comments & Documentation ## Default to zero comments Names document code. Add an inline comment only when the WHY is non-obvious: - A hidden constraint not visible in the code. - A subtle invariant a reader might violate. - A workaround for a specific bug (link the upstream issue). - Behavior a competent reader would find surprising. If removing the comment wouldn't confuse a future reader, delete it. ## Never write - Restatements of the code — `increment counter` above `counter++`. - Task / ticket references — `added for CAN-123`, `fixes billing bug`. - Caller references — `used by the contacts module`. - Change history — `was async before`, `removed old logic`. - Commented-out code. - Banner comments — `=== SECTION ===`. ## Authorized Tracking Tags (Exception) You MUST use the following authorized tags to track technical debt and risks (as required by the Global Rules), using your language's comment syntax. These should cleanly describe the issue for IDE tracking: - `BUG:` — For critical, immediate issues. - `FIXME:` — For broken code or technical debt needing refactor. - `TODO:` — For general planned work. - `CONCERN:` — For edge cases or architectural risks. - `OPTIMIZE:` — For performance improvements or clean-up tasks. ## Document every exported symbol Every part of a module's public surface — exported functions, types, classes, constants — gets a documentation comment in your language's convention (doc comment, docstring, etc.). Internal/private helpers only get one when the WHY is non-obvious. - The first line is a one-sentence summary ending with a period. - Document a parameter only when its name isn't self-explanatory. Never restate information the signature already carries (e.g. the type, in a typed language). - Document the return only when it isn't obvious from the function name. - Document every error/exception the function can raise as part of its contract. - Add an example for non-trivial public APIs and shared utilities. - Don't duplicate what the language already expresses — let the type system, signatures, and tooling do their job. ## Externally-surfaced docs When documentation strings are generated into a public API surface (OpenAPI/Swagger, SDK docs, generated reference sites, schema descriptions), **those strings ship to external consumers** — write them for API users, not just your team. - Describe every public field/parameter with a short user-facing sentence. - Map each endpoint/handler summary to the generated summary and description. - Declare at least one example response for each public route.
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.

