Agent skill

Squid Refactor

by iusztinpaul in iusztinpaul/squid

Plan a refactor as an ordered, commit-grain Tasks Plan with structural acceptance criteria (suite green at every step, no behaviour diff) that /squid-implement-night can execute end-to-end.

Apache-2.0Auto-check passedDevelopment

Install Squid Refactor

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

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

GitHub CLI
$ gh skill install iusztinpaul/squid squid-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/iusztinpaul/squid.git skills-src && mkdir -p .claude/skills && cp -r skills-src/skills/squid-refactor .claude/skills/squid-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
squid-refactor
GitHub stars
203
Token cost
~2.4k tokens
SKILL.md length
879 words
Files
1
Skills in repo
13
Repo updated
First seen
Licence
Apache-2.0

At a glance

Plan a refactor as an ordered, commit-grain Tasks Plan with structural acceptance criteria (suite green at every step, no behaviour diff) that /squid-implement-night can execute end-to-end.

  • Works in 6 steps: Resolve and frame the refactor → Map the blast radius → Decompose into commit-grain tasks → …
  • Tasks that involve Refactoring
  • SKILL.md covers When NOT to use, Step 1 — Resolve and frame the…, Step 2 — Map the blast radius and Step 3 — Decompose into…, plus 3 more sections
  • Instructions only: no scripts, shell commands, URLs or credentials in SKILL.md

What it does

Squid Refactor is an agent skill from iusztinpaul/squid. Plan a refactor as an ordered, commit-grain Tasks Plan with structural acceptance criteria (suite green at every step, no behaviour diff) that /squid-implement-night can execute end-to-end.

Its SKILL.md is about 2.4k 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 and User stories. The licence is Apache-2.0.

When your agent uses it

  • Tasks that involve Refactoring
  • Tasks that involve User stories

Example prompts

  • “/squid-refactor”

Workflow steps

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

  1. Resolve and frame the refactor
  2. Map the blast radius
  3. Decompose into commit-grain tasks
  4. Write the Tasks Plan
  5. File the plan
  6. Hand-off

What it can do on your machine

Read from SKILL.md and the folder at commit f5bf6b3. 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 (its code samples are markdown).

    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

Squid Refactor loads about 2.4k tokens when it runs. Until then it costs about 52 tokens; SKILL.md has 879 words of instructions outside code blocks.

Always · name and description, kept in context so the agent knows when to use it
~52
When it runs · the whole SKILL.md, loaded when a task matches
~2.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); files beside SKILL.md are not scanned.

SKILL.md

The full file from iusztinpaul/squid at commit f5bf6b3, republished under its Apache-2.0 licence (© iusztinpaul). 879 words, ~2,447 tokens.

