O

finding-duplicate-functions

by obra

Use the finding-duplicate-functions skill to identify semantic duplicates: functions that do the same job with different names or implementations. It is built for LLM-generated and fast-growing JavaScript or TypeScript codebases, and it supports finding-duplicate-functions for Code Review, consolidation planning, and cleanup before refactors.

Stars0
Favorites0
Comments0
AddedMay 9, 2026
CategoryCode Review
Install Command
npx skills add obra/superpowers-lab --skill finding-duplicate-functions
Curation Score

This skill scores 78/100, which means it is a solid listing candidate for directory users who need a repeatable workflow for finding semantic duplicate functions. The repository provides a clear use case, a multi-step process, and supporting scripts that reduce guesswork compared with a generic prompt, though it is still somewhat specialized and lacks an install command or broader operational docs.

78/100
Strengths
  • Clear trigger: explicitly for auditing codebases for semantic duplicate functions, especially in LLM-generated codebases.
  • Concrete workflow: extract -> categorize -> split -> detect -> report, with scripts tied to each step.
  • Good operational guidance: includes tool/model hints (haiku for categorization, opus for semantic analysis) and output expectations.
Cautions
  • Narrow scope: focused on TypeScript/JavaScript function analysis, so it may not fit non-JS codebases.
  • No install command or broader setup docs in SKILL.md, so users must infer how to wire the scripts into their workflow.
Overview

Overview of finding-duplicate-functions skill

The finding-duplicate-functions skill helps you spot functions that do the same job but look different in name or implementation. It is most useful when reviewing LLM-generated or fast-growing codebases where semantic duplication accumulates faster than copy-paste duplication. If you need finding-duplicate-functions for Code Review, this skill is aimed at consolidation decisions, not style nitpicks.

What this skill is for

This finding-duplicate-functions skill is built for identifying “same intent, different code” cases: helpers that overlap, utilities that were re-created, or near-equivalent logic scattered across files. It is especially relevant before refactors, during cleanup passes, or after syntactic duplicate tools like jscpd have already handled exact copies.

Who should install it

Install the finding-duplicate-functions skill if you review JavaScript or TypeScript repositories with many small utilities, generated files, or multiple contributors. It is a strong fit when you want a repeatable way to decide whether functions should be merged, kept separate, or investigated further.

What makes it different

The key differentiator is its two-phase workflow: extract functions first, then cluster them by intent with LLM analysis. That means the skill is designed to reduce guesswork around semantic duplicates, not just detect matching lines. The practical benefit is a shorter path from “this code feels redundant” to a reviewable consolidation plan.

How to Use finding-duplicate-functions skill

Install and locate the workflow

Use the repository install path from the skill directory: npx skills add obra/superpowers-lab --skill finding-duplicate-functions. After installation, start with skills/finding-duplicate-functions/SKILL.md, then read the helper scripts in skills/finding-duplicate-functions/scripts/ because they define the actual analysis sequence. For a finding-duplicate-functions guide, those scripts matter more than the prose overview.

What input the skill needs

The skill works best when you provide a source directory and a concrete review goal. Strong inputs mention the code area, the reason for analysis, and any exclusions. For example: “Scan packages/api/src for duplicate validation helpers before merging auth flows; ignore test files and report candidates with high confidence only.” That is better than “find duplicates” because it gives scope, intent, and output expectations.

Read these files first

Prioritize scripts/extract-functions.sh, scripts/categorize-prompt.md, scripts/find-duplicates-prompt.md, scripts/prepare-category-analysis.sh, and scripts/generate-report.sh. These files show the exact finding-duplicate-functions usage pattern: extract a catalog, categorize functions, split by category, run semantic comparison, then generate a report. If you only skim one file, read SKILL.md plus scripts/extract-functions.sh to understand the input shape and exclusions.

Workflow tips that change results

Treat the categorization step as a filter, not an afterthought. The skill is more accurate when categories are coherent and have enough functions to compare, because duplicate detection is run per category. Excluding tests by default is usually correct for production cleanup, but include them if your review goal is shared test utilities or fixture helpers. Use the generated report as a shortlist for human review, not as an automatic refactor plan.

finding-duplicate-functions skill FAQ

Is this better than a normal prompt?

Yes, when you want a reproducible workflow for finding duplicate-function intent rather than a one-off brainstorming answer. A normal prompt can miss scope control, file selection, and confidence thresholds. The finding-duplicate-functions skill gives you a workflow and output structure that are easier to repeat in code review.

Does it replace syntactic duplicate tools?

No. It complements them. Syntactic tools catch copied code; this skill catches functions that are semantically similar even when the implementation differs. If your codebase already has exact-copy issues, handle those first so the semantic pass stays focused.

Is it beginner-friendly?

It is beginner-friendly if you can point it at a source tree and describe what should be reviewed. The main thing beginners need to know is that duplicate detection is category-based and depends on good input boundaries. If you are unsure, start with one package or one feature area instead of the whole repository.

When should I not use it?

Do not use it when you need broad architectural advice, one-off bug fixing, or a general codebase summary. It is also a poor fit if your repository is mostly non-JS/TS code, because the extraction script is oriented around JavaScript and TypeScript function patterns. If your goal is only to find exact copies, a simpler copy-paste detector is enough.

How to Improve finding-duplicate-functions skill

Give tighter scope and a clearer decision target

The biggest quality gain comes from narrowing the review surface and stating the action you want. Instead of asking for all duplicates, ask for “candidate consolidation points in src/utils with a bias toward high-confidence merges.” That improves finding-duplicate-functions usage because the model can compare functions that are actually meant to compete with each other.

Provide the right contrast cases

If you already suspect some pairs, include them in the prompt as likely matches and note why they might differ. Example: “Compare parseUserInput, normalizeInput, and sanitizeInput; they may overlap, but one handles HTML escaping.” This helps the skill distinguish true duplicates from adjacent helpers that only share vocabulary.

Watch the common failure modes

The main failure mode is over-grouping: functions with similar names but different business rules get merged too aggressively. The second is under-grouping: small wrappers are treated as distinct when they only differ by parameter shape or naming. In both cases, add context about inputs, outputs, and expected behavior so the review can judge intent, not just surface similarity.

Iterate from report to refactor

After the first run, use the report to pick one category and manually verify the highest-confidence groups against source code. If a group is borderline, tighten the category or rerun with better context lines and a clearer recommendation threshold. The best finding-duplicate-functions guide is iterative: use the initial output to refine scope, then rerun on the next slice of the codebase.

Ratings & Reviews

No ratings yet
Share your review
Sign in to leave a rating and comment for this skill.
G
0/10000
Latest reviews
Saving...