GrepAI Search Tips
This skill provides tips and best practices for writing effective semantic search queries.
When to Use This Skill
- Improving search result quality
- Learning semantic search techniques
- Understanding how to phrase queries
- Troubleshooting poor search results
Semantic Search Mindset
Think differently from text search:
Query Writing Principles
1. Describe Intent, Not Implementation
❌ Bad: getUserById
✅ Good: fetch user record from database using ID
❌ Bad: handleError
✅ Good: error handling and response to client
❌ Bad: validateInput
✅ Good: check if user input is valid and safe
2. Use Descriptive Language
❌ Bad: auth
✅ Good: user authentication and authorization
❌ Bad: db
✅ Good: database connection and queries
❌ Bad: config
✅ Good: application configuration loading
3. Be Specific About Context
❌ Bad: validation
✅ Good: validate email address format
❌ Bad: parse
✅ Good: parse JSON request body
❌ Bad: send
✅ Good: send email notification to user
4. Use 3-7 Words
5. Use English
Embedding models are trained primarily on English:
❌ authentification utilisateur (French)
✅ user authentication
Even if your code comments are in another language, English queries work best.
Query Patterns
Finding Code by Behavior
Finding Code by Purpose
Finding Error Handling
Finding Data Operations
Finding Configuration
Finding Security Code
Iterative Refinement
If results aren't good, iterate:
Start Broad
Add Context
Be Specific
Using Synonyms
Semantic search understands synonyms. Try different phrasings:
Domain-Specific Terms
Use your domain vocabulary:
Question-Style Queries
Natural questions work well:
Avoiding Common Mistakes
❌ Don't Use Exact Function Names
If you know the exact name, use grep:
GrepAI is for when you don't know the exact name:
❌ Don't Be Too Abstract
❌ Don't Use Code Syntax
❌ Don't Over-Specify
Interpreting Results
High Scores (0.85+)
Strong match. The code likely does what you described.
Medium Scores (0.70-0.84)
Related code. May be what you want, or adjacent functionality.
Low Scores (0.60-0.69)
Loosely related. Consider refining your query.
Very Low Scores (<0.60)
Weak match. The concept may not exist in the codebase, or query needs rework.
When GrepAI Doesn't Find Results
- Check the index:
grepai status - Verify files are indexed: Not in ignore patterns?
- Try simpler query: Remove specificity
- Try different words: Use synonyms
- Check if code exists: Maybe it doesn't yet!
Quick Reference Card
Output Format
Tips summary:


