Agent skill

Refactoring

by extra-org in extra-org/extra

Change the shape of code without changing behavior — safely, in small steps, preserving the project's layers and public contracts.

MITAuto-check passedDevelopment

Install Refactoring

skills CLI
$ npx skills add extra-org/extra --skill refactoring -a claude-code

Project install by default; add -g for ~/.claude/skills/.

GitHub CLI
$ gh skill install extra-org/extra refactoring --agent claude-code

Project scope by default; add --scope user for a personal install. Needs GitHub CLI 2.90.0 or later (public preview).

Manual copy
$ git clone --depth 1 https://github.com/extra-org/extra.git skills-src && mkdir -p .claude/skills && cp -r skills-src/.claude/skills/refactoring .claude/skills/refactoring && rm -rf skills-src

Use ~/.claude/skills/ instead of .claude/skills for a personal install. The folder must contain SKILL.md.

Claude Code skills documentation · loads skills from .claude/skills/

Facts

Skill name
refactoring
GitHub stars
113
Token cost
~855 tokens
SKILL.md length
415 words
Files
1
Skills in repo
14
Repo updated
First seen
Licence
MIT

At a glance

Change the shape of code without changing behavior — safely, in small steps, preserving the project's layers and public contracts.

  • Works in 7 steps: Define the goal and boundary. State… → Ensure a safety net. Confirm or add… → Refactor in small steps, running make… → …
  • Tasks that involve Refactoring
  • SKILL.md covers Purpose, When to Use This Skill, Files to Read First and Core Principles, plus 4 more sections
  • Calls make

What it does

Refactoring is an agent skill from extra-org/extra. Change the shape of code without changing behavior — safely, in small steps, preserving the project's layers and public contracts.

Its SKILL.md is about 860 tokens, which your agent loads only when the skill is triggered. It is a single SKILL.md file with no bundled scripts.

It sits in Development, covering Refactoring. The repository describes itself as: Turn your product into an AI-powered assistant. The licence is MIT.

When your agent uses it

  • Tasks that involve Refactoring

Example prompts

  • “/refactoring”

Workflow steps

7 steps, taken from the first numbered list in SKILL.md.

  1. Define the goal and boundary. State exactly what improves and which files
  2. Ensure a safety net. Confirm or add tests that pin current behavior.
  3. Refactor in small steps, running make test after each meaningful step.
  4. Keep layers intact. Verify the change respects architecture invariants.
  5. Update names everywhere. If a concept is renamed, fix code, tests, and
  6. Keep commits logically scoped (one refactor idea per commit).
  7. Final validation. Run make check; diff should be structure-only.

What it can do on your machine

Read from SKILL.md and the folder at commit 023b0a0. It shows what the files ask for, not the result of running them.

  • Tool permissions

    Pre-approves nothing: there is no allowed-tools line, so your agent's usual permission prompts apply.

    From allowed-tools in the SKILL.md frontmatter.

  • Runs code

    Shell commands in SKILL.md call:

    • make

    From the folder's file list and the shell code blocks in SKILL.md.

  • Network

    No URLs in SKILL.md.

    From URLs in SKILL.md, links to its own repository left out.

  • Credentials

    Names no API keys, tokens, secrets or passwords.

    From names ending in _API_KEY, _TOKEN, _SECRET, _KEY or _PASSWORD in SKILL.md.

Context cost

Refactoring loads about 855 tokens when it runs. Until then it costs about 36 tokens; SKILL.md has 415 words of instructions outside code blocks.

Always · name and description, kept in context so the agent knows when to use it
~36
When it runs · the whole SKILL.md, loaded when a task matches
~855

Estimates: characters ÷ 4, the usual rule of thumb; real counts depend on the model's tokenizer. Scripts and assets cost tokens only if the agent reads them.

Safety

Auto-check passed

The automated check found no risky patterns in SKILL.md.

Automated static check — not a guarantee. Review scripts before installing. It scans the text of SKILL.md for risky patterns (piping downloads into a shell, reading credential files, hidden Unicode, destructive commands); files beside SKILL.md are not scanned.

SKILL.md

The full file from extra-org/extra at commit 023b0a0, republished under its MIT licence (© extra-org). 415 words, ~855 tokens.

