/armory:refactor:refactorfrom armory
Refactors recently modified source files — analyzes complexity, detects duplication, simplifies nesting, extracts helpers, and verifies behavior preservation.
Ships in armory. Installing the plugin adds it to Claude Code.
When the user invokes /refactor [path], execute this workflow exactly.
git diff --name-only HEAD~3 to find recently modified files.
Fall back to git diff --name-only main if fewer than 3 commits on the branch.## Files to clean
| # | File | Lines changed | Last modified |
| --- | ------------- | ------------- | ------------- |
| 1 | src/parser.py | +42 / -18 | 2 commits ago |
For each target file:
Report:
### {filename} — Complexity
| Function | Cyclomatic | Max depth | Lines | Params | Action needed |
| ---------- | ---------- | --------- | ----- | ------ | ------------- |
| parse() | 14 | 5 | 62 | 3 | yes |
| validate() | 6 | 2 | 18 | 2 | no |
Report each duplicate group with file locations and line ranges.
Apply these transformations where applicable:
if condition: <long block> else: <short return> to early
return pattern.not (a and b) to not a or not b when it
improves readability.if/elif/elif/else chains (>= 4 branches) with dictionary
dispatch or match/case.if x: return True else: return False with
return x (or return bool(x)).if x is not None: y = x else: y = default with
y = x if x is not None else default or language-specific null coalescing.For each transformation:
Extract a helper function only when ALL of these conditions hold:
do_stuff, process_data, handle_thing).Do NOT extract when:
For each proposed extraction, state which conditions are met and justify.
## Refactor Clean Summary
**Scope:** `{path_or_git_diff_range}`
**Files analyzed:** {count}
**Files modified:** {count}
### Changes applied
| File | Transformation | Lines before | Lines after | Complexity delta |
| --------- | -------------------------- | ------------ | ----------- | ---------------- |
| parser.py | Guard clauses (3x) | 62 | 48 | -4 |
| parser.py | Extract validate_header() | — | +12 | -3 |
| utils.py | Deduplicate error handling | 28 | 16 | -2 |
### Skipped (justified)
| File | Candidate | Reason skipped |
| ------ | ------------------ | --------------------------------- |
| api.py | Extract auth block | Single use, 8 lines, name unclear |
### Test verification
- Tests run: {count}
- Tests passed: {count}
- Characterization tests added: {count}
### Net impact
- Total lines: {before} -> {after} ({delta})
- Avg cyclomatic complexity: {before} -> {after}
- Functions simplified: {count}
- Helpers extracted: {count}
What the command file sets; muted values are Claude Code's defaults
7-day visitors to each command page
13 commands in this plugin
/decision-map:decision-mapdecision-mapSlash-command wrapper for the decision-map skill. `/decision-map chart` plus a loose idea opens a decision map for an effort too big for one session; `/decision-map work` plus an optional map reference claims and resolves exactly one frontier ticket, then stops. Triggers on: "/decision-map", "decision-map chart", "decision-map work", "chart this effort as a map", "work the next decision ticket", "what is on the frontier", "wayfinder". Use this command when a user wants a two-mode argument surface over a tracker-backed decision map, delegating map format, ticket typing, claim arbitration, and tracker operations to skills/decision-map./evolve:CHANGELOGChangelog — evolve- Report actual package-evaluator report-v2 conformance, separate authored findings and live effectiveness NOT_MEASURED instead of nonexistent quality scores./evolve:evolveevolveCo-evolutionary skill generation command. Given a task domain or research paper, generates a complete skill package through automated generate-verify-refine loops. Wraps the test-engineer agent for one-shot skill creation. Supports paper-to-skill conversion via arXiv URLs and optional Haiku distillation. Triggers on: "/evolve", "evolve a skill", "generate skill from paper", "auto-generate skill", "create skill via evolution", "evo-skill command". Use this command for streamlined skill creation rather than invoking the full test-engineer agent workflow manually. NOT for running application tests (use /tdd). NOT for security scanning (use /security-scan).
/handoff:handoffhandoffSlash-command wrapper for the handoff skill. `/handoff` refreshes `.docs/handoff.md`; `/handoff init` scaffolds the schema in greenfield projects; both preserve the 200-line cap and authority boundary. Triggers on: "/handoff", "/handoff init", "update handoff", "refresh handoff", "session handoff", "create handoff", "resume checklist". Use this command when pausing, ending, transferring, or resuming in-flight coding work across agent sessions./librarian:librarianlibrarianSlash-command wrapper for the skill-librarian agent. `/librarian capture` records one reusable, privacy-safe observation from a completed task; `/librarian status` reports queue metadata without reading evidence bodies; `/librarian review` selects a bounded batch for human-gated disposition. Triggers on: "/librarian capture", "/librarian review", "/librarian status", "record this skill lesson", "review skill observations", "show librarian backlog". Use this command for explicit reflective capture and review, not automatic transcript monitoring or direct package refinement./pr-swarm:pr-swarmpr-swarmSlash-command wrapper for the pr-swarm skill. `/pr-swarm #123 #456` (or bare numbers, space- or comma-separated) drives that many already-open pull requests to merge-ready at the same time, each in its own isolated git worktree and its own headless Claude Code session. Triggers on: "/pr-swarm", "pr-swarm #123 #456", "parallelize these PRs", "drive PR #123 and #456 to green in parallel", "own-PR-to-green fleet", "isolated worktree loops for my PRs". Use this command when a user wants a concise argument surface for parallelizing two or more of their own open pull requests while delegating independence checks, worktree naming, launch mechanics, and verification gates to skills/pr-swarm.npx claudepluginhub mathews-tom/armory --plugin armoryOther plugins' commands for the same job