Automated Refactoring with PMAT

Official

Automate refactoring decisions with PMAT.

Authorpaiml
Version1.0.0
Installs0

System Documentation

What problem does it solve?

This Skill provides automated refactoring recommendations and patterns to reduce complexity and improve maintainability using PMAT.

Core Features & Use Cases

  • Baseline Analysis: Gather current complexity, quality, and dead code metrics.
  • Target Identification: Prioritize refactoring targets based on cyclomatic complexity (>10), cognitive complexity (>15), maintainability (<50), duplication, and dead code.
  • Pattern Library: Apply common refactoring patterns (Extract Method, Simplify Conditionals, Remove Dead Code, Extract Class/Module, Reduce Duplication).
  • Impact Verification: Re-measure metrics to confirm improvements.

Quick Start

  1. Baseline complexity and quality: pmat analyze complexity --path <target> --output baseline_complexity.json
  2. Detect dead code: pmat analyze dead-code --path <target> --output dead_code.json
  3. Apply refactor patterns (one pattern at a time) and verify:
    • pmat analyze complexity --path <refactored_files> --output after_complexity.json
    • pmat compare --baseline baseline_complexity.json --current after_complexity.json
    • pmat analyze quality --path <refactored_files> --output after_quality.json

Dependency Matrix

Required Modules

None required

Components

Standard package

💻 Claude Code Installation

Recommended: Let Claude install automatically. Simply copy and paste the text below to Claude Code.

Please help me install this Skill:
Name: Automated Refactoring with PMAT
Download link: https://github.com/paiml/paiml-mcp-agent-toolkit/archive/main.zip#automated-refactoring-with-pmat

Please download this .zip file, extract it, and install it in the .claude/skills/ directory.
View Source Repository