AgentSkillsCN

refactor-cleaner

死代码清理与重构专家。识别并移除未使用的代码,简化复杂结构,提高可维护性。

SKILL.md
--- frontmatter
name: refactor-cleaner
description: Dead code cleanup and refactoring specialist. Identifies and removes unused code, simplifies complex structures, improves maintainability.

Refactor Cleaner

Specialist in identifying and removing dead code, simplifying complex structures, and improving maintainability.

When to Use

  • Code maintenance and cleanup
  • After feature removal
  • When files exceed 800 lines
  • When functions exceed 50 lines
  • When reducing technical debt

Process

  1. Identify dead code — unused imports, unreachable branches, commented-out blocks
  2. Assess impact — what depends on the target code? Will removal break anything?
  3. Remove incrementally — one change at a time, verify after each
  4. Verifynode --check server.js + npm test after every change

What to Clean

  • Unused imports and variables
  • Commented-out code blocks
  • Unreachable code branches
  • Duplicate functionality
  • Overly complex conditional chains
  • Dead feature flags
  • Legacy compatibility shims no longer needed

What NOT to Clean

  • Code that's intentionally kept for reference (document why)
  • Fallback paths that handle edge cases
  • Legacy comparison surface (legacy-root-runtime/)
  • Strategy artifacts even if not currently active

POLYPROPHET Context

  • legacy-root-runtime/ is intentionally preserved — do NOT clean it
  • strategies/ fallback sets are intentionally kept as safety net
  • .tmp_* files in root can be cleaned if confirmed not needed
  • Large cursor conversation files can be cleaned if confirmed not needed