search-first

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

/search-first — Research Before You Code

/search-first — 编码前调研

Systematizes the "search for existing solutions before implementing" workflow.
将「实现前先搜索现有解决方案」的工作流系统化。

Trigger

触发场景

Use this skill when:
  • Starting a new feature that likely has existing solutions
  • Adding a dependency or integration
  • The user asks "add X functionality" and you're about to write code
  • Before creating a new utility, helper, or abstraction
在以下场景使用此skill:
  • 启动一个可能已有现成解决方案的新功能
  • 添加依赖或集成
  • 用户要求「添加X功能」,而你即将编写代码时
  • 创建新的工具类、辅助函数或抽象层之前

Workflow

工作流

┌─────────────────────────────────────────────┐
│  1. NEED ANALYSIS                           │
│     Define what functionality is needed      │
│     Identify language/framework constraints  │
├─────────────────────────────────────────────┤
│  2. PARALLEL SEARCH (researcher agent)      │
│     ┌──────────┐ ┌──────────┐ ┌──────────┐  │
│     │  npm /   │ │  MCP /   │ │  GitHub / │  │
│     │  PyPI    │ │  Skills  │ │  Web      │  │
│     └──────────┘ └──────────┘ └──────────┘  │
├─────────────────────────────────────────────┤
│  3. EVALUATE                                │
│     Score candidates (functionality, maint, │
│     community, docs, license, deps)         │
├─────────────────────────────────────────────┤
│  4. DECIDE                                  │
│     ┌─────────┐  ┌──────────┐  ┌─────────┐  │
│     │  Adopt  │  │  Extend  │  │  Build   │  │
│     │ as-is   │  │  /Wrap   │  │  Custom  │  │
│     └─────────┘  └──────────┘  └─────────┘  │
├─────────────────────────────────────────────┤
│  5. IMPLEMENT                               │
│     Install package / Configure MCP /       │
│     Write minimal custom code               │
└─────────────────────────────────────────────┘
┌─────────────────────────────────────────────┐
│  1. 需求分析                               │
│     明确所需功能                            │
│     识别语言/框架约束                        │
├─────────────────────────────────────────────┤
│  2. 并行搜索(研究员Agent)                  │
│     ┌──────────┐ ┌──────────┐ ┌──────────┐  │
│     │  npm /   │ │  MCP /   │ │  GitHub / │  │
│     │  PyPI    │ │  Skills  │ │  Web      │  │
│     └──────────┘ └──────────┘ └──────────┘  │
├─────────────────────────────────────────────┤
│  3. 评估                                   │
│     对候选方案评分(功能、维护情况、         │
│     社区活跃度、文档、许可证、依赖)         │
├─────────────────────────────────────────────┤
│  4. 决策                                   │
│     ┌─────────┐  ┌──────────┐  ┌─────────┐  │
│     │  直接采用  │  │  扩展/封装  │  │  自定义开发  │  │
│     │         │  │          │  │         │  │
│     └─────────┘  └──────────┘  └─────────┘  │
├─────────────────────────────────────────────┤
│  5. 实现                                   │
│     安装包 / 配置MCP /                      │
│     编写最少的自定义代码                    │
└─────────────────────────────────────────────┘

Decision Matrix

决策矩阵

SignalAction
Exact match, well-maintained, MIT/ApacheAdopt — install and use directly
Partial match, good foundationExtend — install + write thin wrapper
Multiple weak matchesCompose — combine 2-3 small packages
Nothing suitable foundBuild — write custom, but informed by research
信号行动
完全匹配、维护良好、采用MIT/Apache协议直接采用 — 直接安装使用
部分匹配、基础良好扩展 — 安装并编写轻量封装层
多个弱匹配方案组合 — 整合2-3个小型包
未找到合适方案自定义开发 — 基于调研结果编写自定义代码

How to Use

使用方法

Quick Mode (inline)

快速模式(内联)

Before writing a utility or adding functionality, mentally run through:
  1. Is this a common problem? → Search npm/PyPI
  2. Is there an MCP for this? → Check
    ~/.claude/settings.json
    and search
  3. Is there a skill for this? → Check
    ~/.claude/skills/
  4. Is there a GitHub template? → Search GitHub
在编写工具类或添加功能前,在脑中快速过一遍:
  1. 这是常见问题吗?→ 搜索npm/PyPI
  2. 有没有对应的MCP?→ 查看
    ~/.claude/settings.json
    并搜索
  3. 有没有对应的skill?→ 查看
    ~/.claude/skills/
  4. 有没有GitHub模板?→ 搜索GitHub

Full Mode (agent)

完整模式(Agent)

