search-first
affaan-m/ECC
Investiga las herramientas, bibliotecas y patrones existentes antes de escribir código personalizado, recurriendo a un agente investigador.
...Expandir todo/search-first — Investiga antes de programar
Sistematiza el flujo de trabajo de «buscar soluciones existentes antes de implementar».
Desencadenante
Utiliza esta habilidad cuando:
- Empieces a desarrollar una nueva funcionalidad para la que probablemente ya existan soluciones
- Añadas una dependencia o una integración
- El usuario pide «añadir la funcionalidad X» y estás a punto de escribir código
- Antes de crear una nueva utilidad, un helper o una abstracción
Flujo de trabajo
┌─────────────────────────────────────────────┐
│ 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 │
└─────────────────────────────────────────────┘
Matriz de decisión
| Señal | Acción |
|---|---|
| Coincidencia exacta, bien mantenido, MIT/Apache | Adoptar: instalar y utilizar directamente |
| Coincidencia parcial, buena base | Ampliar: instalar + escribir un envoltorio ligero |
| Varias coincidencias débiles | Componer: combinar 2-3 paquetes pequeños |
| No se ha encontrado nada adecuado | Crear: escribir código a medida, pero basándose en la investigación |
Cómo utilizarlo
Paso 0: Comprobación previa de la disponibilidad de herramientas
Se trata de una guía para el agente, no de un script de configuración ejecutable. Comprueba únicamente los canales que sean relevantes para la tarea y el proyecto que tienes entre manos.
| Canal | Comprobar | Si falta |
|---|---|---|
| Búsqueda en el repositorio | rg --files y las rg consultas |
Indicar que solo se han inspeccionado los archivos visibles |
| Registro de paquetes | npm --version, python -m pip --versiono gestor de paquetes del proyecto |
Utiliza la búsqueda en la web o en la documentación y evita afirmar que se ha revisado todo el registro |
| CLI de GitHub | gh auth status |
Utiliza únicamente el historial público de la web o el historial local de Git |
| Herramientas de MCP/documentación | Lista de herramientas disponibles o configuración local de MCP | Recurrir a la búsqueda en la web o en la documentación oficial |
| Directorio de habilidades | ls ~/.claude/skills ~/.codex/skills cuando proceda |
Supongamos que no hay ningún catálogo de habilidades local disponible |
Modo rápido (en línea)
Antes de escribir una utilidad o añadir una funcionalidad, plantéate mentalmente lo siguiente:
- ¿Existe esto ya en el repositorio? →
rgRevisa primero los módulos y pruebas relevantes - ¿Es un problema habitual? → Busca en npm/PyPI
- ¿Hay algún MCP para esto? → Comprueba
~/.claude/settings.jsony busca - ¿Hay alguna skill para esto? → Compruébalo
~/.claude/skills/ - ¿Existe alguna implementación o plantilla en GitHub? → Realiza una búsqueda de código en GitHub para encontrar software libre (OSS) mantenido antes de escribir código completamente nuevo
Modo completo (agente)
Para funcionalidades no triviales, inicia el agente de investigación:
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
")
La documentación antigua de Claude Code puede referirse a esto como Task(...); utiliza el nombre actual de la herramienta de agente/subagente
que muestra el entorno de pruebas activo.
Atajos de búsqueda por categoría
Herramientas de desarrollo
- Linting →
eslint,ruff,textlint,markdownlint - Formateo →
prettier,black,gofmt - Pruebas →
jest,pytest,go test - Pre-commit →
husky,lint-staged,pre-commit
Integración de IA/LLM
- SDK de Claude → Context7 para consultar la documentación más reciente
- Gestión de prompts → Comprueba los servidores MCP
- Procesamiento de documentos →
unstructured,pdfplumber,mammoth
Datos y API
- Clientes HTTP →
httpx(Python),ky/undici(Node) - Validación →
zod(TS),pydantic(Python) - Base de datos → Comprueba primero los servidores MCP
Contenido y publicación
- Procesamiento de Markdown →
remark,unified,markdown-it - Optimización de imágenes →
sharp,imagemin
Puntos de integración
Con el agente del planificador
El planificador debe invocar al investigador antes de la Fase 1 (Revisión de la arquitectura):
- El investigador identifica las herramientas disponibles
- El planificador las incorpora al plan de implementación
- Evita «reinventar la rueda» en el plan
Con el agente arquitecto
El arquitecto debe consultar al investigador para:
- Las decisiones sobre la pila tecnológica
- Identificación de patrones de integración
- Arquitecturas de referencia existentes
Con la habilidad de recuperación iterativa
Combinar para un descubrimiento progresivo:
- Ciclo 1: Búsqueda amplia (npm, PyPI, MCP)
- Ciclo 2: Evaluar en detalle los principales candidatos
- Ciclo 3: Comprobación de la compatibilidad con las restricciones del proyecto
Ejemplos
Ejemplo 1: «Añadir comprobación de enlaces rotos»
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
Ejemplo 2: «Añadir un envoltorio para el cliente 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
Ejemplo 3: «Añadir un linter para archivos de configuración»
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
Antipatrones
- Pasarse directamente al código: escribir una utilidad sin comprobar si ya existe una
- Ignorar el MCP: No comprobar si un servidor MCP ya ofrece esa funcionalidad
- Omisión silenciosa: informar de que «no se ha encontrado nada» cuando un canal de búsqueda no estaba disponible
- Personalización excesiva: envolver una biblioteca de tal manera que pierda sus ventajas
- Exceso de dependencias: instalar un paquete enorme para una sola función menor
---
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
Todos los archivos
1 archivosInstalar search-first
Descarga y descomprime los archivos de habilidades en tu directorio .claude/skills/.
Descargar ZIPClona el repositorio y copia los archivos de la habilidad a tu proyecto.
git clone https://github.com/affaan-m/ECC/tree/main/skills/search-first # Copy SKILL.md to your .claude/skills/ directory
Copiar





Hogar
