Skip to content
Development
Command

/search-smart

Intelligent code search orchestrator using modern tools with parallel analysis capabilities

From plugin
claude-cmd
313180 skills180 commands

How it fires

How this command gets triggered: by you, by Claude, or both.

  • Fires itselfClaude auto-loads it when your prompt matches the work.
  • You can call itInvoke it directly when you want it.
  • Slash command/search-smart

Context preview

What this command does when you run it.

Intelligent code search orchestrator using modern tools with parallel analysis capabilities

Command definition

search-smart.md
allowed-tools: Task, Bash(rg:*), Bash(fd:*), Bash(bat:*), Bash(fzf:*), Bash(eza:*), Bash(jq:*), Bash(gdate:*), Bash(wc:*), Bash(head:*), Bash(tail:*)
name: "Search Smart"
description: "Intelligent code search orchestrator using modern tools with parallel analysis capabilities"
author: "wcygan"
tags: ["meta","search"]
version: "1.0.0"
created_at: "2025-07-14T00:00:00Z"
updated_at: "2025-07-14T00:00:00Z"

Context

  • Session ID: !`gdate +%s%N 2>/dev/null || date +%s%N 2>/dev/null || echo "$(date +%s)$(jot -r 1 100000 999999 2>/dev/null || shuf -i 100000-999999 -n 1 2>/dev/null || echo $RANDOM$RANDOM)"`
  • Current directory: !`pwd`
  • Search target: $ARGUMENTS
  • Project languages: !`fd "(package\.json|Cargo\.toml|go\.mod|deno\.json|pom\.xml|build\.gradle)" . -d 3 | head -5 || echo "No build files detected"`
  • Codebase size: !`fd "\.(js|ts|jsx|tsx|rs|go|java|py|rb|php|c|cpp|h|hpp|cs|kt|swift|scala)" . | wc -l | tr -d ' '` files
  • Directory structure: !`eza -la --tree --level=2 2>/dev/null | head -10 || fd . -t d -d 2 | head -10`
  • Modern tools status: !`echo "rg: $(which rg >/dev/null && echo ✓ || echo ✗) | fd: $(which fd >/dev/null && echo ✓ || echo ✗) | bat: $(which bat >/dev/null && echo ✓ || echo ✗) | fzf: $(which fzf >/dev/null && echo ✓ || echo ✗)"`

Your Task

STEP 1: Initialize intelligent search session and analyze project context

  • CREATE session state file: `/tmp/search-session-$SESSION_ID.json`
  • ANALYZE project structure from Context section
  • DETERMINE search complexity based on codebase size and query
  • VALIDATE modern CLI tools availability (rg, fd, bat, fzf are MANDATORY)
# Initialize search session state
echo '{
  "sessionId": "'$SESSION_ID'",
  "searchTarget": "'$ARGUMENTS'",
  "projectLanguages": [],
  "searchStrategy": "auto-detect",
  "resultsFound": 0,
  "searchHistory": []
}' > /tmp/search-session-$SESSION_ID.json

STEP 2: Adaptive search strategy selection with intelligent routing

TRY:

CASE search_complexity: WHEN "simple_pattern":

  • EXECUTE direct ripgrep search with smart filtering
  • USE targeted file type detection
  • PROVIDE immediate results with context

WHEN "complex_analysis":

  • LAUNCH parallel sub-agents for comprehensive search
  • COORDINATE results from multiple search domains
  • SYNTHESIZE findings into coherent analysis

WHEN "interactive_exploration":

  • ENABLE fzf-powered interactive search interface
  • PROVIDE live preview with bat syntax highlighting
  • SUPPORT multi-select and batch operations

**Simple Pattern Search (Fast Results):**

# Smart case-insensitive search with context
rg "$ARGUMENTS" --smart-case --context 3 --color always --heading --line-number --stats

# Language-specific search with auto-detection
if fd "\.rs$" . | head -1 >/dev/null; then
  echo "🦀 Rust project detected - searching with Rust patterns"
  rg "$ARGUMENTS" --type rust --context 2
fi

if fd "\.go$" . | head -1 >/dev/null; then
  echo "🐹 Go project detected - searching with Go patterns"  
  rg "$ARGUMENTS" --type go --context 2
fi

if fd "\.(js|ts)$" . | head -1 >/dev/null; then
  echo "⚡ JavaScript/TypeScript project detected"
  rg "$ARGUMENTS" --type-add 'js:*.{js,ts,jsx,tsx}' --type js --context 2
fi

STEP 3: Parallel comprehensive search using sub-agent architecture

IF codebase_size > 1000 files OR search_target contains multiple_terms:

**CRITICAL: Deploy parallel sub-agents for maximum search performance (8-10x faster comprehensive search)**

IMMEDIATELY launch 8 specialized parallel search agents:

  • **Agent 1: Source Code Search**: Deep search across primary source directories (src/, lib/, app/)
  • Focus: Function definitions, class declarations, implementation logic, business logic
  • Tools: rg with language-specific patterns, function signature detection, semantic search
  • Output: Core implementation findings with relevance scoring and cross-references
  • **Agent 2: Test Code Analysis**: Comprehensive test ecosystem search (test/, tests/, spec/, **tests**)
  • Focus: Test cases, mocks, test utilities, usage patterns, test coverage analysis
  • Tools: rg with test-specific patterns, test framework detection, coverage mapping
  • Output: Test coverage insights and example usage patterns with quality assessment
  • **Agent 3: Documentation Search**: Exhaustive documentation and comment analysis
  • Focus: API docs, usage examples, architectural notes, inline comments, READMEs
  • Tools: rg with comment patterns, markdown search, documentation analysis, link validation
  • Output: Contextual documentation with cross-references and knowledge gaps identified
  • **Agent 4: Configuration Search**: Complete configuration and environment analysis
  • Focus: Environment variables, build configs, deployment settings, feature flags
  • Tools: rg with config-specific patterns, structured data search, environment mapping
  • Output: Configuration insights with environment dependencies and security considerations
  • **Agent 5: Script & Automation Search**: CI/CD and automation tool analysis
  • Focus: Build scripts, deployment tools, CI/CD configurations, automation workflows
  • Tools: rg with script patterns, workflow analysis, dependency chain mapping
  • Output: Automation workflow findings with optimization opportunities
  • **Agent 6: Database & Schema Search**: Data layer and persistence pattern analysis
  • Focus: Database schemas, migrations, queries, data models, ORM configurations
  • Tools: rg with SQL patterns, schema analysis, query optimization detection
  • Output: Data architecture findings with performance and integrity insights
  • **Agent 7: API & Integration Search**: Service interface and integration pattern analysis
  • Focus: REST endpoints, GraphQL schemas, service contracts, external integrations
  • Tools: rg with API patterns, contract analysis, integration mapping
  • Output: API surface area with consistency and compatibility analysis
  • **Agent 8: Security & Compliance Search**: Security pattern and vulnera
Read more
Ships withclaude-cmd

A lightweight (~46kB) and comprehensive CLI tool for managing Claude commands, configurations, and workflows.

Get the whole plugin