Download SKILL.mdSave it as .claude/skills/refactoring/SKILL.md (or your agent's skills folder).
name
refactoring
description
Change the shape of code without changing behavior — safely, in small steps, preserving the project's layers and public contracts.
generated
true
source
.ai/skills/refactoring.md
<!--
This file is generated by tools/skills.
Do not edit this file directly.
Edit .ai/skills/refactoring.md and run `make generate-ai`.
-->

Skill: Refactoring

Purpose

Change the shape of code without changing its behavior, safely and in small steps, while preserving the project's layers and public contracts.

When to Use This Skill

  • Improving structure, naming, or readability of existing code.
  • Extracting a function/module, splitting a large file, or removing duplication.
  • Preparing code for a feature by reshaping it first.
  • Reducing complexity flagged during code/architecture review.

Files to Read First

  • AGENTS.md (boundaries and "no large uncontrolled rewrites").
  • .ai/skills/architecture-review.md (invariants you must preserve).
  • The tests covering the code you intend to change.
  • Any doc/ADR describing the contracts the code implements.

Core Principles

  • Preserve public behavior. A refactor changes structure, not observable behavior or contracts.
  • Tests first for risky changes. If coverage is thin, add characterization tests before refactoring.
  • Small steps. Many tiny, verified changes beat one big rewrite.
  • Stay in scope. Do not refactor unrelated code you happen to pass by.
  • Don't collapse layers for convenience, and don't introduce circular dependencies.
  • Rename concepts deliberately. Update docs/ADRs/tests when a name changes.
  • Prefer simple extraction over introducing complex patterns.

Process

  1. Define the goal and boundary. State exactly what improves and which files are in scope.
  2. Ensure a safety net. Confirm or add tests that pin current behavior.
  3. Refactor in small steps, running make test after each meaningful step.
  4. Keep layers intact. Verify the change respects architecture invariants.
  5. Update names everywhere. If a concept is renamed, fix code, tests, and docs in the same change.
  6. Keep commits logically scoped (one refactor idea per commit).
  7. Final validation. Run make check; diff should be structure-only.
Show full SKILL.md (152 more words)Show less

Checklist Before Finishing

  • Public behavior and contracts unchanged (tests still pass unmodified, or changes are justified).
  • Tests existed/were added before risky changes.
  • Change is scoped; no unrelated code touched.
  • No layer collapsed; no circular dependency introduced.
  • Renamed concepts updated across code, tests, and docs.
  • Commits are small and logically scoped.
  • make check passes.

Common Mistakes to Avoid

  • "While I'm here" edits to unrelated code (scope creep).
  • Refactoring without a test safety net.
  • One giant commit mixing behavior changes with restructuring.
  • Renaming a concept in code but not in docs/ADRs.
  • Introducing a clever pattern where a simple extraction suffices.
  • Creating import cycles by moving code carelessly.

Expected Final Report

State: the goal of the refactor and its scope; the safety net used (existing or added tests); the small steps taken; confirmation that public behavior/contracts are unchanged and layers are intact; any renamed concepts and where they were updated; and the make check result.

© extra-org, MIT. Rendered from Markdown: HTML in the file is shown as text, images as links, and headings moved down two levels. Raw file

Files

Just SKILL.md in .claude/skills/refactoring of extra-org/extra.

Open the folder on GitHubat commit 023b0a0

Compare with similar skills

Refactoring next to the 5 skills that share the most tags, products or categories with it. Stars are the repository's; “used in” counts other GitHub owners with a copy.

Refactoring compared with similar skills
SkillStarsUsed inTokensAuto-checkLicenceRepo updated
Refactoring this skillextra-org/extra113—~855Automated safety check: PassMIT
Guidelinesakash-network/node1.1k22 repos~577Automated safety check: PassMIT
Component Refactoringlangflow-ai/langflow156k—~3.5kAutomated safety check: PassMIT
Migrate Core Code to Submodulestinyhumansai/openhuman41k—~2.6kAutomated safety check: PassGPL-3.0
ast-grep Structural Searchcode-yeongyu/oh-my-openagent70k—~3.3kAutomated safety check: PassMIT
Systematic Code Refactoringluongnv89/claude-howto42k—~3kAutomated safety check: PassMIT

Similar skills

  • Guidelines

    akash-network/node

    Behavioral guidelines to reduce common LLM coding mistakes. An agent skill from akash-network/node.

    1.1k GitHub starsUsed in 22 repos~577 tokens
    DevelopmentAuto-check passed
  • Component Refactoring

    langflow-ai/langflow

    Refactor high-complexity React components in Langflow frontend.

    156k GitHub stars~3.5k tokensUpdated today
    DevelopmentAuto-check passed
  • Migrate Core Code to Submodules

    tinyhumansai/openhuman

    Plans and carries out moving non-host-specific code and its tests from the OpenHuman core into vendored tiny submodule libraries, then releases the submodule and re-pins the host.

    41k GitHub stars~2.6k tokensUpdated yesterday
    DevelopmentAuto-check passed
  • ast-grep Structural Search

    code-yeongyu/oh-my-openagent

    Searches and rewrites code by syntax-tree shape across 25 languages with ast-grep, for codemods, structural queries and YAML lint rules, using a Python wrapper script.

    70k GitHub stars~3.3k tokensUpdated today
    DevelopmentAuto-check passed
  • Systematic Code Refactoring

    luongnv89/claude-howto

    Guides refactoring in phases based on Martin Fowler's method: research, test coverage check, planning and small tested steps, with your approval at each phase.

    42k GitHub stars~3k tokensUpdated 7 days ago
    DevelopmentAuto-check passed
  • Codex

    skills-directory/skill-codex

    A skill your agent uses when the user asks to run Codex CLI (codex exec, codex resume) or references OpenAI Codex for code analysis, refactoring, or automated editing

    1.5k GitHub starsUsed in 3 repos~1.8k tokens
    DevelopmentAuto-check passed

More from extra-org/extra

All 14 skills in this repo
  • Testing

    extra-org/extra

    How to write and run fast, deterministic, behavior-focused pytest tests that never touch real external systems.

    113 GitHub stars~1.2k tokensUpdated 1 mo ago
    Auto-check passed
  • Architecture Review

    extra-org/extra

    Guard the project's architecture invariants. An agent skill from extra-org/extra.

    113 GitHub stars~1.1k tokensUpdated 1 mo ago
    Auto-check passed
  • Documentation

    extra-org/extra

    Keep the repository's documentation accurate, honest, and synchronized with the code.

    113 GitHub stars~848 tokensUpdated 1 mo ago
    Auto-check passed
  • The standard for writing Python here — small, typed, explicit, testable modules with side effects pushed to the edges.

    113 GitHub stars~1.4k tokensUpdated 1 mo ago
    Auto-check passed
  • Skill Authoring

    extra-org/extra

    How to create or restructure a skill so the .ai/skills/ system stays consistent, operational, and trustworthy.

    113 GitHub stars~1k tokensUpdated 1 mo ago
    Auto-check passed
  • Code Review

    extra-org/extra

    Senior-level code review for the agent platform — architecture and boundaries first, then correctness, security, testability, and simplicity.

    113 GitHub stars~1.3k tokensUpdated 1 mo ago
    Auto-check passed

Categories

Questions about Refactoring

What does Refactoring do?

Change the shape of code without changing behavior — safely, in small steps, preserving the project's layers and public contracts. Refactoring is an agent skill from extra-org/extra. Change the shape of code without changing behavior — safely, in small steps, preserving the project's layers and public contracts.

When should I use Refactoring?

Refactoring fits situations like: tasks that involve Refactoring.

How do I install Refactoring in Claude Code?

Run `npx skills add extra-org/extra --skill refactoring -a claude-code`. Or copy the skill folder (.claude/skills/refactoring in extra-org/extra) into .claude/skills/refactoring in your project. Claude Code loads it when a task matches its description.

How do I install Refactoring in Codex?

Run `npx skills add extra-org/extra --skill refactoring -a codex`. Or copy the skill folder (.claude/skills/refactoring in extra-org/extra) into .agents/skills/refactoring in your project. Codex loads it when a task matches its description.

Can I use Refactoring in Cursor, Gemini CLI or GitHub Copilot?

Cursor, Gemini CLI, GitHub Copilot and OpenCode also load SKILL.md folders. With the skills CLI, run `npx skills add extra-org/extra --skill refactoring -a cursor` (or -a gemini-cli, github-copilot or opencode for the others). To copy it by hand, put the folder in .cursor/skills/refactoring, .gemini/skills/refactoring, .github/skills/refactoring and .opencode/skills/refactoring in your project.

What does Refactoring need to run?

Going by SKILL.md and its folder, Refactoring needs the command-line tools its instructions call (make).

Does Refactoring access the network?

SKILL.md contains no URLs. Any network use would come from the scripts or tools the agent runs. This is read from the text; nothing was executed.

Is Refactoring safe to install?

Our automated static check of SKILL.md found no risky patterns, such as piping downloads into a shell, reading credential files or hidden Unicode. It is not a guarantee. Review the folder before installing.

What licence does Refactoring use?

Refactoring is published under the MIT licence (the repository's licence). It allows redistribution, so the full SKILL.md is shown on this page.

How many tokens does Refactoring use?

About 855 tokens (SKILL.md is roughly 3.4k characters). Agents keep only the skill's name and description in context until a task matches; then they load SKILL.md in full.

What are the alternatives to Refactoring?

Skills that share tags, products or a category with Refactoring: Guidelines (akash-network/node, 1.1k stars), Component Refactoring (langflow-ai/langflow, 156k stars), Migrate Core Code to Submodules (tinyhumansai/openhuman, 41k stars) and ast-grep Structural Search (code-yeongyu/oh-my-openagent, 70k stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.

Who maintains Refactoring?

extra-org (a GitHub organization) maintains it in extra-org/extra, which has 113 GitHub stars. The repository holds 14 skills in this directory. The repository was last updated on September 7, 2026.

Source: extra-org/extra on GitHub. Facts on this page come from the repository at the commit we read; the author's words are quoted as theirs.