Communitygithub.com

search-first

在执行编码前先进行研究的自动化工作流程。搜索现有工具、库和模式,然后再编写自定义代码。会调用研究者代理。

search-first 是什么?

Search-first 是一种 AI 代理技能,它系统化地实施“先搜索现有解决方案,再编写代码”的工作流程。该工具的主要目标是避免重复造轮子,通过强制在实现新功能前先进行充分的研究,从而节省时间并提高代码质量。它适用于多种平台,包括 Claude Code、Cursor 和 Codex 等 AI 编码代理。该技能定义了五个阶段的工作流:预检查搜索渠道可用性、需求分析、并行搜索(通过 NPM/PyPI、MCP/技能目录、GitHub/网络)、评估候选方案,以及最终决定是直接采用、扩展、组合还是从头构建。此外,它还集成到了其他代理(如规划代理和架构代理)的工作流中,可以通过快速模式(内联思考)或完整模式(启动研究者代理)来使用,以结构化的方式减少过度定制和搜索渠道静默失败等反模式。

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

在你喜欢的 AI 中提问

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

文档

/search-first — 研究先于编码

系统化"在实现之前先搜索现有解决方案"的工作流程。

触发条件

在以下场景使用此技能:

  • 开始一个新功能,该功能很可能已有现成解决方案
  • 添加依赖项或集成
  • 用户要求"添加 X 功能",而你即将编写代码
  • 在创建新的工具函数、辅助方法或抽象层之前

工作流程

┌─────────────────────────────────────────────┐
│  0. 工具可用性预检                           │
│     在依赖搜索渠道之前先检查其可用性;        │
│     诚实报告跳过的渠道                        │
├─────────────────────────────────────────────┤
│  1. 需求分析                                 │
│     定义所需功能                             │
│     确定语言/框架约束                        │
├─────────────────────────────────────────────┤
│  2. 并行搜索(研究者代理)                   │
│     ┌──────────┐ ┌──────────┐ ┌──────────┐  │
│     │  npm /   │ │  MCP /   │ │ GitHub / │  │
│     │  PyPI    │ │  Skills  │ │  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(...);请使用当前活动工具集暴露的 agent/subagent 工具名称。

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

开发工具

  • 语法检查 → 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 (TypeScript)、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/content-engine

Create platform-native content systems for X, LinkedIn, TikTok, YouTube, newsletters, and repurposed multi-platform campaigns. Use when the user wants social posts, threads, scripts, content calendars, or one source asset adapted cleanly across platforms.

affaan-m/ECC

Multi-platform content distribution across X, LinkedIn, Threads, and Bluesky. Adapts content per platform using content-engine patterns. Never posts identical content cross-platform. Use when the user wants to distribute content across social platforms.

affaan-m/fal-ai-media

Unified media generation via fal.ai MCP — image, video, and audio. Covers text-to-image (Nano Banana), text/image-to-video (Seedance, Kling, Veo 3), text-to-speech (CSM-1B), and video-to-audio (ThinkSound). Use when the user wants to generate images, videos, or audio with AI.

affaan-m/manim-video

日本語翻訳:このファイルは manim-video 用の日本語翻訳が必要です

affaan-m/remotion-video-creation

Remotion のベストプラクティス - React で動画を作成する。3D、アニメーション、音声、字幕、チャート、トランジションなどをカバーするドメイン固有の29のルール。

affaan-m/video-editing

AI-assisted video editing workflows for cutting, structuring, and augmenting real footage. Covers the full pipeline from raw capture through FFmpeg, Remotion, ElevenLabs, fal.ai, and final polish in Descript or CapCut. Use when the user wants to edit video, cut footage, create vlogs, or build video content.

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.

agent-self-evaluation

Use after completing any non-trivial task. The agent self-rates its output on 5 axes — accuracy, completeness, clarity, actionability, conciseness — with concrete evidence per criterion. Produces a structured 1-5 scorecard with specific improvement suggestions.

agent-sort

Build an evidence-backed ECC install plan for a specific repo by sorting skills, commands, rules, hooks, and extras into DAILY vs LIBRARY buckets using parallel repo-aware review passes. Use when ECC should be trimmed to what a project actually needs instead of loading the full bundle.

ai-first-engineering

Engineering operating model for teams where AI agents generate a large share of implementation output. Use when setting team process, review gates, or ownership rules for a codebase largely written by agents.

ai-regression-testing

Regression testing strategies for AI-assisted development. Sandbox-mode API testing without database dependencies, automated bug-check workflows, and patterns to catch AI blind spots where the same model writes and reviews code. Use when adding regression coverage to AI-assisted code, or when the same model both wrote and reviewed a change.

android-clean-architecture

Clean Architecture patterns for Android and Kotlin Multiplatform projects — module structure, dependency rules, UseCases, Repositories, and data layer patterns. Use when structuring modules, layers, or data flow in an Android or KMP project.

angular-developer

Generates Angular code and provides architectural guidance. Trigger when creating projects, components, or services, or for best practices on reactivity (signals, linkedSignal, resource), forms, dependency injection, routing, SSR, accessibility (ARIA), animations, styling (component styles, Tailwind CSS), testing, or CLI tooling.

相关技能