plugins/code-analysis/skills/code-search-selector/SKILL.md
💡 Tool selector for code search tasks. Helps choose between semantic search (claudemem) and native tools (Grep/Glob) based on query type. Semantic search recommended for: 'how does X work', 'find all', 'audit', 'investigate', 'architecture'.
npx skillsauth add madappgang/claude-code code-search-selectorInstall 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 choose the most effective search tool for your task.
Claudemem provides better results for conceptual queries:
| Query Type | Example | Recommended Tool |
|------------|---------|------------------|
| "How does X work?" | "How does authentication work?" | claudemem search |
| Find implementations | "Find all API endpoints" | claudemem search |
| Architecture questions | "Map the service layer" | claudemem --agent map |
| Trace data flow | "How does user data flow?" | claudemem search |
| Audit integrations | "Audit Prime API usage" | claudemem search |
| Query Type | Example | Recommended Tool |
|------------|---------|------------------|
| Exact string match | "Find 'DEPRECATED_FLAG'" | Grep |
| Count occurrences | "How many TODO comments?" | Grep -c |
| Specific symbol | "Find class UserService" | Grep |
| File patterns | "Find all *.config.ts" | Glob |
Token Efficiency: Reading 5 files costs ~5000 tokens; claudemem search costs ~500 tokens with ranked results.
Context Discovery: Claudemem finds related code you didn't know to ask for.
Ranking: Results sorted by relevance and PageRank, so important code comes first.
User asks: "How does authentication work?"
Less effective approach:
grep -r "auth" src/
# Result: 500 lines of noise, hard to understand
More effective approach:
claudemem status # Check if indexed
claudemem search "authentication login flow JWT"
# Result: Top 10 semantically relevant code chunks, ranked
| User Request | Category | Recommended Tool | |--------------|----------|------------------| | "Find all X", "How does X work" | Semantic | claudemem search | | "Audit X integration", "Map data flow" | Semantic | claudemem search | | "Understand architecture", "Trace X" | Semantic | claudemem map | | "Find exact string 'foo'" | Exact Match | Grep | | "Count occurrences of X" | Exact Match | Grep | | "Find symbol UserService" | Exact Match | Grep |
# ALWAYS run this before semantic search
claudemem status
Interpret the output:
| Status | What It Means | Next Action | |--------|---------------|-------------| | Shows chunk count (e.g., "938 chunks") | ✅ Indexed | USE CLAUDEMEM (Step 3) | | "No index found" | ❌ Not indexed | Offer to index (Step 2b) | | "command not found" | ❌ Not installed | Fall back to Detective agent |
AskUserQuestion({
questions: [{
question: "Claudemem is not indexed. Index now for better semantic search results?",
header: "Index?",
multiSelect: false,
options: [
{ label: "Yes, index now (Recommended)", description: "Takes 1-2 minutes, enables semantic search" },
{ label: "No, use grep instead", description: "Faster but less accurate for semantic queries" }
]
}]
})
If user says yes:
claudemem index -y
IF CLAUDEMEM IS INDEXED (from Step 2):
# Get role-specific guidance first
claudemem ai developer # or architect, tester, debugger
# Then search semantically
claudemem search "authentication login JWT token validation" -n 15
IF CLAUDEMEM IS NOT AVAILABLE:
Use the detective agent:
Task({
subagent_type: "code-analysis:detective",
description: "Investigate [topic]",
prompt: "Use semantic search to find..."
})
| Use Case | Less Efficient | More Efficient |
|----------|----------------|----------------|
| Semantic queries | grep -r "pattern" src/ | claudemem search "concept" |
| Find implementations | Glob → Read all | claudemem search "feature" |
| Understand flow | find . -name "*.ts" \| xargs... | claudemem --agent map |
Native tools (Grep, Glob, find) work well for exact matches but provide no semantic ranking.
If a hook provides claudemem results instead of native tool output:
_bypass_claudemem: true for native tools when neededThe hook system provides claudemem results proactively when the index is available.
| User Request | Native Approach | Semantic Approach (Recommended) |
|--------------|-----------------|--------------------------------|
| "Audit all API endpoints" | grep -r "router\|endpoint" | claudemem search "API endpoint route handler" |
| "How does auth work?" | grep -r "auth\|login" | claudemem search "authentication login flow" |
| "Find all database queries" | grep -r "prisma\|query" | claudemem search "database query SQL prisma" |
| "Map the data flow" | grep -r "transform\|map" | claudemem search "data transformation pipeline" |
| "What's the architecture?" | ls -la src/ | claudemem --agent map "architecture" |
| "Find error handling" | grep -r "catch\|error" | claudemem search "error handling exception" |
| "Trace user creation" | grep -r "createUser" | claudemem search "user creation registration" |
✅ Use Grep for:
grep -r "DEPRECATED_FLAG" src/grep -c "import React" src/**/*.tsxgrep -r "class UserService" src/grep -r "TODO:\|FIXME:" src/❌ Never use Grep for:
After using this skill's decision tree, invoke the appropriate detective:
| Investigation Type | Detective Skill |
|-------------------|-----------------|
| Architecture patterns | code-analysis:architect-detective |
| Implementation details | code-analysis:developer-detective |
| Test coverage | code-analysis:tester-detective |
| Bug root cause | code-analysis:debugger-detective |
| Comprehensive audit | code-analysis:ultrathink-detective |
┌─────────────────────────────────────────────────────────────────┐
│ CODE SEARCH QUICK REFERENCE │
├─────────────────────────────────────────────────────────────────┤
│ │
│ 1. ALWAYS check first: claudemem status │
│ │
│ 2. If indexed: claudemem search "semantic query" │
│ │
│ 3. For exact matches: Grep tool (only this case!) │
│ │
│ 4. For deep analysis: Task(code-analysis:detective) │
│ │
│ ⚠️ GREP IS FOR EXACT MATCHES, NOT SEMANTIC UNDERSTANDING │
│ │
└─────────────────────────────────────────────────────────────────┘
Before ANY code investigation task, verify:
claudemem status to check indexWhen reading multiple files, consider if a semantic search would be more efficient:
| Scenario | Optimization |
|----------|-------------|
| Read 3+ files in same directory | Try claudemem search first |
| Glob with broad patterns | Try claudemem --agent map |
| Sequential reads to "understand" | One semantic query may suffice |
Quick check before bulk reads:
claudemem status)❌ About to do:
Read src/services/auth/login.ts
Read src/services/auth/session.ts
Read src/services/auth/jwt.ts
Read src/services/auth/middleware.ts
Read src/services/auth/types.ts
Read src/services/auth/utils.ts
✅ Do instead:
claudemem search "authentication login session JWT middleware" -n 15
❌ About to do:
Glob pattern: src/services/prime/**/*.ts
Then read all 12 matches sequentially
✅ Do instead:
claudemem search "Prime API integration service endpoints" -n 20
❌ Parallelization trap:
"Let me Read these 5 files while the detective agent works..."
✅ Do instead:
Trust the detective agent to use claudemem.
Don't duplicate work with inferior Read/Glob.
| Approach | Token Cost | Result Quality |
|----------|------------|----------------|
| Read 5+ files sequentially | ~5000 tokens | No ranking |
| Glob → Read all matches | ~3000+ tokens | No semantic understanding |
| claudemem search once | ~500 tokens | Ranked by relevance |
Tip: Claudemem results include context around matches, so you often don't need to read full files.
claudemem statusclaudemem search "concept query" -n 15This workflow finds relevant code faster than reading files sequentially.
Maintained by: MadAppGang Plugin: code-analysis v2.16.0 Purpose: Help choose the most efficient search tool for each task
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.