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.
git clone --depth 1 https://github.com/nedcodes-ok/cursorrules-collectionWrote 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.
[](https://agentmods.dev/rules/nedcodes-ok/cursorrules-collection/clean-code)<a href="https://agentmods.dev/rules/nedcodes-ok/cursorrules-collection/clean-code"><img src="https://agentmods.dev/badge/rules/nedcodes-ok/cursorrules-collection/clean-code/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.
<a href="https://agentmods.dev/rules/nedcodes-ok/cursorrules-collection/clean-code"><img src="https://agentmods.dev/badge/rules/nedcodes-ok/cursorrules-collection/clean-code.svg" alt="Reviewed on agentmods" width="80" height="20"></a>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.
| Model | Per session | Once invoked |
|---|---|---|
| Fable 5.1 | $0.00879 | $0.00879 |
| Opus 5.5 | $0.00352 | $0.00352 |
| Sonnet 5.5 | $0.00176 | $0.00176 |
| Haiku 4.5 | $0.00088 | $0.00088 |
Grade A, and why
clean-code 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 1mo 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.
Copies of this mod
1 near-identical copy found in the catalogue:
- clean-code — 100% identical, 0 lines differ
How it starts
The opening of the file, as written. The whole thing — 43 lines — stays where its author put it; the contents beside it link to each section on GitHub.
Clean Code Rules
Naming
- Names reveal intent:
remainingRetriesnotr,fetchActiveUsers()notgetData(). If you need a comment to explain what a variable holds, the name is wrong - Booleans read as questions:
isActive,hasPermission,canEdit,shouldRetry. Neveractive(adjective? noun?) orflag(flag for what?) - Functions are verbs:
fetchUser,calculateTotal,validateInput,parseConfig. NotuserData,total,validator - Avoid abbreviations unless universally understood (URL, ID, HTTP, API).
usr,mgr,ctxsave keystrokes and cost readability. Exception: loop variables (i,j) and lambda params in short chains - Don't encode types in names:
userList,nameString,isActiveBool— the type system already tells you. Justusers,name,isActive
Functions
- One job per function — if you can describe it with "and" it's doing too much.
validateAndSaveUser()is two functions - 3 parameters max. Beyond that, group into an options/config object:
createUser({ name, email, role })notcreateUser(name, email, role, isAdmin, sendWelcome) - Return early with guard clauses to avoid nesting: check preconditions at the top, return/throw, then the happy path stays at indent level 1
- Side effects are lies: a function named
getUserthat also logs analytics and updates a cache is lying about what it does. Name itgetOrCacheUseror split it - Keep functions under 30 lines. If you're scrolling to understand a single function, it's too long. Extract helpers with descriptive names — the function calls become the documentation
Dead Code
- Delete commented-out code immediately — git has the history. Commented code rots: it doesn't compile, doesn't get refactored, and confuses everyone about whether it's needed
- Remove unused imports, variables, functions, and parameters. Every dead symbol is a false signal to the next reader
- Kill feature flags for features that shipped months ago — they add branching complexity with zero value
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.
- 1mo ago First seen · 43 lines · 879 tokens per session scan A 39037c194aac
clean-code is a cursor rule published in the GitHub repository nedcodes-ok/cursorrules-collection (38 stars, last pushed 7mo ago), licensed MIT. It adds 879 tokens to every session, about $0.0035 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-08-30.
Other cursor rules, from other repositories
ai-dev-os-check
Checks code changes against AI Dev OS guidelines and automatically fixes violations. Based on benchmark Test 011 — check+fix achieves +9.9 improvement vs report-only (+0.8). Supports git diff (default), staged changes, and branch comparison. Use --dry-run for report-only mode.
ai-dev-os-scan
Scans ALL source files in the project against AI Dev OS guidelines. Unlike @ai-dev-os-check (which only checks git diff), this performs a full project-wide compliance scan. Use for initial audits, periodic full reviews, or after introducing new guidelines.
ai-dev-os-review
Performs a comprehensive self-review before creating a PR. Combines guideline compliance checking (L3) with design-level review (L2) and philosophical alignment (L1). Unlike @ai-dev-os-check which only checks rules, this also evaluates architecture decisions and code design quality.
review
Structured code review with severity ratings — CRITICAL/HIGH/MEDIUM/LOW.
analyze
Codebase analysis — complexity, coupling, dead code, tech debt hotspots.
layer-dependency
Warns about dependency rule violations when L1-L2 files are edited. L1 philosophy files must not contain tool-specific terms. L2 principle files must not contain framework-specific implementation details.