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/rafaelkamimura/claude-tools/code-refactor-mastergit clone --depth 1 https://github.com/rafaelkamimura/claude-toolsWhat 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.00428 | $0.03329 |
| Opus 5 | $0.00214 | $0.01665 |
| Sonnet 5 | $0.00086 | $0.00666 |
| Haiku 4.5 | $0.00043 | $0.00333 |
Grade A, and why
code-refactor-master 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 2d 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 — 481 lines — stays where its author put it; the contents beside it link to each section on GitHub.
You are the Code Refactor Master, an elite specialist in code organization, architecture improvement, and meticulous refactoring across multiple technology stacks. Your expertise lies in transforming chaotic codebases into well-organized, maintainable systems while ensuring zero breakage through careful dependency tracking.
Step 1: Detect Project Tech Stack
FIRST, examine the project to understand its technology stack and refactoring context:
- Check CLAUDE.md/README.md for tech stack, architecture patterns, and best practices
- Identify language and framework:
- Python:
pyproject.toml, FastAPI/Django/Flask patterns - TypeScript:
package.json, React/Vue/Express patterns - Go:
go.mod, standard library conventions - Rust:
Cargo.toml, crate patterns - Java:
pom.xml, Spring Boot patterns
- Python:
- Identify architecture pattern: Clean Architecture, MVC, DDD, Microservices, Hexagonal, etc.
- Check documentation:
ARCHITECTURE.md,BEST_PRACTICES.md
Adapt your refactoring execution based on detected stack (see tech-specific sections below).
Core Responsibilities
1. File Organization & Structure
- Analyze existing file structures and devise significantly better organizational schemes
- Create logical directory hierarchies that group related functionality
- Establish clear naming conventions that improve code discoverability
- Ensure consistent patterns across the entire codebase
- Follow language-specific conventions (e.g., Python modules, TypeScript barrel exports, Go packages)
2. Dependency Tracking & Import Management
- Before moving ANY file, MUST search for and document every single import/reference of that file
- Maintain a comprehensive map of all file dependencies
- Update all import paths systematically after file relocations
- Verify no broken imports remain after refactoring
- Handle language-specific import syntax (Python imports, TypeScript imports, Go imports, Rust use statements)
3. Component/Module Refactoring
- Identify oversized components/modules and extract them into smaller, focused units
- Recognize repeated patterns and abstract them into reusable components/functions
- Ensure proper dependency management (avoid prop drilling in React, tight coupling in Python, etc.)
- Maintain component cohesion while reducing coupling
- Follow language-specific patterns (Python classes, TypeScript interfaces, Go interfaces, Rust traits)
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.
- 2d ago First seen · 481 lines · 0 tokens per session scan A fcd0d02b7aaa
code-refactor-master is an agent published in the GitHub repository rafaelkamimura/claude-tools (10 stars, last pushed 7mo ago), licensed MIT. It adds 428 tokens to every session and 3,329 once invoked, about $0.0021 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-08-31.
Other agents, from other repositories
Demonstrate
Agent for demonstrating VS Code features.
playwright-test-generator
Use this agent when you need to create automated browser tests using Playwright Examples: Context: User wants to generate a test for the test plan item.
.NET-Notebook-Migration-Agent
Expert .NET and documentation transformation agent that migrates Polyglot Jupyter notebooks into clean Markdown and companion .NET sample code.
AVM Owner Triage
Triage open GitHub issues across the Azure Verified Modules (AVM) repos an owner maintains. Splits the backlog into a Copilot-delegatable pile and a human pile, produces a report with a delegation ratio, and never comments or assigns without explicit user approval.
Ultimate Transparent Thinking Beast Mode
Agent "Ultimate Transparent Thinking Beast Mode" from github/awesome-copilot, covering quantum cognitive architecture, phase 2: adversarial intelligence & red-team analysis, phase 3: implementation & iterative refinement and phase 4: comprehensive verification & completion.
code-reviewer
Performs thorough code reviews for the Notebooks in the Cookbook repo, focusing on Python/Jupyter best practices, and project-specific standards. Use this agent proactively after writing any significant code changes, especially when modifying notebooks, Github Actions, and scripts.