Download SKILL.mdSave it as .claude/skills/squid-refactor/SKILL.md (or your agent's skills folder).
name
squid-refactor
description
Plan a refactor as an ordered, commit-grain Tasks Plan with structural acceptance criteria (suite green at every step, no behaviour diff) that `/squid-implement-night` can execute end-to-end.
disable-model-invocation
true
argument-hint
<refactor-goal | path/to/squid-refactor-spec.md | tracker-ref>

Refactor — plan a no-behaviour-change structural improvement

A refactor is not a feature and not a bug, so the Product Architect's feature-grooming flow doesn't fit. This skill produces a Tasks Plan whose tasks are commit-grain (each one keeps main shippable, suite green at every commit) and whose AC are structural: imports, types, signatures, dependency direction, public surface, test coverage ("module X no longer imports module Y"). The output feeds /squid-implement-night directly.

You are the planner — you may delegate exploration but do NOT write code, do NOT execute steps. Your output is the plan file plus a hand-off message.

$ARGUMENTS is one of:

  • A free-form refactor goal ("extract auth.session into its own package", "replace ad-hoc retries with tenacity", "rename User.id to User.uid repo-wide").
  • A path to a markdown spec.
  • A tracker reference.

If empty, ask the user for one.

Read AGENTS.md first to confirm the active tracker mode (file or gh) and the pipeline map this plan plugs into.

When NOT to use

  • A feature with new user-visible behaviour — use /squid-plan (PA grooming) instead.
  • A rewrite — it's a feature whose user-visible behaviour is "the new system, but the same"; don't smuggle it in here.
  • A bug fix — use /squid-triage-issue, then /squid-implement-task or /squid-implement-night.
  • A one-file rename you can finish in five minutes — just do it; don't ceremony.

Step 1 — Resolve and frame the refactor

Identify what to refactor from $ARGUMENTS (same resolution rules as /squid-triage-issue's Step 1).

Capture three things explicitly — ask the user via AskUserQuestion if any are missing, one round of questions max:

  1. Goal — one sentence, structural. ("Move all auth code out of core/ and into auth/.")
  2. Definition of done — concrete, testable structural invariants. ("grep -r 'from core.auth' src/ returns nothing"; "auth/ has no imports from core/ except types"). At least 2.
  3. Hard constraints — what must not change. ("Public API of core.session.Session unchanged"; "no DB schema changes"; "feature flag X stays toggleable throughout").

If the user can't answer (1)–(3), the refactor isn't ready to plan. Surface that and stop — the user does the thinking, not you.

Step 2 — Map the blast radius

Spawn 1 Explore agent (parallel calls if scope is large enough to need 2):

Agent(
  subagent_type="Explore",
  prompt="""Refactor scope: {goal from Step 1}.

  Map: (1) every file that will be touched (rough count + paths); (2) every module/package that imports the affected code (call sites — file:line); (3) every test that exercises the affected code; (4) any public API surface (functions / classes / endpoints / CLI commands) that callers outside the codebase might depend on; (5) the depth of the existing test coverage on the affected modules — coarse estimate (good / thin / none).

  Be exhaustive on (1)–(3); a missed import becomes a broken commit. Report as five sections."""
)

When the agent returns:

  • Read the plan-critical files yourself. Don't trust a summary on the load-bearing modules.
  • Test-coverage gate. If coverage is none or thin on the affected modules, surface this to the user as a prerequisite task ("expand test coverage to cover the current behaviour of core/auth/* before refactoring") and ask: "Add this as the first task, or stop?" Do not silently plan a refactor on top of weak tests.
Show full SKILL.md (449 more words)Show less

Step 3 — Decompose into commit-grain tasks

Each task must satisfy three rules:

  1. Reversible alone. Reverting just this commit leaves main green.
  2. Tests green at the boundary. The full unit + integration suite passes after this task and after every prior task.
  3. One coherent intention. "Move file X and update its imports" is one task. "Move file X, rename function Y, fix bug Z" is three.

Common refactor shapes and their canonical decomposition:

Refactor shapeTypical task sequence
Extract module(1) copy code to new location with old still in place + re-export shim; (2) move call sites in batches by package; (3) delete shim + old file.
Rename across codebase(1) introduce new name as alias of old; (2) migrate call sites in batches; (3) deprecate old name; (4) delete old name.
Library swap(1) introduce new lib alongside old behind an internal facade; (2) migrate call sites; (3) remove old lib.
Layer cleanup (e.g., remove cycle)(1) introduce the seam (new module / interface); (2) move responsibilities one batch at a time; (3) enforce direction with an architectural test.
Dead-code removal(1) delete callers; (2) delete leaves; (3) re-run unused-detector. Each in its own task only if the ordering matters; often this is one task.
De-abstraction / simplification(1) inline the single-implementation interface / factory / wrapper at its one call site; (2) swap hand-rolled logic for the stdlib / native / framework equivalent; (3) drop the now-unused dependency. Structural AC: the abstraction (or dep) is gone, public behaviour unchanged, suite green. Feeds directly from /squid-architecture-review over-engineering findings.

3–8 tasks is a healthy plan size. Fewer than 3 → it's too small for a Tasks Plan; do it as a single /squid-implement-task task. More than 8 → either decompose into multiple sequential refactors (file separate /squid-refactor plans), or you're sneaking feature work in.

Step 4 — Write the Tasks Plan

Use this template. Frontmatter follows squid-scaffold/specs/tracker-workflow.md, so /squid-implement-task and /squid-implement-night accept it without re-grooming.

markdown
# Refactor: {one-line goal}

**Type:** refactor
**Definition of done:**
- {invariant 1}
- {invariant 2}
- ...

**Hard constraints (must not change):**
- {constraint 1}
- ...

**Test-suite anchor:** `make pre-commit && make unit-tests && make integration-tests`. Every task ends with this command green.

## Tasks

### 1. {one-line task title}

**Scope:** {1–2 sentences on what this commit does and only what it does.}

**Files touched (expected):** `path/a.py`, `path/b.py`, ...

**Acceptance criteria:**
- [ ] {Structural assertion. e.g. `grep -r 'from core.auth' src/auth/ | wc -l` is 0.}
- [ ] {Behavioural invariant. e.g. Public API of `Session.login()` unchanged — verified by existing tests at `tests/auth/test_session.py`.}
- [ ] Test suite anchor green.
- [ ] No new unit tests required (this is a refactor) — but if you find a coverage gap that blocks the move, add the test before doing the move and call that out in the SWE log.

**Out of scope:**
- {explicit list — adjacent things that look related but belong to other tasks.}

### 2. ...

(Repeat for each task.)

## Rollback story

If task N goes sideways and the team needs to ship before it's resolved, revert commits {N..} only. Tasks {1..N-1} are independently shippable by construction.

## Notes for the SWE

- This is a refactor — **add no behaviour, fix no bugs**, even if you spot one. File a `/squid-triage-issue` for any bug found mid-refactor; do not let it ride along.
- If a task's AC turns out to be wrong (e.g., a hidden import the planner missed), update the plan via the orchestrator before adapting code — drift between plan and reality is the source of "refactor went off the rails" stories.

Step 5 — File the plan

Where it lands depends on tracker mode (per AGENTS.md).

File mode

There is no separate plan document — the Tasks Plan is the set of task files, same as /squid-plan's output. Write one tasks/<NNN>-<refactor-slug>-<k>.md per task (frontmatter status: pending, feature: refactor-<slug>; allocate NNN per squid-scaffold/specs/tracker-workflow.md). Each file carries its task's Scope, Files touched, Acceptance criteria, and Out of scope from the template; fold the hard constraints into every task's Out of scope, and the definition-of-done invariants into the final task's acceptance criteria so the PA acceptance review verifies them.

gh mode

Open one parent issue (label refactor,plan) with the full plan in the body, then one issue per task linked back to the parent (label refactor,task). Capture all numbers for the hand-off message.

Step 6 — Hand-off

Single markdown block:

markdown
## Refactor plan ready — {goal}

**Plan:** {tracker path or parent issue URL}
**Tasks ({N}):**
1. {NNN-slug or #N} — {title}
2. ...

**Definition of done:** {bulleted DoD from the plan}

### Recommended next step

`/squid-implement-night {plan-ref}` — the inner loop runs each task, the Tester gate enforces "tests green at every step", and the PA acceptance review verifies the structural DoD. The human still gates the merge.

If the refactor is small enough (≤ 2 tasks) and you'd rather supervise:

`/squid-implement-task {first-task-ref}` then `/squid-implement-task {next-task-ref}` — manual, one task at a time.

### Pre-flight checklist (before /squid-implement-night)

- [ ] Test-suite anchor is green on `main` *right now*. Do not start a refactor on a red base.
- [ ] No in-flight feature branches conflict with the affected files (avoidable merge churn).
- [ ] If the refactor touches the public API, the deprecation / migration story for downstream callers is captured in the plan or in an ADR (spec: `squid-scaffold/specs/adr.md`).

© iusztinpaul, 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 skills/squid-refactor of iusztinpaul/squid.

Open the folder on GitHubat commit f5bf6b3

Compare with similar skills

Squid 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.

Squid Refactor compared with similar skills
SkillStarsUsed inTokensAuto-checkLicenceRepo updated
Squid Refactor this skilliusztinpaul/squid203—~2.4kAutomated safety check: PassApache-2.0
Vibe CodingOfficeDev/microsoft-365-agents-toolkit781—~5.5kAutomated safety check: PassCustom licence
Improve Appwondelai/skills2.4k—~6.1kAutomated safety check: PassMIT
Improve Codebase ArchitectureTwiTech-LAB/devchain101—~3kAutomated safety check: PassMIT
Refactor Design Reportpenwyp/ClaudePreference136—~1.4kAutomated safety check: PassMIT
Fixgenkovich/sdd171—~2.5kAutomated safety check: PassMIT

Similar skills

  • Vibe Coding

    OfficeDev/microsoft-365-agents-toolkit

    End-to-end workflow for agent-driven changes that add or modify behavior in the toolkit packages.

    781 GitHub stars~5.5k tokensUpdated today
    DevelopmentAuto-check passed
  • Improve App

    wondelai/skills

    Guided journey from a shipped app that works but feels rough to a product that fits the job, flows without friction, reads clearly, and persuades honestly.

    2.4k GitHub stars~6.1k tokensUpdated 28 days ago
    DevelopmentAuto-check passed
  • Improve Codebase Architecture

    TwiTech-LAB/devchain

    Plan architecture improvements and refactoring for a codebase: scan for deepening opportunities (shallow modules, leaky seams, low-leverage interfaces), present candidates as a markdown report with…

    101 GitHub stars~3k tokensUpdated 2 days ago
    DevelopmentAuto-check passed
  • Refactor Design Report

    penwyp/ClaudePreference

    Produce a professional, code-grounded refactor or implementation design report from identified technical problems, product gaps, review findings, architecture concerns, or frontend-backend contract…

    136 GitHub stars~1.4k tokensUpdated 4 mo ago
    Product & Project ManagementAuto-check passed
  • Fix

    genkovich/sdd

    A skill your agent uses to fix a reported bug spec-first: reproduce it, trace the symptom to the owning feature's acceptance criteria, pin it with a failing (RED) test, apply the minimal GREEN fix…

    171 GitHub stars~2.5k tokensUpdated 1 mo ago
    DevelopmentAuto-check passed
  • Goosetown Researcher Beads

    aaif-goose/goosetown

    Search the local beads (bd) issue tracker for issues, dependencies, epics, blockers, and project status.

    155 GitHub stars~4.2k tokensUpdated 3 mo ago
    DevelopmentAuto-check passed

More from iusztinpaul/squid

All 13 skills in this repo
  • Squid Implement Night

    iusztinpaul/squid

    Run the full agent-team pipeline end-to-end for one feature whose Tasks Plan is already approved by /squid-plan, handing the human a validated, ready-to-squash-merge PR.

    203 GitHub stars~1.2k tokensUpdated 1 mo ago
    Auto-check passed
  • Squid Implement Task

    iusztinpaul/squid

    Implement one task — or a whole list / an approved Tasks Plan — via the inner SWE↔Tester loop, committing each task on PASS.

    203 GitHub stars~1.3k tokensUpdated 1 mo ago
    Auto-check passed
  • Squid Review

    iusztinpaul/squid

    Push the committed feature branch, create or update its PR, then run Product Architect acceptance and PR-Reviewer on it.

    203 GitHub stars~873 tokensUpdated 1 mo ago
    Auto-check passed
  • Squid Review CI

    iusztinpaul/squid

    Drive CI green on a pushed, review-clean feature PR — On-Call diagnoses failures and hands fix tasks to the SWE.

    203 GitHub stars~607 tokensUpdated 1 mo ago
    Auto-check passed
  • Squid Testing Python

    iusztinpaul/squid

    Write and evaluate effective Python tests using pytest. An agent skill from iusztinpaul/squid.

    203 GitHub stars~1.3k tokensUpdated 1 mo ago
    Auto-check passed
  • Squid Architecture Review

    iusztinpaul/squid

    Periodic architectural sweep — reads existing ADRs, maps modules/dependencies/layering, and reports up to 10 prioritised findings shaped as refactor proposals /squid-refactor can consume directly.

    203 GitHub stars~2.6k tokensUpdated 1 mo ago
    Auto-check passed

Questions about Squid Refactor

What does Squid Refactor do?

Plan a refactor as an ordered, commit-grain Tasks Plan with structural acceptance criteria (suite green at every step, no behaviour diff) that /squid-implement-night can execute end-to-end. Squid Refactor is an agent skill from iusztinpaul/squid. Plan a refactor as an ordered, commit-grain Tasks Plan with structural acceptance criteria (suite green at every step, no behaviour diff) that /squid-implement-night can execute end-to-end.

When should I use Squid Refactor?

Squid Refactor fits situations like: tasks that involve Refactoring; tasks that involve User stories.

How do I install Squid Refactor in Claude Code?

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

How do I install Squid Refactor in Codex?

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

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

What does Squid Refactor need to run?

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

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

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

About 2.4k tokens (SKILL.md is roughly 9.8k 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 Squid Refactor?

Skills that share tags, products or a category with Squid Refactor: Vibe Coding (OfficeDev/microsoft-365-agents-toolkit, 781 stars), Improve App (wondelai/skills, 2.4k stars), Improve Codebase Architecture (TwiTech-LAB/devchain, 101 stars) and Refactor Design Report (penwyp/ClaudePreference, 136 stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.

Who maintains Squid Refactor?

iusztinpaul (a GitHub user) maintains it in iusztinpaul/squid, which has 203 GitHub stars. The repository holds 13 skills in this directory. The repository was last updated on September 3, 2026.

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