Communitygithub.com

search-first

先研究后编码的工作流。在编写自定义代码之前,搜索现有的工具、库和模式。调用研究员智能体。

search-first 是什么?

search-first 技能系统化地执行“先搜索现有解决方案,再实现”的工作流程。它适用于开始新功能、添加依赖或集成、以及避免重复造轮子的场景。该技能通过分步工作流驱动:首先检查搜索工具的可用性(预检),然后进行需求分析,接着并行搜索多个渠道(如 npm、PyPI、MCP 服务器、GitHub 和 Web),并对候选方案进行评估(考虑功能性、维护状态、社区、文档、许可证和依赖)。最终,它引导用户做出采用、扩展/包装或自定义构建的决策。该技能支持多种平台(Claude Code、Coder、Codex 等),并提供快速模式(内联检查)和完整模式(启动研究员智能体)两种使用方式。它还与规划器、架构师智能体以及迭代检索技能深度集成,确保整个开发流程中始终优先利用现有资源。

兼容平台✓Claude Code✓Codex CLI~Cursor
npx skills add https://github.com/affaan-m/everything-claude-code/tree/main/skills/search-first

在你喜欢的 AI 中提问

打开一个已预加载此 Agent Skill 的新对话。

文档

/search-first —— 先研究,再编码

系统化地执行“在实现之前搜索现有解决方案”的工作流程。

触发条件

在以下情况使用此技能:

  • 开始一个可能存在现有解决方案的新功能
  • 添加依赖或集成
  • 用户要求“添加 X 功能”,而你正准备编写代码
  • 在创建新的工具函数、助手或抽象层之前

工作流程

┌─────────────────────────────────────────────┐
│  0. 工具可用性预检                          │
│     在依赖搜索渠道之前检查其可用性;          │
│     如实报告跳过的渠道                      │
├─────────────────────────────────────────────┤
│  1. 需求分析                                │
│     定义所需功能                            │
│     识别语言/框架约束                       │
├─────────────────────────────────────────────┤
│  2. 并行搜索(研究员智能体)                │
│     ┌──────────┐ ┌──────────┐ ┌──────────┐  │
│     │  npm /   │ │  MCP /   │ │  GitHub / │  │
│     │  PyPI    │ │  技能     │ │  Web      │  │
│     └──────────┘ └──────────┘ └──────────┘  │
├─────────────────────────────────────────────┤
│  3. 评估                                    │
│     对候选方案打分(功能、维护性、            │
│     社区、文档、许可证、依赖)                │
├─────────────────────────────────────────────┤
│  4. 决策                                    │
│     ┌─────────┐  ┌──────────┐  ┌─────────┐  │
│     │  直接    │  │  扩展    │  │  自定义  │  │
│     │  采用    │  │  /包装   │  │  构建    │  │
│     └─────────┘  └──────────┘  └─────────┘  │
├─────────────────────────────────────────────┤
│  5. 实现                                    │
│     安装包 / 配置 MCP /                    │
│     编写最少的自定义代码                     │
└─────────────────────────────────────────────┘

决策矩阵

信号行动
完全匹配、维护良好、MIT/Apache 许可证直接采用 —— 安装并直接使用
部分匹配、基础良好扩展 —— 安装并编写薄包装层
多个弱匹配组合 —— 结合 2-3 个小包
未找到合适的方案构建自定义 —— 但在研究指导下编写

使用方法

第 0 步:工具可用性预检

这是智能体指导,而非可执行的设置脚本。仅检查与当前任务和项目相关的渠道。

渠道检查方法如果缺失
仓库搜索rg --files 和定向的 rg 查询说明仅检查了可见文件
包注册表npm --version、python -m pip --version 或项目包管理器使用网页/文档搜索,避免声称覆盖了注册表
GitHub CLIgh auth status仅使用公共网页或本地 Git 历史
MCP/文档工具可用的工具列表或本地 MCP 配置回退到官方文档/网页搜索
技能目录在适用时运行 ls ~/.claude/skills ~/.codex/skills说明没有可用的本地技能目录

