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 AnastasiyaW/codex-claude-code-config --skill refactoring-safelygit clone --depth 1 https://github.com/AnastasiyaW/codex-claude-code-configWrote 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/anastasiyaw/codex-claude-code-config/refactoring-safely)<a href="https://agentmods.dev/skills/anastasiyaw/codex-claude-code-config/refactoring-safely"><img src="https://agentmods.dev/badge/skills/anastasiyaw/codex-claude-code-config/refactoring-safely.svg" alt="Measured on agentmods" height="20"></a>- NVIDIA SkillSpector pass
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.00221 | $0.01722 |
| Opus 5 | $0.00111 | $0.00861 |
| Sonnet 5 | $0.00044 | $0.00344 |
| Haiku 4.5 | $0.00022 | $0.00172 |
Grade A, and why
refactoring-safely 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 today.
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 — 132 lines — stays where its author put it; the contents beside it link to each section on GitHub.
Refactoring safely — changing shape without changing behaviour
Refactoring is a behaviour-preserving transformation. If behaviour changed, that was not a refactor, it was a rewrite with optimistic branding — and the reason large restructures fail is almost always that the two were done in one step.
The rule that makes the rest work
Never restructure and change behaviour in the same commit. Alternate deliberately: refactor (green → green, no behaviour change), then change behaviour (with a new test). When both happen at once, a failing test cannot tell you which half broke it.
Before touching anything: the net
Legacy code is code without tests, regardless of age. So:
- Characterization tests first. Not tests of what it should do — tests of what it does, including behaviour you consider wrong. Their job is to detect change, not to judge it. Wrong-but-tested behaviour gets fixed later, on purpose, in its own commit.
- Cover the seams you are about to cut, not the whole file. Coverage of the region under the knife is what matters.
- Confirm they fail when you break something. A characterization test that passes against deliberately broken code is worse than none — run that check once.
- Know how to revert. Small commits, one transformation each.
Smells, and what each one actually indicates
| Smell | Underlying problem | Transformation |
|---|---|---|
| Long function | Several jobs in one scope | Extract function, split by level of abstraction |
| Large module | Several reasons to change in one file | Move features into modules that own their state |
| Long parameter list | A missing object, or a hidden mode flag | Introduce parameter object; split by behaviour |
| Feature envy | Method uses another object's data more than its own | Move method to where the data lives |
| Shotgun surgery | One decision spread across files | Gather it into one owner |
| Divergent change | One file changing for unrelated reasons | Split by reason to change |
| Primitive obsession | A concept represented as a string or dict everywhere | Introduce a type; put its rules with it |
| Duplicated decision | One rule expressed in several places | Extract and give it one home |
What ships with it
7 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/refactoring-patterns-original.md 21 KB
- references/refactoring-patterns/composing-methods.md 12 KB
- references/refactoring-patterns/moving-features.md 12 KB
- references/refactoring-patterns/organizing-data.md 13 KB
- references/refactoring-patterns/refactoring-workflow.md 14 KB
- references/refactoring-patterns/simplifying-conditionals.md 13 KB
- references/refactoring-patterns/smell-catalog.md 13 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.
- today Changed · +12 lines b66703881863
- 8d ago First seen · 120 lines · 221 tokens per session scan A 117415c55843
refactoring-safely is a skill published in the GitHub repository AnastasiyaW/codex-claude-code-config (149 stars, last pushed today), licensed MIT. It adds 221 tokens to every session and 1,722 once invoked, about $0.0011 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-30.
Other skills, from other repositories
code-review
Reviews code for bugs, security issues, and best practices.
trulens-instrumentation
Instrument LLM apps with TruLens OTEL-based tracing - from setup to debugging and optimization.
trulens-diagnosis
Diagnose low evaluation scores and generate actionable improvement recommendations.
lfe-inspector
Act as the Inspector for an LFE-compliant project. Use when verifying an implementation against domain truth, validation baselines, or debugging regressions.
lfe-diagnose
Disciplined bug-diagnosis loop. Reproduce → Hypothesise → Fix. Use in the Inspector sub-pipeline (Step 3, conditional) when verification fails.
lfe-scout
Rapid maintenance for minor fixes (max 3 files). Bypasses the full pipeline for non-architectural content edits.