refactor

Automates linting, duplication, and dead-code fixes for Java and Python projects.

8|1|Updated Apr 9, 2026
One-click install
npx skills add https://github.com/peth-eth/refactor --skill refactor-peth-eth
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: refactor
Source: https://github.com/peth-eth/refactor/tree/main
Command: npx skills add https://github.com/peth-eth/refactor --skill refactor-peth-eth

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This Skill automates comprehensive codebase maintenance and technical-debt remediation by locating and removing dead weight, running duplication and linting scans, fixing safe issues, and surfacing items that require human judgment across JS/TS and Python projects.

Core Features & Use Cases

  • Automated scans and fixes: runs jscpd, knip/vulture, madge, ESLint/Biome, or ruff and applies safe auto-fixes where possible.
  • Dead code elimination and cleanup: identifies legacy code, stubs, AI-generated slop, noisy comments, and removes them in a separate commit to preserve history.
  • Structural analysis and modernization (full mode): detects oversized files, circular dependencies, React anti-patterns, duplicate types, and proposes extraction or consolidation plans while enforcing small, reviewable change batches.
  • Use case: ideal for periodic maintenance days, preparing a repository for upgrades, or reducing noise before major feature development.

Quick Start

Run the refactor skill in quick mode to scan and auto-fix linting, duplication, and dead-code issues in the repository.

Frequently Asked Questions about refactor

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I automate dead code removal and refactoring in a TypeScript project?

Automated dead code removal and refactoring in TypeScript projects is handled by scanning for duplication, legacy code, and unused exports with tools like knip and jscpd. Safe auto-fixes are applied in separate commits to preserve history, while ambiguous changes are flagged for human review.

Can I use static analysis to detect circular dependencies and oversized files in JavaScript?

Static analysis for circular dependencies and oversized files in JavaScript is supported through madge and structural scans. The full maintenance workflow detects these issues alongside React anti-patterns and duplicate types, proposing extraction or consolidation plans while enforcing small, reviewable change batches.

Does this automated refactoring approach work with both Python and JavaScript codebases?

Automated refactoring works with both Python and JavaScript/TypeScript codebases by running language-specific linters and analyzers like ruff for Python and ESLint or Biome for JavaScript. It applies safe auto-fixes and enforces typechecks across both environments during maintenance scans.

What's the best way to run a quick codebase cleanup before a major feature release?

The best way to run a quick codebase cleanup before a major release is using quick mode, which scans and auto-fixes linting, duplication, and dead-code issues rapidly. This reduces noise and technical debt without the extensive structural analysis of a full maintenance-day workflow.

How do I handle AI-generated code slop and noisy comments during code maintenance?

Handling AI-generated code slop and noisy comments during code maintenance is achieved by identifying legacy stubs and redundant comments during automated scans. These elements are removed in a separate commit to preserve history and keep the main branch clean.

When should I avoid using automated linter fixes for technical debt remediation?

You should avoid relying solely on automated linter fixes when changes require human judgment, such as complex structural modernization or resolving circular dependencies. The workflow explicitly flags these ambiguous changes for manual review rather than applying auto-fixes blindly.