快速模式(内联)

在编写工具函数或添加功能之前,快速在头脑中过一遍:

  1. 仓库中是否已存在? —— 先用 rg 搜索相关模块/测试
  2. 这是常见问题吗? —— 搜索 npm/PyPI
  3. 有对应的 MCP 吗? —— 检查 ~/.claude/settings.json 并搜索
  4. 有对应的技能吗? —— 检查 ~/.claude/skills/
  5. 有 GitHub 实现/模板吗? —— 在编写全新代码前,先进行 GitHub 代码搜索,寻找维护良好的开源方案

完整模式(智能体)

对于非简单的功能,启动研究员智能体:

Agent(subagent_type="general-purpose", prompt="
  研究现有工具: [描述]
  语言/框架: [语言]
  约束: [任何]

  搜索:npm/PyPI、MCP 服务器、Claude Code 技能、GitHub
  返回:结构化对比并给出推荐
")

较旧的 Claude Code 文档可能将此称为 Task(...);请使用当前活动工具集暴露的智能体/子智能体工具名称。

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

开发工具

  • 代码检查 → eslint、ruff、textlint、markdownlint
  • 格式化 → prettier、black、gofmt
  • 测试 → jest、pytest、go test
  • 预提交 → husky、lint-staged、pre-commit

AI/LLM 集成

  • Claude SDK → Context7 获取最新文档
  • 提示管理 → 检查 MCP 服务器
  • 文档处理 → unstructured、pdfplumber、mammoth

数据与 API

  • HTTP 客户端 → httpx (Python)、ky/undici (Node)
  • 验证 → zod (TS)、pydantic (Python)
  • 数据库 → 首先检查 MCP 服务器

内容与发布

  • Markdown 处理 → remark、unified、markdown-it
  • 图像优化 → sharp、imagemin

集成点

与规划器智能体集成

规划器应在第一阶段(架构审查)之前调用研究员:

  • 研究员识别可用的工具
  • 规划器将其纳入实现计划
  • 避免在计划中“重复造轮子”

与架构师智能体集成

架构师应咨询研究员以进行:

  • 技术栈决策
  • 集成模式发现
  • 现有的参考架构

与迭代检索技能集成

结合使用以实现渐进式发现:

  • 循环 1:广泛搜索(npm、PyPI、MCP)
  • 循环 2:详细评估顶级候选方案
  • 循环 3:测试与项目约束的兼容性

示例

示例 1:“添加死链检查”

需求:检查 Markdown 文件中的损坏链接
搜索:npm "markdown dead link checker"
找到:textlint-rule-no-dead-link(评分:9/10)
行动:直接采用 —— npm install textlint-rule-no-dead-link
结果:零自定义代码,经过实战检验的解决方案

示例 2:“添加 HTTP 客户端包装”

需求:具有重试和超时处理功能的弹性 HTTP 客户端
搜索:npm "http client retry"、PyPI "httpx retry"
找到:got (Node) 带重试插件、httpx (Python) 内置重试功能
行动:直接采用 —— 使用 got/httpx 并配置重试
结果:零自定义代码,生产级库

示例 3:“添加配置文件检查器”

需求:根据架构验证项目配置文件
搜索:npm "config linter schema"、"json schema validator cli"
找到:ajv-cli(评分:8/10)
行动:直接采用 + 扩展 —— 安装 ajv-cli,编写项目特定的架构文件
结果:1 个包 + 1 个架构文件,无自定义验证逻辑

反模式

  • 直接写代码:不检查现有工具就直接编写工具函数
  • 忽略 MCP:不检查 MCP 服务器是否已提供所需能力
  • 静默跳过:当搜索渠道不可用时,却报告“未找到任何内容”
  • 过度定制:包装库过重,以至于失去了它带来的好处
  • 依赖膨胀:为一个小功能安装一个庞大的包

Individual skills in this repo

This repo contains 20 individual skills — each has its own dedicated page.

accessibility

Design, implement, and audit inclusive digital products using WCAG 2.2 Level AA. Use when building or auditing UI that must meet WCAG 2.2 Level AA, or when reviewing a change for keyboard, contrast, or screen-reader support.

affaan-m/claude-api

Anthropic Claude API patterns for Python and TypeScript. Covers Messages API, streaming, tool use, vision, extended thinking, batches, prompt caching, and Claude Agent SDK. Use when building applications with the Claude API or Anthropic SDKs.

affaan-m/everything-claude-code

End-to-end marketing campaign planning and execution. Covers audience research, positioning, campaign angle definition, landing page copy, email sequences, social posts, ad copy, short-form video scripts, and content calendars. Use as the orchestration layer for multi-channel product launches. Use when planning or executing a multi-channel product launch, or producing landing page, email, social, or ad copy.

affaan-m/everything-claude-code

Development conventions and patterns for everything-claude-code. JavaScript project with conventional commits.

affaan-m/everything-claude-code-conventions

Development conventions and patterns for everything-claude-code. JavaScript project with conventional commits.

affaan-m/frontend-design

Create distinctive, production-grade frontend interfaces with high design quality. Use when the user asks to build web components, pages, or applications and the visual direction matters as much as the code quality.

affaan-m/gget

gget CLI and Python workflow for quick genomic database queries, sequence lookup, BLAST-style searches, enrichment checks, and reproducible bioinformatics evidence logs.

affaan-m/literature-review

Systematic literature-review workflow for academic, biomedical, technical, and scientific topics, including search planning, source screening, synthesis, citation checks, and evidence logging.

affaan-m/motion-ui

Production-ready UI motion system for React/Next.js. Use when implementing animations, transitions, or motion patterns.

affaan-m/project-guidelines-example

Example project-specific skill template based on a real production application.

affaan-m/pubmed-database

Direct PubMed and NCBI E-utilities search workflows for biomedical literature, MeSH queries, PMID lookup, citation retrieval, and API-backed literature monitoring.

affaan-m/scholar-evaluation

Structured scholarly-work evaluation for papers, proposals, literature reviews, methods sections, evidence quality, citation support, and research-writing feedback.

affaan-m/uspto-database

USPTO patent and trademark data workflow for official record lookup, PatentSearch queries, TSDR checks, assignment data, and reproducible IP research logs.

agent-architecture-audit

Full-stack diagnostic for agent and LLM applications. Audits the 12-layer agent stack for wrapper regression, memory pollution, tool discipline failures, hidden repair loops, and rendering corruption. Produces severity-ranked findings with code-first fixes. Essential for developers building agent applications, autonomous loops, or any LLM-powered feature. Use when an agent or LLM feature misbehaves and the failing layer is unknown, or before shipping an agent stack.

agent-eval

Head-to-head comparison of coding agents (Claude Code, Aider, Codex, etc.) on custom tasks with pass rate, cost, time, and consistency metrics. Use when choosing between coding agents, or when a change to an agent setup needs measured pass rate, cost, and time rather than an impression.

agent-harness-construction

Design and optimize AI agent action spaces, tool definitions, and observation formatting for higher completion rates. Use when defining or revising an agent

agentic-engineering

Operate as an agentic engineer using eval-first execution, decomposition, and cost-aware model routing. Use when planning or executing engineering work that agents will carry out end to end.

agentic-os

Build persistent multi-agent operating systems on Claude Code. Covers kernel architecture, specialist agents, slash commands, file-based memory, scheduled automation, and state management without external databases. Use when building a persistent multi-agent system on Claude Code with its own memory, commands, and scheduling.

agent-introspection-debugging

Structured self-debugging workflow for AI agent failures using capture, diagnosis, contained recovery, and introspection reports. Use when an agent run fails and you need a reproducible diagnosis instead of a retry.

agent-payment-x402

Add x402 payment execution to AI agents with per-task budgets, spending controls, and non-custodial wallets. Supports Base through agentwallet-sdk and X Layer through OKX Payments / OKX Agent Payments Protocol. Use when an agent must pay for something itself and needs per-task budgets, spending controls, and a non-custodial wallet.

相关技能