search-first

Enforce a search-first protocol using glob and grep_search before code modification.

Updated Mar 19, 2026
One-click install
npx skills add https://github.com/espensev/ai-skills --skill search-first-espensev
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: search-first
Source: https://github.com/espensev/ai-skills/tree/main/gemini-skills/skills/search-first
Command: npx skills add https://github.com/espensev/ai-skills --skill search-first-espensev

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Enforces a strict search-before-write policy to prevent duplicating existing logic, missing established patterns, or ignoring existing tests.

Core Features & Use Cases

  • Define need and scope before coding to avoid rework.
  • Search the codebase using glob-like searches and code-lookups to locate existing implementations and tests.
  • Reuse or adapt existing utilities and patterns, reducing risk and maintenance cost.
  • Use case: a developer starts a new feature and first checks for similar utilities to reuse, ensuring new work aligns with established patterns.

Quick Start

Apply the search-first protocol before coding new utilities to ensure existing implementations are reused.

Frequently Asked Questions about search-first

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I prevent duplicate logic when adding new features to an existing codebase?

To prevent duplicate logic, enforce a search-first approach using glob and grep_search to locate existing utilities and patterns before writing new code. This ensures you reuse established implementations and align new work with existing structures.

What is a search-first protocol for refactoring and feature development?

A search-first protocol is a strict policy requiring developers to search for existing functions and tests before modifying the codebase. It involves defining need and scope, running code lookups, and analyzing reuse opportunities to reduce maintenance risk.

How do I find existing utilities and tests before modifying code?

Find existing utilities and tests by executing glob-like searches and code-lookups across the repository. This discovery phase identifies established patterns and test coverage, allowing you to adapt current implementations instead of creating redundant ones.

Does a search-before-write policy work for large code repositories?

Yes, applying a search-before-write policy scales to large code repositories by using glob and grep_search tools to locate established patterns. It prevents redundant work by enforcing a reuse-first analysis phase before any code modification occurs.

Why should I search for existing patterns before writing new code?

You should search for existing patterns to avoid duplicating logic and missing established tests. Reusing or adapting current utilities reduces rework, lowers maintenance costs, and minimizes risk by ensuring new features align with the codebase.