search-first
affaan-m/ECC
カスタムコードを記述する前に、リサーチエージェントを呼び出して、既存のツール、ライブラリ、およびパターンを調査する。
...すべて拡張します/search-first — コーディングの前に調査を
「実装する前に既存の解決策を探す」というワークフローを体系化します。
トリガー
次のような場合にこのスキルを活用してください:
- 既存の解決策が存在しそうな新機能の開発を始める際
- 依存関係や連携機能を追加する場合
- ユーザーから「X機能を追加してほしい」と依頼され、コードを記述しようとしている場合
- 新しいユーティリティ、ヘルパー、または抽象化クラスを作成する前
ワークフロー
┌─────────────────────────────────────────────┐
│ 0. TOOL AVAILABILITY PREFLIGHT │
│ Check search channels before relying on │
│ them; report skipped channels honestly │
├─────────────────────────────────────────────┤
│ 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 │
└─────────────────────────────────────────────┘
意思決定マトリックス
| シグナル | アクション |
|---|---|
| 完全一致、メンテナンスがしっかり行われている、MIT/Apache | 採用 — 直接インストールして使用 |
| 部分的に一致、基盤が良好 | 拡張 — インストール+簡易ラッパーの作成 |
| 複数の弱い適合 | 組み立て — 2~3つの小さなパッケージを組み合わせる |
| 適切なものは見つかりませんでした | ビルド — 独自に実装するが、調査結果を参考にする |
使用方法
ステップ0:ツールの利用可能性の事前確認
これはエージェント向けのガイダンスであり、実行可能なセットアップスクリプトではありません。現在取り組んでいるタスクやプロジェクトに関連するチャネルのみを確認してください。
| チャネル | 確認項目 | 欠落している場合 |
|---|---|---|
| リポジトリ検索 | rg --files および対象となる rg クエリ |
表示されているファイルのみが検査されたことを明記する |
| パッケージレジストリ | npm --version, python -m pip --version、またはプロジェクトのパッケージマネージャー |
Web/ドキュメント検索を使用し、レジストリの網羅性を主張しない |
| GitHub CLI | gh auth status |
パブリックなWebまたはローカルのGit履歴のみを使用する |
| MCP/ドキュメントツール | 利用可能なツール一覧またはローカルの MCP 設定 | 公式ドキュメントやWeb検索に切り替える |
| スキルディレクトリ | ls ~/.claude/skills ~/.codex/skills 該当する場合 |
ローカルのスキルカタログが利用できない場合 |
クイックモード(インライン)
ユーティリティを作成したり機能を追加したりする前に、頭の中で次のことを確認してください:
- リポジトリにすでに存在するか? →
rgまずは関連するモジュールやテストを調べてみてください - これはよくある問題か? → npm/PyPIで検索
- これに対応するMCPはあるか? → 確認
~/.claude/settings.json確認し、検索する - これに関するスキルはありますか? → 確認
~/.claude/skills/ - GitHubに実装例やテンプレートはあるか? → 新規コードを書く前に、メンテナンスされているOSSについてGitHubコード検索を実行する
フルモード(エージェント)
複雑な機能については、researcherエージェントを起動してください:
Agent(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
")
古い 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(アーキテクチャレビュー)の前にリサーチャーを呼び出す必要があります:
- リサーチャーが利用可能なツールを特定する
- プランナーはそれらを実装計画に組み込む
- 計画における「車輪の再発明」を回避する
アーキテクト・エージェントとの連携
アーキテクトは、以下の事項についてリサーチャーに相談すべきです:
- 技術スタックの決定
- 統合パターンの特定
- 既存の参照アーキテクチャ
反復的検索スキルを活用して
これらを組み合わせて段階的な発見を行う:
- サイクル1:広範囲な検索(npm、PyPI、MCP)
- サイクル2:上位候補を詳細に評価
- サイクル3:プロジェクトの制約条件との互換性をテスト
例
例 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
例 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
例 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
アンチパターン
- いきなりコードから始める:既存のユーティリティがあるかどうかを確認せずに作成してしまう
- MCPの無視:MCPサーバーがすでにその機能を提供しているかどうかを確認しない
- サイレントスキップ:検索チャネルが利用できない場合に「何も見つかりませんでした」と報告する
- 過度なカスタマイズ:ライブラリを過度にラップし、その利点を失ってしまう
- 依存関係の肥大化:1つの小さな機能のために巨大なパッケージをインストールすること
---
name: search-first
description: Research existing tools, libraries, and patterns before writing custom code by invoking a researcher agent.
---
# /search-first — Research Before You Code
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
## Workflow
```
┌─────────────────────────────────────────────┐
│ 0. TOOL AVAILABILITY PREFLIGHT │
│ Check search channels before relying on │
│ them; report skipped channels honestly │
├─────────────────────────────────────────────┤
│ 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 │
└─────────────────────────────────────────────┘
```
## Decision Matrix
| Signal | Action |
|--------|--------|
| Exact match, well-maintained, MIT/Apache | **Adopt** — install and use directly |
| Partial match, good foundation | **Extend** — install + write thin wrapper |
| Multiple weak matches | **Compose** — combine 2-3 small packages |
| Nothing suitable found | **Build** — write custom, but informed by research |
## How to Use
### Step 0: Tool Availability Preflight
This is agent guidance, not an executable setup script. Check only the channels
that are relevant to the task and project in front of you.
| Channel | Check | If missing |
|---------|-------|------------|
| Repository search | `rg --files` and targeted `rg` queries | State that only visible files were inspected |
| Package registry | `npm --version`, `python -m pip --version`, or project package manager | Use web/docs search and avoid claiming registry coverage |
| GitHub CLI | `gh auth status` | Use public web or local git history only |
| MCP/docs tools | Available tool list or local MCP config | Fall back to official docs/web search |
| Skills directory | `ls ~/.claude/skills ~/.codex/skills` where applicable | Say no local skill catalog was available |
### Quick Mode (inline)
Before writing a utility or adding functionality, mentally run through:
0. Does this already exist in the repo? → `rg` through relevant modules/tests first
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 implementation/template? → Run GitHub code search for maintained OSS before writing net-new code
### Full Mode (agent)
For non-trivial functionality, launch the researcher agent:
```
Agent(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
")
```
Older Claude Code docs may call this `Task(...)`; use the current agent/subagent
tool name exposed by the active harness.
## 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`
### AI/LLM Integration
- Claude SDK → Context7 for latest docs
- Prompt management → Check MCP servers
- Document processing → `unstructured`, `pdfplumber`, `mammoth`
### Data & APIs
- HTTP clients → `httpx` (Python), `ky`/`undici` (Node)
- Validation → `zod` (TS), `pydantic` (Python)
- Database → Check for MCP servers first
### Content & Publishing
- Markdown processing → `remark`, `unified`, `markdown-it`
- Image optimization → `sharp`, `imagemin`
## Integration Points
### With planner 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
### With architect agent
The architect should consult researcher for:
- Technology stack decisions
- Integration pattern discovery
- Existing reference architectures
### With iterative-retrieval 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
## Examples
### Example 1: "Add dead link checking"
```
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
```
### Example 2: "Add HTTP client wrapper"
```
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
```
### Example 3: "Add config file linter"
```
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
```
## 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
- **Silent skipping**: Reporting "nothing found" when a search channel was unavailable
- **Over-customizing**: Wrapping a library so heavily it loses its benefits
- **Dependency bloat**: Installing a massive package for one small feature
すべてのファイル
1件のファイルsearch-firstをインストール
スキルファイルをダウンロードし、.claude/skills/ ディレクトリに解凍してください。
ZIPをダウンロードリポジトリをクローンし、スキルファイルをプロジェクトにコピーしてください。
git clone https://github.com/affaan-m/ECC/tree/main/skills/search-first # Copy SKILL.md to your .claude/skills/ directory
コピー





家
