Skip to content
obra avatar

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
View on GitHub

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 -y

Installs 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

PhaseToolModelOutput
1. Extractscripts/extract-functions.sh-catalog.json
2. Categorizescripts/categorize-prompt.mdhaikucategorized.json
3. Splitscripts/prepare-category-analysis.sh-categories/*.json
4. Detectscripts/find-duplicates-prompt.mdopusduplicates/*.json
5. Reportscripts/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 3

Similar to Finding Duplicate Functions

More Code Review & Quality