code-deduplicator

Extract duplicated code patterns into shared utilities across JavaScript and TypeScript projects.

1|Updated Sep 12, 2025
One-click install
npx skills add https://github.com/JimmyTranDev/dotfiles --skill code-deduplicator
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: code-deduplicator
Source: https://github.com/JimmyTranDev/dotfiles/tree/main/src/opencode/skills/code-deduplicator
Command: npx skills add https://github.com/JimmyTranDev/dotfiles --skill code-deduplicator

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Duplicated code wastes time, increases maintenance cost, and introduces inconsistency. This Skill guides identifying repeated patterns and extracting them into reusable utilities, hooks, and components to keep code DRY and maintainable.

Core Features & Use Cases

  • Detect common duplication patterns across functions, classes, and UI patterns.
  • Provide a structured extraction process to create shared utilities, hooks, and components.
  • Use Case: you notice identical utility code across files; extract into a shared module and update imports accordingly.

Quick Start

Identify duplications across your codebase and extract them into shared utilities with clear naming.

Frequently Asked Questions about code-deduplicator

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

FAQPage Schema
How do I identify and extract duplicated code patterns in a JavaScript or TypeScript project?

To extract duplicated code patterns, identify recurring functions or UI components across your codebase and refactor them into shared utilities, hooks, or components. This enforces the DRY principle and keeps your codebase maintainable.

What is the best way to refactor repeated validation logic into shared utilities?

The best way to refactor repeated validation logic is to detect the common duplication patterns and apply a structured extraction process to create shared utilities with clear naming, ensuring tests verify correctness after updating imports.

Can I use this deduplication approach for React components and hooks?

Yes, you can apply this deduplication approach to React apps. It detects identical UI patterns and utility code across files, allowing you to extract them into reusable hooks and components while updating imports accordingly.

Do I need tests in place before refactoring shared utilities to enforce DRY?

Yes, you need tests to ensure correctness after refactoring. Extracting duplicated code into shared utilities requires vetted extraction boundaries, and tests verify that updating imports across your JavaScript or TypeScript files does not break existing behavior.

When should I avoid extracting duplicated code into shared modules?

You should avoid extracting duplicated code when clear naming and vetted extraction boundaries cannot be established. Forcing extraction without proper tests to ensure correctness may introduce inconsistency and increase maintenance cost rather than reducing it.