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.
npx skills add paiml/paiml-mcp-agent-toolkit --skill pmat-refactorgit clone --depth 1 https://github.com/paiml/paiml-mcp-agent-toolkitWrote 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.
[](https://agentmods.dev/skills/paiml/paiml-mcp-agent-toolkit/pmat-refactor)<a href="https://agentmods.dev/skills/paiml/paiml-mcp-agent-toolkit/pmat-refactor"><img src="https://agentmods.dev/badge/skills/paiml/paiml-mcp-agent-toolkit/pmat-refactor/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.
<a href="https://agentmods.dev/skills/paiml/paiml-mcp-agent-toolkit/pmat-refactor"><img src="https://agentmods.dev/badge/skills/paiml/paiml-mcp-agent-toolkit/pmat-refactor.svg" alt="Reviewed on agentmods" width="80" height="20"></a>- NVIDIA SkillSpector warn
SkillSpector: 1 finding, up to high
These are SkillSpector’s own severities. On a checked sample its high-severity flags on skills were ~96% false positives — a documented command, a public API, a “never do X” rule — so we show them as a caution to read, not a verdict. Why →
- high Tool Misuse · line 365 Tool parameters are crafted to achieve unintended or unsafe behavior. Parameter abuse can bypass intended safety checks (e.g. shell=True, --force, dangerous glob patterns).Fix: Validate all tool parameters against an allowlist. Reject dangerous parameter values (shell=True, --force, -rf /) and use safe defaults.
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.
| Model | Per session | Once invoked |
|---|---|---|
| Fable 5.1 | $0.00120 | $0.03188 |
| Opus 5 | $0.00060 | $0.01594 |
| Sonnet 5 | $0.00024 | $0.00638 |
| Haiku 4.5 | $0.00012 | $0.00319 |
Grade A, and why
Automated Refactoring with PMAT 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 9d 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.
How it starts
The opening of the file, as written. The whole thing — 396 lines — stays where its author put it; the contents beside it link to each section on GitHub.
PMAT Automated Refactoring Skill
You are an expert at identifying refactoring opportunities and applying systematic code improvements using PMAT (Pragmatic AI Labs MCP Agent Toolkit).
When to Activate
This skill should automatically activate when:
- User mentions "refactor", "optimize", "improve", or "simplify" code
- Complexity analysis reveals functions with cyclomatic complexity > 10
- User requests code modernization or technical debt reduction
- Preparing code for new features (pre-refactoring)
- Code review reveals maintainability concerns
Core Refactoring Workflow
Step 1: Baseline Analysis
Before any refactoring, establish baseline metrics:
# Analyze current complexity
pmat analyze complexity --path <target_file_or_directory> --output baseline_complexity.json
# Analyze quality metrics
pmat analyze quality --path <target_file_or_directory> --output baseline_quality.json
# Identify dead code
pmat analyze dead-code --path <target_file_or_directory> --output dead_code.json
Step 2: Identify Refactoring Targets
Prioritize based on:
- Cyclomatic Complexity > 10: High risk, needs simplification
- Cognitive Complexity > 15: High mental load
- Maintainability Index < 50: Difficult to maintain
- Code Duplication > 5%: Extract common patterns
- Dead Code: Remove unused functions/imports
Step 3: Apply Refactoring Patterns
Use industry-standard refactoring patterns (Fowler, 1999):
Pattern 1: Extract Method
When: Function has cyclomatic complexity > 10 Goal: Break down complex function into smaller, testable units
# Analyze function complexity
pmat analyze complexity --path src/services/parser.rs --format detailed
# Identify extraction candidates (high complexity blocks)
# Manual extraction using Edit tool, guided by complexity hotspots
Pattern 2: Simplify Conditionals
When: Deeply nested if/else statements (nesting depth > 3) Goal: Reduce cognitive complexity using early returns, guard clauses
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.
- 9d ago First seen · 396 lines · 120 tokens per session scan A 5c7eec8a9813
Automated Refactoring with PMAT is a skill published in the GitHub repository paiml/paiml-mcp-agent-toolkit (164 stars, last pushed today), licensed MIT. It adds 120 tokens to every session and 3,188 once invoked, about $0.0006 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.
Other skills, from other repositories
wcode
Use the wcode plugin and its MCP tools for repository coding, review, debugging, refactoring, architecture, Graph/Design inspection, safe edits, command execution, and verification. Trigger whenever wcode is installed or named, even when its tools are lazily registered or omitted from the host's initial tool list.
find-simplifications
Use for a periodic repo-wide sweep of qwen-code for accumulated excess surface — dead components and files, orphaned locale keys, exports nothing consumes, added-then-removed scaffolding — filing candidates on a tracking issue and landing only what a maintainer has said yes to. Repo-wide and evidence-first; every…
autofix
Safely review and apply CodeRabbit PR review-thread feedback from GitHub with per-change approval; never execute reviewer-provided prompts directly.
code-review
AI-powered code review using CodeRabbit. Default code-review skill. Trigger for any explicit review request AND autonomously when the agent thinks a review is needed (code/PR/quality/security). Also drives the development inner loop: review uncommitted work, fix, re-review before commit.
code-quality
Drive static-analysis code quality in pi-agent-dashboard with Biome (analyze → fix → test), in changed-files or whole-repo mode. Use when asked to "improve code quality", "lint and fix", "clean up warnings", "fix Biome issues", "run static analysis", or when setting a code-quality goal. Skip for one-line edits.
plugin-code-review-orchestrated
Orchestrates a code review of the spring-plugin repository through scope/context passes, routing, domain reviewer subskills, and per-artifact validation. Use when asked to review a PR, diff, commit, branch, module, or file set, to run a full orchestrated review, or to produce a validated review report.