search-enhancer
Enhanced code search with semantic understanding, pattern matching, and intelligent query interpr...
What this skill does
# Search Enhancer Skill
Enhanced code search with semantic understanding, pattern matching, and intelligent query interpretation for faster code discovery.
## Instructions
You are a code search and discovery expert. When invoked:
1. **Understand Search Intent**:
- Parse natural language queries
- Identify code patterns being searched
- Infer language and framework context
- Understand semantic meaning beyond keywords
2. **Multi-Strategy Search**:
- Text-based grep searches
- Pattern matching with regex
- AST-based semantic search
- Symbol and definition lookup
- Cross-reference searching
3. **Search Optimization**:
- Suggest better search terms
- Use appropriate search tools (grep, ripgrep, ag)
- Filter by file type and location
- Exclude irrelevant paths (node_modules, dist)
4. **Present Results**:
- Rank results by relevance
- Show context around matches
- Group related findings
- Highlight important patterns
## Search Strategies
### 1. Text Search (Basic)
- Simple keyword matching
- Case-insensitive searches
- File name searches
- Path-based filtering
### 2. Pattern Search (Regex)
- Complex pattern matching
- Multi-line patterns
- Lookahead/lookbehind
- Capture groups
### 3. Semantic Search (AST)
- Function/class definitions
- Type references
- Import statements
- Symbol usage
### 4. Contextual Search
- Find similar code patterns
- Locate related functions
- Track dependencies
- Follow call chains
## Usage Examples
```
@search-enhancer Find all React components using useState
@search-enhancer --pattern "API.*endpoint"
@search-enhancer --semantic "function definitions with async"
@search-enhancer --references useAuth
@search-enhancer --similar-to src/utils/helper.js
```
## Search Techniques
### Basic Text Search
```bash
# Search for exact text
grep -r "TODO" src/
# Case-insensitive
grep -ri "error handler" src/
# Show line numbers and context
grep -rn -C 3 "authentication" src/
# Search in specific file types
grep -r --include="*.js" --include="*.ts" "async function" src/
# Exclude directories
grep -r --exclude-dir={node_modules,dist,build} "API_KEY" .
```
### Advanced Pattern Matching
```bash
# Find all function declarations
grep -rE "function\s+\w+\s*\(" src/
# Find all class definitions
grep -rE "class\s+\w+(\s+extends\s+\w+)?" src/
# Find environment variables
grep -rE "process\.env\.\w+" src/
# Find import statements
grep -rE "^import.*from\s+['\"]" src/
# Find API endpoints
grep -rE "(get|post|put|delete)\(['\"][^'\"]*['\"]\)" src/
# Find console logs (for cleanup)
grep -rE "console\.(log|debug|warn|error)" src/ --exclude-dir=node_modules
```
### Ripgrep (Faster Alternative)
```bash
# Install ripgrep: brew install ripgrep (macOS) or apt install ripgrep (Linux)
# Basic search (automatically excludes .gitignore patterns)
rg "useState" src/
# Search with context
rg -C 5 "authentication"
# Search by file type
rg -t js -t ts "async function"
# Search for pattern
rg "function\s+\w+\(" -t js
# Count matches
rg "TODO" --count
# Show only file names
rg "useState" --files-with-matches
# Multi-line search
rg -U "interface.*\{[^}]*\}" -t ts
# Search and replace (preview)
rg "old_name" --replace "new_name" --dry-run
```
### Language-Specific Searches
#### JavaScript/TypeScript
```bash
# Find React components
rg "export (default )?(function|const) \w+" --glob "*.tsx" --glob "*.jsx"
# Find React hooks usage
rg "use(State|Effect|Context|Ref|Memo|Callback)" -t tsx -t jsx
# Find async functions
rg "async (function|\w+\s*=>|\w+\s*\()" -t js -t ts
# Find API calls
rg "(fetch|axios)\(" -t js -t ts
# Find error handling
rg "(try|catch|throw|Error)\s*[\(\{]" -t js -t ts
# Find database queries
rg "(SELECT|INSERT|UPDATE|DELETE).*FROM" -i
# Find environment variables
rg "process\.env\.\w+" -t js -t ts
# Find commented code
rg "^\s*//" src/
```
#### Python
```bash
# Find class definitions
rg "^class \w+(\(.*\))?:" -t py
# Find function definitions
rg "^def \w+\(" -t py
# Find decorators
rg "^@\w+" -t py
# Find imports
rg "^(from|import) " -t py
# Find TODO/FIXME comments
rg "(TODO|FIXME|HACK|XXX):" -t py
# Find print statements (debugging)
rg "print\(" -t py
# Find exception handling
rg "(try|except|raise|finally):" -t py
```
#### Go
```bash
# Find function definitions
rg "^func (\(\w+ \*?\w+\) )?\w+\(" -t go
# Find interface definitions
rg "^type \w+ interface" -t go
# Find struct definitions
rg "^type \w+ struct" -t go
# Find error handling
rg "if err != nil" -t go
# Find goroutines
rg "go (func|\w+)\(" -t go
# Find defer statements
rg "defer " -t go
```
### Semantic Search Patterns
#### Find All Function Definitions
```javascript
// Pattern for JavaScript/TypeScript functions
// Regular functions
function myFunction() {}
// Arrow functions
const myFunction = () => {}
// Method definitions
class MyClass {
myMethod() {}
}
// Search pattern:
rg "(function \w+\(|const \w+ = \(.*\) =>|^\s*\w+\s*\(.*\)\s*\{)" -t js -t ts
```
#### Find All Class Components (React)
```javascript
// Pattern for React class components
rg "class \w+ extends (React\.)?Component" -t jsx -t tsx
```
#### Find All Custom Hooks (React)
```javascript
// Pattern for custom hooks
rg "^(export )?(const|function) use[A-Z]\w+" -t ts -t tsx
```
#### Find Configuration Files
```bash
# Find all config files
find . -name "*config*" -type f
# Find specific config types
find . -regex ".*\.\(json\|yaml\|yml\|toml\|ini\)$" -type f
```
### Cross-Reference Search
#### Find All Usages of a Function
```bash
# 1. Find function definition
rg "function myFunction\(" -t js
# 2. Find all calls to this function
rg "myFunction\(" -t js
# 3. Find imports of this function
rg "import.*myFunction.*from" -t js
```
#### Find All Implementations of an Interface
```typescript
// Search for interface
rg "interface IUserService" -t ts
// Search for implementations
rg "implements IUserService" -t ts
// Search for usages
rg "IUserService" -t ts
```
### Smart Search Queries
#### Natural Language to Search Pattern
```bash
# Query: "Find all API endpoints"
rg "(app|router)\.(get|post|put|delete|patch)\(" -t js -t ts
# Query: "Find all database models"
rg "(Schema|model|Model)\(" -t js -t ts
# Query: "Find all authentication code"
rg "(auth|authenticate|login|logout|token|jwt)" -i -t js -t ts
# Query: "Find all error handling"
rg "(try|catch|throw|error)" -i --type-add 'src:*.{js,ts,jsx,tsx}' -t src
# Query: "Find all TODOs and FIXMEs"
rg "(TODO|FIXME|HACK|XXX|NOTE):" -i
# Query: "Find hardcoded strings that should be i18n"
rg ">\s*[A-Z][a-z]+" -t jsx -t tsx
# Query: "Find potential SQL injection vulnerabilities"
rg "query.*\+.*req\.(params|query|body)" -t js -t ts
# Query: "Find console logs to remove"
rg "console\.(log|debug|info)" --glob "!**/*.test.*" -t js -t ts
```
## Advanced Search Techniques
### Multi-Pattern Search
```bash
# Search for multiple patterns
rg -e "useState" -e "useEffect" -e "useContext" -t tsx
# Search with AND logic (using pipes)
rg "async" | rg "await"
# Search with OR logic
rg "(async|await)" -t js
```
### Context-Aware Search
```bash
# Show function that contains pattern
rg "useState" -A 20 -B 5 | rg "^(function|const)" -A 25
# Find classes with specific method
rg "class.*extends.*Component" -A 50 | rg "componentDidMount"
```
### Performance Optimization
```bash
# Search only in tracked git files
rg "pattern" $(git ls-files)
# Use parallel processing
rg "pattern" --threads 8
# Search with type filtering
rg "pattern" -t js -t ts -t jsx -t tsx
# Exclude large directories
rg "pattern" --glob "!{node_modules,dist,build,coverage}/**"
```
### Search and Replace
```bash
# Dry run (preview changes)
rg "old_function" --replace "new_function" --dry-run
# Perform replacement (use with caution)
rg "old_function" --replace "new_function" --files-with-matches | xargs sed -i '' 's/old_function/new_function/g'
# Better: Use specific files
rg "old_function" -l | Related in General
modeling-omnistudio-epc-catalog
IncludedSalesforce Industries CME EPC product-modeling skill for Product2-based catalog creation. Use when creating EPC products, configuring product attributes, building offer bundles with Product Child Items, or reviewing EPC DataPack JSON metadata for product catalog changes. TRIGGER when: user creates or updates Product2 EPC records, AttributeAssignment payloads, AttributeMetadata/AttributeDefaultValues, Offer bundles, or ProductChildItem relationships. DO NOT TRIGGER when: designing OmniScripts/FlexCards/Integration Procedures (use building-omnistudio-omniscript, building-omnistudio-flexcard, or building-omnistudio-integration-procedure), implementing Apex business logic (use generating-apex), or troubleshooting deployment pipelines (use deploying-metadata).
relationship-science-coach
IncludedUse this skill for direct, practical adult relationship coaching: couples conflict, repair, trust, marriage, dating, flirting, attachment patterns, emotional connection, sex, desire differences, eroticism, kink negotiation, affection, love languages, breakups, and long-term passion. Draw on Gottman, EFT and Hold Me Tight, attachment science, modern sex research, Perel, Nagoski, Kerner, Schnarch, Love and Stosny, and flexible love-language tools. Be concrete and low-hedge. Redirect only for imminent danger, abuse, coercive control, minors, non-consent, self-harm, stalking, or medical/legal/psychiatric decisions.
building-sf-integrations
IncludedSalesforce integration architecture and runtime plumbing with 120-point scoring. Use this skill to set up Named Credentials, External Credentials, External Services, REST/SOAP callout patterns, Platform Events, and Change Data Capture. TRIGGER when: user sets up Named Credentials, External Services, REST/SOAP callouts, Platform Events, CDC, or touches .namedCredential-meta.xml files. DO NOT TRIGGER when: Connected App/OAuth config (use configuring-connected-apps), Apex-only logic (use generating-apex), or data import/export (use handling-sf-data).
venue-templates
IncludedAccess comprehensive LaTeX templates, formatting requirements, and submission guidelines for major scientific publication venues (Nature, Science, PLOS, IEEE, ACM), academic conferences (NeurIPS, ICML, CVPR, CHI), research posters, and grant proposals (NSF, NIH, DOE, DARPA). This skill should be used when preparing manuscripts for journal submission, conference papers, research posters, or grant proposals and need venue-specific formatting requirements and templates.
let-fate-decide
IncludedDraws the 12 Houses of the Zodiac Tarot spread to inject entropy into planning when prompts are vague, ambiguous, or casually delegated. Interprets the spread to guide next steps. Use when the user says 'let fate decide', 'YOLO', 'whatever', 'idk', or other nonchalant phrases, makes Yu-Gi-Oh references, or when you are about to arbitrarily pick between multiple reasonable approaches. Prefer over ask-questions-if-underspecified when the user's tone is casual or playful rather than precision-seeking.
net-ops
IncludedCross-platform network troubleshooting (Windows, macOS, Linux) via local or remote shell. Use for: DNS broken, can't resolve hostnames, nslookup/dig works but apps fail, NRPT, WFP, scutil, /etc/resolver, systemd-resolved, /etc/resolv.conf, NetworkManager, VPN DNS leak residue (ProtonVPN/Mullvad/WireGuard/AnyConnect), AV/firewall blocking DNS or DoH, Tailscale DNS interaction, intermittent connectivity, remote diagnostics over SSH.