mgrep-code-search — Claude Code skill: what it does, how to install
Equips agents with semantic code search across repositories using mgrep. It finds features by intent and natural language in projects with over 30 files.
npx skills add intellectronica/agent-skills --skill mgrep-code-search -a claude-codeWhat mgrep-code-search does
The skill connects the mgrep CLI to provide semantic search across repositories. Instead of matching exact string patterns or regex, it finds code and documents by conceptual meaning. The tool indexes files while respecting .gitignore and .mgrepignore rules.
A background watcher handles repository indexing through bunx @mixedbread/mgrep watch. Once indexed, searches run via bunx @mixedbread/mgrep "query" [path]. Queries can be refined with specific flags, such as -m for result counts, -c for full content display, or -a for an AI-generated summary.
The workflow targets nested directories and projects with more than 30 files. Execution is strictly tied to Bun. Running the command via npm or npx is forbidden by the maintainer, so a working Bun installation is mandatory.
What it helps with
- locate authentication handlers without knowing exact function names
- explore unfamiliar codebases with deeply nested directories
- find error handling patterns using natural language queries
- synthesize explanations of caching layers directly from search results
Example prompts for the agent
- Use mgrep to find where authentication is configured
- Start indexing this repository with mgrep watch
- Search src/services for payment processing using mgrep with the -a flag
How to install mgrep-code-search
1Skills CLI (Vercel)
npx skills add intellectronica/agent-skills --skill mgrep-code-search -a claude-code2Manually: put the files in place
~/.claude/skills/mgrep-code-search/SKILL.mdCopy the whole skill folder; for one project use .claude/skills/mgrep-code-search/
1Skills CLI (Vercel)
npx skills add intellectronica/agent-skills --skill mgrep-code-search -a codex2Manually: put the files in place
.agents/skills/mgrep-code-search/SKILL.mdFor all projects use ~/.agents/skills/
1Skills CLI (Vercel)
npx skills add intellectronica/agent-skills --skill mgrep-code-search -a cursor2Manually: put the files in place
.cursor/skills/mgrep-code-search/SKILL.mdCursor also reads .agents/skills/ and .claude/skills/
1GitHub CLI
gh skill install intellectronica/agent-skills mgrep-code-search2Manually: put the files in place
.github/skills/mgrep-code-search/SKILL.md1Skills CLI (Vercel)
npx skills add intellectronica/agent-skills --skill mgrep-code-search -a gemini-cli2Platform CLI
gemini skills install https://github.com/intellectronica/agent-skills --path skills/mgrep-code-searchManually: put the files in place
.devin/skills/mgrep-code-search/SKILL.mdThe legacy .windsurf/skills/ path still works
Skills CLI (Vercel)
npx skills add intellectronica/agent-skills --skill mgrep-code-search -a opencodeClaude.ai
Zip the folder and upload it in Settings → Capabilities → Skills
Step by step, with commands for each platform: How to install skills in Claude Code: five ways
Questions about mgrep-code-search
How do I install mgrep-code-search in Claude Code?
Run npx skills add intellectronica/agent-skills --skill mgrep-code-search -a claude-code in your terminal to install the skill for Claude Code.
What does the mgrep-code-search skill do?
It enables natural language semantic search across code and documents, helping you locate features and logic without knowing exact identifiers.
Can I run mgrep using npm or npx?
No, commands must be executed strictly with bunx @mixedbread/mgrep. A working Bun runtime is required on your machine.
Source text
SKILL.md · CC0-1.0
--- name: mgrep-code-search description: Semantic code search using mgrep for efficient codebase exploration. This skill should be used when searching or exploring codebases with more than 30 non-gitignored files and/or nested directory structures. It provides natural language semantic search that complements traditional grep/ripgrep for finding features, understanding intent, and exploring unfamiliar code. --- # mgrep Code Search ## Overview mgrep is a semantic search tool that enables natural language queries across code, text, PDFs, and images. It is particularly effective for exploring larger or complex codebases where traditional pattern matching falls short. ## When to Use This Skill Use mgrep when: - The codebase contains more than 30 non-gitignored files - There are nested directory structures - Searching for concepts, features, or intent rather than exact strings - Exploring an unfamiliar codebase - Need to understand "where" or "how" something is implemented Use traditional grep/ripgrep when: - Searching for exact patterns or symbols - Regex-based refactoring - Tracing specific function or variable names ## Quick Start ### Indexing Before searching, start the watcher to index the repository: ```bash bunx @mixedbread/mgrep watch ``` The `watch` command indexes the repository and maintains synchronisation with file changes. It respects `.gitignore` and `.mgrepignore` patterns. ### Searching ```bash bunx @mixedbread/mgrep "your natural language query" [path] ``` ## Search Commands ### Basic Search ```bash bunx @mixedbread/mgrep "where is authentication configured?" bunx @mixedbread/mgrep "how do we handle errors in API calls?" src/ bunx @mixedbread/mgrep "database connection setup" src/lib ``` ### Search Options | Option | Description | |--------|-------------| | `-m <count>` | Maximum results (default: 10) | | `-c, --content` | Display full result content | | `-a, --answer` | Generate AI-powered synthesis of results | | `-s, --sync` | Update index before searching | | `--no-rerank` | Disable relevance optimisation | ### Examples with Options ```bash # Get more results bunx @mixedbread/mgrep -m 25 "user authentication flow" # Show full content of matches bunx @mixedbread/mgrep -c "error handling patterns" # Get an AI-synthesised answer bunx @mixedbread/mgrep -a "how does the caching layer work?" # Sync index before searching bunx @mixedbread/mgrep -s "payment processing" src/services ``` ## Workflow 1. **Start watcher** (once per session or when files change significantly): ```bash bunx @mixedbread/mgrep watch ``` 2. **Search semantically**: ```bash bunx @mixedbread/mgrep "what you're looking for" [optional/path] ``` 3. **Refine as needed** using path constraints or options: ```bash bunx @mixedbread/mgrep -m 20 -c "refined query" src/specific/directory ``` ## Environment Variables Configure defaults via environment variables: | Variable | Purpose | |----------|---------| | `MGREP_MAX_COUNT` | Default result limit | | `MGREP_CONTENT` | Enable content display (1/true) | | `MGREP_ANSWER` | Enable AI synthesis (1/true) | | `MGREP_SYNC` | Pre-search sync (1/true) | ## Important Notes - Always use `bunx @mixedbread/mgrep` to run commands (not npm/npx or direct installation) - Run `bunx @mixedbread/mgrep watch` before searching to ensure the index is current - mgrep respects `.gitignore` patterns automatically - Create `.mgrepignore` for additional exclusions
© intellectronica · CC0-1.0 · intellectronica/agent-skills