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 skills add humanerd-drew/opencode-drewgent --skill codebase-refactoringgit clone --depth 1 https://github.com/humanerd-drew/opencode-drewgentWrote 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/skills/humanerd-drew/opencode-drewgent/codebase-refactoring)<a href="https://agentmods.dev/skills/humanerd-drew/opencode-drewgent/codebase-refactoring"><img src="https://agentmods.dev/badge/skills/humanerd-drew/opencode-drewgent/codebase-refactoring.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.00044 | $0.05538 |
| Opus 5 | $0.00022 | $0.02769 |
| Sonnet 5 | $0.00009 | $0.01108 |
| Haiku 4.5 | $0.00004 | $0.00554 |
Grade C, and why
codebase-refactoring scanned grade C with 2 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 3d 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.
Recursive force deletehighDestructive command
rm -rf with a variable or a broad path is one typo away from removing the wrong tree.
| Dedicated directory | `rm -rf` entire dir | `terminal` | Makes network callslowCapability
Not a fault in itself. Listed so you know the mod talks to something, and to what.
curl -s -o /dev/null -w "%{http_code}" "http://localhost:PORT/path/to/deleted/file" How it starts
The opening of the file, as written. The whole thing — 320 lines — stays where its author put it; the contents beside it link to each section on GitHub.
코드베이스 안전 리팩토링
Systematic, safe refactoring — not big-bang rewrites. One change at a time, verified between each step.
Core Principles
- Map before you cut. Never delete or move code without tracing its import/reference graph first.
- Smallest safe step first. Dead config removal → orphan file deletion → data consolidation → structural change. Each step must be independently reversible.
- Verify between each change. With a running dev server, confirm HTTP 200 before the next edit.
- Master data pattern. When the same data exists in 2+ places (frontend constants, backend arrays, separate workers), extract to a JSON file and have every consumer import it. JSON is universally readable by JS and TS.
- No "while I'm here" expansions. One class of change per session.
Step-by-step Workflow
Phase 1 — Discovery
# 1. Map all files under the project root (exclude node_modules, build artifacts)
find . -type f -name '*.ts' -o -name '*.js' -o -name '*.html' -o -name '*.css' -o -name '*.sql' | grep -v node_modules | sort
# 2. Map all import/reference edges
grep -rn "^import\|from.*['\"]" --include='*.ts' --include='*.js' . | grep -v node_modules | sort
# 3. Identify dead code by reference counting
# If a file/export has zero import references, it's a candidate for deletion
grep -rn "export const\|export function\|export class" --include='*.ts' . | grep -v node_modules
# Cross-reference each export against import statements in other files
Phase 2 — Dead Code Removal (Risk: 🟢 Zero)
Safe to delete when:
- No
importorrequirereferences from any other file - No
<script src="...">or<link href="...">from any HTML - Config keys that are defined but never read (grep for the read-side)
Verification command:
# After deletion, confirm 404 on deleted paths and 200 on everything else
curl -s -o /dev/null -w "%{http_code}" "http://localhost:PORT/path/to/deleted/file"
Phase 2.5 — Complete Feature Removal (Risk: 🟢 Low–🟡 Medium)
What ships with it
6 files beside SKILL.md in the same directory: the scripts, references and assets a skill reads on demand. Not counted in the per-session cost; read them before you install if any of them is executable.
- references/analysis-engine-injection.md 4.1 KB
- references/extraction-completeness-checklist.md 26 KB
- references/m-log-frontend-backend-integration-20260612.md 4.2 KB
- references/m-log-refactoring-session-20260611.md 2.7 KB
- references/m-log-v2-structure-20260613.md 2.8 KB
- references/svelte-mpa-setup.md 4.2 KB
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.
- 3d ago First seen · 320 lines · 44 tokens per session scan C d7fd46376d21
codebase-refactoring is a skill published in the GitHub repository humanerd-drew/opencode-drewgent (2 stars, last pushed 1mo ago), licensed MIT. It adds 44 tokens to every session and 5,538 once invoked, about $0.0002 per session on Opus 5. A static security scan graded it C with 2 findings (recursive force delete, makes network calls). No closer match exists in the catalogue, so it is treated as the original; first seen 2026-09-03.
Other skills, from other repositories
health-check
Get an overall Python code quality health score using pyscn. Use when user asks how healthy or good the code is, wants a quality overview, a grade, a summary of technical debt, or a before/after quality comparison.
code-agent
General-purpose coding agent that reads, writes, and edits code, and searches codebases.
dead-code-cleanup
Use when the user asks about cleanup, removing unused code, refactoring, reducing bundle size, or identifying dead code in a Repowise-indexed codebase (.repowise/ directory exists). Also activates when discussing technical debt, code hygiene, or repository maintenance.
guardrails-developer-guide
Routes NVIDIA NeMo Guardrails library product-usage questions to the canonical documentation. Use when users ask how to install, configure, integrate, evaluate, observe, deploy, troubleshoot, or use the NVIDIA NeMo Guardrails library. Trigger keywords - install guardrails, configure rails, guardrail catalog, Colang…
ast-grep
Write, debug, and validate ast-grep structural code search rules. Use for syntax-aware code search, AST pattern matching, structural refactor discovery, or searches plain text tools like rg can miss — functions with particular descendants, calls inside specific contexts, decorators, or other Tree-sitter-backed…
tldr-code
Token-efficient code analysis via 5-layer stack (AST, Call Graph, CFG, DFG, PDG). 95% token savings.