Agent skill

Refactor Skill

by vinta in vinta/hal-9000

A skill your agent uses when about to refactor or refine an existing skill, its SKILL.md or sibling files, from a full restructure down to a one-line wording fix; a change that looks too small to…

MITAuto-check passedDevelopment

Install Refactor Skill

skills CLI
$ npx skills add vinta/hal-9000 --skill refactor-skill -a claude-code

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

GitHub CLI
$ gh skill install vinta/hal-9000 refactor-skill --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/vinta/hal-9000.git skills-src && mkdir -p .claude/skills && cp -r skills-src/skills/refactor-skill .claude/skills/refactor-skill && 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
refactor-skill
GitHub stars
138
Token cost
~1.5k tokens
SKILL.md length
891 words
Files
3 (incl. references)
Skills in repo
15
Repo updated
First seen
Licence
MIT

At a glance

A skill your agent uses when about to refactor or refine an existing skill, its SKILL.md or sibling files, from a full restructure down to a one-line wording fix; a change that looks too small to…

  • Works in 5 steps: Pick the target. If the invocation names… → Fetch the guides. The platform and model… → Audit. Give every frontmatter key, body… → …
  • About to refactor
  • Calls claude
  • Refine an existing skill

What it does

Refactor Skill is an agent skill from vinta/hal-9000. Use when about to refactor or refine an existing skill, its SKILL.md or sibling files, from a full restructure down to a one-line wording fix; a change that looks too small to need this skill is not an exemption. Not for creating a skill from scratch

Its SKILL.md is about 1.5k tokens, which your agent loads only when the skill is triggered. The skill folder holds 3 other files, including reference files (for example `references/claude-code.md` and `references/codex.md`).

It sits in Development, covering Refactoring. The repository describes itself as: Opinionated AI coding agent and dev environment automation for macOS. The licence is MIT.

When your agent uses it

  • About to refactor
  • Refine an existing skill
  • From a full restructure down to a one-line wording fix
  • A change that looks too small to need this skill is not an exemption

Example prompts

  • “/refactor-skill”

