
find-similar-functions
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 reusable functions. Agents should use this skill whenever they are about to add or refactor functionality in a JS/TS repository and need to avoid duplicating existing code, even if the user does not explicitly mention deduplication.
- Installs
- 457
- Last 24h
- —
- Trending rank
- —
- Security
- Not audited
Install
Works with every agent the skills CLI supports.
npx skills add https://github.com/millionco/react-doctor --skill find-similar-functions- 01
Install
Run the command in your project. The CLI asks which agents to install for.
- 02
Describe the task
Ask your agent for something this skill covers. It loads find-similar-functions automatically when relevant.
- 03
Review the result
The agent follows the SKILL.md steps, scripts and references bundled with the skill.
SKILL.md
The instructions your agent reads when the skill is triggered.
Similar 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.
FAQ
What does the find-similar-functions skill do?
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 reusable functions. Agents should use this skill whenever they are about to add or refactor functionality in a JS/TS repository and need to avoid duplicating existing code, even if the user does not explicitly mention deduplication.
How do I install find-similar-functions?
Run npx skills add https://github.com/millionco/react-doctor --skill find-similar-functions in your project. The skills CLI detects the agents you use and copies the skill into the right folder. For Claude Code you can also place the skill folder at ~/.claude/skills/find-similar-functions/ (personal) or .claude/skills/find-similar-functions/ (project).
Which AI agents can use find-similar-functions?
Any agent that supports the open Agent Skills format (a folder with a SKILL.md file), including Claude Code, Codex, Cursor, GitHub Copilot, Gemini CLI, Windsurf, Cline, OpenCode and more.
Is find-similar-functions safe to install?
No partner security audit is available yet. Skills can run commands and scripts, so read the SKILL.md and any bundled files before installing.
Who maintains find-similar-functions?
It is published by millionco in millionco/react-doctor. It has 457 recorded installs.
More from millionco/react-doctor
react-doctor
millionco/react-doctor
Use when finishing a feature, fixing a bug, before committing React code, or when the user types /doctor, asks to scan, triage, or clean up React diagnostics. Covers lint, accessibility, bundle size, architecture. Includes a regression check and a full local-triage workflow that fetches the canonical playbook.
improve-react
millionco/react-doctor
Survey a whole React codebase as a senior React engineer, using React Doctor's scan as evidence, then produce a prioritized audit and self-contained implementation plans for other agents (or cheaper models) to execute. Read-only on source code — it plans improvements, it does not apply them. Use when the user asks to "improve the React code", "audit this codebase", "make this app faster / more robust", or wants a roadmap of fixes rather than a review of a single diff. For a regression check or a fix-it-now pass, use the react-doctor skill instead.
deslop
millionco/react-doctor
Simplify and refine recently modified code while preserving functionality. Use when asked to "deslop", "clean up code", "simplify code", or after making changes that could benefit from refinement.
rule-validate
millionco/react-doctor
Open the skill to read its SKILL.md instructions.
rule-research
millionco/react-doctor
Open the skill to read its SKILL.md instructions.
rule-writing
millionco/react-doctor
Open the skill to read its SKILL.md instructions.
Popular code quality & workflow skills
grill-me
mattpocock/skills
A relentless interview to sharpen a plan or design.
improve-codebase-architecture
mattpocock/skills
Scan a codebase for deepening opportunities, present them as a visual HTML report, then grill through whichever one you pick.
handoff
mattpocock/skills
Compact the current conversation into a handoff document for another agent to pick up.
domain-modeling
mattpocock/skills
Build and sharpen a project's domain model. Use when discussing codebase terminology, writing or editing a GLOSSARY.md, or recording or editing an ADR.
codebase-design
mattpocock/skills
Shared vocabulary for designing deep modules. Use when the user wants to design or improve a module's interface, find deepening opportunities, decide where a seam goes, make code more testable or AI-navigable, or when another skill needs the deep-module vocabulary.
diagnosing-bugs
mattpocock/skills
Diagnosis loop for hard bugs and performance regressions. Use when the user says "diagnose"/"debug this", or reports something broken/throwing/failing/slow.