review-duplication
Skill1 starsChanged 59 days agoMITView on GitHub
Investigate a change for duplicated logic, reinvented utilities, and missed reuse of the project's existing helpers, patterns and installed libraries, then report what should have been reused and how. Use when you say "check this PR for duplication", "did we already have a function for this", "is this reinventing something", "why is there a second date formatter", or "review this for reuse before I approve it". Not for a full multi-pillar review pass, use `code-reviewer`.
2 other projects use a version of this.
Adopted by
Most recently taken up by
- delorenj/skillstheir own version, first seen Oct 2, 2026
- google-gemini/gemini-clitheir own version, first seen May 18, 2026
Other versions2 projects use a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 2
- google-gemini/gemini-cli★ 107ksame name
- delorenj/skills★ 15same name
How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.
In this repository59 other files it gives its agents.
- AGENTS.mdAGENTS.md
- .claude/CLAUDE.mdCLAUDE.md
- agentic-engineeringSkill
- ai-regression-testingSkill
- angularSkill
- ansibleSkill
- api-designSkill
- architecture-decision-recordsSkill
- ascend-memorySkill
- ascend-web-hunterSkill
- audio-scribeSkill
- automation-inventorySkill
- backend-patternsSkill
- bashSkill
- build-dependency-managementSkill
- code-formatterSkill
- code-reviewerSkill
- coding-standardsSkill
- dart-flutter-patternsSkill
- database-migrationsSkill
- deployment-patternsSkill
- design-systemSkill
- docker-patternsSkill
- e2e-runbooksSkill
- e2e-testingSkill
- embedded-c-arduinoSkill
- frontend-designSkill
- g-code-3d-printingSkill
- github-opsSkill
- git-workflowSkill
- golang-patternsSkill
- hexagonal-architectureSkill
- home-assistantSkill
- java-coding-standardsSkill
- jetbrains-ide-opsSkill
- jira-integrationSkill
- keycloak-patternsSkill
- kicadSkill
- markdown-writerSkill
- mongodb-patternsSkill
- nextjs-app-router-patternsSkill
- node-backend-patternsSkill
- observability-and-loggingSkill
- obsidianSkill
- performance-optimizationSkill
- postgres-patternsSkill
- powershellSkill
- project-trackingSkill
- python-patternsSkill
- pytorch-patternsSkill
- react-patternsSkill
- researchSkill
- security-reviewSkill
- seoSkill
- soap-webservicesSkill
- springboot-patternsSkill
- tdd-workflowSkill
- unitySkill
- web-accessibilitySkill
The file
We split this skill into the rules it gives an agent
4 rules. About 0 are common, 4 are distinctive, and 0 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈4
Distinctive · estimate
This author's own choices. Worth a look.
0
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 38
Look past the business wrapper to the mechanics underneath: the algorithm, the utility function, the generic data structure, the reusable …
- Distinctive: line 58
Read the project's own layout first, then map each category onto it.
- Distinctive: line 94
Keep a fast path for unambiguous single-fact checks.
- Distinctive: line 109
When the change introduces a genuinely new pattern, say so explicitly and compare it against the documented standard, rather than letting a …
≈ “Common” is an estimate: at least 1 in 5 of the 213,897 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Review Duplication
Investigate a codebase during review to find logic the project already has, utilities that were reinvented, and
established patterns the change walked past. The conventions you check reuse against, and the DRY principle behind this
skill, live in the coding-standards hub.
When to activate
- Reviewing a change that introduces a helper, formatter, validator, client wrapper, or generic component.
- A new third-party dependency or a new import of an existing one appears in the diff.
- The user asks whether something already exists in the project, or why two similar things now exist.
- A reviewer's instinct says "we have this somewhere", and the location needs to be found before the review is finalised.
When not to activate
- The full review pass across correctness, security, performance and tests. Use
code-reviewerand invoke this skill as its reuse step. - Mapping an unfamiliar codebase for its own sake rather than for one change. Use the
code-archaeologistagent directly. - Deciding whether a new dependency is admissible and where its version is pinned. Use
build-dependency-management. - Restructuring the duplicated code once it is found. Use the language skill that owns it, such as
python-patterns,golang-patterns, orjava-coding-standards.
Step 1: extract the core logic
Look past the business wrapper to the mechanics underneath: the algorithm, the utility function, the generic data structure, the reusable component. Reuse is found by shape, not by feature name.
Fail: the search is framed around the feature and finds nothing.
Searching for "checkout retry banner".Pass: the search is framed around the mechanic, which the project may already implement elsewhere.
The new code debounces input and formats a relative timestamp. Searching for existing debounce helpers and relative-time formatting.Step 2: hypothesise where it would already live
Name concrete candidate locations from the repo root before searching, so the search is directed rather than exhaustive. Read the project's own layout first, then map each category onto it. In a layered service the categories usually land like this:
| Category | Typical home |
| Shared utilities | a utils, common, or shared module under the source root |
| UI components | the component directory of the front-end module |
| Domain services | the service or use-case layer of the application module |
| Configuration | the config module, plus environment schema files |
| Cross-cutting logic | the core or domain module, when the behaviour is not presentation specific |
Trace third-party dependencies too. When the diff introduces an import of a utility library, find how the project
already uses that library, because a wrapper or a shared helper usually exists. Before flagging a hand-written
implementation of a standard algorithm, check the manifest (package.json, pyproject.toml, build.gradle.kts,
go.mod) for a library already installed that provides it.
Step 3: delegate the investigation
Delegate deep searching to subagents so the review session stays readable and the search stays thorough. Give each one a specific objective built from the mechanics found in step 1, not a vague "look for duplication".
code-archaeologistis the primary researcher for structural questions. Ask it about the underlying APIs in use ("does any existing code callIntl.DateTimeFormator a date library for the same purpose?"), naming patterns ("are there existing symbols matching*Format*or*Debounce*?"), where the behaviour is centralised today, and, crucially, how the new code could be refactored onto whatever it finds.- A fast read-only search subagent is the fan-out for locating candidates across many directories and naming
conventions when you do not yet know where to look. It reads excerpts and returns locations, so use it to narrow the
field before a deeper pass. The built-in one is
Exploreon Claude Code,exploreon OpenCode, Kilo Code and the GitHub Copilot CLI, andexploreron Codex. - A general subagent handles turn-intensive semantic comparison, for example: "compare the new
OrderSummaryCardagainst every component in the shared component module and report which one could be extended instead". The built-in one isgeneral-purposeon Claude Code and the GitHub Copilot CLI,generalon OpenCode and Kilo Code, anddefaulton Codex.
Keep a fast path for unambiguous single-fact checks. Grepping the manifest for one package name is faster done directly than delegated. Anything open-ended goes to a subagent.
Step 4: evaluate against project conventions
Duplication is not only copied functions. A change that bypasses an established pattern duplicates the decision behind it.
- Error handling: does it use the project's error types and logging entry point, or invent its own?
- State management: does it bypass an established store, context, or repository?
- Styling: does it hardcode colours and spacing instead of using the project's tokens?
- Configuration: does it read an environment variable directly where the project has a config object?
When the change introduces a genuinely new pattern, say so explicitly and compare it against the documented standard, rather than letting a second way of doing the same thing land silently.
Step 5: report what should have been reused
A useful finding names the replacement and shows the call. A useless one names the problem and leaves the work to the author.
Fail: unactionable.
This looks like it duplicates something we already have.Pass: names the source, shows the integration, and states the benefit.
This adds a new `formatDate` helper. The project already has a tested one in `src/utils/date-helpers.ts`.
Replace the new function with:
import { formatDate } from '../utils/date-helpers'
const displayDate = formatDate(userDate, 'MMM d, yyyy')
Reusing it keeps formatting consistent across the app and inherits the timezone handling the shared helper already covers.Cite the path and the exact symbol, project-relative, on every finding, and explain the value in one clause: consistency, maintenance, or edge cases the existing code already handles.
Related skills
code-revieweris the parent review workflow. This skill is its reuse step and findings feed back into that report.coding-standardsholds the DRY principle and the conventions reuse is judged against.build-dependency-managementowns whether a newly imported library should be there at all.hexagonal-architecturehelps when the duplication is a boundary problem rather than a copied function.
Checklist
- The underlying mechanic was named, not just the feature.
- Candidate locations were hypothesised from the project's real layout before searching.
- Any newly imported library was traced to its existing usage and wrapper.
- The manifest was checked for an installed library that already solves the problem.
- Open-ended searching was delegated to
code-archaeologist, a read-only search subagent, or a general subagent. - Convention bypasses were checked, not only copied code.
- Every finding names the reusable symbol, its path, and how to call it.
- Findings were folded back into the
code-reviewerreport.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

