
Find Duplicated Code
Checks a change for reinvented utilities and duplicated functionality in the codebase.
Install
npx skills add google-gemini/gemini-cli --skill review-duplication -g -a claude-code -y- Repository
- google-gemini/gemini-cli109k
- Category
- Engineering
- Updated
- 4d ago
- License
- Apache-2.0
- Context cost
- Lightabout 1,360 tokens
- Runs scripts
- No, instructions only
What it does
Use this skill during code reviews to proactively investigate the codebase for duplicated functionality, reinvented wheels, or failure to reuse existing project best practices and shared utilities.
Review Duplication
Overview
This skill provides a structured workflow for investigating a codebase during a code review to identify duplicated logic, reinvented utilities, and missed opportunities to reuse established patterns. By executing this workflow, you ensure that new code integrates seamlessly with the existing project architecture.
Workflow: Investigating for Duplication
When reviewing code, perform the following steps before finalizing your review:
1. Extract Core Logic
Analyze the new code to identify the core algorithms, utility functions, generic data structures, or UI components being introduced. Look beyond the specific business logic to see the underlying mechanics.
2. Hypothesize Existing Locations & Trace Dependencies
Think about where this type of code would live if it already existed in the project. Provide absolute paths from the repo root to disambiguate.
- Utilities:
packages/core/src/utils/,packages/cli/src/utils/ - UI Components:
packages/cli/src/ui/components/,packages/cli/src/ui/ - Services:
packages/core/src/services/,packages/cli/src/services/ - Configuration:
packages/core/src/config/,packages/cli/src/config/ - Core Logic: Call out
packages/core/if functionality does not appear React UI specific.
Trace Third-Party Dependencies: If the PR introduces a new import for a utility library (e.g., lodash.merge, date-fns), trace how and where the project currently uses that library. There is likely an existing wrapper or shared utility.
Check Package Files: Before flagging a custom implementation of a complex algorithm, check package.json to see if a standard library (like lodash or uuid) is already installed that provides this functionality.
