🚀 AI Magicx API v1.0 is Live!
View API Docs
Magicx

Code Search Guide | Github Tools

Last updated: July 1, 2025
By AI Magicx Team

#Code Search Guide

Master the art of finding code in your repositories using both basic and AI-powered search capabilities.

#🔍 Basic Code Search

#Simple Text Search

Find exact matches in your codebase:

"Find all occurrences of 'getUserData'" "Search for 'TODO' comments in the project" "Where is the string 'API_ENDPOINT' used?" "Find all files containing 'authentication'"

#Function and Class Search

"Find the definition of the User class" "Where is the calculateTotal function defined?" "Show me all React components" "Find all async functions"

#File Type Specific Search

"Search for 'useState' in all TypeScript files" "Find 'SELECT' queries in all SQL files" "Look for 'import' statements in JavaScript files" "Find all CSS classes containing 'button'"

#Directory Scoped Search

"Search for 'axios' in the api folder" "Find all React hooks in the hooks directory" "Look for database queries in the models folder" "Search components folder for 'props.children'"

#🤖 AI-Powered Semantic Search

#Conceptual Search

Find code by what it does, not just what it's called:

"Find code that handles user authentication" "Show me functions that validate email addresses" "Where is the payment processing logic?" "Find components that display user information"

#Natural Language Descriptions

"Find code that connects to the database" "Show me error handling implementations" "Where do we validate form inputs?" "Find code that sends email notifications"

#Pattern Recognition

"Find all API endpoint handlers" "Show me Redux action creators" "Find React components that use state" "Locate all database model definitions"

#Cross-Reference Search

"Find all code related to user registration" "Show me everything connected to the shopping cart" "Find all authentication-related functions" "Display code that handles file uploads"

#🎯 Advanced Search Techniques

#Multi-Criteria Search

Combine multiple search terms:

"Find functions that use both 'fetch' and 'async'" "Show me React components that use 'useState' and 'useEffect'" "Find code that includes 'error' and 'catch'"

#Exclusion Search

"Find all JavaScript files except test files" "Search for 'import' statements excluding node_modules" "Show me functions that don't have error handling"

#Regex Patterns

"Find all email validation patterns" "Search for phone number formats" "Find all URL patterns in the code" "Locate all date format strings"

#Code Structure Search

"Find all exported functions" "Show me all private methods" "Find components with lifecycle methods" "Locate all constants and configurations"

#🧠 Smart Search Features

#Context-Aware Results

The AI understands your project context:

  • Prioritizes relevant files
  • Groups related results
  • Shows usage patterns
  • Identifies dependencies

#Code Analysis

Search results include:

  • Function signatures
  • Parameter types
  • Return values
  • Usage examples
  • Related code snippets

#Intelligent Filtering

  • Filters out irrelevant matches
  • Focuses on actual implementation
  • Excludes comments and documentation (unless specifically requested)
  • Prioritizes main logic over boilerplate

#📊 Search Result Types

#Code Snippets

Example: "Find the login function" Result: Shows the function definition with context

#File Locations

Example: "Where is user validation implemented?" Result: Lists files and line numbers with relevant code

#Usage Examples

Example: "How is the API client used?" Result: Shows various usage patterns across the codebase

#Dependencies and Imports

Example: "What imports the Button component?" Result: Lists all files that import and use the component

#🔧 Search Optimization Tips

#1. Be Specific

Instead of: "Find the user code" Try: "Find the user authentication middleware"

#2. Use Domain Language

"Find the JWT token validation" (instead of "find token stuff") "Show me the React router configuration" (instead of "find routing")

#3. Combine Search Types

"Find all database queries related to user management" "Show me error handling in the payment processing code"

#4. Ask for Explanations

"Find the user service and explain what it does" "Show me the authentication flow and walk me through it"

#📋 Common Search Scenarios

#Bug Investigation

"Find all error handling related to user login" "Where might the memory leak be occurring?" "Show me code that could cause the performance issue"

#Feature Development

"Find similar implementations to the one I'm building" "Show me how other forms handle validation" "Find examples of API error responses"

#Code Review

"Find all TODO comments for this sprint" "Show me functions without proper error handling" "Find code that might need security improvements"

#Refactoring

"Find all duplicate code patterns" "Show me functions that are too complex" "Find components that should be split up"

#Documentation

"Find all public API methods" "Show me functions that need documentation" "Find all configuration options"

#🎨 Search Result Presentation

#Organized Display

Results are presented with:

  • File paths and line numbers
  • Code context (surrounding lines)
  • Syntax highlighting
  • Relevance scoring

#Interactive Navigation

  • Click to view full file
  • Jump to definition
  • See all usages
  • Navigate related code

#Export Options

  • Copy code snippets
  • Save search results
  • Create documentation from findings
  • Generate issue reports

#🚀 Advanced Use Cases

#Architecture Analysis

"Map out the data flow in the application" "Show me the dependency structure" "Find all external API integrations"

#Security Audit

"Find all user input validation" "Show me authentication checkpoints" "Find potential SQL injection points"

#Performance Investigation

"Find expensive database operations" "Show me large file operations" "Find potential memory leaks"

#Migration Planning

"Find all deprecated API usage" "Show me code using the old framework version" "Find components that need updating"

#🎯 Search Best Practices

#1. Start Broad, Then Narrow

  1. "Find user-related code"
  2. "Show me user authentication specifically"
  3. "Find the JWT validation in user auth"

#2. Use Multiple Search Types

  • Combine text search with semantic search
  • Use both specific terms and concepts
  • Try different phrasings

#3. Verify Results

"Show me how this function is actually used" "Are there any other implementations of this pattern?" "What did I miss in my search?"

#4. Document Findings

"Create a summary of what we found" "List all the authentication-related files" "Generate documentation for these API endpoints"

#🔍 Search Troubleshooting

#No Results Found

  • Try broader search terms
  • Check spelling and syntax
  • Use semantic search instead of exact matches
  • Search in different directories

#Too Many Results

  • Add more specific criteria
  • Limit to specific file types
  • Focus on particular directories
  • Use exclusion filters

#Irrelevant Results

  • Use more descriptive terms
  • Add context to your search
  • Try semantic search for better understanding
  • Specify the type of code you're looking for

#✨ Pro Search Tips

  1. Combine searches: "Find the user service, then show me how it's tested"
  2. Ask for patterns: "Show me the common patterns for error handling"
  3. Request summaries: "Summarize what the authentication system does"
  4. Get recommendations: "What code should I look at to understand this feature?"