Agent skill

Refactoring

by tola-rs in tola-rs/tola-ssg

Restructure code while keeping observable behavior identical, and prove it with difference testing.

MITAuto-check passedDevelopment

Install Refactoring

skills CLI
$ npx skills add tola-rs/tola-ssg --skill refactoring -a claude-code

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

GitHub CLI
$ gh skill install tola-rs/tola-ssg 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/tola-rs/tola-ssg.git skills-src && mkdir -p .claude/skills && cp -r skills-src/.agents/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
178
Token cost
~659 tokens
SKILL.md length
297 words
Files
1
Skills in repo
10
Repo updated
First seen
Licence
MIT

At a glance

Restructure code while keeping observable behavior identical, and prove it with difference testing.

  • Merging modules
  • SKILL.md covers Prove preservation with…, Simplify, or the refactor has… and Evidence
  • Instructions only: no scripts, shell commands, URLs or credentials in SKILL.md
  • Migrating to a new implementation

What it does

Refactoring is an agent skill from tola-rs/tola-ssg. Restructure code while keeping observable behavior identical, and prove it with difference testing. Use when refactoring, simplifying, splitting or merging modules, migrating to a new implementation, or replacing one mechanism with an equivalent.

Its SKILL.md is about 660 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: SSG for typst-based websites - keep your focus on the content. The licence is MIT.

When your agent uses it

  • Merging modules
  • Migrating to a new implementation
  • Replacing one mechanism with an equivalent

Example prompts

  • “/refactoring”

What it can do on your machine

Read from SKILL.md and the folder at commit fbb0506. 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

    No scripts in the folder and no shell commands in SKILL.md.

    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 659 tokens when it runs. Until then it costs about 65 tokens; SKILL.md has 297 words of instructions outside code blocks.

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

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 tola-rs/tola-ssg at commit fbb0506, republished under its MIT licence (© tola-rs). 297 words, ~659 tokens.

