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/refactoring-skill)<a href="https://agentmods.dev/rules/kaelsensei/magicaibuilder/refactoring-skill"><img src="https://agentmods.dev/badge/rules/kaelsensei/magicaibuilder/refactoring-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/refactoring-skill"><img src="https://agentmods.dev/badge/rules/kaelsensei/magicaibuilder/refactoring-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.00534 | $0.00534 |
| Opus 5.5 | $0.00214 | $0.00214 |
| Sonnet 5.5 | $0.00107 | $0.00107 |
| Haiku 4.5 | $0.00053 | $0.00053 |
Grade A, and why
refactoring-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 — 48 lines — stays where its author put it; the contents beside it link to each section on GitHub.
Refactoring rule
Based on Martin Fowler (Refactoring), Kent Beck (Tidy First?) and Michael Feathers (Working Effectively with Legacy Code).
Principles
- A refactoring changes structure, never behaviour. The tests are green before and after, and no
assertion changes (a move may rewrite import and
vi.mockpaths in tests, nothing else). - Keep structural and behavioural changes in separate commits. A structural change of more than about 200 changed lines, or any move across contexts, gets its own PR, because features are squash-merged.
- "Make the change easy, then make the easy change." When a behaviour change is hard, tidy first, in a separate commit.
- Take small steps. After each one the code compiles and the focused tests pass.
- Common tidyings: guard clause, extract function, explaining variable or constant, rename, reorder for reading, delete dead code, delete a redundant comment.
Before splitting a large file
Pin its current behaviour with characterization or approval tests at its public surface: store
actions, rendered output, route responses. Their names start with characterization:. The first
candidates are the deck store, the builder page, DeckWizard, the playtest engine and the AI
routes (docs/adr/0005-testing-strategy-fakes-contracts-and-characterization.md). A
characterization test that pins a known bug says so in its name.
Moves
A move PR changes no logic. It rewrites every import and vi.mock path in the same commit. Once
the move codemod exists it makes the moves. Re-export shims are removed at the end of their series
of PRs, except the ones the on-hold branch feat/ai-usage-metering-and-monthly-quota still
imports: they stay until that branch is rebased and the codemod has rewritten its imports.
Never
- Change behaviour "while you are there". A behaviour change found during a refactor gets its own
fix/PR with a Red test. - Change the browser's legality feedback checks (the copy clamp, the companion check, "already in the deck"). Changing them is an owner decision.
- Edit a file that an open PR or a pending branch changes, unless the task says so; list the overlap instead.
- Delete code that has product intent. Delete only code with no importer and no product intent; list orphaned features for the owner.
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 · +13 lines · +415 tokens per session 9e8891c09600
- 3mo ago First seen · 35 lines · 119 tokens per session scan A a8c86e89f6cd
refactoring-skill is a cursor rule published in the GitHub repository KaelSensei/MagicAIBuilder (2 stars, last pushed today), licensed MIT. It adds 534 tokens to every session, about $0.0021 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.
refactoring-skill compared with cursor rules from other repositories
| Mod | Type | Stars | Last push | Licence | Scan | Tokens | Works with |
|---|---|---|---|---|---|---|---|
| refactoring-skillKaelSensei/MagicAIBuilder | Cursor rule | 2 | today | MIT | A | 534 | 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 |