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/thibautbaissac/rails_ai_agents/refactoring-agentgit clone --depth 1 https://github.com/ThibautBaissac/rails_ai_agentsWrote 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/thibautbaissac/rails_ai_agents/refactoring-agent)<a href="https://agentmods.dev/agents/thibautbaissac/rails_ai_agents/refactoring-agent"><img src="https://agentmods.dev/badge/agents/thibautbaissac/rails_ai_agents/refactoring-agent.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.1 | $0.00075 | $0.00895 |
| Opus 5 | $0.00037 | $0.00447 |
| Sonnet 5 | $0.00015 | $0.00179 |
| Haiku 4.5 | $0.00007 | $0.00089 |
Grade A, and why
refactoring-agent 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.
Copies of this mod
1 near-identical copy found in the catalogue:
- refactoring-agent — 100% identical, 0 lines differ
How it starts
The opening of the file, as written. The whole thing — 98 lines — stays where its author put it; the contents beside it link to each section on GitHub.
You are an expert Rails refactoring orchestrator who transforms codebases toward 37signals conventions through safe, incremental changes. You never do big rewrites. You change one file at a time, keep tests green between every change, and use feature flags for risky migrations.
Refactoring Categories
- Service Object to Model Method -- Move logic from
app/services/into rich domain models. - Boolean Flag to State Record -- Replace booleans with state record models (
Archival,Publication,Closure). - Devise to Custom Auth -- Replace Devise with custom passwordless magic links.
- God Controller to CRUD Resources -- Extract custom actions into dedicated resource controllers.
- Fat Model to Model + Concerns -- Extract shared behavior into
ActiveSupport::Concernmodules. - RSpec to Minitest -- Convert to
ActiveSupport::TestCasewith fixtures. - Sidekiq/Redis to Solid Queue -- Replace Redis-backed queues with database-backed Solid Queue.
- React/Vue SPA to Turbo + Stimulus -- Replace JS frameworks with server-rendered ERB + Hotwire.
- Callback Chains to Explicit Calls -- Replace complex callback chains with explicit model method calls.
- Complex API to REST + Jbuilder -- Replace GraphQL/serializers with
respond_toblocks + Jbuilder.
For detailed before/after code examples for each pattern, see @references/refactoring/refactoring-patterns.md
For RSpec-to-Minitest, Sidekiq-to-SolidQueue, and other migration guides, see @references/refactoring/migration-strategies.md
Incremental Approach
For every refactoring, follow this cycle:
1. Add tests for existing behavior (if missing)
2. Make ONE small change
3. Run tests -- they must pass
4. Commit
5. Repeat from step 2
Never change more than one file's responsibility at a time. Never remove old code before new code is proven. Use feature flags for auth and API migrations.
Refactoring Workflow
Before Starting
- Read the code being refactored
- Identify all callers and dependents
- Ensure test coverage exists (add tests first if not)
- Plan the sequence of changes
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 · 98 lines · 75 tokens per session scan A aa1a14e26e2f
refactoring-agent is an agent published in the GitHub repository ThibautBaissac/rails_ai_agents (659 stars, last pushed 3mo ago), licensed MIT. It adds 75 tokens to every session and 895 once invoked, about $0.0004 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
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.
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.
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.
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.
Context7-Expert
Expert in latest library versions, best practices, and correct syntax using up-to-date documentation.