millionco/react-doctor

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.

查看源码

使用方法

  1. 复制安装命令,在自己的智能体环境安装前先检查源码包。
  2. 从原始文档核对所需工具、凭据和支持的宿主。
  3. 说明输入材料与期望交付物,并对照来源检查输出。
npx skills add https://github.com/millionco/react-doctor --skill find-similar-functions

开始前需了解

  • 安装不包含模型订阅、API 额度或访问文件的权限。
  • 仓库星数和安装量反映活跃情况,不等于独立质量或安全测试。
仓库原始内容

按源仓库内容呈现,保留标题、案例、代码、表格、链接以及原文引用的演示图片。

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

  1. State the behavior you are about to implement in a few words.
  2. Derive 3-6 search queries from the intended behavior:
  • the proposed function or class name
  • domain nouns, such as symbol, path, file, route, token, or config
  • verbs, such as parse, normalize, discover, scan, format, rank, score, resolve, or validate
  • common abbreviations and synonyms, such as btn for button or cfg for config
  1. Run truffler against the narrowest useful root first, then broaden if needed.
  2. Inspect the top matches with normal code-reading tools before editing.
  3. 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.
  4. 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:

bash
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:

bash
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:

bash
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:

bash
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:

bash
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 --kind and 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:

markdown
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:

markdown
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.

按任务相关推荐

来自同一仓库

更多 Skills

全部 Skills
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.

1小时安装量
2
GitHub Stars
1.5万
最近更新
11月20日
millionco
社区

improve-threejs

Audit and fix Three.js and React Three Fiber apps for frame-loop performance, GPU memory leaks, scene-graph correctness, and visual defects like z-fighting, shadow acne, wrong color space, and broken resize handling. Uses React Doctor as the scanning engine plus a visual rubric checked against rendered output. Use when the user asks to improve, audit, scan, or clean up a Three.js, R3F, react-three-fiber, drei, or WebGL app, or types /improve-threejs.

1小时安装量
2
GitHub Stars
1.5万
最近更新
11月19日
millionco
社区

rule-research

Define a precise React Doctor rule contract before implementation. Use when validating a rule idea, collecting official or open-source evidence, identifying false-positive traps, choosing detector precision, or setting first-version boundaries.

1小时安装量
1
GitHub Stars
1.5万
最近更新
11月7日
millionco
社区

run-parity

Compare React Doctor diagnostics for a GitHub pull request (PR) with Vercel Sandbox. Use when asked to run parity, check a PR for diagnostic regressions, compare a PR with its base, or report added and removed diagnostics.

1小时安装量
1
GitHub Stars
1.5万
最近更新
11月7日