plugins/code-analysis/skills/search-interceptor/SKILL.md
💡 Bulk file read optimizer. Suggests semantic search alternatives when reading multiple files. Helps reduce token usage by using claudemem's ranked results instead of sequential file reads.
npx skillsauth add madappgang/claude-code search-interceptorInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
This skill helps optimize bulk file operations by suggesting semantic search alternatives when they would be more efficient.
| Scenario | Token Cost | Alternative |
|----------|------------|-------------|
| Read 5+ files | ~5000 tokens | claudemem search (~500 tokens) |
| Glob all *.ts files | ~3000+ tokens | claudemem --agent map |
| Sequential reads to understand | Variable | One semantic query |
If planning to read several files, consider:
# Instead of reading 5 files individually
claudemem search "concept from those files" -n 15
# Gets ranked results with context
If using patterns like src/**/*.ts:
# Instead of globbing and reading all matches
claudemem --agent map "what you're looking for"
# Gets structural overview with PageRank ranking
Even when specific paths are mentioned, semantic search often finds additional relevant code:
claudemem search "concept related to mentioned files"
When you're about to execute bulk file operations, STOP and run:
claudemem status
If claudemem is indexed:
| Your Plan | Better Alternative |
|-----------|-------------------|
| Read 5 auth files | claudemem search "authentication login session" |
| Glob all services | claudemem search "service layer business logic" |
| Read mentioned paths | claudemem search "[concept from those paths]" |
If claudemem is NOT indexed:
claudemem index -y
Then proceed with semantic search.
# Instead of reading N files, run ONE semantic query
claudemem search "concept describing what you need" -n 15
# ONLY THEN read specific lines from results
| Situation | Intercept? | Action | |-----------|-----------|--------| | Read 1-2 specific files | No | Proceed with Read | | Read 3+ files in investigation | YES | Convert to claudemem search | | Glob for exact filename | No | Proceed with Glob | | Glob for pattern discovery | YES | Convert to claudemem search | | Grep for exact string | No | Proceed with Grep | | Grep for semantic concept | YES | Convert to claudemem search | | Files mentioned in prompt | YES | Search semantically first |
❌ Original plan:
I see the task mentions auth, let me read:
- src/services/auth/login.ts
- src/services/auth/session.ts
- src/services/auth/jwt.ts
- src/services/auth/middleware.ts
- src/services/auth/utils.ts
✅ After interception:
claudemem status # Check if indexed
claudemem search "authentication login session JWT token validation" -n 15
# Now I have ranked, relevant chunks instead of 5 full files
❌ Original plan:
Audit mentions Prime API files:
- src/services/prime/internal_api/client.ts
- src/services/prime/api.ts
Let me just Read these directly...
✅ After interception:
claudemem search "Prime API integration endpoints HTTP client" -n 20
# This finds ALL Prime-related code, ranked by relevance
# Not just the 2 files mentioned
❌ Original plan:
Glob("src/**/*.controller.ts")
Then read all 15 controllers to understand routing
✅ After interception:
claudemem search "HTTP controller endpoint route handler" -n 20
# Gets the most relevant routing code, not all controllers
| Native Tools | Semantic Search | |--------------|-----------------| | No ranking | Ranked by relevance + PageRank | | No relationships | Shows code connections | | ~5000 tokens for 5 files | ~500 tokens for ranked results | | Only explicitly requested code | Discovers related code |
Tip: For investigation tasks, try claudemem search first to get a ranked view of relevant code.
This skill works with:
| Skill | Relationship |
|-------|-------------|
| code-search-selector | Selector determines WHAT tool; Interceptor validates BEFORE execution |
| claudemem-search | Interceptor redirects to claudemem; this skill shows HOW to search |
| deep-analysis | Interceptor prevents bad patterns; deep-analysis uses good patterns |
| Detective skills | Interceptor prevents duplicate work by trusting detective agents |
The hook system may provide claudemem results proactively when the index is available:
When you specifically need native tool behavior:
{ "pattern": "exact string", "_bypass_claudemem": true }
This tells hooks you intentionally want native tool output.
Before bulk Read/Glob operations, consider:
claudemem statusGeneral guideline: For understanding/investigation, try semantic search first. For exact matches, use native tools.
Maintained by: MadAppGang Plugin: code-analysis v2.16.0 Purpose: Help optimize bulk file operations with semantic search alternatives
testing
A test skill for validation testing. Use when testing skill parsing and validation logic.
tools
--- name: bad-skill description: This skill has invalid YAML in frontmatter allowed-tools: [invalid, array, syntax prerequisites: not-an-array --- # Bad Skill This skill has malformed frontmatter that should fail parsing. The YAML has: - Unclosed array bracket - Wrong type for prerequisites (should be array, not string)
tools
Plugin release process for MAG Claude Plugins marketplace. Covers version bumping, marketplace.json updates, git tagging, and common mistakes. Use when releasing new plugin versions or troubleshooting update issues.
testing
Fetch trending programming models from OpenRouter rankings. Use when selecting models for multi-model review, updating model recommendations, or researching current AI coding trends. Provides model IDs, context windows, pricing, and usage statistics from the most recent week.