Skip to content
Back to skills

Code Search

ASecurity

Select the right search tool (Grep, Glob, codebase-retrieval) to locate existing code, symbols, or files across the project's monorepo. Don't use it for creating new files, implementing features, or reviewing code quality.

  • 9 stars
  • 0 votes
  • 0 copies
  • 3 views
  • Added September 5, 2026
ai-agentsbashnodegitapidocumentation

Works with

  • cli
  • api

Security analysis

A100/100

Pro scans all 3 files and shows the line behind each finding

Scanned November 10, 2026

npx -y skills add atretyak1985/swarmery --skill code-search --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Code Search?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Code Search
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/atretyak1985-code-search/badge)](https://www.skillsdirectory.com/skills/atretyak1985-code-search)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
name: code-search
description: "Select the right search tool (Grep, Glob, codebase-retrieval) to locate existing code, symbols, or files across the project's monorepo. Don't use it for creating new files, implementing features, or reviewing code quality."
version: "1.0.0"
owner: "swarmery-core"
allowed-tools: Grep, Glob, Read
disable-model-invocation: true
docs:
  status: reviewed
  source_sha: ccc8c6baa5c1
  updated: 2026-11-01
---

# Purpose

Selects the most efficient search tool — Grep for exact symbol lookup, Glob for file-name patterns, codebase-retrieval for semantic/architectural questions — to locate code across the project's repositories (`.claude/project.json` → `repos`). Produces matching file paths with line numbers and context. Read-only, tool-selection skill. Placeholders: `<mainApp>`, `<device>`, `<infrastructure-repo>` come from project.json.

# Rules (never violate)

- Grep for exact symbols, Glob for name patterns, codebase-retrieval for "how does X work?" — never swap them.
- Every result carries a `file:line` citation, never a bare file path; max 50 results per search.
- Verify the top 2 codebase-retrieval results with Read; anything mismatched is marked `[POTENTIALLY-STALE]`, never presented as authoritative.
- No hardcoded absolute paths, never search the filesystem root — scope to the workspace; repo names come from `.claude/project.json` → `repos`.
- Never run an unscoped `path: "."` Grep over a large repo without excluding `node_modules`/`vendor`/`dist`/`build`/`.git` — that combination is the usual cause of a ripgrep timeout.
- For Glob, narrow `path` to the pattern's literal ancestor rather than relying on the pattern alone; if the target is intentionally inside `node_modules`/`vendor`/`.pnpm`/build caches, use Bash (`find`/`rg --files`) with an explicit timeout instead of retrying Glob/Grep.
- `plugins/core/hooks/search-scope-guard.sh` enforces the two rules above as a `PreToolUse` hook on every `Grep`/`Glob` call project-wide, in `warn` mode — heed its guidance (delivered via `additionalContext` before the call runs, not just its log) instead of retrying the same call, even in a session that never loaded this skill.
- Zero-result searches report the alternatives attempted before saying "not found".
- Refuse searches outside the project workspace; stop and ask on >50 results or an ambiguous query.

# Resources

- Read `resources/search-procedure.md` when running a search — tool selection table, procedure, scope defaults, self-check, mistakes, escalation, failure modes.
- Read `resources/query-patterns.md` when composing queries — per-repo Grep/Glob patterns and two worked examples.

# How to use

## What it does

Picks the right search tool for a lookup and runs it, so you stop guessing between exact match, file-name pattern, and "how does this work?". It classifies your query, scopes it to the most likely repository, runs Grep, Glob, or semantic retrieval, and returns matches with `file:line` citations and surrounding context. It never edits anything.

## When to use it

- You need every occurrence of a function, type, or variable across the workspace.
- You need files following a naming convention: route handlers, test files, values files.
- You are starting a task cold, or have a natural-language question about a cross-repo data flow.

Not for writing code (`api-integration`), judging code (`code-quality`/`code-standards`), files you already know, or conceptual questions answered by documentation.

## How to invoke

```
Skill(skill: "core:code-search")
```

State your `query` in plain words; optionally add `search_type` (`exact`, `pattern`, `semantic` — inferred when omitted) and a `scope` path restriction.

## Worked example

```
Skill(skill: "core:code-search")
query: "telemetryEmitter", search_type: "exact", scope: "apps/<mainApp>/src/"
```

Classified as an exact symbol lookup, Grep runs over `*.ts` under that path. Five matches across two files come back: the emitter declared at `ws-client.ts:5`, emitted at line 12, then imported and subscribed in `stream/route.ts` at lines 2, 11, and 14 — the definition and every consumer in one pass.

## Related

- `code-quality`, `api-contract`, `code-standards` — compose downstream: search first, then hand them the `file:line:snippet` tuples for audit, contract verification, or convention review.

Files in this skill

  • SKILL.md3.5 KB
  • resources/query-patterns.md3 KB
  • resources/search-procedure.md6.8 KB

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

View all in ai-agents →

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.