comment-style

Rules for writing code comments that explain the reason behind a decision, such as business rules, compliance requirements, or known limitations. They discourage comments that merely repeat what the code already says.

In plain words
What is it for?
Use them when adding or reviewing comments in application code, especially around validation, retries, business logic, and implementation trade-offs.
Why use it?
They make comments more useful to future developers by preserving context that may not be obvious from the code. This avoids clutter from redundant explanations.

Cursor rule

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.

agentmods
npx agentmods add rules/jahands/prompts/comment-style
Clone the repo
git clone --depth 1 https://github.com/jahands/prompts
Per session 12 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 324 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
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 $0.00012 $0.00324
Opus 5 $0.00006 $0.00162
Sonnet 5 $0.00002 $0.00065
Haiku 4.5 $0.00001 $0.00032

Measured 3d ago against content hash 53efb1468dc9, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

comment-style 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 3d 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.

cursor-rules/test-rules/comment-style.mdc · 55 lines

What it actually says

// Good: Explains the why counter++; // Retry limit based on network latency studies showing 3 attempts optimal

// Bad: Describes what the code does if (user.age < 18) { // check if user is under 18 return false; }

// Good: Explains business logic if (user.age < 18) { // COPPA compliance requires parental consent for users under 18 return false; }

// Bad: Restates the function name // This function validates email function validateEmail(email: string) { return emailRegex.test(email); }

// Good: Explains the approach and limitations function validateEmail(email: string) { // Using simplified regex that covers 99.9% of real-world emails // Full RFC 5322 compliance would require 4KB regex return emailRegex.test(email); }

</example>
</examples>

</comment-style>
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. 3d ago First seen · 55 lines · 12 tokens per session scan A 53efb1468dc9

Subscribe to this mod's changes

comment-style is a cursor rule published in the GitHub repository jahands/prompts (19 stars, last pushed 7mo ago), licensed MIT. It adds 12 tokens to every session and 324 once invoked, about $0.0001 per session on Opus 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-08-30.