
Finding Duplicate Functions
LLM-generated codebases have a nasty habit of reimplementing the same utility function six different ways instead of reusing what exists. This skill catches those semantic duplicates that traditional copy-paste detectors miss. It extracts your functions, uses Haiku to group them by domain, then unleashes Opus on each category to find functions that do the same thing despite different implementations. The two-tier model approach is smart: cheap categorization, expensive analysis only where it matters. Focus on your utils folders and validation code first, those accumulate duplicates fastest. Just make sure the survivor function has tests before you consolidate, because the LLM can miss edge cases that only one implementation handled.
- skills.sh installs
- 647
- GitHub stars
- 438
- last updated
- Aug 21, 2026
Install
$ npx -y skills add obra/superpowers-lab --skill finding-duplicate-functions --agent claude-codeInstalls into .claude/skills of the current project.
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
Sponsors
Details
- Repository
- github.com/obra/superpowers-lab
- Category
- AI & Agent Building
- First seen
- Jun 3, 2026