Agent skill

Mechanical Refactor Verify

by sgl-project in sgl-project/sglang

Make mechanical refactoring (file splits, function moves, module extractions, renames) machine-checkable instead of eyeballed.

Apache-2.0Auto-check passedDevelopment

Install Mechanical Refactor Verify

skills CLI
$ npx skills add sgl-project/sglang --skill mechanical-refactor-verify -a claude-code

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

GitHub CLI
$ gh skill install sgl-project/sglang mechanical-refactor-verify --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/sgl-project/sglang.git skills-src && mkdir -p .claude/skills && cp -r skills-src/.agents/skills/mechanical-refactor-verify .claude/skills/mechanical-refactor-verify && 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
mechanical-refactor-verify
GitHub stars
37k
Used in
2 other repos
Token cost
~1.4k tokens
SKILL.md length
586 words
Files
42 (incl. scripts)
Skills in repo
31
Repo updated
First seen
Licence
Apache-2.0

At a glance

Make mechanical refactoring (file splits, function moves, module extractions, renames) machine-checkable instead of eyeballed.

  • Works in 3 steps: Overview → Commands — what do you want to do? → Files
  • Reviewing such changes
  • SKILL.md covers 1. Overview, 2. Commands — what do you want… and 3. Files
  • Runs Python scripts from its folder

What it does

Mechanical Refactor Verify is an agent skill from sgl-project/sglang. Make mechanical refactoring (file splits, function moves, module extractions, renames) machine-checkable instead of eyeballed. Reproduce a relocation commit byte-for-byte from faithful primitives, and split an extraction into a verifiable prepare + move + postpare. Use when doing or reviewing such changes.

Its SKILL.md is about 1.4k tokens, which your agent loads only when the skill is triggered. The skill folder holds 45 other files, including scripts (for example `guide-construct-proof.md`, `guide-modify-skill.md` and `guide-split.md`).

It sits in Development, covering Refactoring. The repository describes itself as: SGLang is a high-performance serving framework for large language models and multimodal models. The licence is Apache-2.0.

When your agent uses it

  • Reviewing such changes
  • Tasks that involve Refactoring

Example prompts

  • “/mechanical-refactor-verify”

Requirements

  • Python 3

Workflow steps

3 steps, taken from the step headings in SKILL.md.

  1. Overview
  2. Commands — what do you want to do?
  3. Files

What it can do on your machine

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

    Ships 12 files in scripts/ (Python, from the files we listed), which the agent can run.

    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

Mechanical Refactor Verify loads about 1.4k tokens when it runs. Until then it costs about 84 tokens; SKILL.md has 586 words of instructions outside code blocks.

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

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); the scripts in this folder are not scanned.

SKILL.md

The full file from sgl-project/sglang at commit b7b2975, republished under its Apache-2.0 licence (© sgl-project). 586 words, ~1,408 tokens.

Download SKILL.mdSave it as .claude/skills/mechanical-refactor-verify/SKILL.md (or your agent's skills folder). This skill also uses 41 other files; get the full folder from GitHub.
name
mechanical-refactor-verify
description
Make mechanical refactoring (file splits, function moves, module extractions, renames) machine-checkable instead of eyeballed. Reproduce a relocation commit byte-for-byte from faithful primitives, and split an extraction into a verifiable prepare + move + postpare. Use when doing or reviewing such changes.
user_invocable
true
argument
split <base>..<tip> | construct <base>..<tip> [--match REGEX] [--out DIR] | verify --base <base> --branch <branch> --proof <folder> [--jobs N] [--skip-passed]

Mechanical Refactor — Machine-Checkable Verification

1. Overview

  • The correctness of a mechanical change (file split, function move, module extraction, rename) must be machine-checkable, not eyeballed — the proof is something anyone can re-run, whoever made the change and whenever.
  • One property: a commit is a pure relocation. One proof: reproduce — regenerate the move from the base commit with faithful primitives, run the formatter, byte-diff against the target.
  • Empty diff = the proof. Any residual = a bundled non-move change, surfaced for review.
  • A reshape must not ride along: split into optional prepare + certified move + optional postpare (guide-split.md).

2. Commands — what do you want to do?

The skill takes an argument naming one of three commands; invoked without one, pick the row matching your task.

  • split <base>..<tip> — author a compliant refactor branch: split it into commits, satisfy the contract (extract, move, file split) → guide-split.md: §1 splits the PR into classified pieces (the chain contract: classification format, correct labeling, proofs PASS, non-mechanical commits correctness-reviewed); §2 splits one piece into prepare + move + postpare (the case recipes and the anti-patterns). The argument is the chain to author (or a single commit / a description of the change to split).
  • construct <base>..<tip> [--match REGEX] [--out DIR] — construct the proof, for the chain or one commit → guide-construct-proof.md: §1 generates + publishes the whole chain's proof folder (the flags are the generator's: scripts/mechanical_refactor_proof_generator.py <base>..<tip> --match REGEX --out DIR); §2 proves a single commit — pass just <commit> (the generator, or a hand-written Repro when it reports UNSUPPORTED).
  • verify --base <base> --branch <branch> --proof <folder> [--jobs N] [--skip-passed] — verify someone's proof: a whole chain / PR branch → guide-verify-proof.md: run the chain verifier with exactly these flags (scripts/mechanical_refactor_reproduction_cli.py) — it checks every commit declares mechanical_provable or non_mechanical_provable, runs every provable commit's proof (never a sample), and writes one full report; then audit the authored surfaces and the HUMAN_REVIEW rows. Re-running one commit's script is for diagnosis only.
  • Decide whether a change counts as a clean move → spec-reproduction-utils.md: the property, the whole whitelist / not-allowed list, and each primitive's contract. The source of truth for the reproduction module; if any other file disagrees, it wins.
  • Change this skill itself (edit the engine, the generator, or the spec) → guide-modify-skill.md: the spec-leads rule, the faithfulness invariant, and the testing bar a change must clear before it is trusted.
