refactoring

refactoring is a skill for Claude Code from saajunaid/caddis-plugin. It costs 30 tokens per session (2,923 once invoked), scanned A, original, MIT.

A guide to changing code structure while keeping its existing behavior. It focuses on reducing duplication, extracting functions, and updating older code safely.

In plain words
What is it for?
Use it when reorganizing code, removing duplication, extracting functions, or modernizing legacy projects.
Why use it?
It helps make difficult or repetitive code easier to maintain without changing what it does.

Skill for Claude Code

Written for Claude Code: context: fork in frontmatter.

Good fit Use it when reorganizing code, removing duplication, extracting functions, or modernizing legacy projects.

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

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 refactoring

README.md
[![agentmods](https://agentmods.dev/badge/skills/saajunaid/caddis-plugin/refactoring/github.svg)](https://agentmods.dev/skills/saajunaid/caddis-plugin/refactoring)
Your own site
<a href="https://agentmods.dev/skills/saajunaid/caddis-plugin/refactoring"><img src="https://agentmods.dev/badge/skills/saajunaid/caddis-plugin/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/saajunaid/caddis-plugin/refactoring"><img src="https://agentmods.dev/badge/skills/saajunaid/caddis-plugin/refactoring.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 30 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 2,923 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.00030 $0.02923
Opus 5.5 $0.00012 $0.01169
Sonnet 5.5 $0.00006 $0.00585
Haiku 4.5 $0.00003 $0.00292

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

.github/skills/coding/refactoring/SKILL.md · 490 lines

How it starts

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

Refactoring Skill

Systematically refactor code to improve quality while preserving functionality.

Trigger

Activate when:

  • User asks to "refactor" or "clean up" code
  • Code review identifies structural issues
  • User wants to improve maintainability
  • Technical debt needs to be addressed

Refactoring Principles

  1. Never change behavior during refactoring
  2. Small steps - one change at a time
  3. Tests first - ensure coverage before changing
  4. Commit often - after each successful refactoring
  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 under a tight deadline (schedule it for later)
  • "Just because" - always have a clear purpose

Phase 1: Assessment

Objectives

  • Understand current code structure
  • Identify refactoring opportunities
  • Assess test coverage

Actions

  1. Read and understand the code

    • What does this code do?
    • What are the inputs/outputs?
    • Where are the dependencies?
  2. Identify code smells

    Smell Signs Refactoring
    Long Method >20 lines Extract Method
    Large Class >200 lines, multiple concerns Extract Class
    Duplicated Code Same logic in multiple places Extract Method/Class
    Long Parameter List >3-4 parameters Parameter Object
    Deep Nesting >3 levels of indentation Guard Clauses, Extract Method
    Magic Numbers Hardcoded values Named Constants
    Dead Code Unused functions/variables Delete
    Feature Envy Method uses another class's data more Move Method
  3. Check test coverage

    pytest --cov=module_name --cov-report=term-missing
    

Output

## Refactoring Assessment

### Current State
- File: [filename]
- Lines: [count]
- Test Coverage: [percentage]

### Code Smells Identified
1. [Smell]: [Location] - [Description]
2. [Smell]: [Location] - [Description]

### Recommended Refactorings
1. [Refactoring]: [Expected improvement]
2. [Refactoring]: [Expected improvement]

### Risk Assessment
- Test coverage: [adequate/needs improvement]
- Complexity: [low/medium/high]
- Dependencies: [list affected areas]

Read the full file on GitHub · 490 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 Changed · +3 lines 654c8eb32b3c
  2. 2mo ago First seen · 487 lines · 30 tokens per session scan A 7ff40d7e2a8c

Subscribe to this mod's changes

refactoring is a skill published in the GitHub repository saajunaid/caddis-plugin (0 stars, last pushed 3d ago), licensed MIT. It adds 30 tokens to every session and 2,923 once invoked, about $0.0001 per session on Opus 5.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

refactoring compared with skills from other repositories

refactoring next to 6 skills from other repositories
ModTypeStarsLast pushLicenceScanTokensWorks with
refactoringsaajunaid/caddis-pluginSkill03d agoMITA30Claude Code
goga-review-planqarium/gogaSkill468d agoBSD-3-ClauseA11Claude Code, Codex
goga-accept-manifest-reviewqarium/gogaSkill468d agoBSD-3-ClauseA18Claude Code, Codex
goga-change-manifest-reconcilerqarium/gogaSkill468d agoBSD-3-ClauseA18Claude Code, Codex
goga-change-validatorqarium/gogaSkill468d agoBSD-3-ClauseA14Claude Code, Codex
goga-accept-reportqarium/gogaSkill468d agoBSD-3-ClauseA13Claude Code, Codex
goga-change-usage-reconcilerqarium/gogaSkill468d agoBSD-3-ClauseA19Claude Code, Codex