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/fatihkan/badiWrote 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/fatihkan/badi/refactor)<a href="https://agentmods.dev/commands/fatihkan/badi/refactor"><img src="https://agentmods.dev/badge/commands/fatihkan/badi/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/fatihkan/badi/refactor"><img src="https://agentmods.dev/badge/commands/fatihkan/badi/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.00290 |
| Opus 5.5 | $0.00000 | $0.00116 |
| Sonnet 5.5 | $0.00000 | $0.00058 |
| Haiku 4.5 | $0.00000 | $0.00029 |
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 1mo 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.
What it actually says
Refactoring command. Detects code smells and creates a safe refactoring plan.
Required Tools
- Read (code reading)
- Grep (pattern scan)
- Glob (file discovery)
- Agent (refactoring-advisor agent)
- Bash (running tests)
Procedure (5 Steps)
Step 1: Define the Scope
- A specific file/function or a module?
- What is the user's goal? (performance, readability, testability, SOLID compliance)
Step 2: Delegate to the Refactoring-Advisor Agent
Pass the agent:
- Target file(s)
- The user's goal
- Current test coverage state
Step 3: Review the Suggestions
Present the agent's suggestions to the user:
- A before/after example for each suggestion
- Risk assessment
- Other files that will be affected
Step 4: Apply the Approved Changes
With user approval:
- Apply the refactoring steps in order
- Run the tests after each step
- Roll back on failure
Step 5: Verify and Document
- Verify all tests pass
- Add a change summary to the daily note
- Suggest an ADR for large refactorings
Output Format
=== BADI REFACTORING ===
Scope: [file/module]
Detected: [code smell count]
Applied: [refactoring count]
Tests: PASSED / FAILED
========================
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.
- 1mo ago First seen · 48 lines · 0 tokens per session scan A 0d9522544808
refactor is a command published in the GitHub repository fatihkan/badi (7 stars, last pushed 19d ago), licensed MIT. It costs nothing until one of its globs matches a file; then it loads 290 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-09-06.
Other commands, from other repositories
hatch3r-bug-plan
Diagnose a complex incident -- reproduce the symptom, rank root-cause hypotheses, design the fix path, and emit regression coverage items as a board-ready investigation.
hatch3r-bug-pipeline
Run a known-cause bug fix through a 3-phase test-first pipeline -- reproduce + root-cause, regression-test + fix together, then root-cause-depth review -- with full sub-agent delegation.
check-cache-bugs
Audit Claude Code setup for cache bugs (CC#40524) — sentinel, --resume/--continue, attribution header + ArkNill B3/B4/B5.
investigate
Systematic root-cause debugging — find the cause before writing any fix.
qa
Systematic QA testing of a web application — diff-aware, tiered, with fix-and-verify loop.
autoresearch
Autonomous improvement loop — scan codebase metrics, scaffold experiment files, run agent-driven iterations until metric improves.