refactor

refactor is a skill for Claude Code, Codex from NoesisVision/nasde-toolkit. It costs 0 tokens per session (4,310 once invoked), scanned A, a copy of refactor, MIT.

A guide to improving existing code structure while keeping its behavior unchanged. Refactoring means making small changes such as extracting functions, renaming variables, improving types, or removing code smells.

In plain words
What is it for?
Use it to break up oversized functions or classes, improve names and type safety, remove structural problems, and apply suitable design patterns.
Why use it?
It helps make difficult code easier to understand and maintain without turning the work into a rewrite. The guidance emphasizes small steps, tests, and preserving behavior.

Skill for Claude CodeCodex

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

Good fit Use it to break up oversized functions or classes, improve names and type safety, remove structural problems, and apply suitable design patterns.

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

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 refactor

README.md
[![agentmods](https://agentmods.dev/badge/skills/noesisvision/nasde-toolkit/refactor/github.svg)](https://agentmods.dev/skills/noesisvision/nasde-toolkit/refactor)
Your own site
<a href="https://agentmods.dev/skills/noesisvision/nasde-toolkit/refactor"><img src="https://agentmods.dev/badge/skills/noesisvision/nasde-toolkit/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/noesisvision/nasde-toolkit/refactor"><img src="https://agentmods.dev/badge/skills/noesisvision/nasde-toolkit/refactor.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 0 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 4,310 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 97% copy Near-identical to another mod 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.00000 $0.04310
Opus 5.5 $0.00000 $0.01724
Sonnet 5.5 $0.00000 $0.00862
Haiku 4.5 $0.00000 $0.00431

Measured 1mo ago against content hash 03b46c73a641, method: parsed. Prices are Anthropic first-party input rates as of 2026-10-07, 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 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.

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.

Origin

This is a copy

97% identical to refactor — 6 lines differ, which has more behind it and is treated as the original. This page carries a canonical link to it rather than competing with it.

examples/refactoring-skill/variants/claude-refactoring-skill/skills/refactor/SKILL.md · 648 lines

How it starts

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


name: refactor description: 'Surgical code refactoring to improve maintainability without changing behavior. Covers extracting functions, renaming variables, breaking down god functions, improving type safety, eliminating code smells, and applying design patterns. Less drastic than repo-rebuilder; use for gradual improvements.' license: MIT

Refactor

Overview

Improve code structure and readability without changing external behavior. Refactoring is gradual evolution, not revolution. Use this for improving existing code, not rewriting from scratch.

When to Use

Use this skill when:

  • Code is hard to understand or maintain
  • Functions/classes are too large
  • Code smells need addressing
  • Adding features is difficult due to code structure
  • User asks "clean up this code", "refactor this", "improve this"

Refactoring Principles

The Golden Rules

  1. Behavior is preserved - Refactoring doesn't change what the code does, only how
  2. Small steps - Make tiny changes, test after each
  3. Version control is your friend - Commit before and after each safe state
  4. Tests are essential - Without tests, you're not refactoring, you're editing
  5. One thing at a time - Don't mix refactoring with feature changes

When NOT to Refactor

- Code that works and won't change again (if it ain't broke...)
- Critical production code without tests (add tests first)
- When you're under a tight deadline
- "Just because" - need a clear purpose

Common Code Smells & Fixes

1. Long Method/Function

# BAD: 200-line function that does everything
- async function processOrder(orderId) {
-   // 50 lines: fetch order
-   // 30 lines: validate order
-   // 40 lines: calculate pricing
-   // 30 lines: update inventory
-   // 20 lines: create shipment
-   // 30 lines: send notifications
- }

# GOOD: Broken into focused functions
+ async function processOrder(orderId) {
+   const order = await fetchOrder(orderId);
+   validateOrder(order);
+   const pricing = calculatePricing(order);
+   await updateInventory(order);
+   const shipment = await createShipment(order);
+   await sendNotifications(order, pricing, shipment);
+   return { order, pricing, shipment };
+ }

Read the full file on GitHub · 648 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. 1mo ago First seen · 648 lines · 0 tokens per session scan A 03b46c73a641

Subscribe to this mod's changes

refactor is a skill published in the GitHub repository NoesisVision/nasde-toolkit (14 stars, last pushed 6d ago), licensed MIT. It costs nothing until one of its globs matches a file; then it loads 4,310 tokens. A static security scan graded it A with 0 findings. It is 97% identical to refactor, differing in 6 lines, and is treated as a copy.

Related

Other skills, from other repositories

code-reviewer

Performs comprehensive code reviews with security, quality, and best practice checks.

hidai25/eval-view · 18 tokens

code-reviewer

A skill that helps review code for best practices, bugs, and security issues.

hidai25/eval-view · 19 tokens

accessibility-audit

Use when the user wants a WCAG 2.2 accessibility review of a UI — semantics, keyboard operability, focus management, color contrast, ARIA, forms/labels, reduced-motion, and screen-reader support, including streaming AI output via live regions. Triggers on "accessibility audit", "is this WCAG compliant", "a11y review"…

vikast908/agent-repo-card · 90 tokens

agent-reliability

Use when the user wants to know whether an AI agent / tool-using loop will survive the real world — reviewing loop termination, tool error handling, retries/backoff, idempotency, timeouts, state & resumability, guardrails, determinism, rate limits, graceful degradation, and observability/tracing. Triggers on "is my…

vikast908/agent-repo-card · 102 tokens

report-card

Use when the user wants ONE combined quality grade for an AI-agent / LLM-app repo instead of running each review separately — auto-detects which reviews apply, runs them, dedupes overlapping findings, and emits a single overall grade, a per-area scorecard, and a prioritized cross-cutting fix list. Triggers on "grade…

vikast908/agent-repo-card · 99 tokens

code-review-and-quality

Conducts multi-axis code review. Use before merging any change. Use when reviewing code written by yourself, another agent, or a human. Use when you need to assess code quality across multiple dimensions before it enters the main branch.

kevinnft/ai-agent-skills · 51 tokens