safe-refactoring

safe-refactoring is a skill for Claude Code, Codex from Sounio-lang/sounio. It costs 34 tokens per session (901 once invoked), scanned A, original, Apache-2.0.

A method for changing the structure of code while keeping its outside behavior the same. It uses dependency checks, identification of rules that must remain true, and tests or other verification.

In plain words
What is it for?
Use it to extract functions, split large modules, rename identifiers across a codebase, restructure code, or migrate an API or dependency while checking that existing behavior remains intact.
Why use it?
It reduces the risk of breaking working code while improving its organization, readability, or maintainability. It is useful when splitting modules, renaming code, or moving between library versions.

Skill for Claude CodeCodex

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

Good fit Use it to extract functions, split large modules, rename identifiers across a codebase, restructure code, or migrate an API or dependency while checking that existing behavior remains intact.

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

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 safe-refactoring

README.md
[![agentmods](https://agentmods.dev/badge/skills/sounio-lang/sounio/safe-refactoring/github.svg)](https://agentmods.dev/skills/sounio-lang/sounio/safe-refactoring)
Your own site
<a href="https://agentmods.dev/skills/sounio-lang/sounio/safe-refactoring"><img src="https://agentmods.dev/badge/skills/sounio-lang/sounio/safe-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 safe-refactoring

Your own site · 80×15
<a href="https://agentmods.dev/skills/sounio-lang/sounio/safe-refactoring"><img src="https://agentmods.dev/badge/skills/sounio-lang/sounio/safe-refactoring.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 34 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.00034 $0.00901
Opus 5 $0.00017 $0.00451
Sonnet 5 $0.00007 $0.00180
Haiku 4.5 $0.00003 $0.00090

Measured 9d ago against content hash 635ef8dfe380, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-09, from the pricing page.

Security

Grade A, and why

safe-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 9d 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.

.roo/skills/safe-refactoring/SKILL.md · 119 lines

How it starts

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

Safe Refactoring

When to use this skill

Use this skill when you need to:

  • Restructure code while preserving its external behavior
  • Improve readability, maintainability, or performance without breaking functionality
  • Migrate between API versions or library dependencies
  • Split large functions or modules into smaller, cohesive units
  • Rename identifiers consistently across a codebase

When NOT to use this skill

  • For adding new features (use the appropriate development skill)
  • For fixing bugs that are not related to code structure
  • For performance optimizations that change algorithmic complexity

Inputs required

  • The code to be refactored (file paths, repository location)
  • The specific refactoring operation (rename, extract function, split module, etc.)
  • Any invariants that must be preserved (e.g., “function X must always return a positive integer”)
  • Existing test suite that can be used to validate correctness

Workflow

  1. Understand the code and its dependencies

    • Read the relevant source files and identify data flows
    • Map callers and callees of the functions/modules being changed
    • Note any implicit invariants (e.g., global state, side effects)
  2. Plan the refactoring

    • Choose the refactoring steps and their order
    • Determine which tests will be affected and need updating
    • Decide whether to use automated tools (e.g., semantic grep, AST transformers)
  3. Execute the changes

    • Apply one refactoring step at a time
    • After each step, run the test suite to ensure nothing broke
    • Use version control to create checkpoints (commits) for easy rollback
  4. Validate the result

    • Run the full test suite (unit, integration, regression)
    • If available, run static analysis tools to detect new warnings
    • Verify that the refactored code meets the original invariants
  5. Update documentation

    • Adjust comments, READMEs, and API references that refer to the changed code
    • Ensure any examples in documentation still work

Read the full file on GitHub · 119 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. 9d ago First seen · 119 lines · 34 tokens per session scan A 635ef8dfe380

Subscribe to this mod's changes

safe-refactoring is a skill published in the GitHub repository Sounio-lang/sounio (6 stars, last pushed today), licensed Apache-2.0. It adds 34 tokens to every session and 901 once invoked, about $0.0002 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-31.

Related

Other skills, from other repositories

migrate-oxlint

Guide for migrating a project from ESLint to Oxlint. Use when asked to migrate, convert, or switch a JavaScript/TypeScript project's linter from ESLint to Oxlint.

oxc-project/oxc · 44 tokens

vera-language

Write programs in the Vera programming language. Use when asked to write, edit, debug, or review Vera code (.vera files). Vera is a statically typed, purely functional language with algebraic effects, mandatory contracts, and typed slot references (@T.n) instead of variable names.

aallan/vera · 61 tokens

handle-regression

Protocol for detecting, isolating, and fixing regressions in test262 pass count. Use when a test run shows fewer passes than expected.

loopdive/js2 · 32 tokens

regression-triage

Bulk-classify a list of test262 pass→other transitions from a CI run. Distinct from handle-regression (single fix) and analyze-regression (diff two runs). Use after a merge wave when the sharded run reports N regressions and you need to bucket them by root cause and decide which are false positives.

loopdive/js2 · 72 tokens

scratch-cleanup

Sweep leaked ad-hoc dev scratch files (check-.ts, debug-.ts, test--debug.ts, tests/probe-.test.ts, etc.) into .tmp/ so git status stays clean and token cost per tool call stays low.

loopdive/js2 · 57 tokens

analyze-wat

Compile a source file to WAT and analyze the output for codegen inefficiencies. Use after a codegen change to verify the output is clean, when investigating performance issues, or when creating optimization issues from real compiler output.

loopdive/js2 · 50 tokens