Finding Duplicate Functions
Audits codebases for same-intent functions with different names or implementations, using a five-phase LLM-assisted pipeline.
- CCM score
- 68 of 100
- skills.sh installs
- 672
- GitHub stars
- 441
- last updated
- Aug 21, 2026
Own this skill? Claim it
What it does
- Covers extraction, domain categorization, per-category duplicate detection, and a prioritized markdown report that feeds human review
- Includes 4 scripts (
extract-functions.sh,prepare-category-analysis.sh,generate-report.sh) plus 2 prompt templates for haiku categorization and opus duplicate detection - Excludes test files by default and skips categories with fewer than 3 functions to keep comparisons focused
- Designed for LLM-generated or multi-contributor codebases where jscpd-style syntactic duplicate detection misses reimplemented utilities
Install
$ npx -y skills add obra/superpowers-lab --skill finding-duplicate-functions -yInstalls into .agents/skills for every agent it finds here, and .claude/skills for Claude Code.
Files
Finding Duplicate-Intent Functions
Overview
LLM-generated codebases accumulate semantic duplicates: functions that serve the same purpose but were implemented independently. Classical copy-paste detectors (jscpd) find syntactic duplicates but miss "same intent, different implementation."
This skill uses a two-phase approach: classical extraction followed by LLM-powered intent clustering.
When to Use
- Codebase has grown organically with multiple contributors (human or LLM)
- You suspect utility functions have been reimplemented multiple times
- Before major refactoring to identify consolidation opportunities
- After jscpd has been run and syntactic duplicates are already handled
Quick Reference
| Phase | Tool | Model | Output |
|---|---|---|---|
| 1. Extract | scripts/extract-functions.sh | - | catalog.json |
| 2. Categorize | scripts/categorize-prompt.md | haiku | categorized.json |
| 3. Split | scripts/prepare-category-analysis.sh | - | categories/*.json |
| 4. Detect | scripts/find-duplicates-prompt.md | opus | duplicates/*.json |
| 5. Report | scripts/generate-report.sh | - | report.md |
Process
Details
- Repository
- github.com/obra/superpowers-lab
- Category
- Code Review & Quality
- First seen
- Jun 3, 2026
More from obra/superpowers-lab
All 3Similar to Finding Duplicate Functions
More Code Review & Qualityreview-duplicationSkillgoogle-gemini/gemini-cli373 installsStructured code-review workflow that hunts for duplicated logic and missed reuse of existing project utilities.
jscpdSkillkucherenko/jscpd2.9K installsDetect duplicated code and measure duplication percentages.
file-name-wizardSkillcygnusfear/agent-skills1.2K installsPhase-based audit that finds and reports filename and naming-convention violations across a codebase.
code-deduplicationSkillalinaqi/maggy627 installsMaintains a capability index and check-before-write rules to prevent semantic duplication in code.
ontomicsMCP serveretiennechollet44 starsSemantic index of a codebase's domain concepts, conventions, and behavioral similarity, queried over MCP.
code-reviewPluginanthropics/claude-code157K starsAutomated code review for pull requests using multiple specialized agents with confidence-based scoring to filter false positives