refactor

refactor is a skill for Claude Code from sd0xdev/sd0x-harness. It costs 65 tokens per session (2,898 once invoked), scanned A, original, MIT.

A refactoring coordinator for cleaning up or restructuring multiple code or documentation targets, followed by a review step.

In plain words
What is it for?
Use it to simplify messy code or documents, reduce complexity, or perform a batch cleanup across selected files or directories.
Why use it?
It organizes broad cleanup work and helps keep the resulting changes checked rather than treating each edit as an isolated task.

Skill for Claude Code

Written for Claude Code: allowed-tools in frontmatter. Also seen: mentions CLAUDE.md; names the AskUserQuestion tool; mentions Codex.

Part of the sd0x-dev-flow plugin — 98 skills, 16 agents, 5 hooks shipped together

Good fit Use it to simplify messy code or documents, reduce complexity, or perform…

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/sd0xdev/sd0x-harness/refactor
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.

Any agent
npx skills add sd0xdev/sd0x-harness --skill refactor
Clone the repo
git clone --depth 1 https://github.com/sd0xdev/sd0x-harness

Made for: Claude Code.

Or install sd0x-dev-flow, the plugin that ships this one along with the rest of its 98 skills, 16 agents, 5 hooks.

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

agentmods badge for refactor

README.md
[![agentmods](https://agentmods.dev/badge/skills/sd0xdev/sd0x-harness/refactor.svg)](https://agentmods.dev/skills/sd0xdev/sd0x-harness/refactor)
Your own site
<a href="https://agentmods.dev/skills/sd0xdev/sd0x-harness/refactor"><img src="https://agentmods.dev/badge/skills/sd0xdev/sd0x-harness/refactor.svg" alt="Measured on agentmods" height="20"></a>
Per session 65 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 2,898 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe.
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.1 $0.00065 $0.02898
Opus 5 $0.00032 $0.01449
Sonnet 5 $0.00013 $0.00580
Haiku 4.5 $0.00006 $0.00290

Measured 3d ago against content hash 4458b29ae759, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-06, 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 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.

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 · 268 lines

How it starts

The opening of the file, as written. The whole thing — 268 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Refactor — Multi-Target Refactoring Orchestrator

Trigger

  • Keywords: refactor, cleanup, clean up, simplify code, restructure, tidy up, reduce complexity, batch refactor
  • zh-TW: 重構, 整理, 清理, 簡化

When NOT to Use

Scenario Alternative
New feature development /feature-dev
Bug fix /bug-fix
Code understanding /code-explore
Doc review only /codex-review-doc
Single file simplify (known target) /simplify directly
Remove AI artifacts (known doc) /de-ai-flavor directly

Prohibited Actions

❌ git add | git commit | git push — per @rules/git-workflow.md

budget:token_budget150000</budget:token_budget>

Arguments

Flag Default Description
--target <path> Specific file or directory (repo-relative)
--auto Auto-detect targets using inline metrics
--max-targets N 10 Maximum targets per run
--mode reference-stability Narrow pointer-conversion pass (see § Reference-Stability Targets). Requires explicit --target files — repeat the flag for multiple files (--target a.md --target b.js, ≤ 5); incompatible with --auto

Workflow

Phase 0: Target Detection → Phase 2: Incremental Refactor Loop → Phase 3: Report
(Phase 1: reserved for v2 — parallel exploration)

Phase 0: Target Detection & Planning

--mode reference-stability Branch (checked first)

When this mode is passed, Phase 0 takes this branch and bypasses the generic pipeline below entirely — no AI-artifact heuristic, no refactor-catalog classification, and no v2 type skip (the mode accepts any maintained text file its transformation table covers: docs, code, tests, instruction surfaces — a *.test.js target is valid here even though the generic path skips test files as v2). In code and test files, only comment and documentation regions are conversion candidates: executable strings, assertion expectations, fixtures, snapshots, generated content, and ordinary data are never touched — that is INV-005's boundary, and it is what makes skipping the behavioral gate sound (an eligible prose-only comment cannot change runtime behavior — tool-consumed directives and pragmas such as lint/type-checker directives or source-map metadata are not eligible regions, since comments can carry machine semantics; anything that could change behavior is out of this mode's reach):

Read the full file on GitHub · 268 lines

Files

What ships with it

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

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. 3d ago First seen · 268 lines · 65 tokens per session scan A 4458b29ae759

Subscribe to this mod's changes

refactor is a skill published in the GitHub repository sd0xdev/sd0x-harness (188 stars, last pushed yesterday), licensed MIT. It adds 65 tokens to every session and 2,898 once invoked, about $0.0003 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-09-03.

Related

Other skills, from other repositories

code-review

Two-mode skill: (1) adversarial review — spec compliance + code quality + security, confidence-scored findings with file:line evidence; (2) receiving review — verify-before- agreeing discipline for acting on external/human review feedback.

romiluz13/cc10x · 53 tokens

codebase-hygiene

Two-mode skill: (1) find semantic duplicates — functions doing the same thing under different names, invisible to copy-paste detectors; (2) deepen shallow modules — thin wrappers and pass-through layers that spread complexity. Advisory and read-only; changes route through BUILD with full gates.

romiluz13/cc10x · 67 tokens

evaluator-review-contract

Internal Auto-Harness evaluator skill for sprint contract review before implementation. Use only inside the Evaluator subagent during review mode.

redker56/auto-harness · 30 tokens

comet-verify

Comet Phase 4: Verify and Close. Invoke with /comet-verify. Verify implementation matches design, handle development branch.

rpamis/comet · 32 tokens

comet-review

A read-only review guide for checking the current Comet change, a managed software-change workflow. It focuses on correctness, security, and boundary problems without changing files or advancing the workflow.

rpamis/comet · 30 tokens

comet-github-pr-review

A read-only review process for pull requests in Comet's GitHub repositories. A pull request is a proposed code change; the review checks its current code, related issue, comments, merge status, and automated checks.

rpamis/comet · 69 tokens