Agent skill

Finding Duplicate Functions

by obra in obra/superpowers-lab

A skill your agent uses when auditing a codebase for semantic duplication - functions that do the same thing but have different names or implementations.

MITAuto-check passed

Install Finding Duplicate Functions

skills CLI
$ npx skills add obra/superpowers-lab --skill finding-duplicate-functions -a claude-code

Project install by default; add -g for ~/.claude/skills/.

GitHub CLI
$ gh skill install obra/superpowers-lab finding-duplicate-functions --agent claude-code

Project scope by default; add --scope user for a personal install. Needs GitHub CLI 2.90.0 or later (public preview).

Manual copy
$ git clone --depth 1 https://github.com/obra/superpowers-lab.git skills-src && mkdir -p .claude/skills && cp -r skills-src/skills/finding-duplicate-functions .claude/skills/finding-duplicate-functions && rm -rf skills-src

Use ~/.claude/skills/ instead of .claude/skills for a personal install. The folder must contain SKILL.md.

Claude Code skills documentation · loads skills from .claude/skills/

Facts

Skill name
finding-duplicate-functions
GitHub stars
429
Used in
2 other repos
Token cost
~1.2k tokens
SKILL.md length
427 words
Files
6 (incl. scripts)
Skills in repo
2
Repo updated
First seen
Licence
MIT

At a glance

A skill your agent uses when auditing a codebase for semantic duplication - functions that do the same thing but have different names or implementations.

  • Works in 6 steps: Extract Function Catalog → Categorize by Domain → Split into Categories → …
  • Auditing a codebase for semantic duplication - functions that do the same thing but have different names
  • SKILL.md covers Overview, When to Use, Quick Reference and Process, plus 2 more sections
  • Runs Shell scripts from its folder

What it does

Finding Duplicate Functions is an agent skill from obra/superpowers-lab. Use when auditing a codebase for semantic duplication - functions that do the same thing but have different names or implementations. Especially useful for LLM-generated codebases where new functions are often created rather than reusing existing ones.

Its SKILL.md is about 1.2k tokens, which your agent loads only when the skill is triggered. The skill folder holds 6 other files, including scripts (for example `scripts/categorize-prompt.md`, `scripts/extract-functions.sh` and `scripts/find-duplicates-prompt.md`).

The repository describes itself as: Experimental skills for Claude Code Superpowers - new techniques and tools. The licence is MIT.

When your agent uses it

  • Auditing a codebase for semantic duplication - functions that do the same thing but have different names
  • Implementations

Example prompts

  • “/finding-duplicate-functions”

Requirements

  • A Bash shell

Workflow steps

6 steps, taken from the step headings in SKILL.md.

  1. Extract Function Catalog
  2. Categorize by Domain
  3. Split into Categories
  4. Find Duplicates (Per Category)
  5. Generate Report
  6. Human Review

What it can do on your machine

Read from SKILL.md and the folder at commit 51111f7. It shows what the files ask for, not the result of running them.

  • Tool permissions

    Pre-approves nothing: there is no allowed-tools line, so your agent's usual permission prompts apply.

    From allowed-tools in the SKILL.md frontmatter.

  • Runs code

    Ships 5 files in scripts/ (Shell), which the agent can run.

    From the folder's file list and the shell code blocks in SKILL.md.

  • Network

    No URLs in SKILL.md.

    From URLs in SKILL.md, links to its own repository left out.

  • Credentials

    Names no API keys, tokens, secrets or passwords.

    From names ending in _API_KEY, _TOKEN, _SECRET, _KEY or _PASSWORD in SKILL.md.

Context cost

Finding Duplicate Functions loads about 1.2k tokens when it runs. Until then it costs about 70 tokens; SKILL.md has 427 words of instructions outside code blocks.

Always · name and description, kept in context so the agent knows when to use it
~70
When it runs · the whole SKILL.md, loaded when a task matches
~1.2k

Estimates: characters ÷ 4, the usual rule of thumb; real counts depend on the model's tokenizer. Scripts and assets cost tokens only if the agent reads them.

Safety

Auto-check passed

The automated check found no risky patterns in SKILL.md.

Automated static check — not a guarantee. Review scripts before installing. It scans the text of SKILL.md for risky patterns (piping downloads into a shell, reading credential files, hidden Unicode, destructive commands); the scripts in this folder are not scanned.

SKILL.md

The full file from obra/superpowers-lab at commit 51111f7, republished under its MIT licence (© obra). 427 words, ~1,199 tokens.

