kanso-refactor

Remove dead code and redundant comments while preserving behavior.

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

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This skill addresses the accumulation of technical debt, redundant code, and clutter that obscures intent and makes codebases difficult to maintain.

Core Features & Use Cases

  • Behaviour-Preserving Cleanup: Automatically removes dead code, tautological comments, and filler variables without altering program logic.
  • Safety-First Refactoring: Integrates verification steps to ensure that refactored code remains functionally identical to the original.
  • Use Case: Use this skill to clean up a legacy module by inlining unnecessary variables, removing unreachable branches, and collapsing defensive code blocks while ensuring all existing tests still pass.

Quick Start

Invoke the refactor skill to clean up the current file while ensuring all existing behavior remains unchanged.

Frequently Asked Questions about kanso-refactor

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

FAQPage Schema
How do I safely refactor code to eliminate technical debt without altering program logic?

Behaviour-preserving refactoring eliminates technical debt by removing dead code, redundant comments, and unnecessary abstractions while integrating verification commands to guarantee functional equivalence. This ensures the codebase stays maintainable without altering program logic.

What is the best way to clean up dead code and unnecessary abstractions in a legacy module?

Cleaning up a legacy module involves inlining unnecessary variables, removing unreachable branches, and collapsing defensive code blocks. This de-slopping process targets specific file paths or diff scopes to tighten code and improve readability safely.

How do I ensure refactored code remains functionally identical to the original?

To ensure refactored code is functionally identical, integrate project-specific verification commands like test suites after modifications. This safety-first refactoring approach validates that behavior is preserved when dead code and filler variables are removed.

Can I target code cleanup to specific file paths or diff scopes instead of the whole project?

Yes, code cleanup can target specific file paths or diff scopes rather than the whole project. This allows you to surgically remove tautological comments and unreachable branches within defined boundaries while leaving untouched areas completely isolated.

Do I need existing tests to pass before and after automated code cleanup?

Yes, existing tests must pass before and after automated code cleanup to verify behavior is preserved. The refactoring process requires integration with project-specific verification commands to guarantee functional equivalence after dead code removal.