github-code-search
jaredpalmer/claude-plugins
Search GitHub code across millions of repositories using grep.app. Use when you need to find code patterns, implementations, examples, or understand how features are built in public codebases. (project)
...Expand allAbout github-code-search
The 'github-code-search' skill allows users to search across millions of public GitHub repositories using the grep.app service. This skill provides a powerful and efficient way to find code patterns, implementations, and examples within the vast pool of open-source code. By leveraging the grep.app MCP server, it enables users to search for specific code patterns, such as finding how other projects implement certain features or how libraries and APIs are used across different repositories. It provides an easy and efficient method for querying GitHub code, whether it be for learning purposes, analyzing existing implementations, or gathering examples of specific code patterns.
Main features of the skill include the ability to execute TypeScript code for searching, filtering, and processing results locally, allowing for more efficient searches and reducing token usage. The built-in TypeScript search script provides an easy-to-use command line interface to perform searches with various options like language filtering, limiting results, and using regular expressions. Users can also perform custom searches by writing inline TypeScript for custom filtering and processing. Furthermore, the skill offers a direct API for quick searches using simple tools like curl, providing flexibility for both advanced and basic users.
This skill is ideal for developers, researchers, and anyone involved in analyzing open-source projects. It is perfect for those who want to find code implementations or examples, analyze coding patterns, or study best practices. The skill is particularly useful for developers seeking reusable code snippets, exploring how features are built in open-source projects, or gaining insights into the use of libraries and APIs within public repositories.
FAQ
How do I search for specific code snippets using this skill?
You can search for specific code snippets by using the included TypeScript search script. Run the script with the desired search query and optional filters like language or repository. For example, you can search for 'use cache' in TypeScript files with the command: 'bun run skills/github-code-search/scripts/search.ts "use cache" --lang=TypeScript'.
Can I search within a specific repository?
Yes, you can search within a specific repository by using the '--repo' flag followed by the owner/repository name. For example, to search within the 'vercel/next.js' repository, use the command: 'bun run skills/github-code-search/scripts/search.ts "cacheLife" --repo=vercel/next.js'.
What are the setup requirements for using this skill?
To use this skill, you need to have the grep.app MCP server configured. You can add the server using the command: 'claude mcp add --transport http grep https://mcp.grep.app'. Verify the configuration by running '/mcp', which should list 'grep'.
How does the inline TypeScript option work?
The inline TypeScript option allows for custom searches and filtering. You can write TypeScript code that calls the grep.app API and then processes the results locally to filter or transform the data as needed. This provides more flexibility for advanced use cases, such as combining multiple query results or filtering by repository name.
GitHub Code Search via grep.app
Overview
This skill enables searching across millions of public GitHub repositories using the grep.app service. It uses a code mode pattern where you write and execute TypeScript code to query the grep.app MCP server, filter results locally, and return only relevant findings.
When to Use
- Find implementations of specific patterns (e.g., "how do other projects implement OAuth2?")
- Search for usage examples of APIs or libraries
- Analyze architectural patterns across codebases
- Find code snippets matching regex patterns
- Research best practices by examining popular repositories
Setup Requirements
The grep.app MCP server must be configured. Add it with:
claude mcp add --transport http grep https://mcp.grep.app
Verify with /mcp - you should see grep listed.
Code Mode Pattern
Instead of calling MCP tools directly (which loads all tool definitions into context), this skill uses code execution for efficiency:
- Write TypeScript code that calls the grep MCP server
- Execute the code via Bash with
bunornpx tsx - Filter and process results in the execution environment
- Return only relevant findings to minimize token usage
This approach reduces token usage by 90%+ compared to direct tool calls with large result sets.
Implementation
Option 1: Use the bundled search script (recommended)
A ready-to-use TypeScript search script is included:
bun run skills/github-code-search/scripts/search.ts "query" [--lang=Language] [--repo=owner/repo] [--limit=N] [--regexp]
Examples:
# Search for "use cache" in TypeScript filesbun run skills/github-code-search/scripts/search.ts "use cache" --lang=TypeScript --limit=5# Search in a specific repositorybun run skills/github-code-search/scripts/search.ts "cacheLife" --repo=vercel/next.js --limit=10# Use regex patternsbun run skills/github-code-search/scripts/search.ts "async.*await" --regexp --lang=TypeScript
Output format (JSON):
{ "query": "cacheLife", "options": { "language": "TypeScript", "limit": 3 }, "total": 2931, "results": [ { "repo": "vercel/next.js", "path": "packages/next/src/server/use-cache/cache-life.ts", "url": "https://github.com/vercel/next.js/blob/canary/packages/next/src/server/use-cache/cache-life.ts", "matches": [{ "lineNumber": 5, "content": "export type »CacheLife« = {" }] } ]}The » and « markers indicate where the search term was matched.
Option 2: Inline TypeScript (for custom processing)
For more complex searches with custom filtering, write inline TypeScript:
// Execute with: bun -e "..."const response = await fetch( 'https://grep.app/api/search?q=useOptimistic&l=TypeScript')const data = await response.json()// Process results locally - this is the efficiency gain!const filtered = data.hits.hits .filter((hit: any) => hit.repo.includes('react')) .slice(0, 5) .map((hit: any) => ({ repo: hit.repo, path: hit.path }))console.log(JSON.stringify(filtered, null, 2))
Quick Search (Direct API)
For simple searches, use curl directly:
curl -s "https://grep.app/api/search?q=useOptimistic+hook&l=TypeScript" | jq '.hits.hits[:5] | .[] | {repo: .repo.raw, path: .path.raw}'
Parameters
| Parameter | Description | Example |
|---|---|---|
q | Search query (required). Supports regex with regexp:true | "use cache", async.*await |
l | Language filter | TypeScript, Python, Go |
r | Repository filter | vercel/next.js, facebook/react |
regexp | Enable regex mode | true |
Example Queries
Find "use cache" implementations in Next.js projects
curl -s "https://grep.app/api/search?q=%22use%20cache%22&l=TypeScript" | jq '.hits.hits[:10] | .[] | {repo: .repo.raw, path: .path.raw}'
Search for error handling patterns
curl -s "https://grep.app/api/search?q=catch.*error.*log®exp=true&l=TypeScript" | jq '.hits.total'
Find implementations in a specific repo
curl -s "https://grep.app/api/search?q=cacheLife&r=vercel/next.js" | jq '.hits.hits[] | {path: .path.raw, lines: .content.lines}'
Best Practices
- Start broad, then narrow: Begin with a general query, then add language/repo filters
- Use regex for patterns: Enable
regexp=truefor complex pattern matching - Limit results locally: Process and filter in code before returning to save tokens
- Cache common searches: Store results for frequently-used queries
- Respect rate limits: The grep.app API has rate limits; batch queries when possible
Integration with MCP Tools
If the grep MCP server is configured, you can also use it via MCP tools:
// Via MCP (if mcp__grep__search is available)mcp__grep__search({ query: 'authentication middleware', language: 'TypeScript', useRegexp: false,})
However, the code mode approach (curl + jq or TypeScript script) is preferred for:
- Large result sets that need filtering
- Complex post-processing logic
- Chaining multiple searches
- Minimizing context window usage
Troubleshooting
- No results: Try broadening the query or removing filters
- Rate limited: Wait a few seconds and retry, or use the MCP server which may have higher limits
- Timeout: Large queries may timeout; add more specific filters
Install github-code-search
Download and extract the skill files to your .claude/skills/ directory.
Download ZIPClone the repository and copy the skill files to your project.
git clone https://github.com/jaredpalmer/claude-plugins/blob/main/skills/github-code-search/SKILL.md # Copy SKILL.md to your .claude/skills/ directory
Copy





Home