Download SKILL.mdSave it as .claude/skills/finding-duplicate-functions/SKILL.md (or your agent's skills folder). This skill also uses 5 other files; get the full folder from GitHub.
name
finding-duplicate-functions
description
Use when auditing a codebase for semantic duplication - functions that do the same thing but have different names or implementations. Especially useful for LLM-generated codebases where new functions are often created rather than reusing existing ones.

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

dot
digraph duplicate_detection {
  rankdir=TB;
  node [shape=box];

  extract [label="1. Extract function catalog\n./scripts/extract-functions.sh"];
  categorize [label="2. Categorize by domain\n(haiku subagent)"];
  split [label="3. Split into categories\n./scripts/prepare-category-analysis.sh"];
  detect [label="4. Find duplicates per category\n(opus subagent per category)"];
  report [label="5. Generate report\n./scripts/generate-report.sh"];
  review [label="6. Human review & consolidate"];

  extract -> categorize -> split -> detect -> report -> review;
}
Phase 1: Extract Function Catalog
bash
./scripts/extract-functions.sh src/ -o catalog.json

Options:

  • -o FILE: Output file (default: stdout)
  • -c N: Lines of context to capture (default: 15)
  • -t GLOB: File types (default: *.ts,*.tsx,*.js,*.jsx)
  • --include-tests: Include test files (excluded by default)

Test files (*.test.*, *.spec.*, __tests__/**) are excluded by default since test utilities are less likely to be consolidation candidates.

Phase 2: Categorize by Domain

Dispatch a haiku subagent using the prompt in scripts/categorize-prompt.md.

Insert the contents of catalog.json where indicated in the prompt template. Save output as categorized.json.

Phase 3: Split into Categories
bash
./scripts/prepare-category-analysis.sh categorized.json ./categories

Creates one JSON file per category. Only categories with 3+ functions are worth analyzing.

Phase 4: Find Duplicates (Per Category)

For each category file in ./categories/, dispatch an opus subagent using the prompt in scripts/find-duplicates-prompt.md.

Save each output as ./duplicates/{category}.json.

Phase 5: Generate Report
bash
./scripts/generate-report.sh ./duplicates ./duplicates-report.md

Produces a prioritized markdown report grouped by confidence level.

Show full SKILL.md (173 more words)Show less
Phase 6: Human Review

Review the report. For HIGH confidence duplicates:

  1. Verify the recommended survivor has tests
  2. Update callers to use the survivor
  3. Delete the duplicates
  4. Run tests

High-Risk Duplicate Zones

Focus extraction on these areas first - they accumulate duplicates fastest:

ZoneCommon Duplicates
utils/, helpers/, lib/General utilities reimplemented
Validation codeSame checks written multiple ways
Error formattingError-to-string conversions
Path manipulationJoining, resolving, normalizing paths
String formattingCase conversion, truncation, escaping
Date formattingSame formats implemented repeatedly
API response shapingSimilar transformations for different endpoints

Common Mistakes

Extracting too much: Focus on exported functions and public methods. Internal helpers are less likely to be duplicated across files.

Skipping the categorization step: Going straight to duplicate detection on the full catalog produces noise. Categories focus the comparison.

Using haiku for duplicate detection: Haiku is cost-effective for categorization but misses subtle semantic duplicates. Use Opus for the actual duplicate analysis.

Consolidating without tests: Before deleting duplicates, ensure the survivor has tests covering all use cases of the deleted functions.

© obra, MIT. Rendered from Markdown: HTML in the file is shown as text, images as links, and headings moved down two levels. Raw file

Files

SKILL.md and 5 other files (scripts) in skills/finding-duplicate-functions of obra/superpowers-lab.

  • SKILL.md
  • scripts/categorize-prompt.md
  • scripts/extract-functions.sh
  • scripts/find-duplicates-prompt.md
  • scripts/generate-report.sh
  • scripts/prepare-category-analysis.sh

Open the folder on GitHubat commit 51111f7

Used in 2 other repositories

We found 2 copies of this SKILL.md (exact, near-identical or edited) in other folders, from 2 other GitHub owners. This page covers the copy in obra/superpowers-lab, which our catalogue first saw on October 7, 2026.

Compare with similar skills

Finding Duplicate Functions next to the 5 skills that share the most tags, products or categories with it. Stars are the repository's; “used in” counts other GitHub owners with a copy.

Finding Duplicate Functions compared with similar skills
SkillStarsUsed inTokensAuto-checkLicenceRepo updated
Finding Duplicate Functions this skillobra/superpowers-lab4292 repos~1.2kAutomated safety check: PassMIT
Find Similar Functionsmillionco/react-doctor15k—~1.2kAutomated safety check: PassCustom licence
Finding Duplicate Functionsbobmatnyc/claude-mpm155—~1.3kAutomated safety check: PassMIT
Production Auditaffaan-m/ECC274k1 repos~1.9kAutomated safety check: PassMIT
Aims Auditalirezarezvani/claude-skills28k—~1.3kAutomated safety check: PassMIT
Click Path Auditaffaan-m/ECC274k3 repos~2kAutomated safety check: PassMIT

Similar skills

  • Find Similar Functions

    millionco/react-doctor

    Use truffler to find similar or pre-existing JavaScript/TypeScript symbols before implementing new code, especially helpers, utilities, parsers, formatters, scanners, fuzzy matchers, and other…

    15k GitHub stars~1.2k tokensUpdated today
    DevelopmentAuto-check passed
  • Finding Duplicate Functions

    bobmatnyc/claude-mpm

    A skill your agent uses when auditing a codebase for semantic duplication — functions that do the same thing but have different names or implementations, especially common in LLM-generated codebases

    155 GitHub stars~1.3k tokensUpdated 1 mo ago
    DevelopmentAuto-check passed
  • Production Audit

    affaan-m/ECC

    Local-evidence production readiness audit for shipped apps, pre-launch reviews, post-merge checks, and "what breaks in prod?" questions without sending repo data to an external audit service.

    274k GitHub starsUsed in 1 repo~1.9k tokens
    Product & Project ManagementAuto-check passed
  • Aims Audit

    alirezarezvani/claude-skills

    /cs:aims-audit <scope — ISO/IEC 42001 AIMS internal-audit 6-question forcing interrogation.

    28k GitHub stars~1.3k tokensUpdated 1 mo ago
    Legal & ComplianceAuto-check passed
  • Click Path Audit

    affaan-m/ECC

    Trace every user-facing button/touchpoint through its full state change sequence to find bugs where functions individually work but cancel each other out, produce wrong final state, or leave the UI…

    274k GitHub starsUsed in 3 repos~2k tokens
    DevelopmentAuto-check passed
  • Geo Audit

    sickn33/agentic-awesome-skills

    Full website GEO+SEO audit with parallel subagent delegation.

    47k GitHub starsUsed in 1 repo~3.4k tokens
    Marketing & SEOAuto-check: notes

More from obra/superpowers-lab

  • A skill your agent uses when you need to run interactive CLI tools (vim, git rebase -i, Python REPL, etc.) that require real-time input/output - provides tmux-based approach for controlling…

    429 GitHub starsUsed in 2 repos~1.3k tokens
    Auto-check passed

Questions about Finding Duplicate Functions

What does Finding Duplicate Functions do?

A skill your agent uses when auditing a codebase for semantic duplication - functions that do the same thing but have different names or implementations. Finding Duplicate Functions is an agent skill from obra/superpowers-lab. Use when auditing a codebase for semantic duplication - functions that do the same thing but have different names or implementations.

When should I use Finding Duplicate Functions?

Finding Duplicate Functions fits situations like: auditing a codebase for semantic duplication - functions that do the same thing but have different names; implementations.

How do I install Finding Duplicate Functions in Claude Code?

Run `npx skills add obra/superpowers-lab --skill finding-duplicate-functions -a claude-code`. Or copy the skill folder (skills/finding-duplicate-functions in obra/superpowers-lab) into .claude/skills/finding-duplicate-functions in your project. Claude Code loads it when a task matches its description.

How do I install Finding Duplicate Functions in Codex?

Run `npx skills add obra/superpowers-lab --skill finding-duplicate-functions -a codex`. Or copy the skill folder (skills/finding-duplicate-functions in obra/superpowers-lab) into .agents/skills/finding-duplicate-functions in your project. Codex loads it when a task matches its description.

Can I use Finding Duplicate Functions in Cursor, Gemini CLI or GitHub Copilot?

Cursor, Gemini CLI, GitHub Copilot and OpenCode also load SKILL.md folders. With the skills CLI, run `npx skills add obra/superpowers-lab --skill finding-duplicate-functions -a cursor` (or -a gemini-cli, github-copilot or opencode for the others). To copy it by hand, put the folder in .cursor/skills/finding-duplicate-functions, .gemini/skills/finding-duplicate-functions, .github/skills/finding-duplicate-functions and .opencode/skills/finding-duplicate-functions in your project.

What does Finding Duplicate Functions need to run?

Going by SKILL.md and its folder, Finding Duplicate Functions needs a shell for the scripts in its folder. Our summary lists: A Bash shell.

Does Finding Duplicate Functions access the network?

SKILL.md contains no URLs. Any network use would come from the scripts or tools the agent runs. This is read from the text; nothing was executed.

Is Finding Duplicate Functions safe to install?

Our automated static check of SKILL.md found no risky patterns, such as piping downloads into a shell, reading credential files or hidden Unicode. It is not a guarantee. The check reads SKILL.md only: the scripts in the folder are not scanned, so read them before running anything.

What licence does Finding Duplicate Functions use?

Finding Duplicate Functions is published under the MIT licence (the repository's licence). It allows redistribution, so the full SKILL.md is shown on this page.

How many tokens does Finding Duplicate Functions use?

About 1.2k tokens (SKILL.md is roughly 4.8k characters). Agents keep only the skill's name and description in context until a task matches; then they load SKILL.md in full.

What are the alternatives to Finding Duplicate Functions?

Skills that share tags, products or a category with Finding Duplicate Functions: Find Similar Functions (millionco/react-doctor, 15k stars), Finding Duplicate Functions (bobmatnyc/claude-mpm, 155 stars), Production Audit (affaan-m/ECC, 274k stars) and Aims Audit (alirezarezvani/claude-skills, 28k stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.

Who maintains Finding Duplicate Functions?

obra (a GitHub user) maintains it in obra/superpowers-lab, which has 429 GitHub stars. The repository holds 2 skills in this directory. The repository was last updated on June 1, 2026.

Source: obra/superpowers-lab on GitHub. Facts on this page come from the repository at the commit we read; the author's words are quoted as theirs.