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/adriannoes/awesome-agentic-aiWrote 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/adriannoes/awesome-agentic-ai/agentic-clean-code)<a href="https://agentmods.dev/rules/adriannoes/awesome-agentic-ai/agentic-clean-code"><img src="https://agentmods.dev/badge/rules/adriannoes/awesome-agentic-ai/agentic-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/adriannoes/awesome-agentic-ai/agentic-clean-code"><img src="https://agentmods.dev/badge/rules/adriannoes/awesome-agentic-ai/agentic-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.00692 | $0.00692 |
| Opus 5.5 | $0.00277 | $0.00277 |
| Sonnet 5.5 | $0.00138 | $0.00138 |
| Haiku 4.5 | $0.00069 | $0.00069 |
Grade A, and why
agentic-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 3mo 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.
How it starts
The opening of the file, as written. The whole thing — 75 lines — stays where its author put it; the contents beside it link to each section on GitHub.
Agent Clean Code
The primary reader of this code is an AI agent. Optimize for grep navigation, single tool-call comprehension, and headless test loops.
Size and structure
- Functions: 4–30 lines; split if longer.
- Files: under 500 lines; ideal 200–300. Split by responsibility.
- One responsibility per module (SRP).
- Follow framework conventions (Rails, Django, Next.js, etc.) so paths are predictable.
- Prefer small focused modules over god files.
Grep-friendly names
- Names must reveal intent and be distinct in the codebase.
- Avoid generic names:
data,process,handler,Manager,Service,util,helper. - Prefer specific names:
UserRegistrationValidator,InvoiceLineItemTotal. - Target:
rg "<symbol>"returns fewer than 5 hits; if not, rename or namespace.
Types
- Explicit types everywhere the language supports them.
- No untyped public APIs (
any, bareDict, untyped function signatures). - Typed code gives the agent immediate contracts and reduces inference errors.
DRY and control flow
- No duplicated logic across files — extract shared functions or modules.
- Named constants instead of magic numbers.
- Early returns and guard clauses; max 2 indentation levels.
- Prefer pattern matching / guard clauses over deep nesting.
Comments (provenance, not narration)
- Write WHY and provenance, not WHAT the syntax does.
- Keep agent-written comments on refactor — do not strip them.
- Document non-obvious constraints: upstream bugs, business rules, protocol quirks.
- Reference issue numbers when logic exists because of a specific bug or decision.
- Docstrings on public APIs: intent + one usage example.
- Skip obvious comments (
// increment counterabovecount++).
Errors
- Error and exception messages must include the offending value and expected shape.
- Bad:
raise ValueError("invalid input") - Good:
raise ValueError(f"invalid input: received {x!r}, expected non-empty string of digits")
Testability
- Inject dependencies through constructor, parameter, or context — not hidden globals.
- Wrap third-party libraries behind a thin project-owned interface when they may be swapped.
- Mock external I/O (API, DB, filesystem) with named fakes, not scattered inline stubs.
- Every new public function gets a test; every bug fix gets a regression test.
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.
- 3mo ago First seen · 75 lines · 692 tokens per session scan A 6b1b3b94b786
agentic-clean-code is a cursor rule published in the GitHub repository adriannoes/awesome-agentic-ai (108 stars, last pushed 5d ago), licensed MIT. It adds 692 tokens to every session, about $0.0028 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.
agentic-clean-code compared with cursor rules from other repositories
| Mod | Type | Stars | Last push | Licence | Scan | Tokens | Works with |
|---|---|---|---|---|---|---|---|
| agentic-clean-codeadriannoes/awesome-agentic-ai | Cursor rule | 108 | 5d ago | MIT | A | 692 | Cursor |
| code-simplifiersayeedjoy/cursor-rules | Cursor rule | 4 | 10mo ago | none | A | 550 | Cursor |
| optimize-dry-solid-principles-cursorrules-prompt-fPatrickJS/awesome-cursorrules | Cursor rule | 41k | 6mo ago | CC0-1.0 | A | 150 | Cursor |
| advanced-patternsadonai-labs/agent-runway | Cursor rule | 2 | 7d ago | MIT | A | 0 | Cursor |
| testingadonai-labs/agent-runway | Cursor rule | 2 | 7d ago | MIT | A | 0 | Cursor |
| vueinboxpraveen/Minimize-Cursor-Cost | Cursor rule | 12 | 2mo ago | Apache-2.0 | A | 0 | Cursor |
| 004_auto_contextforsonny/Enhanced-Cursor-Memory-Bank-System | Cursor rule | 36 | 1y ago | MIT | A | 0 | Cursor |