Download SKILL.mdSave it as .claude/skills/refactoring/SKILL.md (or your agent's skills folder).
name
refactoring
description
Restructure code while keeping observable behavior identical, and prove it with difference testing. Use when refactoring, simplifying, splitting or merging modules, migrating to a new implementation, or replacing one mechanism with an equivalent.

Refactoring

Refactor: changes structure, not observable behavior. Two obligations: prove behavior survived; leave code simpler or clearer.

Prove preservation with difference testing

Difference testing (= differential testing in literature): run same inputs through old + new implementation, compare observer-visible output: return values, emitted output, written files, errors, built site. NEVER compare internals.

  • Pick observable boundary — public function, CLI invocation, published tree, inspect projection — compare at highest one the refactor moves.
  • Keep both versions runnable side by side for the duration (second module, test-only entry point, recorded golden of old output); drive with inputs reaching changed paths: existing tests, fixtures, boundary cases, generated inputs.
  • Normalize what contract does not cover before comparing: timestamps, host paths, ids, unordered collections, log framing. Normalize narrowly — sorting everything can hide real regression.
  • Investigate EVERY difference + classify: accidental regression, unstated behavior change, bug in old implementation, nondeterminism. Only a classified, intended difference stays.
  • Passing proves equivalence only for inputs exercised + observations compared. Name surfaces not pinned.

No second implementation: record old behavior first — characterization test, golden capture of built output — treat capture as reference refactor compared against.

Simplify, or the refactor has not paid for itself

Excess = original sin: point of restructuring is code ends smaller + clearer.

  • Delete what change exposes: dead paths, redundant states, obsolete indirection, pass-through wrappers, leftovers of old shape. End state describes only current design.
  • Restructure keeping same duplication under new names changed nothing that matters — fix shape, not spelling.
  • New abstraction waits for second real use case + nameable boundary; until then, inline it.
  • Behavior changes riding along: named + proven, NEVER smuggled inside refactor — mixed goal makes difference test meaningless.

Evidence

Report difference run — inputs, normalized comparison, classification of every difference — plus checks AGENTS.md's Validation section asks for. Refactor without difference run = unverified; full comparison impossible → say which surfaces stay unpinned.

© tola-rs, 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 .agents/skills/refactoring of tola-rs/tola-ssg.

Open the folder on GitHubat commit fbb0506

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 skilltola-rs/tola-ssg178—~659Automated safety check: PassMIT
Guidelinesakash-network/node1.1k20 repos~577Automated safety check: PassMIT
Migrate Core Code to Submodulestinyhumansai/openhuman42k—~2.6kAutomated safety check: PassGPL-3.0
Component Refactoringlangflow-ai/langflow155k—~3.5kAutomated safety check: PassMIT
Ponytail Lazy Developer ModeDietrichGebert/ponytail160k1 repos~873Automated safety check: PassMIT
ast-grep Structural Searchcode-yeongyu/oh-my-openagent70k—~3.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 20 repos~577 tokens
    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.

    42k GitHub stars~2.6k tokensUpdated today
    DevelopmentAuto-check passed
  • Component Refactoring

    langflow-ai/langflow

    Refactor high-complexity React components in Langflow frontend.

    155k GitHub stars~3.5k tokensUpdated today
    DevelopmentAuto-check passed
  • Ponytail Lazy Developer Mode

    DietrichGebert/ponytail

    Makes the agent pick the laziest solution that works: skip unneeded work, reuse what exists, prefer the standard library and platform features, and keep diffs small.

    160k GitHub starsUsed in 1 repo~873 tokens
    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 10 days ago
    DevelopmentAuto-check passed

More from tola-rs/tola-ssg

All 10 skills in this repo
  • Trim

    tola-rs/tola-ssg

    Shrink code, tests, comments, and docs to what carries meaning — delete dead paths, redundant states, and refactor-dragging tests outright, then hold the survivors to the four bars.

    178 GitHub stars~2.9k tokensUpdated yesterday
    Auto-check passed
  • Tola

    tola-rs/tola-ssg

    Build and maintain Tola websites and documentation. An agent skill from tola-rs/tola-ssg.

    178 GitHub stars~6k tokensUpdated yesterday
    Auto-check passed
  • Concurrency And Failure

    tola-rs/tola-ssg

    Design and review work that runs concurrently, waits, retries, or owns resources.

    178 GitHub stars~1.5k tokensUpdated yesterday
    Auto-check passed
  • Friendly Report

    tola-rs/tola-ssg

    Report progress to the human. An agent skill from tola-rs/tola-ssg.

    178 GitHub stars~634 tokensUpdated yesterday
    Auto-check passed
  • Subagent Delegation

    tola-rs/tola-ssg

    Run work through subagents instead of the main thread. An agent skill from tola-rs/tola-ssg.

    178 GitHub stars~924 tokensUpdated yesterday
    Auto-check passed
  • Scope Discipline

    tola-rs/tola-ssg

    Keep a change inside its requested scope. An agent skill from tola-rs/tola-ssg.

    178 GitHub stars~478 tokensUpdated yesterday
    Auto-check passed

Categories

Questions about Refactoring

What does Refactoring do?

Restructure code while keeping observable behavior identical, and prove it with difference testing. Refactoring is an agent skill from tola-rs/tola-ssg. Restructure code while keeping observable behavior identical, and prove it with difference testing.

When should I use Refactoring?

Refactoring fits situations like: merging modules; migrating to a new implementation; replacing one mechanism with an equivalent.

How do I install Refactoring in Claude Code?

Run `npx skills add tola-rs/tola-ssg --skill refactoring -a claude-code`. Or copy the skill folder (.agents/skills/refactoring in tola-rs/tola-ssg) 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 tola-rs/tola-ssg --skill refactoring -a codex`. Or copy the skill folder (.agents/skills/refactoring in tola-rs/tola-ssg) 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 tola-rs/tola-ssg --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?

SKILL.md names no scripts, command-line tools or credentials: Refactoring is instructions for the agent only.

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 659 tokens (SKILL.md is roughly 2.6k 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), Migrate Core Code to Submodules (tinyhumansai/openhuman, 42k stars), Component Refactoring (langflow-ai/langflow, 155k stars) and Ponytail Lazy Developer Mode (DietrichGebert/ponytail, 160k stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.

Who maintains Refactoring?

tola-rs (a GitHub organization) maintains it in tola-rs/tola-ssg, which has 178 GitHub stars. The repository holds 10 skills in this directory. The repository was last updated on October 9, 2026.

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