refactor

A workflow for finding architectural friction and proposing structural refactors, such as splitting oversized modules or reducing duplicated code.

In plain words
What is it for?
Use it to review module boundaries, deep or oversized components, repeated logic, import relationships, and safe ways to reorganise a codebase.
Why use it?
It makes hard-to-maintain code easier to test and change while preserving existing behaviour through explicit interface choices and checks.

Skill for Claude CodeCodex

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.

agentmods
npx agentmods add skills/howells/arc/refactor
Any agent
npx skills add howells/arc --skill refactor
Clone the repo
git clone --depth 1 https://github.com/howells/arc

Made for: Claude Code, Codex.

Per session 97 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 5,057 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
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 $0.00097 $0.05057
Opus 5 $0.00048 $0.02528
Sonnet 5 $0.00019 $0.01011
Haiku 4.5 $0.00010 $0.00506

Measured 2d ago against content hash 3fead3d8221a, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

refactor 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 2d 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.

plugins/arc/skills/refactor/SKILL.md · 372 lines

How it starts

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

<tool_restrictions> EnterPlanMode and ExitPlanMode are banned. This skill is Arc's own structured process. </tool_restrictions>

<arc_runtime> Requires the full Arc bundle. Arc-owned paths (agents/, references/, disciplines/, templates/, scripts/, rules/, skills/) resolve from the plugin root — the directory containing agents/ and skills/. Everything else is the user's repository. </arc_runtime>

<required_reading> Before starting, read these references:

  1. references/architecture-patterns.md — import depth rules, boundary violations
  2. references/maintainability-review.md — strict god-file, duplication, and structural simplification bar
  3. references/complexity-optimization.md — safe optimization patterns and behavior-preservation checks

Also read, when present in the target project:

  • CONTEXT.md or the relevant context from CONTEXT-MAP.md
  • docs/adr/*.md or area-specific ADRs
  • the most recent docs/arc/audits/*-audit.md — prior classifications and dismissed findings

Load when relevant:

  • references/component-design.md — compound vs simple component patterns, when the candidate is a god-component and the split will produce a new component API.
  • references/index.md — the full reference catalogue, when the refactor needs background you can't name a file for. </required_reading>

Architectural Refactoring

Discover structural friction, propose deep-module refactors, and create project-local RFCs.

  • If the primary issue is reusable UI component cataloguing, missed shared UI package usage, or design-system component extraction, say so and stop: that work is out of scope for /arc:refactor and belongs with the project's own design-system tooling.
  • If the primary issue is an overgrown component, script, module, or duplicated implementation logic, keep it in /arc:refactor.
  • If the primary issue is broad codebase health, security, performance, or test coverage, recommend /arc:audit.
  • If the user wants implementation, stop at a clear plan unless they explicitly ask to start implementing.
  • Do not create external tracker issues unless the user explicitly asks.

Read the full file on GitHub · 372 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. 2d ago First seen · 372 lines · 97 tokens per session scan A 3fead3d8221a

Subscribe to this mod's changes

refactor is a skill published in the GitHub repository howells/arc (25 stars, last pushed 18d ago), licensed MIT. It adds 97 tokens to every session and 5,057 once invoked, about $0.0005 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-30.

Related

Other skills, from other repositories

n8n-agents

Design n8n AI agents the right way. Use when building or editing any @n8n/n8n-nodes-langchain. AI node — an AI Agent, LLM chain, Text Classifier, or Information Extractor — and whenever the user mentions AI agents, LLM with tools, tool calling, $fromAI, system prompts, agent memory, sessionId, structured/JSON output…

czlonkowski/n8n-mcp · 156 tokens

n8n-error-handling

Wire n8n error handling so failures are loud, structured, and recoverable. Use when building any webhook/API workflow, a scheduled or unattended workflow, or any path where a silent failure would drop user-visible work — and whenever the user mentions error handling, onError, continueErrorOutput, error…

czlonkowski/n8n-mcp · 128 tokens

n8n-subworkflows

Build reusable, composable n8n sub-workflows. Use when extracting shared logic, building anything multi-step or reused across workflows, or any workflow over 10 nodes — and whenever the user mentions sub-workflows, Execute Workflow, reuse, shared/common logic, modular workflows, "Define Below" inputs…

czlonkowski/n8n-mcp · 121 tokens

n8n-binary-and-data

Handle files and binary data in n8n correctly. Use when working with files, images, PDFs, attachments, uploads or downloads, base64, vision/multimodal input, or when an AI agent needs a file as tool input or output — and whenever the user mentions $binary, binaryPropertyName, "read the PDF", "attach the file", "send…

czlonkowski/n8n-mcp · 135 tokens

n8n-code-tool

Write JavaScript or Python for the n8n Custom Code Tool (@n8n/n8n-nodes-langchain.toolCode) — the AI-agent-callable tool, NOT the workflow Code node. Use when building a Code Tool attached to an AI Agent, writing code that an LLM will invoke, parsing the query input, returning a string result, defining an input schema…

czlonkowski/n8n-mcp · 221 tokens

n8n-multi-instance

Use when an n8n-mcp account targets more than one n8n instance — i.e. the n8ninstances tool is available, the user mentions multiple n8n instances or environments (prod vs staging, several teams or clients), a workflow / datatable / credential / execution call returns an unexpected NOTFOUND or reads data you don't…

czlonkowski/n8n-mcp · 181 tokens