Requirements

  • Pre-approved tools (allowed-tools): WebFetch, Edit(**/skills/**)

Workflow steps

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

  1. Pick the target. If the invocation names one, resolve it to its SKILL.md. Otherwise ask which skill. For a full audit, read SKILL.md and…
  2. Fetch the guides. The platform and model guides below calibrate the delete, demote, and rewrite verdicts.
  3. Audit. Give every frontmatter key, body instruction, and sibling file in scope exactly one verdict, judged against its bar below. Done…
  4. Get decisions. Reuse changes and verdicts the user already authorized. Resolve contradictions from instruction priority and explicit user…
  5. Rewrite. Apply the authorized changes and verdicts in one pass, without asking again. Apply only those: anything else noticed while…

What it can do on your machine

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

  • Tool permissions

    Pre-approves these tools, so the agent can use them without asking each time:

    • WebFetch
    • Edit(**/skills/**)

    From allowed-tools in the SKILL.md frontmatter.

  • Runs code

    Shell commands in SKILL.md call:

    • claude

    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

Refactor Skill loads about 1.5k tokens when it runs, and up to ~2k if it reads all its reference files. Until then it costs about 66 tokens; SKILL.md has 891 words of instructions outside code blocks.

Always · name and description, kept in context so the agent knows when to use it
~66
When it runs · the whole SKILL.md, loaded when a task matches
~1.5k
With references · SKILL.md plus every file in references/, read only if the agent opens them
~2k

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 vinta/hal-9000 at commit 0a2005a, republished under its MIT licence (© vinta). 891 words, ~1,548 tokens.

Download SKILL.mdSave it as .claude/skills/refactor-skill/SKILL.md (or your agent's skills folder). This skill also uses 2 other files; get the full folder from GitHub.
name
refactor-skill
description
Use when about to refactor or refine an existing skill, its SKILL.md or sibling files, from a full restructure down to a one-line wording fix; a change that looks too small to need this skill is not an exemption. Not for creating a skill from scratch
allowed-tools
WebFetch, Edit(**/skills/**)
argument-hint
skill name | path/to/SKILL.md

Overview

Refactor a skill. A skill spends two budgets. Its description is loaded into every session, so each word there must do triggering work. Its body enters the context on invocation and stays there for the rest of the session, so each line there must guide every path through the skill. Conditional material moves behind a pointer; unnecessary material leaves the skill.

Instructions

Use AskUserQuestion in Claude Code or request_user_input in Codex when available.

  1. Pick the target. If the invocation names one, resolve it to its SKILL.md. Otherwise ask which skill. For a full audit, read SKILL.md and every sibling file in its directory. For a targeted change, read SKILL.md, affected files, and references needed to assess their interactions. That change sets the scope: the verdicts below cover the lines it adds or touches, the rest of the skill stays as it is, and anything noticed there is a follow-up.

  2. Fetch the guides. The platform and model guides below calibrate the delete, demote, and rewrite verdicts.

    • Fetch one model guide, picked by the target skill's model: frontmatter. Unset or inherit means the most capable model of the family running this skill: fable under Claude, gpt-6-astra under a GPT model. Read the matching reference and follow its fetch instructions:
  3. Audit. Give every frontmatter key, body instruction, and sibling file in scope exactly one verdict, judged against its bar below. Done when nothing in scope lacks a verdict.

    • contradiction: conflicts with another instruction, or the frontmatter promises what the body does not deliver, such as a context: fork skill whose body assumes conversation history. Record both sides.
    • delete: fails the no-op test, meaning the model the skill targets would behave the same without it, or the fetched pages say to remove it because it was written for an earlier model's habits. Judge defaults against those pages, not memory. Covers explanations of what the model already knows, emphasis that carries no instruction, and sibling files nothing points to.
    • demote: real content that only some runs of the skill reach. Destinations: a file in the skill directory linked from SKILL.md, one level deep; a script under scripts/ when the steps are deterministic; a separate skill only when it needs its own trigger or another skill must reach it. Name the destination.
    • rewrite: right meaning, phrasing falls short of the fetched pages: a description that names features instead of triggers, a step with no completion criterion, a prohibition with no positive target, a rule shouted in capitals instead of explained. Also a rewrite when the line carries words that fail the no-op test on their own: a duplicate of another line, a definition of a term the model knows, or emphasis; a rationale or example stays, since both steer the model. Voice follows the system prompt: the body addresses the model as "you" and names the human as "the user", so "I" or "my" for the human, and "Claude" or "the agent" for the model, are rewrites; words quoted as user speech keep their own voice.
    • keep: earns its cost as written.

    The bar per part:

    • Frontmatter (each key a decision, judged before the body): disable-model-invocation: true when only the user ever names the skill; omitted when the agent must reach the skill on its own, or another skill or a CLAUDE.md line invokes it. user-invocable: false when the human never runs it by hand. context: fork when the arguments fully specify the work and the body needs no conversation history. model and effort only when a run at the inherited value failed, and model only on a context: fork skill or one that owns the whole turn. argument-hint present when the skill takes arguments, absent when it does not.
    • Description (loaded into every session): every word does triggering work. Leads with when to use, names each distinct trigger once, marks the near miss it must not fire on. A user-invoked skill gets a one-line human-facing summary with no trigger list.
    • Body (in context from invocation to session end): actions, constraints, completion criteria, or reference every path through the skill needs. Require a fixed order only where correctness depends on it; route conditional workflows to supporting files. Written as standing instructions, since the body is never re-read.
    • Sibling files (loaded only when reached): each has a pointer in SKILL.md stating what it is and when to read it, or for a script, when to run it. A file with no pointer is unreachable.
  4. Get decisions. Reuse changes and verdicts the user already authorized. Resolve contradictions from instruction priority and explicit user intent where possible; ask one single-select question per unresolved contradiction. Present any remaining delete and demote proposals and collect sign-off with one question. Preserve explicit review boundaries and leave unapproved proposals untouched.

  5. Rewrite. Apply the authorized changes and verdicts in one pass, without asking again. Apply only those: anything else noticed while editing is a follow-up to report in the final message. Keep the directory name and the name field, since renaming changes the slash command. Done when every audited item landed where its verdict says: kept, rewritten, demoted, or deleted. When the description changed, name a trigger test in the final message: claude plugin eval with a tool_used: Skill grader in Claude Code, or the skill-creator skill's forward-testing in Codex.

© vinta, MIT. 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 2 other files (references) in skills/refactor-skill of vinta/hal-9000.

  • SKILL.md
  • references/claude-code.md
  • references/codex.md

Open the folder on GitHubat commit 0a2005a

Compare with similar skills

Refactor Skill 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.

Refactor Skill compared with similar skills
SkillStarsUsed inTokensAuto-checkLicenceRepo updated
Refactor Skill this skillvinta/hal-9000138—~1.5kAutomated 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 today
    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 vinta/hal-9000

All 15 skills in this repo
  • Finds which plugins in the repository changed, bumps only the ones not already bumped since origin/main, and checks that each plugin's two manifests stay in sync.

    138 GitHub stars~1k tokensUpdated 2 days ago
    Auto-check passed
  • Audits your Claude Code settings and environment variables against the current official docs and returns a ranked list of changes tied to how you actually work.

    138 GitHub stars~1.4k tokensUpdated 2 days ago
    Auto-check passed
  • Logical Git Commits

    vinta/hal-9000

    Commits everything in the working tree as one logical change per commit, splitting files by hunk, with bodies that say what was wrong before and never an invented reason.

    138 GitHub stars~3.1k tokensUpdated 2 days ago
    Auto-check passed
  • PR

    vinta/hal-9000

    A skill your agent uses when the user explicitly asks to push the current branch and open a PR, rewrite an open PR's body from its commits, or wait for CI and merge it

    138 GitHub stars~1.4k tokensUpdated 2 days ago
    Auto-check passed
  • Keeps Ansible install tasks in line with upstream docs by fixing version, install-method and link drift one tool at a time, with a commit for each.

    138 GitHub stars~1.4k tokensUpdated 2 days ago
    Auto-check passed
  • Rewrites docs, READMEs, issues, comments or UI text in plain Global English that translates well and still sounds native, keeping every fact intact.

    138 GitHub stars~1.1k tokensUpdated 2 days ago
    Auto-check passed

Categories

Questions about Refactor Skill

What does Refactor Skill do?

A skill your agent uses when about to refactor or refine an existing skill, its SKILL.md or sibling files, from a full restructure down to a one-line wording fix; a change that looks too small to…. Refactor Skill is an agent skill from vinta/hal-9000.md or sibling files, from a full restructure down to a one-line wording fix; a change that looks too small to need this skill is not an exemption.

When should I use Refactor Skill?

Refactor Skill fits situations like: about to refactor; refine an existing skill; from a full restructure down to a one-line wording fix; A change that looks too small to need this skill is not an exemption.

How do I install Refactor Skill in Claude Code?

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

How do I install Refactor Skill in Codex?

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

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

What does Refactor Skill need to run?

Going by SKILL.md and its folder, Refactor Skill needs the command-line tools its instructions call (claude). Its frontmatter pre-approves these tools: WebFetch, Edit(**/skills/**).

Does Refactor Skill 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 Refactor Skill 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 Refactor Skill use?

Refactor Skill 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 Refactor Skill use?

About 1.5k tokens (SKILL.md is roughly 6.2k characters). Agents keep only the skill's name and description in context until a task matches; then they load SKILL.md in full. Its references folder adds about 455 tokens, read only when the agent opens those files.

What are the alternatives to Refactor Skill?

Skills that share tags, products or a category with Refactor Skill: 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 Refactor Skill?

vinta (a GitHub user) maintains it in vinta/hal-9000, which has 138 GitHub stars. The repository holds 15 skills in this directory. The repository was last updated on October 5, 2026.

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