For non-trivial functionality, launch the researcher agent:
Task(subagent_type="general-purpose", prompt="
  Research existing tools for: [DESCRIPTION]
  Language/framework: [LANG]
  Constraints: [ANY]

  Search: npm/PyPI, MCP servers, Claude Code skills, GitHub
  Return: Structured comparison with recommendation
")
对于非 trivial 的功能,启动研究员Agent:
Task(subagent_type="general-purpose", prompt="
  Research existing tools for: [DESCRIPTION]
  Language/framework: [LANG]
  Constraints: [ANY]

  Search: npm/PyPI, MCP servers, Claude Code skills, GitHub
  Return: Structured comparison with recommendation
")

Search Shortcuts by Category

按类别划分的搜索快捷方式

Development Tooling

开发工具链

  • Linting →
    eslint
    ,
    ruff
    ,
    textlint
    ,
    markdownlint
  • Formatting →
    prettier
    ,
    black
    ,
    gofmt
  • Testing →
    jest
    ,
    pytest
    ,
    go test
  • Pre-commit →
    husky
    ,
    lint-staged
    ,
    pre-commit
  • 代码检查 →
    eslint
    ,
    ruff
    ,
    textlint
    ,
    markdownlint
  • 代码格式化 →
    prettier
    ,
    black
    ,
    gofmt
  • 测试 →
    jest
    ,
    pytest
    ,
    go test
  • 提交前检查 →
    husky
    ,
    lint-staged
    ,
    pre-commit

AI/LLM Integration

AI/LLM集成

  • Claude SDK → Context7 for latest docs
  • Prompt management → Check MCP servers
  • Document processing →
    unstructured
    ,
    pdfplumber
    ,
    mammoth
  • Claude SDK → Context7 获取最新文档
  • 提示词管理 → 检查MCP服务器
  • 文档处理 →
    unstructured
    ,
    pdfplumber
    ,
    mammoth

Data & APIs

数据与API

  • HTTP clients →
    httpx
    (Python),
    ky
    /
    got
    (Node)
  • Validation →
    zod
    (TS),
    pydantic
    (Python)
  • Database → Check for MCP servers first
  • HTTP客户端 →
    httpx
    (Python),
    ky
    /
    got
    (Node)
  • 校验 →
    zod
    (TS),
    pydantic
    (Python)
  • 数据库 → 先检查MCP服务器

Content & Publishing

内容与发布

  • Markdown processing →
    remark
    ,
    unified
    ,
    markdown-it
  • Image optimization →
    sharp
    ,
    imagemin
  • Markdown处理 →
    remark
    ,
    unified
    ,
    markdown-it
  • 图片优化 →
    sharp
    ,
    imagemin

Integration Points

集成点

With planner agent

与规划师Agent集成

The planner should invoke researcher before Phase 1 (Architecture Review):
  • Researcher identifies available tools
  • Planner incorporates them into the implementation plan
  • Avoids "reinventing the wheel" in the plan
规划师应在阶段1(架构评审)前调用研究员:
  • 研究员识别可用工具
  • 规划师将其纳入实现计划
  • 避免在计划中「重复造轮子」

With architect agent

与架构师Agent集成

The architect should consult researcher for:
  • Technology stack decisions
  • Integration pattern discovery
  • Existing reference architectures
架构师应向研究员咨询:
  • 技术栈决策
  • 集成模式探索
  • 现有参考架构

With iterative-retrieval skill

与迭代检索skill集成

Combine for progressive discovery:
  • Cycle 1: Broad search (npm, PyPI, MCP)
  • Cycle 2: Evaluate top candidates in detail
  • Cycle 3: Test compatibility with project constraints
结合使用以进行渐进式发现:
  • 第一轮:广泛搜索(npm、PyPI、MCP)
  • 第二轮:详细评估顶级候选方案
  • 第三轮:测试与项目约束的兼容性

Examples

示例

Example 1: "Add dead link checking"

示例1:「添加死链检查功能」

Need: Check markdown files for broken links
Search: npm "markdown dead link checker"
Found: textlint-rule-no-dead-link (score: 9/10)
Action: ADOPT — npm install textlint-rule-no-dead-link
Result: Zero custom code, battle-tested solution
需求:检查Markdown文件中的死链
搜索:npm "markdown dead link checker"
找到:textlint-rule-no-dead-link(评分:9/10)
行动:直接采用 — npm install textlint-rule-no-dead-link
结果:零自定义代码,经过实战检验的解决方案

Example 2: "Add HTTP client wrapper"

示例2:「添加HTTP客户端封装」

Need: Resilient HTTP client with retries and timeout handling
Search: npm "http client retry", PyPI "httpx retry"
Found: got (Node) with retry plugin, httpx (Python) with built-in retry
Action: ADOPT — use got/httpx directly with retry config
Result: Zero custom code, production-proven libraries
需求:具备重试和超时处理的高可用HTTP客户端
搜索:npm "http client retry", PyPI "httpx retry"
找到:got(Node)带重试插件,httpx(Python)内置重试功能
行动:直接采用 — 直接使用got/httpx并配置重试
结果:零自定义代码,生产环境验证的库

Example 3: "Add config file linter"

示例3:「添加配置文件检查器」

Need: Validate project config files against a schema
Search: npm "config linter schema", "json schema validator cli"
Found: ajv-cli (score: 8/10)
Action: ADOPT + EXTEND — install ajv-cli, write project-specific schema
Result: 1 package + 1 schema file, no custom validation logic
需求:根据Schema验证项目配置文件
搜索:npm "config linter schema", "json schema validator cli"
找到:ajv-cli(评分:8/10)
行动:直接采用+扩展 — 安装ajv-cli,编写项目专属Schema
结果:1个包 + 1个Schema文件,无需自定义校验逻辑

Anti-Patterns

反模式

  • Jumping to code: Writing a utility without checking if one exists
  • Ignoring MCP: Not checking if an MCP server already provides the capability
  • Over-customizing: Wrapping a library so heavily it loses its benefits
  • Dependency bloat: Installing a massive package for one small feature
  • 直接写代码:不检查是否已有工具类就直接编写
  • 忽略MCP:不检查MCP服务器是否已提供该能力
  • 过度自定义:对库进行过度封装,使其失去原有优势
  • 依赖膨胀:为了一个小功能安装大型包