grepai-search-basics
Basic semantic code search with GrepAI. Use this skill to learn fundamental search commands and concepts.
By yoanbernabeu · 833 installs
npx skills add yoanbernabeu/grepai-skills --skill grepai-search-basics
Source repository · Upstream listing
GrepAI Search Basics
This skill covers the fundamentals of semantic code search with GrepAI.
When to Use This Skill
Learning GrepAI search
Performing basic code searches
Understanding semantic vs. text search
Interpreting search results
Prerequisites
1. GrepAI initialized ( grepai init )
2. Index created ( grepai watch )
3. Embedding provider running (Ollama, etc.)
What is Semantic Search?
Unlike traditional text search (grep, ripgrep), GrepAI searches by meaning :
Type How it Works Example
Text search Exact string match "login" → finds "login"
Semantic search Meaning similarity "authenticate user" → finds login, auth, signin code
Basic Search Command
Example
Output:
Understanding Results
Result Format
Component Meaning
Score Similarity (0.0 to 1.0, higher = more relevant)
File path Location of the code
Line numbers Start end lines of the chunk
Content The actual code
Score Interpretation
Score Meaning
0.90+ Excellent match
0.80 0.89 Good match
0.70 0.79 Related
0.60 0.69 Loosely related
<0.60 Weak match
Limiting Results
By default, GrepAI returns 10 results. Adjust with limit :
Checking Index Status
Before searching, verify your index:
Output:
Search vs Grep Comparison
Traditional grep
Finds exact text "authenticate"
Misses synonyms (login, signin, auth)
Returns all matches, unranked
GrepAI search
Finds semantically similar code
Includes related concepts
Results ranked by relevance
What Makes a Good Query
Good Queries ✅
Describe the intent or behavior:
Less Effective Queries ❌
Too short or generic:
Natural Language Queries
GrepAI understands natural language:
Multiple Words vs Phrases
Both work, but phrases often get better results:
Quick Tips
1. Use English: Models are trained on English
2. Be specific: "JWT token validation" vs "validation"
3. Describe intent: What the code DOES, not what it's called
4. Use 3 7 words: Enough context, not too verbose
5. Iterate: Refine query based on results
Common Search Patterns
Finding Entry Points
Finding Error Handling
Finding Data Access
Finding Business Logic
Troubleshooting
❌ Problem: No results
✅ Solutions:
Check index exists: grepai status
Run grepai watch if index is empty
Simplify query
❌ Problem: Irrelevant results
✅ Solutions:
Be more specific
Use different words
Check if code exists in the codebase
❌ Problem: Missing expected code
✅ Solutions:
Check if file is ignored in config
Ensure file extension is supported
Re index: rm .grepai/index.gob && grepai watch
Output Format
Successful basic search: