file-searching
Regex file search via gh-grep extension. TRIGGERS - search code files, grep repository, file content search.
What this skill does
# File Search with Regex
**Capability:** Regex-based file content search across GitHub repositories using gh-grep
**When to use:** Searching repository files (code, docs, configs) - NOT issues
**Installation Required:** `gh extension install k1LoW/gh-grep`
---
## Key Distinction
```
┌─────────────────────────────────────────────────────┐
│ SEARCH DECISION │
├─────────────────────────────────────────────────────┤
│ │
│ gh search issues → Search ISSUES/PRs │
│ (searching-issues skill) │
│ │
│ gh grep → Search FILES (code, docs) │
│ (THIS skill) │
│ │
└─────────────────────────────────────────────────────┘
```
---
## Quick Commands
### Basic File Search
```bash
# Search in repository
gh grep "authentication" --owner myorg --repo myrepo
# Search with regex
gh grep "Bug.*critical" --owner myorg --repo myrepo
# Search specific file types
gh grep "API_KEY" --owner myorg --repo myrepo --include "*.env*"
# Case-insensitive search
gh grep -i "password" --owner myorg --repo myrepo
```
### Common Patterns
```bash
# Find function definitions
gh grep "function.*login" --owner myorg --repo myrepo
# Find TODO comments
gh grep "TODO:" --owner myorg --repo myrepo --include "*.js,*.ts"
# Find environment variables
gh grep "process\.env\." --owner myorg --repo myrepo
# Find imports
gh grep "^import.*axios" --owner myorg --repo myrepo
```
---
## Flags & Options
### Output Control
```bash
# Show line numbers
gh grep "error" --owner myorg --repo myrepo --line-number
# Show file names only
gh grep "config" --owner myorg --repo myrepo --files-with-matches
# Limit results
gh grep "api" --owner myorg --repo myrepo --max-count 10
```
### File Filtering
```bash
# Include specific files
gh grep "test" --owner myorg --repo myrepo --include "*.test.js"
# Exclude files
gh grep "console" --owner myorg --repo myrepo --exclude "node_modules/*"
# Multiple file types
gh grep "interface" --owner myorg --repo myrepo --include "*.ts,*.tsx"
```
### Search Scope
```bash
# Search specific branch
gh grep "feature" --owner myorg --repo myrepo --branch develop
# Search multiple repositories
for repo in repo1 repo2 repo3; do
gh grep "authentication" --owner myorg --repo $repo
done
```
---
## Regex Patterns
### Common Regex
```bash
# Exact word match
gh grep "\bpassword\b" --owner myorg --repo myrepo
# Start of line
gh grep "^export" --owner myorg --repo myrepo
# End of line
gh grep ";$" --owner myorg --repo myrepo --include "*.js"
# Optional characters
gh grep "colou?r" --owner myorg --repo myrepo
# Character classes
gh grep "[0-9]{3}-[0-9]{4}" --owner myorg --repo myrepo
```
### Advanced Patterns
```bash
# Function with any parameters
gh grep "function \w+\(.*\)" --owner myorg --repo myrepo
# Multiword match
gh grep "error.*handler" --owner myorg --repo myrepo
# Negation (find lines WITHOUT pattern)
gh grep "import" --owner myorg --repo myrepo | grep -v "node_modules"
```
---
## Common Workflows
### 1. Security Audit
```bash
# Find hardcoded secrets
gh grep "api_key.*=.*['\"]" --owner myorg --repo myrepo --include "*.js,*.ts,*.py"
# Find password patterns
gh grep -i "password\s*=\s*['\"][^'\"]+['\"]" --owner myorg --repo myrepo
# Find environment variable leaks
gh grep "AWS_SECRET" --owner myorg --repo myrepo
```
### 2. Code Quality Check
```bash
# Find TODO/FIXME comments
gh grep -i "TODO|FIXME" --owner myorg --repo myrepo
# Find console.log statements
gh grep "console\.log" --owner myorg --repo myrepo --include "*.js,*.ts"
# Find deprecated APIs
gh grep "deprecated" --owner myorg --repo myrepo --include "*.md"
```
### 3. Dependency Analysis
```bash
# Find specific package usage
gh grep "import.*lodash" --owner myorg --repo myrepo
# Find external API calls
gh grep "axios\.|fetch\(" --owner myorg --repo myrepo
# Find database queries
gh grep "SELECT.*FROM" --owner myorg --repo myrepo
```
### 4. Documentation Search
````bash
# Find markdown links
gh grep "\[.*\]\(.*\)" --owner myorg --repo myrepo --include "*.md"
# Find code examples in docs
gh grep "^```" --owner myorg --repo myrepo --include "*.md"
# Find heading references
gh grep "^#{1,3} " --owner myorg --repo myrepo --include "*.md"
````
---
## Multi-Repository Search
```bash
#!/bin/bash
# Search across multiple repositories
PATTERN="authentication"
OWNER="myorg"
REPOS=("repo1" "repo2" "repo3")
for repo in "${REPOS[@]}"; do
echo "=== Searching $repo ==="
gh grep "$PATTERN" --owner "$OWNER" --repo "$repo" --line-number
echo ""
done
```
---
## Performance Considerations
**Speed:**
- gh-grep searches via GitHub API (network latency)
- Faster than cloning repos for quick searches
- Slower than local grep for large codebases
**Rate Limits:**
- GitHub API rate limits apply
- Authenticated requests: 5,000/hour
- Consider caching results for repeated searches
**Best Practices:**
1. **Specific patterns** - Narrower regex = fewer results = faster
2. **File filters** - Use `--include` to reduce search scope
3. **Limit results** - Use `--max-count` for quick verification
4. **Batch searches** - Search multiple patterns in one pass
---
## Comparison: gh grep vs gh search issues
| Feature | gh grep | gh search issues |
| ---------------- | ---------------------- | ---------------- |
| **Searches** | Repository files | Issues/PRs |
| **Regex** | ✅ Full regex support | ❌ No regex |
| **Wildcards** | ✅ Yes | ❌ No |
| **Context** | ✅ Line-based | ❌ No context |
| **File types** | ✅ Filter by extension | N/A |
| **Installation** | Extension required | Native |
| **Use case** | Code/docs search | Issue/PR search |
---
## Limitations
- **No local search** - Always queries GitHub API
- **Branch-specific** - Searches one branch at a time
- **No multiline** - Pattern must match within single line
- **Rate limits** - API quota applies
- **No content display** - Shows matches, not full file content
---
## Tool Selection
- **Search repository FILES** → Use `gh grep` (this skill)
- **Search Issues/PRs** → Use `gh search issues` (searching-issues skill)
- **AI-powered operations** → Use `gh models` (ai-assisted-operations skill)
---
**Installation:** `gh extension install k1LoW/gh-grep`
**Maintenance Status:** Actively maintained (211 stars, updated daily)
**Full Extension Guide:** [GITHUB_CLI_EXTENSIONS.md](/docs/research/GITHUB_CLI_EXTENSIONS.md)
Related in Writing & Docs
jax-development
IncludedUse this skill when the user is writing, debugging, profiling, refactoring, reviewing, benchmarking, parallelising, exporting, or explaining JAX code, or when they mention JAX, jax.numpy, jit, grad, value_and_grad, vmap, scan, lax, random keys, pytrees, jax.Array, sharding, Mesh, PartitionSpec, NamedSharding, pmap, shard_map, Pallas, XLA, StableHLO, checkify, profiler, or the JAX repo. It helps turn NumPy or PyTorch-style code into pure functional JAX, fix tracer/control-flow/shape/PRNG bugs, remove recompiles and host-device syncs, choose transforms and sharding strategies, inspect jaxpr/lowering/IR, and benchmark compiled code correctly.
nature-article-writer
IncludedDrafts, rewrites, diagnostically critiques, and style-calibrates primary research manuscripts for Nature and Nature Portfolio journals. Use when the user wants a Nature-style title, summary paragraph or abstract, introduction, results, discussion, methods, figure legends, presubmission enquiry, cover letter, reviewer response, or when a scientific draft sounds generic, jargon-heavy, structurally weak, or AI-ish and needs precise, broad-reader-friendly prose without inventing data, analyses, or references. Best for primary research articles and letters rather than reviews or press releases unless explicitly adapting one.
deckrd
IncludedDocument-driven framework that derives requirements, specifications, implementation plans, and executable tasks from goals through structured AI dialogue. Use when user says "write requirements", "create spec", "plan implementation", "derive tasks", "structure this feature", "break down into tasks", or "document this module". Also use for reverse engineering existing code into docs (/deckrd rev). Do NOT use for direct code writing — use /deckrd-coder after tasks are generated. Do NOT use when the user only wants to run or fix existing code without planning.
clinical-decision-support
IncludedGenerate professional clinical decision support (CDS) documents for pharmaceutical and clinical research settings, including patient cohort analyses (biomarker-stratified with outcomes) and treatment recommendation reports (evidence-based guidelines with decision algorithms). Supports GRADE evidence grading, statistical analysis (hazard ratios, survival curves, waterfall plots), biomarker integration, and regulatory compliance. Outputs publication-ready LaTeX/PDF format optimized for drug development, clinical research, and evidence synthesis.
handling-sf-data
IncludedSalesforce data operations with 130-point scoring. Use this skill to create, update, delete, bulk import/export, generate test data, and clean up org records using sf CLI and anonymous Apex. TRIGGER when: user creates test data, performs bulk import/export, uses sf data CLI commands, needs data factory patterns for Apex tests, or needs to seed/clean records in a Salesforce org. DO NOT TRIGGER when: SOQL query writing only (use querying-soql), Apex test execution (use running-apex-tests), or metadata deployment (use deploying-metadata).
accelint-ac-to-playwright
IncludedConvert and validate acceptance criteria for Playwright test automation. Use when user asks to (1) review/evaluate/check if AC are ready for automation, (2) assess if AC can be converted as-is, (3) validate AC quality for Playwright, (4) turn AC into tests, (5) generate tests from acceptance criteria, (6) convert .md bullets or .feature Gherkin files to Playwright specs, (7) create test automation from requirements. Handles both bullet-style markdown and Gherkin syntax with JSON test plan generation and validation.