code-refiner

code-refiner is a skill for Claude Code from Mathews-Tom/armory. It costs 69 tokens per session (2,743 once invoked), scanned A, original, MIT.

A guided refactoring review for Python, Go, TypeScript, or Rust code that makes complicated code easier to read while keeping its behavior unchanged.

In plain words
What is it for?
Use it to simplify tangled code, remove readability debt, identify complexity, and check that the refactoring preserves behavior.
Why use it?
It reduces nesting, complexity, and confusing patterns without changing what the program does.

Skill for Claude Code

Written for Claude Code: shipped in a Claude Code plugin. Also seen: mentions CLAUDE.md.

Part of the armory plugin — 89 skills shipped together

Good fit Use it to simplify tangled code, remove readability debt, identify complexity, and check that the refactoring preserves behavior.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/mathews-tom/armory/code-refiner
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.

Any agent
npx skills add Mathews-Tom/armory --skill code-refiner
Clone the repo
git clone --depth 1 https://github.com/Mathews-Tom/armory

Made for: Claude Code.

Or install armory, the plugin that ships this one along with the rest of its 89 skills.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for code-refiner

README.md
[![agentmods](https://agentmods.dev/badge/skills/mathews-tom/armory/code-refiner/github.svg)](https://agentmods.dev/skills/mathews-tom/armory/code-refiner)
Your own site
<a href="https://agentmods.dev/skills/mathews-tom/armory/code-refiner"><img src="https://agentmods.dev/badge/skills/mathews-tom/armory/code-refiner/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for code-refiner

Your own site · 80×15
<a href="https://agentmods.dev/skills/mathews-tom/armory/code-refiner"><img src="https://agentmods.dev/badge/skills/mathews-tom/armory/code-refiner.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 69 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 2,743 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe. Third-party audits
  • NVIDIA SkillSpector pass 7 Sept 2026
How audits are shown
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.1 $0.00069 $0.02743
Opus 5.5 $0.00028 $0.01097
Sonnet 5.5 $0.00014 $0.00549
Haiku 4.5 $0.00007 $0.00274

Measured 1mo ago against content hash 1c2970980194, method: parsed. Prices are Anthropic first-party input rates as of 2026-10-07, from the pricing page.

Security

Grade A, and why

code-refiner 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 1mo ago.

The scan reads SKILL.md. This mod also ships 1 executable file (scripts/complexity_report.py), listed below but not scanned — reading those needs a real analyzer, not pattern matching.

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.

skills/code-refiner/SKILL.md · 263 lines

How it starts

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

Code Refiner

A structured, multi-pass code refinement skill that transforms complex, verbose, or tangled code into clean, idiomatic, maintainable implementations — without changing what the code does.

Philosophy

The goal is not fewer lines. The goal is code that a tired engineer at 2am can read, understand, and safely modify. Every change must pass three tests:

  1. Behavioral equivalence — identical inputs produce identical outputs, side effects, and errors
  2. Cognitive load reduction — a reader unfamiliar with the code understands it faster after the change
  3. Maintenance leverage — the change makes future modifications easier, not harder

When clarity and brevity conflict, clarity wins. When idiom and explicitness conflict, consider the team's experience level. When DRY and locality conflict, prefer locality for code read more than modified.

Prerequisites

  • git — used in Phase 1 for scope detection (git diff) when the user doesn't specify target files
  • Python 3.10+ — required to run scripts/complexity_report.py for quantitative complexity metrics

Workflow

Follow this sequence. Each phase builds on the previous one. Do not skip phases, but adapt depth to the scope of the request (a single function gets a lighter pass than a full module).

Phase 1: Reconnaissance

Before touching anything, build a mental model:

  1. Identify scope — What files/functions are in play? If the user hasn't specified, check recent git modifications: git diff --name-only HEAD~5 or git diff --staged --name-only
  2. Detect language and ecosystem — Read file extensions, imports, config files (package.json, pyproject.toml, go.mod, Cargo.toml). Load the appropriate language reference from references/ if needed for idiom-specific guidance
  3. Read project conventions — Check for CLAUDE.md, .editorconfig, linter configs (eslint, ruff, golangci-lint, clippy). These override generic idiom preferences
  4. Understand test coverage — Locate test files. If tests exist, note the test runner so you can verify behavioral equivalence after changes
  5. Baseline complexity snapshot — For each target function/method, mentally note:
    • Nesting depth (max indentation levels)
    • Number of branches (if/else/match/switch arms)
    • Number of early returns vs single-exit
    • Parameter count
    • Lines of code
    • Number of responsibilities (does it do more than one thing?)

Read the full file on GitHub · 263 lines

Files

What ships with it

6 files beside SKILL.md in the same directory: the scripts, references and assets a skill reads on demand. Not counted in the per-session cost; read them before you install if any of them is executable.

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. 1mo ago First seen · 263 lines · 69 tokens per session scan A 1c2970980194

Subscribe to this mod's changes

code-refiner is a skill published in the GitHub repository Mathews-Tom/armory (332 stars, last pushed 2d ago), licensed MIT. It adds 69 tokens to every session and 2,743 once invoked, about $0.0003 per session on Opus 5.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

gh-pr-review

Review GitHub Pull Requests using the gh CLI. Use when a user asks to review a PR, perform code review, check a pull request, or provide feedback on proposed changes. Triggers on phrases like "review PR", "review pull request", "check PR", "code review".

tao12345666333/ankaloop · 62 tokens

code-review

Provides expert code review guidelines and best practices.

tao12345666333/ankaloop · 11 tokens

mx-flow

Full development workflow orchestrator: brainstorm → plan → worktree → convergent TDD/review loop → verify → PR. One human gate (spec approval); all other gates auto-proceed. Use when starting a feature or significant change from scratch. Usage: /mx-flow ; /mx-flow status [name]; /mx-flow finish .

maxence2997/mx-harness · 75 tokens

mx-pr

Draft a pull request from the feature spec and git log, then publish to GitHub or GitLab (Bitbucket experimental) — or hand off. Use when a feature branch is ready for PR, standalone or from mx-flow. Usage: /mx-pr [name].

maxence2997/mx-harness · 57 tokens

mx-team-review

Deep code review of a local git diff or files against this user's own engineering standards (Go, C#), written to a report file that /mx-review-triage consumes. Use before commit/merge when you want the standards-based review, not a quick diff scan. Usage: /mx-team-review [diff-spec] | --repo.

maxence2997/mx-harness · 75 tokens

mx-brainstorm

Turn a rough idea into an approved design spec: clarifying questions in one batch, 2-3 distinct approaches with trade-offs, spec (and ADR when a real choice was made) written to /.mx/ / /. Hard gate: no implementation until the user approves the spec. Use when starting any feature or non-trivial fix.

maxence2997/mx-harness · 76 tokens