code-refactoring

A code-refactoring guide for safely renaming, moving, extracting, or restructuring code while checking related callers, tests, documents, and interfaces.

In plain words
What is it for?
Use it when changing existing code structure, such as renaming a class, moving a method, or reorganizing modules.
Why use it?
It reduces the chance that a structural code change breaks parts of the project that depend on it.

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/event4u-app/agent-config/code-refactoring
Any agent
npx skills add event4u-app/agent-config --skill code-refactoring
Clone the repo
git clone --depth 1 https://github.com/event4u-app/agent-config

Made for: Claude Code, Codex.

Per session 44 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 3,126 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.00044 $0.03126
Opus 5 $0.00022 $0.01563
Sonnet 5 $0.00009 $0.00625
Haiku 4.5 $0.00004 $0.00313

Measured 2d ago against content hash 5836834a455c, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

code-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 2d 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.

src/skills/code-refactoring/SKILL.md · 256 lines

How it starts

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

refactorer

When to use

Use this skill when renaming, moving, extracting, or restructuring code — any change that may have downstream effects on callers, interfaces, tests, documentation, or API contracts.

Do NOT use when:

  • New feature development (use feature-planning skill)
  • Bug fixes that don't involve restructuring (use bug-analyzer skill)

Before refactoring

  1. Read the agent docs — check agents/reference/docs/ and agents/settings/contexts/ for the area you're refactoring. For modules, also read the project's module-docs directory (path varies by stack — Laravel: app/Modules/{Module}/agents/; Nx: apps/{app}/docs/; mono-repo: per-package docs/). See the project-docs skill for the mapping.
  2. Understand the scope — what exactly needs to change and why?
  3. Find ALL references — use codebase-retrieval and view with search_query_regex to find every caller, implementation, test, and configuration that references the code being changed. If the change is to a closed set — an enum, union, literal type, state machine, role or permission set — identifier search is not enough: the consumers that break are the ones that never name the type. Search by shape as well (switch / match / if-chains over it, lookup tables keyed by it, validators, serializers, schemas, fixtures, translation keys) and classify each as exhaustive, deliberate fallback, or missing case. Procedure: downstream-changes-mechanics.
  4. Map the impact — create a list of all files that will need changes.
  5. Decide the verdict, if the refactor is a de-duplication — see the safe-abstraction gate below. An extraction with no recorded verdict is a guess about whether two things are the same thing.
  6. Present the plan — show the user what will be affected before starting.

Safe-abstraction gate — before merging two things into one

This skill performs extractions; it is therefore the place that decides whether one should happen. A wrong abstraction costs more than the duplication it replaced, because the duplication is visible and the wrong abstraction grows caller flags until nobody can remove it. Ask, before moving any code:

Read the full file on GitHub · 256 lines

Files

What ships with it

1 file 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. 2d ago First seen · 256 lines · 44 tokens per session scan A 5836834a455c

Subscribe to this mod's changes

code-refactoring is a skill published in the GitHub repository event4u-app/agent-config (10 stars, last pushed 2d ago), licensed MIT. It adds 44 tokens to every session and 3,126 once invoked, about $0.0002 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

save-progress

Save current project task progress to local task state file for cross-session continuity. Use when the user asks to save progress, uses an equivalent localized trigger phrase, the session is interrupted, or the user wants to resume work later. Writes to .claude/project-task-state.json so next session can load it via…

KimYx0207/Meta_Kim · 65 tokens

meta-theory

MetaKim executable governance dispatcher. It classifies the run, loads only needed references, preserves foundational capabilities and runtime-native abilities, routes owner + weapon + dependency + runtime + OS + verification, and closes only with evidence, intent acceptance, and writeback decision.

KimYx0207/Meta_Kim · 57 tokens

same-set-reusable-flow-for-project-file-inventor

Reusable MetaKim file inventory classification flow. It helps separate durable sources, generated evidence, runtime mirrors, temporary state, and risky unknowns before cleanup or commit.

KimYx0207/Meta_Kim · 45 tokens

starreel-drama-production

Operating skill for any AI agent driving the StarReel short-drama production pipeline (script → rewrite → extract → portraits + sheets → storyboards → frames → video → voiceover → final cut) over MCP or REST. Covers the ordered workflow, the eleven operating disciplines (prepaid billing, quote-before-spend, retryable…

waydaxp/starreel-mcp · 87 tokens

seedance-20

Generate and direct cinematic AI videos with Seedance 2.0 (ByteDance/Dreamina/Jimeng). Covers text-to-video, image-to-video, video-to-video, and reference-to-video workflows with @Tag asset references, multi-character scenes, audio design, and post-processing. Use when making AI video, writing Seedance prompts…

Kingdaddy007/my-os · 96 tokens

human-approval

Request human approval before performing a SAFETY-CRITICAL, IRREVERSIBLE, or SCOPE-EXPANDING action — submit a structured context (action, scope, risk, consequence) plus options, then STOP the current turn. The platform redispatches the agent after the human decides. NEVER use for routine deliverables (writing docs /…

Prismer-AI/PrismerCloud · 168 tokens