Agent skill

Finding Duplicate Functions

by bobmatnyc in 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

MITAuto-check passedDevelopment

Install Finding Duplicate Functions

skills CLI
$ npx skills add bobmatnyc/claude-mpm --skill finding-duplicate-functions -a claude-code

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

GitHub CLI
$ gh skill install bobmatnyc/claude-mpm 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/bobmatnyc/claude-mpm.git skills-src && mkdir -p .claude/skills && cp -r skills-src/src/claude_mpm/skills/bundled/debugging/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
155
Token cost
~1.3k tokens
SKILL.md length
571 words
Files
1
Skills in repo
51
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, especially common in LLM-generated codebases

  • 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 3 more sections
  • Instructions only: no scripts, shell commands, URLs or credentials in SKILL.md

What it does

Finding Duplicate Functions is an agent skill from bobmatnyc/claude-mpm. Use 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

Its SKILL.md is about 1.3k tokens, which your agent loads only when the skill is triggered. It is a single SKILL.md file with no bundled scripts.

It sits in Development. The repository describes itself as: Claude Multi-Agent Project Manager — multi-channel orchestration, GitHub-first SDK mode, and plugin system for Claude. 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
  • Especially common in LLM-generated codebases

Example prompts

  • “/finding-duplicate-functions”

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 25203d3. 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

    No scripts in the folder and no shell commands in SKILL.md.

    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.3k tokens when it runs. Until then it costs about 52 tokens; SKILL.md has 571 words of instructions outside code blocks.

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

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); files beside SKILL.md are not scanned.

SKILL.md

The full file from bobmatnyc/claude-mpm at commit 25203d3, republished under its MIT licence (© bobmatnyc). 571 words, ~1,308 tokens.