Show full SKILL.md (210 more words)Show less

3. Files

  • guide-split.md — split the PR into classified pieces (§1, the chain contract) and each piece into prepare + move + postpare (§2: case recipes, what stays mechanical, anti-patterns).
  • guide-construct-proof.md — produce the proof: the whole chain's proof folder + publishing (§1), and a single commit's proof — generator or hand-written Repro (§2).
  • guide-verify-proof.md — consume the proof: the whole-chain verifier, single-commit re-runs, verdicts, and the audit checklist for authored surfaces.
  • spec-reproduction-utils.md — the normative spec of the clean-move property and the reproduction primitives.
  • spec-reproduction-cli.md — the normative spec of the verified-chain property: the classification word rule, the proof obligation, the report, and the exit codes.
  • guide-modify-skill.md — change the engine, the generator, or the spec: the spec-leads rule, the byte-faithfulness invariant, and the testing bar.
  • scripts/mechanical_refactor_proof_generator.py — the generator: infers a reproduce recipe from a commit's diff and emits/runs a standalone, auditable script per commit, with a PASS / RESIDUAL / UNSUPPORTED verdict.
  • scripts/mechanical_refactor_reproduction_utils.py — the proof engine: the Repro builder's faithful relocation primitives plus the worktree + pre-commit + byte-diff scaffold. Self-contained — only git and the standard library.
  • scripts/mechanical_refactor_reproduction_cli.py — the chain verifier: classifies every commit in base..branch, runs every provable commit's proof from the proof folder, and emits the full chain report.
  • scripts/tests/ — pytest suites, one folder per module: reproduction_utils/ for the proof engine, proof_generator/ for the generator, reproduction_cli/ for the chain verifier.

© sgl-project, Apache-2.0. Rendered from Markdown: HTML in the file is shown as text, images as links, and headings moved down two levels. Raw file

Files

SKILL.md and 41 other files (scripts) in .agents/skills/mechanical-refactor-verify of sgl-project/sglang.

  • SKILL.md
  • guide-construct-proof.md
  • guide-modify-skill.md
  • guide-split.md
  • guide-verify-proof.md
  • scripts/mechanical_refactor_proof_generator.py
  • scripts/mechanical_refactor_reproduction_cli.py
  • scripts/mechanical_refactor_reproduction_utils.py
  • scripts/tests/proof_generator/conftest.py
  • scripts/tests/proof_generator/generator_testlib.py
  • scripts/tests/proof_generator/test_infer_extract_functions.py
  • scripts/tests/proof_generator/test_infer_extracts.py
  • scripts/tests/proof_generator/test_infer_imports.py
  • scripts/tests/proof_generator/test_infer_moves.py
  • scripts/tests/proof_generator/test_main_single_commit.py
  • scripts/tests/proof_generator/test_script_and_diff.py
  • scripts/tests/reproduction_cli/cli_testlib.py
  • … and 25 more

Open the folder on GitHubat commit b7b2975

Used in 2 other repositories

We found 2 copies of this SKILL.md (exact, near-identical or edited) in other folders, from 2 other GitHub owners. This page covers the copy in sgl-project/sglang, which our catalogue first saw on October 7, 2026.

Compare with similar skills

Mechanical Refactor Verify 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.

Mechanical Refactor Verify compared with similar skills
SkillStarsUsed inTokensAuto-checkLicenceRepo updated
Mechanical Refactor Verify this skillsgl-project/sglang37k2 repos~1.4kAutomated safety check: PassApache-2.0
Guidelinesakash-network/node1.1k22 repos~577Automated safety check: PassMIT
Component Refactoringlangflow-ai/langflow156k—~3.5kAutomated safety check: PassMIT
Migrate Core Code to Submodulestinyhumansai/openhuman42k—~2.6kAutomated safety check: PassGPL-3.0
Systematic Code Refactoringluongnv89/claude-howto42k—~3kAutomated safety check: PassMIT
Codexskills-directory/skill-codex1.5k3 repos~1.8kAutomated 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.

    42k GitHub stars~2.6k 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 8 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
  • Ponytail

    DavidObando/gsharp

    Forces the laziest solution that actually works, simplest, shortest, most minimal.

    565 GitHub starsUsed in 8 repos~1.7k tokens
    DevelopmentAuto-check passed

