
Similar Function Finder
FreeAvoid code duplication by finding existing JavaScript/TypeScript symbols.
Free · Opens the source repo
What Similar Function Finder does
The Similar Function Finder skill leverages the truffler tool to help developers identify existing JavaScript and TypeScript symbols that may overlap with new functionality they intend to implement. By using this skill, developers can efficiently search for functions, methods, constants, types, and interfaces that are relevant to their current coding task. This proactive approach not only saves time but also encourages code reuse, which can lead to cleaner and more maintainable codebases.
When using this skill, developers should begin by articulating the behavior they plan to implement and then derive a series of search queries based on that behavior. The truffler tool is designed to perform fuzzy searches, allowing developers to find symbols that may not match exactly but are conceptually similar. This is particularly useful when working in large codebases where similar functionalities may exist but are not immediately obvious.
The workflow encourages developers to inspect the search results thoroughly before deciding whether to reuse existing code or create new implementations. By following the guidelines provided, developers can make informed decisions that align with best practices in software development. This skill is particularly beneficial for teams focused on maintaining high code quality and reducing redundancy in their JavaScript and TypeScript projects.
Overall, the Similar Function Finder skill is an essential tool for any developer or team looking to streamline their coding process and enhance collaboration by minimizing duplicated efforts across their codebases.
When to use it
Use this skill when you are about to implement new functionality in a JavaScript or TypeScript project and want to ensure you're not duplicating existing code.
When not to use it
This skill may not be useful if you are working in a small codebase where existing functions are easy to track or if you are implementing highly unique functionality that is unlikely to overlap with existing code.
What you can build with it
Implementing a New Utility Function
Before adding a new utility function, use the Similar Function Finder to search for existing functions that may serve the same purpose.
Refactoring Existing Code
When refactoring, check for similar functions to ensure you can reuse or extend existing code instead of creating new duplicates.
Adding a New Parser
If you're implementing a new parser, use this skill to find any existing parsers that could be reused or modified.
How to install Similar Function Finder
View source1. Install with the skills CLI
npx skills add millionco/react-doctor/find-similar-functions --agent claude-code2. Or install it manually
Download the skill folder and drop it into ~/.claude/skills/ for all projects, or .claude/skills/ to scope it to one repo. Restart Claude Code so it picks up the new skill.
Anthropic's agentic coding CLI, and the reference implementation of Agent Skills. Drop a skill folder into ~/.claude/skills and Claude Code loads it automatically whenever a task matches the skill's description. Claude Code docs
Inside SKILL.md
Written by millioncoSimilar Function Finder
Use this skill before writing new JavaScript or TypeScript code that might overlap with existing helpers. The goal is to discover nearby functions, methods, constants, types, and interfaces early enough to reuse or extend them instead of creating duplicate behavior.
truffler is a fuzzy symbol search tool. Treat it as a discovery layer: it points you to likely symbols, but you still need to inspect the code before deciding whether something is reusable.
Workflow
- State the behavior you are about to implement in a few words.
- Derive 3-6 search queries from the intended behavior:
- the proposed function or class name
- domain nouns, such as
symbol,path,file,route,token, orconfig - verbs, such as
parse,normalize,discover,scan,format,rank,score,resolve, orvalidate - common abbreviations and synonyms, such as
btnforbuttonorcfgforconfig
- Run
truffleragainst the narrowest useful root first, then broaden if needed. - Inspect the top matches with normal code-reading tools before editing.
- Prefer reusing, extending, or moving existing code when the behavior substantially matches. Create new code only after the search shows there is not a suitable existing symbol.
- In your final response, briefly mention what you found and whether you reused something or intentionally added a new implementation.
Command Recipes
When truffler is installed in the target project:
truffler "normalize path" src --kind function,method,constant,type --limit 20
truffler "score" src --kind function,method --format json --limit 15
When working inside this truffler repository:
bun src/cli.ts "discover file" src --kind function,method,constant,type --limit 20
bun src/cli.ts "format result" src --kind function,method --format json --limit 15
When the project has no installed binary and you should not add dependencies, use bunx if network/package execution is acceptable for the environment:
bunx @rayhanadev/truffler "parse config" src --kind function,method,type --limit 20
If truffler cannot be run, say so and fall back to the repository's available search tools. Still follow the same deduplication intent: search before implementing.
Search Strategy
Start with symbols most likely to represent reusable behavior:
truffler "<query>" <root> --kind function,method,constant,type,interface --limit 20
Use JSON output when you need structured fields for ranking, locations, signatures, or automation:
truffler "<query>" <root> --format json --limit 20
Broaden deliberately:
- If a precise function name has no match, search the domain noun and verb separately.
- If a utility may live outside
src/, try known library, package, app, or test roots. - If there are many matches, restrict
--kindand reduce the root rather than skimming unrelated output. - If top matches look close, read the implementation and nearby tests or call sites before deciding.
Reuse Decision Guide
Consider an existing symbol reusable when it already handles the same input shape, side effects, error behavior, and return shape, or when a small extension would preserve its current contract.
Avoid reusing a symbol just because its name is close. Fuzzy matches can surface unrelated code. Inspect signatures, implementation, callers, and tests before changing anything.
When no suitable symbol exists, keep the new implementation near the closest related module and align with that module's naming, error handling, and test style.
Reporting Template
Use a short note like this when the search affects your implementation:
I checked for existing symbols with `truffler` using queries like `normalize`, `path`, and `resolve`. The closest match was `normalizePath` in `src/files.ts`, so I reused that behavior instead of adding a separate helper.
If nothing relevant exists:
I searched with `truffler` for `parse`, `config`, and `loadConfig` across `src/`; the matches were unrelated, so I added a new helper in the nearest module.
Frequently asked questions about Similar Function Finder
Similar skills
React Composition Patterns
Streamline your React component architecture with proven patterns.
Pester Should Migration
Easily convert Pester v5 assertions to v6 syntax.
Radix to Base UI Migration
Seamlessly migrate React components from Radix UI to Base UI.
Migrate Next.js to Vinext
Seamlessly transition your Next.js projects to Vinext.
WinUI 3 Migration Guide
Streamline your UWP to WinUI 3 migration process.
Refactor
Enhance code maintainability without altering behavior.
