Notre avis
sgrep permet de rechercher du code par concept ou fonctionnalité en utilisant des requêtes en langage naturel, facilitant la navigation dans une base de code.
Points forts
- Compréhension sémantique du code, pas seulement du texte exact
- Support de filtres par langage et glob patterns
- Sortie JSON pour intégration avec des agents IA
- Indexation automatique et mode watch pour mises à jour en temps réel
Limites
- Nécessite une installation préalable (curl/sh)
- Dépend d'un modèle d'embeddings local, ce qui peut être lent ou bloqué dans certains environnements
- La qualité des résultats dépend de la taille et de la qualité de l'index
Utilisez sgrep lorsque vous devez trouver du code par sa signification, comme des schémas d'authentification, de gestion d'erreurs ou de connexion à une base de données.
Ne l'utilisez pas pour des recherches textuelles exactes rapides (préférez grep) ou si vous ne pouvez pas installer d'outils supplémentaires.
Analyse de sécurité
PrudenceThe skill instructs to install sgrep via curl pipe to sh from a GitHub URL. While the tool itself is likely safe, the installation method carries a risk of remote code execution if the source is tampered with. No destructive commands are otherwise present.
- •Uses curl|sh to install from an external URL without signature verification, which could execute arbitrary code if the remote script is compromised.
Exemples
Search the codebase for how user authentication is handled using sgrep.Search for error handling patterns in Rust files only using sgrep with language filter.Get a JSON-formatted result for retry logic patterns in the codebase using sgrep.name: sgrep description: Use sgrep for semantic code search. Use when you need to find code by meaning rather than exact text matching. Perfect for finding concepts like "authentication logic", "error handling patterns", or "database connection pooling". allowed-tools: ["Bash"]
sgrep - Semantic Code Search
Use sgrep to search code semantically using natural language queries. sgrep understands code meaning, not just text patterns.
When to Use
- Finding code by concept or functionality ("where do we handle authentication?")
- Discovering related code patterns ("show me retry logic")
- Exploring codebase structure ("how is the database connection managed?")
- Searching for implementation patterns ("where do we validate user input?")
Prerequisites
Ensure sgrep is installed:
curl -fsSL https://raw.githubusercontent.com/rika-labs/sgrep/main/scripts/install.sh | sh
Basic Usage
Search Command
sgrep search "your natural language query"
Common Patterns
Find functionality:
sgrep search "where do we handle user authentication?"
Search with filters:
sgrep search "error handling" --filters lang=rust
sgrep search "API endpoints" --glob "src/**/*.rs"
Get more results:
sgrep search "database queries" --limit 20
Show full context:
sgrep search "retry logic" --context
Command Options
--limit <n>or-n <n>: Maximum results (default: 10)--contextor-c: Show full chunk content instead of snippet--path <dir>or-p <dir>: Repository path (default: current directory)--glob <pattern>: File pattern filter (repeatable)--filters key=value: Metadata filters likelang=rust(repeatable)--json: Emit structured JSON output (agent-friendly)--threads <n>: Maximum threads for parallel operations--cpu-preset <preset>: CPU usage preset (auto|low|medium|high|background)
Indexing
If no index exists, sgrep will automatically create one on first search. To manually index:
sgrep index # Index current directory
sgrep index --force # Rebuild from scratch
Watch Mode
For real-time index updates during development:
sgrep watch # Watch current repo
sgrep watch --debounce-ms 200
Configuration
Check or create embedding provider configuration:
sgrep config # Show current configuration
sgrep config --init # Create default config file
sgrep config --show-model-dir # Show model cache directory
sgrep config --verify-model # Check if model files are present
sgrep uses local embeddings by default. Config lives at ~/.sgrep/config.toml.
If HuggingFace is blocked (e.g., in China), set HTTPS_PROXY environment variable or see the offline installation guide.
Examples
Find authentication code:
sgrep search "how do we authenticate users?"
Find error handling:
sgrep search "error handling patterns" --filters lang=rust
Search specific file types:
sgrep search "API rate limiting" --glob "src/**/*.rs"
Get detailed results:
sgrep search "database connection pooling" --context --limit 5
Agent-friendly JSON output:
sgrep search --json "retry logic"
Understanding Results
Results show:
- File path and line numbers: Where the code is located
- Score: Relevance score (higher is better)
- Semantic score: How well it matches the query meaning
- Keyword score: Text matching score
- Code snippet: Relevant code excerpt
Best Practices
- Use natural language: Ask questions like you would ask a colleague
- Be specific: "authentication middleware" is better than "auth"
- Combine with filters: Use
--filters lang=rustto narrow by language - Use globs:
--glob "src/**/*.rs"to search specific directories - Check context: Use
--contextwhen you need full function/class definitions - Use JSON for automation: Use
--jsonfor structured output in scripts
Expert Next.js App Router
Developpement
Un skill qui transforme Claude en expert Next.js App Router.
Générateur de README
Developpement
Crée des README.md professionnels et complets pour vos projets.
Rédacteur de Documentation API
Developpement
Génère de la documentation API complète au format OpenAPI/Swagger.