Back to Skills

sgrep

verified

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".

View on GitHub

Marketplace

sgrep

Rika-Labs/sgrep

Plugin

sgrep

search

Repository

Rika-Labs/sgrep
35stars

plugins/sgrep/skills/sgrep/SKILL.md

Last Verified

January 20, 2026

Install Skill

Select agents to install to:

Scope:
npx add-skill https://github.com/Rika-Labs/sgrep/blob/main/plugins/sgrep/skills/sgrep/SKILL.md -a claude-code --skill sgrep

Installation paths:

Claude
.claude/skills/sgrep/
Powered by add-skill CLI

Instructions

# 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:
```bash
curl -fsSL https://raw.githubusercontent.com/rika-labs/sgrep/main/scripts/install.sh | sh
```

## Basic Usage

### Search Command

```bash
sgrep search "your natural language query"
```

### Common Patterns

**Find functionality:**
```bash
sgrep search "where do we handle user authentication?"
```

**Search with filters:**
```bash
sgrep search "error handling" --filters lang=rust
sgrep search "API endpoints" --glob "src/**/*.rs"
```

**Get more results:**
```bash
sgrep search "database queries" --limit 20
```

**Show full context:**
```bash
sgrep search "retry logic" --context
```

## Command Options

- `--limit <n>` or `-n <n>`: Maximum results (default: 10)
- `--context` or `-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 like `lang=rust` (repeatable)
- `--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:

```bash
sgrep index           # Index current directory
sgrep index --force   # Rebuild from scratch
```

## Watch Mode

The plugin automatically manages `sgrep watch` during Claude sessions. For manual watch:

```bash
sgrep watch           # Watch current directory
sgrep watch --debounce-m

Validation Details

Front Matter
Required Fields
Valid Name Format
Valid Description
Has Sections
Allowed Tools
Instruction Length:
3757 chars