refactor

refactor is a skill for Claude Code from mystilleef/spae-framework. It costs 21 tokens per session (1,539 once invoked), scanned D, original, MIT.

A code-cleanup assistant that reorganizes existing code while keeping its observable behavior unchanged. DRY means avoiding repeated code, SOLID is a set of design guidelines, and structure violations are patterns that make code harder to maintain.

In plain words
What is it for?
It is for improving code during feature work, bug fixing, code review, or when common design problems are found.
Why use it?
It reduces duplication and confusing structure while preserving what the software does.

Skill for Claude Code

Written for Claude Code: user-invocable in frontmatter.

Good fit It is for improving code during feature work, bug fixing, code review, or when common design problems are found.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/mystilleef/spae-framework/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 mystilleef/spae-framework --skill refactor
Clone the repo
git clone --depth 1 https://github.com/mystilleef/spae-framework

Made for: Claude Code.

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/mystilleef/spae-framework/refactor/github.svg)](https://agentmods.dev/skills/mystilleef/spae-framework/refactor)
Your own site
<a href="https://agentmods.dev/skills/mystilleef/spae-framework/refactor"><img src="https://agentmods.dev/badge/skills/mystilleef/spae-framework/refactor/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for refactor

Your own site · 80×15
<a href="https://agentmods.dev/skills/mystilleef/spae-framework/refactor"><img src="https://agentmods.dev/badge/skills/mystilleef/spae-framework/refactor.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 21 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 1,539 The whole file, excluding the scripts and references it only reads on demand.
Security scan D 2 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.00021 $0.01539
Opus 5.5 $0.00008 $0.00616
Sonnet 5.5 $0.00004 $0.00308
Haiku 4.5 $0.00002 $0.00154

Measured 1mo ago against content hash 59617178c60a, method: parsed. Prices are Anthropic first-party input rates as of 2026-10-07, from the pricing page.

Security

Grade D, and why

refactor scanned grade D 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 1mo 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.

Hidden instructionshighPrompt injection

Directives inside HTML comments, invisible characters or bidirectional overrides are read by the model and not by the person reviewing the file.

<!-- prettier-ignore-start -->

Strips warnings and disclaimersmediumAnti-refusal

Omitting safety caveats hides risk from the user and is a common jailbreak preamble.

- Code compiles without warnings or missing dependencies.
skills/refactor/SKILL.md · 172 lines

How it starts

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

Refactoring agent

When to use

  • Rule of Three: Third instance triggers extraction. Exception: security and validation logic warrants unification at 2+.
  • Adding features: Restructure to accommodate the change first.
  • Fixing bugs: Clarify structure to expose the error.
  • Code review: Improve unfamiliar code incrementally.
  • Smells detected: See violation catalog in references/refactoring-guide.md.

Goal

  • Execute disciplined, semantics-preserving transformations to remove DRY, SOLID, and Structure violations, improving maintainability without altering observable behavior.

Input

Determine scope by the first available source:

  • Files or folders provided by the user.
  • Current changes in the repository.

Abort if no scope exists.

Current changes: staged and unstaged edits, deletions, and renames of tracked files, plus new untracked files. Requires a versioned project. Abort with a clear message if none detected.

Testing

See references/testing-guide.md for test structure, isolation, mocking, assertion, and performance standards.

Shell commands

See references/shell-command-guide.md for command safety, timeouts, redirects, and non-interactive environment directives.

Cleanup

See references/cleanup-guide.md for the self-introduced-artifact checklist and diff-only audit scope.

Workflow

  1. GATE—Precondition guard. Halt immediately on failure.
    • Abort if no scope exists.
    • Read references/testing-guide.md.
    • Read references/shell-command-guide.md.
    • Read references/cleanup-guide.md.
    • Read relevant production code, adjacent tests, and test commands.
    • Confirm automated test suite passes before touching code.
    • Detect antipatterns using the violation catalog in references/refactoring-guide.md.
    • Short-circuit: halt and emit Result: No Changes if none detected: duplicated logic, long methods, large classes, primitive obsession, SOLID violations.
  2. ORIENT—Name the smallest production area worth refactoring and what won't change.
  3. PLAN—Declare the minimal change and rationale.
    • Analyze package, module, or class boundaries for cyclic imports and unresolved downstream consumers.
    • Select the fix from the playbook; resolve compound violations using the triage rules in references/refactoring-guide.md.
  4. ACT—Apply one transformation at a time. Execute only what PLAN declared.
  5. VERIFY—Loop over every criterion declared in PLAN:
    • Run the full suite after each ACT step.
    • Audit the task's own git diff/git status against the Self-cleanup checklist in references/cleanup-guide.md; remove every self-introduced artifact before proceeding.
    • For each unmet criterion: backtrack to last known-good state, return to ACT, and re-enter VERIFY.
    • Exit only when all criteria pass.
    • Halt only for out-of-scope blockers.
  6. REPORT—Emit the result following the result directives and using the result template.

Read the full file on GitHub · 172 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. 1mo ago First seen · 172 lines · 21 tokens per session scan D 59617178c60a

Subscribe to this mod's changes

refactor is a skill published in the GitHub repository mystilleef/spae-framework (1 stars, last pushed 2mo ago), licensed MIT. It adds 21 tokens to every session and 1,539 once invoked, about $0.0001 per session on Opus 5.5. A static security scan graded it D with 2 findings (hidden instructions, strips warnings and disclaimers). 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

ahk-triage

Triage a bug or unexpected behavior. Deep diagnostic analysis with structured report. No tasks created, no harness tracking.

enmanuelmag/agent-harness-kit · 29 tokens

ahk-ask

Ask a question about this codebase — where is X, does Y exist, how does Z work. Read-only. No tasks created, no harness tracking.

enmanuelmag/agent-harness-kit · 37 tokens

windows-encoding-fixes

Use when working with Windows (cmd/PowerShell console, MINGW64, script installation): stdout encoding (cp1251 vs UTF-8, UnicodeEncodeError on ✓/Cyrillic), CRLF/LF when writing files (md5 checks of mirrors), UTF-8 BOM for PowerShell 5.1, npm.cmd instead of npm, venv Scripts vs bin, PYTHONIOENCODING/PYTHONUTF8. Verified…

oleg494/coding-kit · 108 tokens

fix-and-verify

Diagnose a software defect, make the smallest compatible correction, and verify the affected behavior. Use for bugs, regressions, failing tests, and focused code changes.

RyosukeSAMA/github-ai · 38 tokens

debug-incident-protocol

Use when the user says: «it doesn't work», «still broken», «hung/stuck», «disappeared after the update», «it used to work», «the metric is zero but the UI is fine» — or when an incident needs to be analyzed, the root cause of a hang found, and whether a process was actually restarted verified. Covers: facts before…

oleg494/coding-kit · 126 tokens

systematic-debugging

Use when encountering any bug, test failure, or unexpected behavior, before proposing fixes.

oleg494/coding-kit · 21 tokens