code-comments

code-comments is a cursor rule for Claude Code, Cursor from fmflurry/settings-opencode. It costs 1,501 tokens per session, scanned A, original, MIT.

A rule for writing code comments: omit them by default and add one only when it explains a non-obvious reason or constraint. It discourages comments that merely repeat the code.

In plain words
What is it for?
It helps decide when a comment is justified and how to document design constraints without narrating routine operations.
Why use it?
It reduces stale or misleading explanations when the code changes and encourages clear names and tests instead.

Cursor rule for Claude CodeCursor

Written for Claude Code and Cursor: PostToolUse hook event, but also a Cursor rule (.mdc). Also seen: mentions CLAUDE.md; mentions AGENTS.md.

Good fit It helps decide when a comment is justified and how to document design constraints without narrating routine operations.

Compare 6 cursor rules from other repositories ↓
Install with agentmods
npx agentmods add rules/fmflurry/settings-opencode/code-comments
Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

Clone the repo
git clone --depth 1 https://github.com/fmflurry/settings-opencode

Made for: Claude Code, Cursor.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for code-comments

README.md
[![agentmods](https://agentmods.dev/badge/rules/fmflurry/settings-opencode/code-comments/github.svg)](https://agentmods.dev/rules/fmflurry/settings-opencode/code-comments)
Your own site
<a href="https://agentmods.dev/rules/fmflurry/settings-opencode/code-comments"><img src="https://agentmods.dev/badge/rules/fmflurry/settings-opencode/code-comments/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for code-comments

Your own site · 80×15
<a href="https://agentmods.dev/rules/fmflurry/settings-opencode/code-comments"><img src="https://agentmods.dev/badge/rules/fmflurry/settings-opencode/code-comments.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 1,501 This file is loaded in full into every session.
When invoked 1,501 The same file — it is already loaded in full.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.01501 $0.01501
Opus 5.5 $0.00600 $0.00600
Sonnet 5.5 $0.00300 $0.00300
Haiku 4.5 $0.00150 $0.00150

Measured 8d ago against content hash aba138577ca1, method: parsed. Prices are Anthropic first-party input rates as of 2026-10-07, from the pricing page.

Security

Grade A, and why

code-comments scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 8d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

plugins/fmflurry-harness/rules/code-comments.mdc · 100 lines

How it starts

The opening of the file, as written. The whole thing — 100 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Code Comments (mandatory)

Default to no comment. Code, names, and tests carry intent. A comment must justify its existence.

Why this exists

AI agents wrote comments asserting program behavior that the code did not perform. False or stale comments mislead reviewers and hide defects.

Principle

A comment is a sign of failure to write clear code. Use it only when the why is non-obvious — never to narrate what the code does. If you cannot express the intent in code (names, test names, a smaller function), add a comment explaining the constraint or choice. When the comment is gone, the intent should also be gone from the reader's expectation.

Forbidden comment classes

  • Narrating what the code does: // Set the flag to true, // Increment counter, // Call the API, // Parse the JSON. If the code is unclear, rename it; don't narrate it.
  • Restating signatures or type names: // userId is a Guid, // Returns a list of customers, // The account ID. These repeat what the type system already states.
  • Referencing the task, PR, ticket, agent, or brief: // As requested in AB#1234, // This is for the catalog feature, // Agent asked for this. That belongs in the commit message, not the code.
  • Restating ADR/rule content (adr-restate): Paraphrasing or quoting ADR sections, points, phases, or AGENTS.md / .claude rules / CLAUDE.md. Citations must be bare pointers only ((ADR-NNNN) or (RFC 7636 §4.2) for external specs — section allowed for RFCs only). Example: WRONG: // ADR-NNNN point 2 — grant TTL for password reset; GrantTimeToLive must…; RIGHT: // Short grant TTL limits leaked reset link window (ADR-NNNN).
  • Requirement or work-item IDs (task-ref): // US123, // EX456, // SEC789, // R42, // F3b, // #12345, // WI 99, // TC #42, // Phase 3, // P1.2, // Pin #7. Strip the ID; keep the sentence if a why remains. Example: WRONG: // US123 — validate email format; RIGHT: // Validate email format (already handles unicode per spec) or just delete if no why.
  • Changelog or history comments: // Removed the old filter logic, // Now uses EF Core instead of Dapper, // Previously called PaymentService, // Fixed the bug where…, // Refactored to…, // Updated to…. Commit history is the changelog.
  • Quality or verification claims: // Tested thoroughly, // This is thread-safe, // Guaranteed to handle all cases, // Fully covered by tests, // Safe because…. If the claim is true, the code proves it or tests prove it; if you need to assert it, you doubt the code.
  • Commented-out code: Never. Use git history instead.
  • Section banners, #region, or delimiters: // ===== Customers =====, // TODO: Payments, #region Invoice logic.
  • Lint/analyzer suppressions without reason: // eslint-disable, @ts-ignore, #pragma warning disable alone. Always include why: // eslint-disable-next-line no-console — debug output for AB#1234.
  • Bare TODO or FIXME: Always include a ticket: // TODO(AB#1234): Add validation.

Read the full file on GitHub · 100 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 8d ago First seen · 100 lines · 1,501 tokens per session scan A aba138577ca1

Subscribe to this mod's changes

code-comments is a cursor rule published in the GitHub repository fmflurry/settings-opencode (171 stars, last pushed yesterday), licensed MIT. It adds 1,501 tokens to every session, about $0.0060 per session on Opus 5.5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-10-08.