refactoring

refactoring is a skill for Claude Code, Codex from andreaswasita/copilot-agents-dojo. It costs 13 tokens per session (901 once invoked), scanned A, original, MIT.

A way to reorganize existing code without changing what it does, using small changes checked by tests. Refactoring improves the structure while keeping the behavior the same.

In plain words
What is it for?
Use it to break up oversized functions or files, remove duplication, improve names, or clean an area before adding a feature.
Why use it?
It makes tangled, duplicated, or misleading code easier to maintain while tests help detect accidental behavior changes.

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 files, remove duplication, improve names, or clean an area before adding a feature.

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

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/andreaswasita/copilot-agents-dojo/refactoring.svg)](https://agentmods.dev/skills/andreaswasita/copilot-agents-dojo/refactoring)
Your own site
<a href="https://agentmods.dev/skills/andreaswasita/copilot-agents-dojo/refactoring"><img src="https://agentmods.dev/badge/skills/andreaswasita/copilot-agents-dojo/refactoring.svg" alt="Measured on agentmods" 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 901 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. Third-party audits
  • NVIDIA SkillSpector pass 7 Sept 2026
How audits are shown
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.00901
Opus 5 $0.00006 $0.00451
Sonnet 5 $0.00003 $0.00180
Haiku 4.5 $0.00001 $0.00090

Measured 8d ago against content hash 4cd75c701440, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-08, 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 8d 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.

skills/refactoring/SKILL.md · 101 lines

How it starts

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

Refactoring Skill

Restructures existing code without changing behavior, in small atomic steps each backed by a green test suite. Does NOT add features in the same change — refactoring and feature work travel in separate PRs.

When to Use

  • A function, class, or file has grown unmanageable.
  • Duplication is spreading across modules.
  • The demand-elegance skill flagged a hacky solution.
  • Names no longer reflect purpose after a domain shift.
  • Before adding a new feature into a messy area.
  • NOT when there is no test coverage and the change is high-risk — write tests first.

Prerequisites

  • Working test suite (or willingness to write characterization tests first).
  • git for atomic commits per transformation.
  • The view, edit, grep, and glob Copilot tools.
  • A baseline run of the test suite passing (proven, not assumed).

How to Run

1. Run the full test suite. Confirm green baseline.
2. If no tests cover the target, write characterization tests; commit separately.
3. Apply one named transformation.
4. Re-run tests. If red, revert.
5. Commit. Repeat for next transformation.
6. Final pass: full suite + review of the whole diff.

Quick Reference

Smell Refactoring
Long function (>30 lines) Extract smaller, named functions
Duplicate code Extract shared function or module
Deep nesting (>3 levels) Early returns, extract conditions
God class / file Split by responsibility
Primitive obsession Introduce domain types
Feature envy Move logic to the class that owns the data
Long parameter list (>4) Introduce parameter object
Dead code Delete it — version control remembers

Procedure

Step 1: Establish the Safety Net

Identify tests covering the target with grep / glob. Run them via the powershell tool. If they fail or do not exist, write characterization tests first and commit them in a separate commit before any refactor.

Step 2: Name the Transformation

Each step in the refactor must have a name from the rubric above ("extract method", "introduce parameter object", "rename for clarity"). If you cannot name it, you are freelancing — stop.

Read the full file on GitHub · 101 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. 8d ago First seen · 101 lines · 13 tokens per session scan A 4cd75c701440

Subscribe to this mod's changes

refactoring is a skill published in the GitHub repository andreaswasita/copilot-agents-dojo (51 stars, last pushed yesterday), licensed MIT. It adds 13 tokens to every session and 901 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-08-30.

Related

Other skills, from other repositories

code-review

Use to judge a concrete diff, branch, or GitHub PR on its own merits with no rsc-SDD spec/plan chain to key off — the spec-less giving pass behind /code-review: only findings you can defend, one verdict, read-only unless --comment or --fix. NOT the SDD gate keyed to 02-DOCS/wiki/sdd/ that also processes incoming…

ericrisco/rsc-harness · 90 tokens

design-loop

Use when something must be built well and there is a real reference it should beat: turn what makes the reference good into measured mechanisms, then run a builder and three fresh-context critics until all three pass. Fires on 'design loop', 'make it as good as ', 'it looks generic'. NOT keeping an already-won look…

ericrisco/rsc-harness · 79 tokens

clean-code-reviewer

Reviews code against Robert C. Martin's Clean Code principles. Use when users share code for review, ask for refactoring suggestions, or want to improve code quality. Produces actionable feedback organized by Clean Code principles with concrete before/after examples.

booklib-ai/booklib · 54 tokens

Code Quality

Maintain high code quality through reviews, refactoring, and standards enforcement.

saolalab/clawforce · 16 tokens

decision-ledger

A session record for tracking unresolved decisions and drafting them into `.governance/claims/` when they are settled. It preserves both the decision and the reason behind it.

johnrucnapier-sketch/ACGM-for-Claude-Code · 99 tokens

governance-bootstrap

A guided checklist for creating a project's governance system from scratch when no governance exists.

johnrucnapier-sketch/ACGM-for-Claude-Code · 107 tokens