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 skills/int2t05/engineering-skills/refactoringnpx skills add int2t05/engineering-skills --skill refactoringgit clone --depth 1 https://github.com/int2t05/engineering-skillsWrote 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/int2t05/engineering-skills/refactoring)<a href="https://agentmods.dev/skills/int2t05/engineering-skills/refactoring"><img src="https://agentmods.dev/badge/skills/int2t05/engineering-skills/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 | $0.00123 | $0.01292 |
| Opus 5 | $0.00062 | $0.00646 |
| Sonnet 5 | $0.00025 | $0.00258 |
| Haiku 4.5 | $0.00012 | $0.00129 |
Grade A, and why
refactoring 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 4d 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 — 88 lines — stays where its author put it; the contents beside it link to each section on GitHub.
Refactoring
Restructure code while preserving exact behavior — extract a module, move a class to its better home, redraw a dependency boundary, split or merge files. The goal is a codebase that is easier to evolve, not fewer lines or prettier names. Every move is behavior-preserving and test-pinned.
When to use
- Extracting a module or class from inline code to redraw a boundary
- Moving a function/class to where it has the most context (Feature Envy fix at structure level)
- Splitting one oversized file/module into cohesive units, or merging near-duplicates into one
- Changing a dependency direction — inverting, decoupling, replacing a concrete dep with an interface
- Preparing a codebase for a feature by reshaping it first (then implement separately)
- Triggers on "refactor structure", "extract module", "move class", "split file", "change dependency", "重构结构", "提取模块", "拆分文件", "改依赖图"
Not for: single-file clarity cleanup — renaming, nesting, dead-code removal (use simplify); producing an architecture audit or design doc without executing the change (use codebase-design); machine-detectable lint/style issues (use linting).
Steps
1. Pin behavior before moving anything
Refactoring is behavior-preserving by definition — if behavior can shift, you're not refactoring, you're rewriting. Pin it first:
- Run the test suite; it must be green. If it isn't, stop — fix the breakage or establish the baseline separately.
- If the area has weak coverage, add characterization tests that capture current behavior (inputs → observed outputs) before you touch structure. You're not testing what it should do; you're pinning what it does do so the refactor can't silently change it.
- Note any behavior you suspect is accidental (a bug tests currently encode). Don't fix it here — refactoring preserves behavior, bugs included. File it; fix it in a separate change.
2. Name the structural move
State the move in one sentence before executing. The catalog:
What ships with it
2 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.
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.
- 4d ago First seen · 88 lines · 123 tokens per session scan A 919fcef8c06c
refactoring is a skill published in the GitHub repository int2t05/engineering-skills (3 stars, last pushed 3d ago), licensed MIT. It adds 123 tokens to every session and 1,292 once invoked, about $0.0006 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 skills, from other repositories
specify-incremental
Decompose a single-feature specification into a linear, phase-by-phase implementation plan. Use this for medium-complexity work — single feature, one or two components — where transparent human-in-the-loop phase review is preferred over factory automation.
building
Implementation skill for writing production code with TDD. Covers the RED-GREEN-REFACTOR cycle, false-RED detection, vertical slicing, scope escalation, test process discipline, and code generation patterns. Loaded by component-builder and bug-investigator.
threat-model
Usar para modelar amenazas con metodología STRIDE. También: análisis de amenazas, STRIDE, superficie de ataque, vectores de ataque, modelado de amenazas.
writing-plans
Use when you have a spec or requirements for a multi-step task, before touching code.
sbom-generate
Usar para generar Software Bill of Materials para cumplimiento del CRA. También: Software Bill of Materials, inventario de componentes, CycloneDX, SPDX, cadena de suministro.
memory
This skill should be used when the user asks to record a design decision, search past project decisions, inspect the Alfred memory timeline, or work with the alfred-memory MCP server. Use it to call the namespaced MCP tools instead of inventing history.