More from sgl-project/sglang

All 31 skills in this repo
  • Sglang Prod Incident Triage

    sgl-project/sglang

    Replay-first debug flow for SGLang serving problems. An agent skill from sgl-project/sglang.

    37k GitHub starsUsed in 3 repos~2.1k tokens
    Auto-check passed
  • LLM Torch Profiler Analysis

    sgl-project/sglang

    Unified LLM torch-profiler triage skill for sglang, vllm, TensorRT-LLM, and TokenSpeed.

    37k GitHub starsUsed in 2 repos~6.4k tokens
    Auto-check passed
  • Babysit PR To Pass CI

    sgl-project/sglang

    Start and persistently pursue a goal to babysit an SGLang pull request until selected GitHub Actions workflows pass on the latest PR head.

    37k GitHub starsUsed in 2 repos~3k tokens
    Auto-check passed
  • Compute Mamba Ratio

    sgl-project/sglang

    Compute the optimal --mamba-full-memory-ratio (or --max-mamba-cache-size pin) for a hybrid attention + linear-attention (Mamba / GDN / KDA) model's two serving memory pools, from the workload and…

    37k GitHub starsUsed in 2 repos~2.9k tokens
    Auto-check passed
  • Debug Distributed Hang

    sgl-project/sglang

    Debug hanging issues in SGLang distributed inference (TP/PP/DP/EP).

    37k GitHub starsUsed in 2 repos~2.4k tokens
    Auto-check passed
  • Env Var Conventions

    sgl-project/sglang

    Conventions for SGLang environment variables — where to define, how to access, how to name, and how to deprecate.

    37k GitHub starsUsed in 2 repos~2.9k tokens
    Auto-check passed

Categories

Questions about Mechanical Refactor Verify

What does Mechanical Refactor Verify do?

Make mechanical refactoring (file splits, function moves, module extractions, renames) machine-checkable instead of eyeballed. Mechanical Refactor Verify is an agent skill from sgl-project/sglang. Make mechanical refactoring (file splits, function moves, module extractions, renames) machine-checkable instead of eyeballed.

When should I use Mechanical Refactor Verify?

Mechanical Refactor Verify fits situations like: reviewing such changes; tasks that involve Refactoring.

How do I install Mechanical Refactor Verify in Claude Code?

Run `npx skills add sgl-project/sglang --skill mechanical-refactor-verify -a claude-code`. Or copy the skill folder (.agents/skills/mechanical-refactor-verify in sgl-project/sglang) into .claude/skills/mechanical-refactor-verify in your project. Claude Code loads it when a task matches its description.

How do I install Mechanical Refactor Verify in Codex?

Run `npx skills add sgl-project/sglang --skill mechanical-refactor-verify -a codex`. Or copy the skill folder (.agents/skills/mechanical-refactor-verify in sgl-project/sglang) into .agents/skills/mechanical-refactor-verify in your project. Codex loads it when a task matches its description.

Can I use Mechanical Refactor Verify 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 sgl-project/sglang --skill mechanical-refactor-verify -a cursor` (or -a gemini-cli, github-copilot or opencode for the others). To copy it by hand, put the folder in .cursor/skills/mechanical-refactor-verify, .gemini/skills/mechanical-refactor-verify, .github/skills/mechanical-refactor-verify and .opencode/skills/mechanical-refactor-verify in your project.

What does Mechanical Refactor Verify need to run?

Going by SKILL.md and its folder, Mechanical Refactor Verify needs Python for the scripts in its folder. Our summary lists: Python 3.

Does Mechanical Refactor Verify 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 Mechanical Refactor Verify 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. The check reads SKILL.md only: the scripts in the folder are not scanned, so read them before running anything.

What licence does Mechanical Refactor Verify use?

Mechanical Refactor Verify is published under the Apache-2.0 licence (the repository's licence). It allows redistribution, so the full SKILL.md is shown on this page.

How many tokens does Mechanical Refactor Verify use?

About 1.4k tokens (SKILL.md is roughly 5.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 Mechanical Refactor Verify?

Skills that share tags, products or a category with Mechanical Refactor Verify: Guidelines (akash-network/node, 1.1k stars), Component Refactoring (langflow-ai/langflow, 156k stars), Migrate Core Code to Submodules (tinyhumansai/openhuman, 42k stars) and Systematic Code Refactoring (luongnv89/claude-howto, 42k stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.

Who maintains Mechanical Refactor Verify?

sgl-project (a GitHub organization) maintains it in sgl-project/sglang, which has 36,851 GitHub stars. The repository holds 31 skills in this directory. The repository was last updated on October 8, 2026.

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