From armory
Simplifies and refactors complex Python, Go, TypeScript, Rust code preserving behavior. Targets anti-patterns, nesting, readability debt via multi-pass analysis with git and complexity metrics.
npx claudepluginhub mathews-tom/armory --plugin armoryThis skill uses the workspace's default tool permissions.
A structured, multi-pass code refinement skill that transforms complex, verbose, or tangled code
Implements Playwright E2E testing patterns: Page Object Model, test organization, configuration, reporters, artifacts, and CI/CD integration for stable suites.
Guides Next.js 16+ Turbopack for faster dev via incremental bundling, FS caching, and HMR; covers webpack comparison, bundle analysis, and production builds.
Discovers and evaluates Laravel packages via LaraPlugins.io MCP. Searches by keyword/feature, filters by health score, Laravel/PHP compatibility; fetches details, metrics, and version history.
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.
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:
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.
git diff) when the user doesn't specify target filesscripts/complexity_report.py for quantitative complexity metricsFollow 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).
Before touching anything, build a mental model:
git diff --name-only HEAD~5 or git diff --staged --name-onlyreferences/ if needed for idiom-specific guidanceIdentify what's actually wrong before reaching for solutions. Categorize issues by severity:
Critical (always fix):
High (fix unless there's a clear reason not to):
Medium (fix when it improves clarity without adding risk):
Low (fix only in a dedicated cleanup pass):
Apply changes using these tactics, ordered by impact-to-risk ratio:
Remove before restructuring. Less code = less to think about.
Reduce nesting and cognitive load:
if nesting to early returnsis_valid_order = ...)else branch is the "happy path", flip itMake the code's intent visible:
data → user_records, process → validate_and_enqueueApply language-specific patterns (consult references/<language>.md for details):
? operator, From/Into, newtype patternTypes are documentation that the compiler checks:
any/interface{} to specific types where possibleNever skip this phase. Simplification that breaks behavior is not simplification.
If tests fail or behavior diverges: revert the specific change, don't try to fix the test.
Present changes as a structured summary. This is important — the developer needs to understand and trust what changed before committing.
For each file modified, provide:
## <filename>
### Changes
- [Critical] Removed unreachable error branch in `parse_config` (dead code after L42 guard)
- [High] Extracted `validate_credentials()` from 60-line `handle_login()` (was 3 responsibilities)
- [Medium] Renamed `d` → `document`, `proc` → `process_batch`
### Complexity Delta
- `handle_login`: 4 levels nesting → 2, 8 branches → 5
- `parse_config`: removed 12 lines of dead code
### Risk Assessment
- Low risk: all changes are structural, no logic modifications
- Tests: 47/47 passing
Adjust verbosity to scope. Single-function cleanup gets a one-liner. Multi-file refactor gets the full report.
These are hard rules. Do not violate them regardless of how much cleaner the code would look:
The user may specify different modes. If they don't, default to standard.
| Mode | Scope | Severity Threshold | Test Requirement |
|---|---|---|---|
quick | Single file or function | Critical + High only | Tests recommended |
standard | Recent git changes | Critical + High + Medium | Tests required if they exist |
deep | Entire module/package | All severities | Tests mandatory |
surgical | User-specified lines/functions | All severities | Manual trace sufficient |
The user can specify mode by saying things like "just do a quick pass" or "deep clean this module".
Push back (politely) if:
For language-specific idiom guidance, read the appropriate reference file:
references/python.md — Python-specific patterns, anti-patterns, and stdlib alternativesreferences/go.md — Go idioms, error handling patterns, and interface designreferences/typescript.md — TypeScript/JavaScript patterns, type narrowing, and module designreferences/rust.md — Rust idioms, ownership patterns, and iterator usageOnly load the reference file for the language(s) in the current scope. These provide detailed pattern catalogs that supplement the general methodology above.
| Rationalization | Reality |
|---|---|
| "It's readable enough" | "Enough" is not a standard — if the next developer needs to re-read a function 3 times, it's not readable |
| "Refactoring risks regressions" | Not refactoring risks accumulating debt — run the test suite before and after, that's what tests are for |
| "This is how the codebase has always done it" | Consistency with a bad pattern is still bad — improve incrementally, don't preserve anti-patterns |
| "The performance might get worse" | Benchmark before and after — most readability refactors have zero performance impact; premature optimization is the root of all evil |
| "It's not broken, don't fix it" | Refining isn't fixing — it's making working code maintainable, testable, and understandable for the next person |
| "I'll refactor the whole module later" | Incremental refinement works; big-bang rewrites fail — improve what you touch now |
ruff check + mypy --strict or tsc --noEmit + eslint