Agent skill

Refactor

by guardana in guardana/guardana

Behaviour-preserving restructuring and cleanup — splitting an oversized module, removing dead code, finished scripts, flags or documents, consolidating duplicates, tightening comments.

Apache-2.0Auto-check passedSecurity

Install Refactor

skills CLI
$ npx skills add guardana/guardana --skill refactor -a claude-code

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

GitHub CLI
$ gh skill install guardana/guardana refactor --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/guardana/guardana.git skills-src && mkdir -p .claude/skills && cp -r skills-src/.claude/skills/refactor .claude/skills/refactor && 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
GitHub stars
129
Token cost
~827 tokens
SKILL.md length
422 words
Files
1
Skills in repo
16
Repo updated
First seen
Licence
Apache-2.0

At a glance

Behaviour-preserving restructuring and cleanup — splitting an oversized module, removing dead code, finished scripts, flags or documents, consolidating duplicates, tightening comments.

  • Works in 5 steps: Inventory before touching (delegate the… → Pin behaviour → Change in small, reversible commits → …
  • Any task whose promise is nothing changes for users
  • SKILL.md covers 1. Inventory before touching…, 2. Pin behaviour, 3. Change in small, reversible… and 4. Prove nothing moved, plus 1 more section
  • Calls git

What it does

Refactor is an agent skill from guardana/guardana. Behaviour-preserving restructuring and cleanup — splitting an oversized module, removing dead code, finished scripts, flags or documents, consolidating duplicates, tightening comments. Use for any task whose promise is "nothing changes for users", in any of the five packages, in scripts/ or in docs/.

Its SKILL.md is about 830 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 Security, covering Refactoring and Prompt injection and agent security. It works with Git. The repository describes itself as: Open-source AI security verification for model artifacts, live endpoints, MCP servers, and recorded agent traces. Reproducible evidence for release decisions. The licence is Apache-2.0.

When your agent uses it

  • Any task whose promise is nothing changes for users
  • In any of the five packages

Example prompts

  • “nothing changes for users”
  • “/refactor”

Workflow steps

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

  1. Inventory before touching (delegate the sweep)
  2. Pin behaviour
  3. Change in small, reversible commits
  4. Prove nothing moved
  5. Report

What it can do on your machine

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

    • git

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

  • Network

    No URLs in SKILL.md. Its commands use git, which can reach the network depending on how they are called.

    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 loads about 827 tokens when it runs. Until then it costs about 78 tokens; SKILL.md has 422 words of instructions outside code blocks.

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

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 guardana/guardana at commit ae7ee8b, republished under its Apache-2.0 licence (© guardana). 422 words, ~827 tokens.

Download SKILL.mdSave it as .claude/skills/refactor/SKILL.md (or your agent's skills folder).
name
refactor
description
Behaviour-preserving restructuring and cleanup — splitting an oversized module, removing dead code, finished scripts, flags or documents, consolidating duplicates, tightening comments. Use for any task whose promise is "nothing changes for users", in any of the five packages, in scripts/ or in docs/.
argument-hint
[target: file, module, directory or theme]

Refactor and cleanup

Target: $ARGUMENTS

The promise is "same behaviour". Every step below exists to make that promise checkable.

1. Inventory before touching (delegate the sweep)

Send scout for callers and references; do not read the tree yourself. For each candidate record the evidence, because "looks unused" has been wrong here before:

claimevidence that settles it
code is deadno import or call (git grep), not reached through an entry-point group, the registry, a YAML evaluator: / requires: string, a CLI command table, a schema $ref or a fixture; a test alone does not make it live
a script is finishedone-off by its own docstring AND not named in CI, .pre-commit-config.yaml, RELEASING.md, a skill, or docs/maintainers/ops-catalogue.md
a flag or option is deadno producer anywhere (CLI, profile schema, guardana.yaml examples, Action inputs, CI templates)
a document is consumedits findings are closed or live elsewhere; no LIVE file cites its path; it is not a design record (docs/design/ keeps accepted and superseded decisions on purpose)

Low reference count on a recent file means "new", not "dead" — check git log -1 first.

2. Pin behaviour

  • Green full gate on the untouched tree (/gate), so later red is yours.
  • Where tests do not cover the target, write characterisation tests FIRST from real inputs: the fixtures in guardana.core.testing, a saved run under examples/, a scripted transport.
  • For anything that writes a document: run the documented command on a fixture before and after, and diff the JSON. Expected result: no difference.
Show full SKILL.md (174 more words)Show less

3. Change in small, reversible commits

  • Move/rename in one commit, change in the next: a reviewer can only trust a move that is pure.
  • One theme per commit: "split x.py by concept" and "delete finished scripts" are two.
  • Deleting is cheap because git keeps it — but fix every inbound reference in the SAME commit: docs/index.md (the nav refuses a missing page), docs/ links (a test refuses a dead one), site/llms.txt and site/docs/ (regenerate), docs/maintainers/ops-catalogue.md, CLAUDE.md, .claude/rules/, the skills.
  • Leave alone: docs/generated/ (regenerate it), schemas/ (versioned contracts — a change is a migration, not a cleanup), examples/vulnerable-model/ (deliberately malicious fixture), anything a user's persisted document depends on.
  • Comment cleanup follows the hard rule: keep the WHY, drop dates, names, incident stories and references to decisions; history goes to the commit message.

4. Prove nothing moved

Full gate green; the before/after artifact diff empty; guardana scan packages --profile scripts/dogfood.yaml still at zero findings. Then /review.

5. Report

What was removed or moved and the evidence for each, what was kept and why, what is left for docs/work/BACKLOG.md.

© guardana, 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

Just SKILL.md in .claude/skills/refactor of guardana/guardana.

Open the folder on GitHubat commit ae7ee8b

Compare with similar skills

Refactor 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 compared with similar skills
SkillStarsUsed inTokensAuto-checkLicenceRepo updated
Refactor this skillguardana/guardana129—~827Automated safety check: PassApache-2.0
Remediating With AWS Security Agentaws/agent-toolkit-for-aws2.8k—~2.9kAutomated safety check: PassApache-2.0
Codexskills-directory/skill-codex1.5k3 repos~1.8kAutomated safety check: PassMIT
Nexus MapperHaaaiawd/Nexus-skills1661 repos~2.5kAutomated safety check: NotesNone
Refactoring Auditepam/ai-dial-chat504—~4.3kAutomated safety check: PassApache-2.0
Worklog Designregisx001/Worklog261—~3.3kAutomated safety check: PassMIT

Similar skills

  • Remediating With AWS Security Agent

    aws/agent-toolkit-for-aws

    Official

    Pull AWS Security Agent findings (penetration tests and code reviews) and drive remediation.

    2.8k GitHub stars~2.9k tokensUpdated today
    SecurityAuto-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
  • Nexus Mapper

    Haaaiawd/Nexus-skills

    Generate a persistent .nexus-map/ knowledge base that lets any AI session instantly understand a codebase's architecture, systems, dependencies, and change hotspots.

    166 GitHub starsUsed in 1 repo~2.5k tokens
    DevelopmentAuto-check: notes
  • Refactoring Audit

    epam/ai-dial-chat

    Deep codebase refactoring audit for AI DIAL Chat. An agent skill from epam/ai-dial-chat.

    504 GitHub stars~4.3k tokensUpdated today
    DevelopmentAuto-check passed
  • Worklog Design

    regisx001/Worklog

    Design and UI skill for the Worklog desktop project manager.

    261 GitHub stars~3.3k tokensUpdated 1 mo ago
    Frontend & DesignAuto-check passed
  • Docs

    latitude-dev/latitude-llm

    Review the current conversation context and git changes, then persist durable repository knowledge into dev-docs/.md by domain and into AGENTS.md for cross-cutting repo rules.

    4.7k GitHub stars~2.5k tokensUpdated yesterday
    Agent WorkflowsAuto-check passed

More from guardana/guardana

All 16 skills in this repo
  • Content Model

    guardana/guardana

    Route wording work to GPT (codex CLI) or Gemini (agy CLI) instead of writing it with Claude — landing-page copy, a readability rewrite of a README or docs page, attack and judge prompts for a rule…

    129 GitHub stars~1.2k tokensUpdated yesterday
    Auto-check passed
  • Ship

    guardana/guardana

    Commit and push a finished change the way this repo requires — explicit paths, one commit per logical change, no attribution, the five documentation places answered, the site checks before a push (a…

    129 GitHub stars~836 tokensUpdated yesterday
    Auto-check: notes
  • Add A Rule

    guardana/guardana

    Add security coverage to Guardana the way this repository requires — as a rule, evaluator or target, never by patching the engine — with the fixtures, the framework mapping and the documentation…

    129 GitHub stars~1.1k tokensUpdated yesterday
    Auto-check passed
  • Auto

    guardana/guardana

    Autonomous, non-interactive run of the whole lifecycle for one development task — size, plan, build, gate, review, fix, commit — without stopping for questions.

    129 GitHub stars~792 tokensUpdated yesterday
    Auto-check passed
  • Docs

    guardana/guardana

    Documentation work in this repo — the five places a user-visible change must answer, the page conventions the site build enforces, the tests that pin prose to the registry, and a simplification pass…

    129 GitHub stars~1k tokensUpdated yesterday
    Auto-check passed
  • False Green Audit

    guardana/guardana

    Hunt for the failure this project exists to prevent — code that compiles, types, tests green, and quietly reports "all clear" about something it never examined.

    129 GitHub stars~1.1k tokensUpdated yesterday
    Auto-check passed

Works with

Questions about Refactor

What does Refactor do?

Behaviour-preserving restructuring and cleanup — splitting an oversized module, removing dead code, finished scripts, flags or documents, consolidating duplicates, tightening comments. Refactor is an agent skill from guardana/guardana. Behaviour-preserving restructuring and cleanup — splitting an oversized module, removing dead code, finished scripts, flags or documents, consolidating duplicates, tightening comments.

When should I use Refactor?

Refactor fits situations like: any task whose promise is nothing changes for users; in any of the five packages.

How do I install Refactor in Claude Code?

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

How do I install Refactor in Codex?

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

Can I use Refactor 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 guardana/guardana --skill refactor -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, .gemini/skills/refactor, .github/skills/refactor and .opencode/skills/refactor in your project.

What does Refactor need to run?

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

Does Refactor access the network?

SKILL.md contains no URLs. Its commands use git, which can reach the network depending on how they are called. This is read from the text; nothing was executed.

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

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

About 827 tokens (SKILL.md is roughly 3.3k 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 Refactor?

Skills that share tags, products or a category with Refactor: Remediating With AWS Security Agent (aws/agent-toolkit-for-aws, 2.8k stars), Codex (skills-directory/skill-codex, 1.5k stars), Nexus Mapper (Haaaiawd/Nexus-skills, 166 stars) and Refactoring Audit (epam/ai-dial-chat, 504 stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.

Who maintains Refactor?

guardana (a GitHub organization) maintains it in guardana/guardana, which has 129 GitHub stars. The repository holds 16 skills in this directory. The repository was last updated on October 7, 2026.

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