refactor

A controlled workflow for changing code structure while using tests to check that behavior stays the same. Refactoring means reorganizing code without intentionally changing what it does.

In plain words
What is it for?
Use it to refactor, restructure, reorganize, clean up, or rename code across a project while requiring tests to pass.
Why use it?
It breaks the work into analysis, planning, changes, testing, fixes, and comparison, so structural changes are checked before completion.

Skill for Claude CodeCodex

Install

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.

agentmods
npx agentmods add skills/5uck1ess/devkit/refactor
Any agent
npx skills add 5uck1ess/devkit --skill refactor
Clone the repo
git clone --depth 1 https://github.com/5uck1ess/devkit

Made for: Claude Code, Codex.

Per session 223 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 331 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

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.

ModelPer sessionOnce invoked
Fable 5 $0.00223 $0.00331
Opus 5 $0.00112 $0.00166
Sonnet 5 $0.00045 $0.00066
Haiku 4.5 $0.00022 $0.00033

Measured yesterday against content hash 26e39ab3b9ae, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

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 yesterday.

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.

skills/refactor/SKILL.md · 15 lines

What it actually says

Refactor

Deterministic refactor workflow. Analyze → plan → refactor → run-tests → fix-tests → comparison. Tests are the safety net — the workflow will not exit until they pass.

Invoke

Use the devkit_start tool with workflow: "refactor" and input: "{input}".

Then follow each step the engine returns. Call devkit_advance after completing each step. The engine controls step order, gates, and loops. Do NOT skip steps.

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.

  1. yesterday First seen · 15 lines · 223 tokens per session scan A 26e39ab3b9ae

Subscribe to this mod's changes

refactor is a skill published in the GitHub repository 5uck1ess/devkit (5 stars, last pushed 13d ago), licensed MIT. It adds 223 tokens to every session and 331 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-31.

Related

Other skills, from other repositories