Download SKILL.mdSave it as .claude/skills/finding-duplicate-functions/SKILL.md (or your agent's skills folder).
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 common in LLM-generated codebases
when_to_use
after syntactic duplicate detection (jscpd), during codebase audits, or before major refactoring to find consolidation opportunities
version
1.0.0
category
debugging
author
Jesse Vincent
license
MIT
source
https://github.com/obra/superpowers-lab/tree/main/skills/finding-duplicate-functions
tags
debugging, refactoring, duplication, code-quality, analysis
effort
medium

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. ExtractExtract function catalog-catalog.json
2. CategorizeCategorize by domainhaiku modelcategorized.json
3. SplitSplit by category-categories/*.json
4. DetectFind duplicates per categoryopus modelduplicates/*.json
5. ReportGenerate prioritized report-report.md

Process

Phase 1: Extract Function Catalog

Extract all functions from source files. Focus on:

  • Exported functions and public methods
  • Files in utility/helper directories
  • Excluding test files (*.test.*, *.spec.*, __tests__/**)

For each function capture:

  • Function name and signature
  • File path and location
  • ~15 lines of context (enough to understand intent)
Phase 2: Categorize by Domain

Dispatch a haiku subagent to categorize functions by domain.

Insert the function catalog into the prompt. Save output as categorized.json with functions grouped into domains like:

  • String manipulation
  • Validation
  • Path operations
  • Error formatting
  • Date/time formatting
  • API response shaping
Phase 3: Split into Categories

Create one JSON file per category. Only categories with 3+ functions are worth analyzing for duplicates.

Phase 4: Find Duplicates (Per Category)

For each category file, dispatch an opus subagent to find semantic duplicates.

Opus is required here (not haiku) — subtle semantic matches require stronger reasoning. The subagent should identify:

  • Functions with same intent, different implementation
  • Recommended "survivor" function (the one to keep)
  • Confidence level (HIGH/MEDIUM/LOW)
  • Reasoning for the grouping

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

Phase 5: Generate Report

Produce a prioritized markdown report grouped by confidence level.

For each duplicate group, report:

  • All function names and file locations
  • Recommended survivor
  • Confidence level
  • Brief reasoning
Show full SKILL.md (243 more words)Show less
Phase 6: Human Review

Review the report. For HIGH confidence duplicates:

  1. Verify the recommended survivor has tests covering all use cases
  2. Update callers to use the survivor
  3. Delete the duplicates
  4. Run tests to confirm no regressions

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.

Red Flags

Never:

  • Delete duplicates without verifying the survivor has adequate test coverage
  • Use a cheap model for the duplicate detection phase (use opus)
  • Skip categorization and try to find duplicates in the full catalog at once

Always:

  • Run full test suite after consolidation
  • Verify all callers have been updated before deletion
  • Start with HIGH confidence duplicates before attempting MEDIUM or LOW

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

Files

Just SKILL.md in src/claude_mpm/skills/bundled/debugging/finding-duplicate-functions of bobmatnyc/claude-mpm.

Open the folder on GitHubat commit 25203d3

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 skillbobmatnyc/claude-mpm155—~1.3kAutomated safety check: PassMIT
Vercel Composition Patternssupabase/supabase111k58 repos~726Automated safety check: PassMIT
Finishing a Development Branchobra/superpowers297k5 repos~1.9kAutomated safety check: PassMIT
Typescript Advanced Typesrolling-scopes/rsschool-app10k25 repos~4.2kAutomated safety check: PassMPL-2.0
PR Babysitteropeninterpreter/openinterpreter69k3 repos~4.2kAutomated safety check: PassApache-2.0
Code Review ChecklistshareAI-lab/learn-claude-code78k5 repos~1.1kAutomated safety check: PassMIT

Similar skills

  • Official

    React composition patterns that scale. An agent skill from supabase/supabase.

    111k GitHub starsUsed in 58 repos~726 tokens
    DevelopmentAuto-check passed
  • Walks the last step of a branch: confirm tests pass, detect the git environment, ask how to integrate, carry out your choice and clean up the worktree.

    297k GitHub starsUsed in 5 repos~1.9k tokens
    DevelopmentAuto-check passed
  • Typescript Advanced Types

    rolling-scopes/rsschool-app

    Master TypeScript's advanced type system including generics, conditional types, mapped types, template literals, and utility types for building type-safe applications.

    10k GitHub starsUsed in 25 repos~4.2k tokens
    DevelopmentAuto-check passed
  • PR Babysitter

    openinterpreter/openinterpreter

    Watches an open GitHub pull request until it merges, handling review comments, diagnosing CI failures and retrying flaky checks along the way.

    69k GitHub starsUsed in 3 repos~4.2k tokens
    DevelopmentAuto-check passed
  • Code Review Checklist

    shareAI-lab/learn-claude-code

    Reviews code against a five-part checklist covering security, correctness, performance, maintainability and testing, and reports findings in a fixed format.

    78k GitHub starsUsed in 5 repos~1.1k tokens
    DevelopmentAuto-check passed
  • Greploop

    onyx-dot-app/onyx

    Iteratively improves a PR (GitHub), MR (GitLab), or shelved changelist (Perforce) until Greptile gives it a 5/5 confidence score with zero unresolved comments.

    32k GitHub starsUsed in 4 repos~3.3k tokens
    DevelopmentAuto-check passed

More from bobmatnyc/claude-mpm

All 51 skills in this repo
  • Build MCP Server

    bobmatnyc/claude-mpm

    Create high-quality MCP servers that enable LLMs to effectively interact with external services.

    155 GitHub stars~2k tokensUpdated 1 mo ago
    Auto-check passed
  • Env Manager

    bobmatnyc/claude-mpm

    Environment variable validation, synchronization, and management across local development, CI/CD, and deployment platforms

    155 GitHub stars~2k tokensUpdated 1 mo ago
    Auto-check: notes
  • Session Analyzer

    bobmatnyc/claude-mpm

    Debug and teach agentic coding: a deterministic-first session timeline + cost report, with optional narrative polish and a standalone JSX visualiser.

    155 GitHub stars~2.2k tokensUpdated 1 mo ago
    Auto-check passed
  • Software Patterns

    bobmatnyc/claude-mpm

    Decision framework for architectural patterns including DI, SOA, Repository, Domain Events, Circuit Breaker, and Anti-Corruption Layer.

    155 GitHub stars~1.8k tokensUpdated 1 mo ago
    Auto-check passed
  • Verification Before Completion

    bobmatnyc/claude-mpm

    Run verification commands and confirm output before claiming success

    155 GitHub starsUsed in 2 repos~1k tokens
    Auto-check passed
  • Dependency Audit

    bobmatnyc/claude-mpm

    Dependency audit and cleanup workflow for maintaining healthy project dependencies.

    155 GitHub stars~3.5k tokensUpdated 1 mo ago
    Auto-check passed

Categories

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, especially common in LLM-generated codebases. Finding Duplicate Functions is an agent skill from bobmatnyc/claude-mpm.

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; especially common in LLM-generated codebases.

How do I install Finding Duplicate Functions in Claude Code?

Run `npx skills add bobmatnyc/claude-mpm --skill finding-duplicate-functions -a claude-code`. Or copy the skill folder (src/claude_mpm/skills/bundled/debugging/finding-duplicate-functions in bobmatnyc/claude-mpm) 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 bobmatnyc/claude-mpm --skill finding-duplicate-functions -a codex`. Or copy the skill folder (src/claude_mpm/skills/bundled/debugging/finding-duplicate-functions in bobmatnyc/claude-mpm) 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 bobmatnyc/claude-mpm --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?

SKILL.md names no scripts, command-line tools or credentials: Finding Duplicate Functions is instructions for the agent only.

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. Review the folder before installing.

What licence does Finding Duplicate Functions use?

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

How many tokens does Finding Duplicate Functions use?

About 1.3k tokens (SKILL.md is roughly 5.2k 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: Vercel Composition Patterns (supabase/supabase, 111k stars), Finishing a Development Branch (obra/superpowers, 297k stars), Typescript Advanced Types (rolling-scopes/rsschool-app, 10k stars) and PR Babysitter (openinterpreter/openinterpreter, 69k 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?

bobmatnyc (a GitHub user) maintains it in bobmatnyc/claude-mpm, which has 155 GitHub stars. The repository holds 51 skills in this directory. The repository was last updated on August 31, 2026.

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