agentleFS
pahlevikunpahlevikun/levistack/.cursor/rules/comments.mdc

levistack / rules

Cursor rule0 starsChanged 18 days agoMITView on GitHub

Comments are a last resort: only for non-obvious constraints, gotchas and trade-offs the code cannot express.

The file

We split this comments.mdc into the rules it gives an agent

1 rule. About 0 are common, 1 is distinctive, and 0 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈1

    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
  1. Distinctive:

    If you feel the urge to explain *what* the code does, rename or restructure instead.

    line 27

≈ “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.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
comments.mdc
---
description: "Comments are a last resort: only for non-obvious constraints, gotchas and trade-offs the code cannot express."
globs: "**/*.{go,ts,tsx,js,jsx,py,rb,ex,exs,md}"
alwaysApply: false
---

# Comments: extremely rare by design

Comments cost tokens, rot silently and hide bad naming. **Default: do not write one.** Add one only when names, types, structure, tests and error handling cannot express the truth.

## Allowed
- A subtle correctness, security or concurrency gotcha the types do not make obvious.
- A non-obvious performance, ordering or consistency trade-off ("must run before X because of Y").
- An external constraint invisible in the code ("the gateway already rate-limits this; do not add another check"), ideally with a link to the decision record.
- A contract detail on an exported symbol that the name, signature and tests still leave ambiguous (improve the name first).

## Never
- Narrating the next line ("build the request", "call the client", "return the result").
- Restating what a test or assertion already verifies.
- Describing the change you just made ("added X for Y").
- Section dividers or paraphrasing a function name in a doc comment.
- Planning notes the decision record should hold.

## Prefer instead
Better names, smaller functions, stronger types (enums and newtypes over "this bool means X"), tests as executable specification, structured config over magic comments.

If you feel the urge to explain *what* the code does, rename or restructure instead. When reviewing, delete narrative comments.

## Documentation is not a comment
Module and function docs, architecture notes, API contracts, migration notes and skills are documentation, not disposable comments. Keep them accurate and explanatory, and **update or delete stale documentation in the same change as the code.**

## Docs comments
Exported-symbol docs (godoc, docstrings) are allowed when the name and signature do not communicate the contract or an important caveat. Restating the name is forbidden, same bar as inline comments.

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

Reviews can't be read right now.

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.