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/KaelSensei/MagicAIBuilderWrote 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/kaelsensei/magicaibuilder/clean-code-skill)<a href="https://agentmods.dev/rules/kaelsensei/magicaibuilder/clean-code-skill"><img src="https://agentmods.dev/badge/rules/kaelsensei/magicaibuilder/clean-code-skill/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/kaelsensei/magicaibuilder/clean-code-skill"><img src="https://agentmods.dev/badge/rules/kaelsensei/magicaibuilder/clean-code-skill.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.00502 | $0.00502 |
| Opus 5.5 | $0.00201 | $0.00201 |
| Sonnet 5.5 | $0.00100 | $0.00100 |
| Haiku 4.5 | $0.00050 | $0.00050 |
Grade A, and why
clean-code-skill 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 20d 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 — 45 lines — stays where its author put it; the contents beside it link to each section on GitHub.
Clean Code rule
Based on Robert C. Martin (Clean Code) and Kent Beck (Tidy First?). The full reference is the
clean-code skill; TypeScript specifics are in the typescript-craftsmanship skill.
Principles
- Duplicated knowledge is a bug; similar-looking code is a hint. When the same business rule appears twice, move it now into the context that owns it. When code only looks alike, wait for the third occurrence and check it is the same concept.
- One responsibility per function, component and module. A name that needs "and" asks for a split.
- Names reveal intent and come from the glossary in
CONTEXT.md. - Guard clauses over nested
if/else. Nesting depth ≤ 3. - Small units. Cognitive complexity ≤ 15 per function. Components ≤ 200 lines, other files ≤ 300 lines, comments and blank lines excluded. A file already over its limit must not grow; leave it smaller when you touch it.
- No magic values. A named constant, with a comment that gives its source.
- No commented-out code and no
console.log(usesrc/lib/logger.ts). - Comments carry information: a module header, a TSDoc contract on every export, a "why" with
its source. Never a restatement of the code (
docs/engineering/code-documentation.md).
Errors
- Parse at the boundary with Zod; inside, trust the types.
- Never swallow an error: log it, wrap it or rethrow it.
- Expected failures are values (a discriminated union), mapped exhaustively at the edge.
Enforcement
The size and complexity limits are prose today. ESLint max-lines, max-lines-per-function and
complexity, with bulk suppressions as a ratchet, are planned
(docs/adr/0007-architecture-enforcement-in-stages.md). SonarCloud reports duplication and
complexity; it is advisory (CLAUDE.md).
Agent behaviour
- Do not explain unclear code with a comment: rename or extract it first.
- Tidy in a separate structural commit, never mixed with a behaviour change.
- Do not reformat code you are not otherwise changing.
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.
- 20d ago Changed · -16 lines · -130 tokens per session 800af2aabdd0
- 3mo ago First seen · 61 lines · 632 tokens per session scan A da0ba34ae3c8
clean-code-skill is a cursor rule published in the GitHub repository KaelSensei/MagicAIBuilder (2 stars, last pushed today), licensed MIT. It adds 502 tokens to every session, about $0.0020 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-31.
clean-code-skill compared with cursor rules from other repositories
| Mod | Type | Stars | Last push | Licence | Scan | Tokens | Works with |
|---|---|---|---|---|---|---|---|
| clean-code-skillKaelSensei/MagicAIBuilder | Cursor rule | 2 | today | MIT | A | 502 | Cursor |
| ultraciteelie222/inbox-zero | Cursor rule | 13k | today | none | A | 0 | Cursor |
| server-actionskrivoox/agent-stack-template | Cursor rule | 30 | 2mo ago | MIT | A | 0 | Cursor |
| projectkrivoox/agent-stack-template | Cursor rule | 30 | 2mo ago | MIT | A | 656 | Cursor |
| ui-design-systemkrivoox/agent-stack-template | Cursor rule | 30 | 2mo ago | MIT | A | 0 | Cursor |
| performancekrivoox/agent-stack-template | Cursor rule | 30 | 2mo ago | MIT | A | 0 | Cursor |
| prisma-schemakrivoox/agent-stack-template | Cursor rule | 30 | 2mo ago | MIT | A | 0 | Cursor |