dry-refactor

Detect and consolidate duplicated Python logic across modules.

Updated Feb 14, 2026
One-click install
npx skills add https://github.com/Suniljit/personal-toolkit --skill dry-refactor-suniljit
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: dry-refactor
Source: https://github.com/Suniljit/personal-toolkit/tree/main/.opencode/skills/dry-refactor
Command: npx skills add https://github.com/Suniljit/personal-toolkit --skill dry-refactor-suniljit

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Scans Python codebases to identify duplication and reuse opportunities, then presents approved changes to reduce code and complexity. It focuses on concrete, verifiable reductions rather than cosmetic rearrangements.

Core Features & Use Cases

  • Identify duplicated or near-duplicate logic across modules.
  • Propose refactors to create shared helpers, parameterized functions, or base classes.
  • Present findings for user approval and apply approved changes to reduce total code and complexity.
  • Use Case: In a codebase with several similar data processing utilities, consolidate into a single helper and update call sites.

Quick Start

Analyze the Python project directory to locate duplicated logic, review proposed refactors, and approve changes to reduce code size.

Frequently Asked Questions about dry-refactor

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

FAQPage Schema
How do I reduce Python code duplication across multiple modules?

You can reduce Python code duplication by scanning your project directory to surface near-duplicate functions and boilerplate, then applying approved refactors that consolidate repeated logic into shared helpers or parameterized functions.

What is the best way to find code smells and duplicated logic in a Python codebase?

Finding code smells and duplicated logic involves automated detection across your Python codebase to surface repeated blocks, which are then presented for user-approved changes to reduce overall complexity and total code size.

How do I safely refactor Python functions into shared helpers?

Safely refactoring Python functions involves proposing targeted abstractions like base classes or parameterized functions, presenting these changes for your approval, and tracking lines saved during application within your development workflow.

Can I review and approve refactor changes before they are applied to my Python project?

Yes, you can review proposed refactors before they are applied, ensuring that only user-approved changes are executed to consolidate duplicated logic and reduce code complexity safely.

Does Python refactoring work for near-duplicate functions or only exact matches?

Python refactoring targets both exact matches and near-duplicate functions, identifying similar data processing utilities across modules to propose consolidation into a single helper and update call sites.