Automated summary
sgrep enables semantic code search using natural language queries, allowing you to find code based on meaning rather than exact text matches.
Strengths
- Understands code semantics, not just literal text
- Supports language filters and glob patterns for precise searches
- Provides JSON output for AI agent integration
- Auto-indexing and watch mode for real-time updates
Limitations
- Requires prior installation via curl/sh
- Relies on a local embedding model, which can be slow or blocked in some environments
- Search quality depends on index size and quality
Use sgrep when you need to locate code by concept or functionality, such as authentication logic, error handling patterns, or database connection pooling.
Do not use it for quick exact-text searches (prefer grep) or when you cannot install additional tools.
Security analysis
CautionThe 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.
Examples
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
From the file to a first result
The download contains exactly the content displayed on this page. This copy may differ from the latest version in the source repository.
View the source and supporting filesThis download contains SKILL.md only. Any scripts, references, templates and dependencies are not included. Get the required files from the source, preserving their directory structure, before continuing.
1. Download the file
Download SKILL.mdFrom the root of a test project, save the file as .skill-downloads/sgrep-semantic-code-search-mm5t8b5a/SKILL.md, or use the command below. This folder is for inspecting the skill before installation.
Command for macOS/Linux or WSL: requires a POSIX shell and curl. On Windows without WSL, use the download button and create the folder manually.
mkdir -p '.skill-downloads/sgrep-semantic-code-search-mm5t8b5a' && curl --fail --show-error --location 'https://skills-guides.com/api/skills/sgrep-semantic-code-search-mm5t8b5a/download' --output '.skill-downloads/sgrep-semantic-code-search-mm5t8b5a/SKILL.md.part' && mv '.skill-downloads/sgrep-semantic-code-search-mm5t8b5a/SKILL.md.part' '.skill-downloads/sgrep-semantic-code-search-mm5t8b5a/SKILL.md'2. Check prerequisites
Read SKILL.md before using it. If it references scripts or external services, inspect them and prepare the required access in your test environment.
Original excerpt: Prerequisites
Ensure sgrep is installed:
curl -fsSL https://raw.githubusercontent.com/rika-labs/sgrep/main/scripts/install.sh | sh
The platforms on this page are catalog indications. The paths below follow tool documentation; they do not prove this skill has been run in those tools. No minimum tool version is confirmed for this listing.
3. Load the skill
After inspection, copy the complete folder into your project using one of the commands below, then open a new tool session. The command stops if a folder with the same name already exists: compare the files before replacing it.
Claude Code
test -f '.skill-downloads/sgrep-semantic-code-search-mm5t8b5a/SKILL.md' && test -s '.skill-downloads/sgrep-semantic-code-search-mm5t8b5a/SKILL.md' && mkdir -p '.claude/skills' && test ! -e '.claude/skills/sgrep' && cp -R '.skill-downloads/sgrep-semantic-code-search-mm5t8b5a' '.claude/skills/sgrep'Cursor
test -f '.skill-downloads/sgrep-semantic-code-search-mm5t8b5a/SKILL.md' && test -s '.skill-downloads/sgrep-semantic-code-search-mm5t8b5a/SKILL.md' && mkdir -p '.cursor/skills' && test ! -e '.cursor/skills/sgrep' && cp -R '.skill-downloads/sgrep-semantic-code-search-mm5t8b5a' '.cursor/skills/sgrep'Codex
test -f '.skill-downloads/sgrep-semantic-code-search-mm5t8b5a/SKILL.md' && test -s '.skill-downloads/sgrep-semantic-code-search-mm5t8b5a/SKILL.md' && mkdir -p '.agents/skills' && test ! -e '.agents/skills/sgrep' && cp -R '.skill-downloads/sgrep-semantic-code-search-mm5t8b5a' '.agents/skills/sgrep'OpenSkills
OpenSkills must already be installed. The local install/read procedure is checked with OpenSkills 1.5.0, which requires Node.js ≥ 20.6.0. Catalog slugs are not resolved automatically.
Official OpenSkills installationopenskills install './.skill-downloads/sgrep-semantic-code-search-mm5t8b5a'openskills read 'sgrep-semantic-code-search-mm5t8b5a'Reading should display the installed file content and its base directory. It does not run the skill or install its dependencies.
For an agent that reads AGENTS.md, then sync the index. This command changes AGENTS.md: review the diff before using it.
openskills syncManual method or another tool: attach SKILL.md to a conversation, or open it in an agent that can read files. Include any required supporting resources. No universal folder is recognized by every tool.
4. Try a first task
Use a short, synthetic input: an API endpoint, a small document or an interface brief. In a new conversation, attach the file or give the agent its path, then adapt this request:
Read .skill-downloads/sgrep-semantic-code-search-mm5t8b5a/SKILL.md and apply its instructions to this example: [describe a test input]. Identify any missing files, dependencies or access. Produce the result requested by the skill without inventing data or running unreviewed scripts.Expected result: output matching the skill instructions, or a precise list of missing prerequisites. A read confirmation alone does not validate a first use. If an external resource is unavailable, that path remains untested.
React Hook Form Best Practices
Development
Master React Hook Form: avoid anti-patterns, manage subscriptions, and handle reset, dirty state, and controlled inputs correctly.
Emotion to Mantine Migration
Development
Migrate Emotion styled-components to Mantine components with style props and CSS modules. Use when converting .styled.tsx files or removing @emotion imports.
Scope Creep Detector
Development
Analyzes git diffs against a stated intent to detect scope creep, unrelated files, broad PRs, and oversized changes, then suggests keep, split, or justify actions.