refactoring

refactoring is a skill for Claude Code, Codex from tamnguyendinh/Anvien. It costs 13 tokens per session (596 once invoked), scanned A, original, MIT.

A workflow guide for changing code structure while preserving its behavior. Refactoring means improving names, organization, or shared code without changing what the software does.

In plain words
What is it for?
Use it for renaming symbols, extracting or moving code, splitting modules, cleaning up shared code, and checking the impact of API or route changes.
Why use it?
It helps identify ownership, callers, affected routes, and changed files before edits create unexpected breakage.

Skill for Claude CodeCodex

Written for no agent in particular: nothing here depends on one.

Good fit Use it for renaming symbols, extracting or moving code, splitting modules, cleaning up shared code, and checking the impact of API or route changes.

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

Made for: Claude Code, Codex.

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 refactoring

README.md
[![agentmods](https://agentmods.dev/badge/skills/tamnguyendinh/anvien/refactoring/github.svg)](https://agentmods.dev/skills/tamnguyendinh/anvien/refactoring)
Your own site
<a href="https://agentmods.dev/skills/tamnguyendinh/anvien/refactoring"><img src="https://agentmods.dev/badge/skills/tamnguyendinh/anvien/refactoring/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 refactoring

Your own site · 80×15
<a href="https://agentmods.dev/skills/tamnguyendinh/anvien/refactoring"><img src="https://agentmods.dev/badge/skills/tamnguyendinh/anvien/refactoring.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 13 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 596 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.00013 $0.00596
Opus 5 $0.00006 $0.00298
Sonnet 5 $0.00003 $0.00119
Haiku 4.5 $0.00001 $0.00060

Measured 9d ago against content hash 0a597e52fbd8, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-12, from the pricing page.

Security

Grade A, and why

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 9d 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.

internal/aicontext/skills/refactoring/SKILL.md · 49 lines

How it starts

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

Refactoring With Anvien

Use this skill for behavior-preserving renames, extractions, moves, splits, and shared-code cleanup.

This skill is a workflow gate for refactoring work. It is not a command router. When a concrete Anvien command is needed, choose it directly from the generated Command Selection Guide.

Command Choices

Need Use
Understand current ownership MCP/CLI context; prefer context file or context symbol once target type is known
Check callers and flows before editing MCP/CLI impact --direction upstream; prefer impact file or impact symbol once target type is known
Rename a symbol MCP rename or CLI anvien rename <symbol> <newName> --repo <repo>
Check API route/contract consumers MCP api_impact or CLI anvien api impact [route] --repo <repo>
Check route/tool blast radius anvien impact route <route> --repo <repo> or anvien impact tool <tool> --repo <repo>
Verify changed scope before commit MCP detect_changes or CLI anvien detect-changes --repo <repo> --scope all

Workflow

  1. Refresh the graph with anvien analyze --force before graph-based refactoring.
  2. Use context to inspect the exact target. If multiple candidates exist, use UID/file disambiguation.
  3. Run upstream impact and report the blast radius. HIGH/CRITICAL means proceed carefully, not stop automatically.
  4. For renames, start with a graph-guided dry run. Do not use find-and-replace for symbols.
  5. Make behavior-preserving changes first. Defer unrelated cleanup unless required.
  6. Run focused tests, broader tests when shared contracts are touched, and detect-changes.

Rename Flow

  1. anvien rename oldName newName --repo <repo> --json
  2. Inspect files, edit counts, graph edits, text-search edits, and ambiguity warnings.
  3. Use --uid or --file if the dry run is ambiguous.
  4. Apply with --apply only when the edit list matches the intended scope.

Extract, Split, Or Move Flow

  • Use context to identify callers/callees and nearby contracts.
  • Use impact to identify consumers that must remain compatible.
  • Move code in a small slice, update imports deliberately, and preserve behavior.
  • Re-run tests that cover affected flows and any API shape tests if contracts moved.

Read the full file on GitHub · 49 lines

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. 9d ago First seen · 49 lines · 13 tokens per session scan A 0a597e52fbd8

Subscribe to this mod's changes

refactoring is a skill published in the GitHub repository tamnguyendinh/Anvien (9 stars, last pushed yesterday), licensed MIT. It adds 13 tokens to every session and 596 once invoked, about $0.0001 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

blast-radius-review

Review a change by its blast radius, using Kin's graph to find what downstream code the change can reach. Use when reviewing a diff or pull request, deciding whether an edit is safe, or answering "what else breaks if I change this" in a repository admitted to Kin.

firelock-ai/kin · 60 tokens

qartez

Semantic code intelligence skill for qartez MCP. Use qartez tools for code exploration, impact analysis, and guarded refactors; treat built-in code-tool denials as routing signals and recover via qartez replacements.

kuberstar/qartez-mcp · 48 tokens

security-review

Perform a focused security review of pending git changes to identify high-confidence security vulnerabilities with real exploitation potential. Use this skill when the user asks for a security review, security audit, vulnerability scan, or wants to check pending changes on a branch for security issues before merging.…

waybarrios/opencode-power-pack · 64 tokens

huggingface-llm-trainer

Train or fine-tune language models with TRL or Unsloth on Hugging Face Jobs, including SFT, DPO, GRPO, reward models, and GGUF conversion. Use for cloud LLM training; use huggingface-vision-trainer for vision tasks.

waybarrios/opencode-power-pack · 65 tokens

feature-dev

Guide a feature implementation through a structured seven-phase workflow with deep codebase understanding, clarifying questions, parallel architecture design, and quality review. Use this skill when the user asks to build a new feature, add functionality, or wants a methodical approach to implementation rather than…

waybarrios/opencode-power-pack · 62 tokens

review

Validate plans, execution, or PRs against wish criteria — returns SHIP / FIX-FIRST / BLOCKED with severity-tagged gaps.

automagik-dev/genie · 29 tokens