/mas-efficiency-pack:selective-grep-filteringfrom mas-efficiency-pack
Narrows code searches with file globs, literal matching, and target directory scopes to reduce irrelevant results. Useful when grep returns too many false positives from tests, docs, or build artifacts.
Ships in mas-efficiency-pack. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
None: SKILL.md is the whole skill.
When searching a repository for a specific method or constant ("handlePaymentCallback"), naive agents execute broad, unconstrained searches across the entire workspace directory.
Unfiltered searches return hundreds of false-positive matches:
.map or dist/ files that dump unreadable minified code into context.The Surgical Grep Filtering Protocol constrains the search space using strict file extension globs, target directory scopes, and exact literal matching (IsRegex: false), returning strictly the 1 to 3 production source matches.
┌─────────────────────────────────────────────────────────────┐
│ Search Precision Comparison │
│ │
│ Unconstrained Workspace Search (140 Matches / 6,200 Toks): │
│ • 80 matches in `tests/__snapshots__/` │
│ • 45 matches in `dist/bundle.js` │
│ • 12 matches in `docs/architecture.md` │
│ • 3 matches in `src/services/` │
│ ↳ 6,200 tokens billed, agent gets lost in snapshots │
│ │
│ Surgical Glob Filtering (3 Matches / 85 Tokens - 98.6% Cut):│
│ • Includes: `["src/**/*.ts", "!**/*.spec.ts"]` │
│ • Match: `src/services/billing.ts:42` │
│ • Match: `src/routes/payment.ts:18` │
│ ↳ 85 clean tokens, 100% production source hits │
└─────────────────────────────────────────────────────────────┘
┌───────────────────────────────────────────────────────────────────────────┐
│ 1. TARGET DIRECTORY ONLY: Confine `SearchPath` to `src/` or `pkg/` │
│ 2. EXCLUDE TESTS & SPECS: Add `!**/*.test.ts`, `!**/*.spec.py` │
│ 3. LITERAL MATCHING BY DEFAULT: Set `IsRegex: false` (Prevents regex bugs)│
└───────────────────────────────────────────────────────────────────────────┘
When invoking grep_search in Antigravity IDE / Claude Code:
{
"Query": "handlePaymentCallback",
"SearchPath": "c:/Users/ASUS/Documents/Newfolder/Antigravity/Major AI Skills/src",
"CaseInsensitive": false,
"IsRegex": false,
"MatchPerLine": true,
"Includes": [
"**/*.ts",
"!**/*.test.ts",
"!**/*.spec.ts",
"!**/__mocks__/**"
],
"toolAction": "Searching for payment callback in production TS sources",
"toolSummary": "Surgical Grep Search"
}
When running ripgrep directly via terminal:
# Surgical search: TypeScript production files only (excluding tests and mocks)
rg "handlePaymentCallback" src/ -t ts --glob '!**/*.test.ts' --glob '!**/__mocks__/**'
# Search Python source files only
rg "def authenticate_user" src/ -t py --glob '!tests/**'
Searching for a common error handler across a 1,500-file repository:
| Search Configuration | Matches Returned | Tokens Ingested | Accuracy / Signal |
|---|---|---|---|
| Unfiltered Global Grep | 185 matches | 8,400 tokens | 12% (Flooded with snapshots & docs) |
| Case-Insensitive Regex | 240 matches | 11,200 tokens | 8% (Catches comments & prose) |
| Surgical Glob Protocol | 2 matches | 70 tokens | 100% (Exact production targets) |
MANDATORY: Agents executing code searches must scope
SearchPathto active source directories (src/,app/,pkg/) and populate theIncludesarray with specific filetype globs and test exclusion filters (!**/*.test.*).
What SKILL.md sets; muted values are Claude Code's defaults
npx claudepluginhub alivirgo/major-ai-skills --plugin mas-efficiency-pack5 skills in this plugin
/cached-system-instructionsStructure stable system instructions and variable input separately when configuring supported prompt-cache workflows./csv-over-json-tablesRepresent rectangular datasets as CSV or TSV when repeated JSON field names add unnecessary payload size./multi-tool-batch-invocationBatch independent tool operations where the runtime supports parallel execution, preserving dependencies between steps.Other plugins' skills for the same job
2 plugins in one repository ship this exact skill · first indexed Sep 11, 2026