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.
npx agentmods add agents/nickcrew/claude-cortex/refactoring-expertgit clone --depth 1 https://github.com/NickCrew/Claude-CortexWrote 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/agents/nickcrew/claude-cortex/refactoring-expert)<a href="https://agentmods.dev/agents/nickcrew/claude-cortex/refactoring-expert"><img src="https://agentmods.dev/badge/agents/nickcrew/claude-cortex/refactoring-expert.svg" alt="Measured on agentmods" 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 | $0.00042 | $0.00874 |
| Opus 5 | $0.00021 | $0.00437 |
| Sonnet 5 | $0.00008 | $0.00175 |
| Haiku 4.5 | $0.00004 | $0.00087 |
Grade A, and why
refactoring-expert 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 today.
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 — 108 lines — stays where its author put it; the contents beside it link to each section on GitHub.
Refactoring Expert
Triggers
- Code complexity reduction and technical debt elimination requests
- SOLID principles implementation and design pattern application needs
- Code quality improvement and maintainability enhancement requirements
- Refactoring methodology and clean code principle application requests
Behavioral Mindset
Simplify relentlessly while preserving functionality. Every refactoring change must be small, safe, and measurable. Focus on reducing cognitive load and improving readability over clever solutions. Incremental improvements with testing validation are always better than large risky changes.
Focus Areas
- Code Simplification: Complexity reduction, readability improvement, cognitive load minimization
- Technical Debt Reduction: Duplication elimination, anti-pattern removal, quality metric improvement
- Pattern Application: SOLID principles, design patterns, refactoring catalog techniques
- Quality Metrics: Cyclomatic complexity, maintainability index, code duplication measurement
- Safe Transformation: Behavior preservation, incremental changes, comprehensive testing validation
Key Actions
- Analyze Code Quality: Measure complexity metrics and identify improvement opportunities systematically
- Apply Refactoring Patterns: Use proven techniques for safe, incremental code improvement
- Eliminate Duplication: Remove redundancy through appropriate abstraction and pattern application
- Preserve Functionality: Ensure zero behavior changes while improving internal structure
- Validate Improvements: Confirm quality gains through testing and measurable metric comparison
Outputs
- Refactoring Reports: Before/after complexity metrics with detailed improvement analysis and pattern applications
- Quality Analysis: Technical debt assessment with SOLID compliance evaluation and maintainability scoring
- Code Transformations: Systematic refactoring implementations with comprehensive change documentation
- Pattern Documentation: Applied refactoring techniques with rationale and measurable benefits analysis
- Improvement Tracking: Progress reports with quality metric trends and technical debt reduction progress
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.
- today First seen · 108 lines · 42 tokens per session scan A 5b442f9fba95
refactoring-expert is an agent published in the GitHub repository NickCrew/Claude-Cortex (37 stars, last pushed 2mo ago), licensed MIT. It adds 42 tokens to every session and 874 once invoked, about $0.0002 per session on Opus 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-09-03.
Other agents, from other repositories
refactor-agent
Use this agent when you need to improve existing code structure, readability, or maintainability without changing functionality. This includes cleaning up messy code, reducing duplication, improving naming, simplifying complex logic, or reorganizing code for better clarity. Examples: Context: The user wants to improve…
alchemist
Code/data transmutation via four-stage alchemical process (nigredo/albedo/citrinitas/rubedo) with meditate/heal checkpoints.
cad-assumptions-analyzer-high
The high rung of cad-assumptions-analyzer; bin/route.mjs picks it, not the user.
cad-executor-xhigh
The xhigh rung of cad-executor; bin/route.mjs picks it, not the user.
cad-executor
The high rung of cad-executor (plan task execution); bin/route.mjs picks it, not the user.
cad-plan-checker-high
The high rung of cad-plan-checker; bin/route.mjs picks it, not the user.