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/kid-sid/claude-spellbookWrote 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/commands/kid-sid/claude-spellbook/refactor)<a href="https://agentmods.dev/commands/kid-sid/claude-spellbook/refactor"><img src="https://agentmods.dev/badge/commands/kid-sid/claude-spellbook/refactor/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/commands/kid-sid/claude-spellbook/refactor"><img src="https://agentmods.dev/badge/commands/kid-sid/claude-spellbook/refactor.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.00000 | $0.00691 |
| Opus 5.5 | $0.00000 | $0.00276 |
| Sonnet 5.5 | $0.00000 | $0.00138 |
| Haiku 4.5 | $0.00000 | $0.00069 |
Grade A, and why
refactor 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 — 101 lines — stays where its author put it; the contents beside it link to each section on GitHub.
Analyze code for smells and suggest or apply refactoring with examples.
Instructions
- Read the target file or directory the user specifies.
- Detect the language and analyze the code for these smell categories:
Code Smells to Detect
Size & Complexity:
- Functions longer than 30 lines
- Classes with more than 10 methods (God Class)
- Cyclomatic complexity > 10
- Deep nesting (> 3 levels)
- Long parameter lists (> 4 parameters)
Duplication & Coupling:
- Duplicate or near-duplicate code blocks
- Shotgun surgery (one change requires editing many files)
- Feature envy (method uses another class's data more than its own)
- Inappropriate intimacy (classes that know too much about each other)
Naming & Clarity:
- Unclear variable/function names
- Magic numbers without named constants
- Boolean parameters (use named options/enums instead)
- Comments explaining "what" instead of code being self-documenting
Design:
- Primitive obsession (using primitives instead of small value objects)
- Data clumps (groups of data that always appear together)
- Switch statements that should be polymorphism
- Refused bequest (subclass doesn't use parent's methods)
- Speculative generality (unused abstractions)
SOLID Violations:
- Single Responsibility: class/function doing too many things
- Open/Closed: modification required instead of extension
- Liskov Substitution: subtypes not substitutable for base types
- Interface Segregation: forced to depend on unused methods
- Dependency Inversion: high-level modules depending on low-level details
-
For each smell found, provide:
- Location: file:line
- Smell: name of the code smell
- Severity: Low / Medium / High
- Current code: the problematic snippet
- Refactored code: the improved version
- Technique: name of the refactoring pattern applied (e.g., Extract Method, Replace Conditional with Polymorphism, Introduce Parameter Object)
-
Output format:
## Refactoring Report
**File(s):** {paths}
**Language:** {language}
**Issues found:** {count}
### High Priority
#### 1. {Smell Name} — {file:line}
**Technique:** {refactoring pattern}
Before:
```{lang}
{original code}
After:
{refactored code}
Why: {explanation of the improvement}
Medium Priority
{same format}
Low Priority
{same format}
Summary
- {count} issues found across {severity levels}
- Estimated improvement: {what gets better — readability, testability, maintainability}
- Suggested order: {which refactors to do first}
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 · 101 lines · 0 tokens per session scan A 2a0c04c82223
refactor is a command published in the GitHub repository kid-sid/claude-spellbook (194 stars, last pushed 3mo ago), licensed MIT. It costs nothing until one of its globs matches a file; then it loads 691 tokens. 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.
refactor compared with commands from other repositories
| Mod | Type | Stars | Last push | Licence | Scan | Tokens | Works with |
|---|---|---|---|---|---|---|---|
| refactorkid-sid/claude-spellbook | Command | 194 | 3mo ago | MIT | A | 0 | Claude Code |
| review-branchdamusix/atomic-claude | Command | 117 | today | MIT | A | 35 | Claude Code |
| diff-reviewcoco-research/coco | Command | 323 | 3d ago | Apache-2.0 | A | 11 | Claude Code |
| spec-trace-requirementsrjmurillo/ai-agents | Command | 50 | today | Apache-2.0 | A | 0 | GitHub Copilot |
| merge-conflict-analysisrjmurillo/ai-agents | Command | 50 | today | Apache-2.0 | A | 0 | GitHub Copilot |
| refactorRchGrav/claudebox | Command | 1.2k | 2mo ago | MIT | A | 9 | Claude Code |
| initazrtydxb/procoder | Command | 212 | 23d ago | Apache-2.0 | A | 16 | Claude Code |