github-code-search
jaredpalmer/claude-plugins
grep.app を使って、数百万ものリポジトリにまたがる GitHub のコードを検索できます。コードのパターンや実装、例を見つけたい場合や、公開されているコードベースで機能がどのように構築されているかを理解したい場合に活用してください。(プロジェクト)
...すべて拡張しますgithub-code-searchについて
「github-code-search」スキルは、grep.app サービスを利用して、数百万もの公開 GitHub リポジトリを横断検索することを可能にします。このスキルは、膨大なオープンソースコードの中からコードパターン、実装例、サンプルを見つけるための強力かつ効率的な手段を提供します。 grep.appのMCPサーバーを活用することで、他のプロジェクトが特定の機能をどのように実装しているか、あるいは異なるリポジトリ間でライブラリやAPIがどのように使用されているかなど、特定のコードパターンを検索することが可能になります。学習目的であれ、既存の実装の分析であれ、特定のコードパターンの例を集めるためであれ、GitHubのコードを検索するための簡単かつ効率的な方法を提供します。
このスキルの主な機能には、検索、フィルタリング、結果のローカル処理のためにTypeScriptコードを実行する機能が含まれており、これにより検索効率が向上し、トークンの使用量を削減できます。組み込みのTypeScript検索スクリプトは、言語フィルタリング、結果の絞り込み、正規表現の使用など、さまざまなオプションを備えた使いやすいコマンドラインインターフェースを提供します。 また、ユーザーはインラインのTypeScriptを記述して独自のフィルタリングや処理を行い、カスタム検索を実行することも可能です。さらに、このスキルはcurlなどのシンプルなツールを使った迅速な検索のための直接APIを提供しており、上級ユーザーから初心者まで柔軟に対応しています。
このスキルは、開発者、研究者、およびオープンソースプロジェクトの分析に携わるすべての人にとって理想的です。コードの実装や例を見つけたり、コーディングパターンを分析したり、ベストプラクティスを学んだりしたい方に最適です。 特に、再利用可能なコードスニペットを探している開発者や、オープンソースプロジェクトにおける機能の構築方法を調査したい方、公開リポジトリ内のライブラリやAPIの使用状況について洞察を得たい方にとって、このスキルは非常に有用です。
よくある質問
このスキルを使って特定のコードスニペットを検索するにはどうすればよいですか?
同梱の TypeScript 検索スクリプトを使用して、特定のコードスニペットを検索できます。 目的の検索クエリや、言語やリポジトリなどのオプションのフィルターを指定してスクリプトを実行してください。たとえば、TypeScript ファイル内で「use cache」を検索するには、次のコマンドを実行します:'bun run skills/github-code-search/scripts/search.ts "use cache" --lang=TypeScript'。
特定のリポジトリ内で検索することはできますか?
はい、「--repo」フラグの後に所有者名またはリポジトリ名を指定することで、特定のリポジトリ内を検索できます。 たとえば、「vercel/next.js」リポジトリ内で検索するには、次のコマンドを使用します:「bun run skills/ github-code-search /scripts/search.ts "cacheLife" --repo=vercel/next.js」。
このスキルを使用するための設定要件は何ですか?
このスキルを使用するには、grep.app MCP サーバーが設定されている必要があります。サーバーは次のコマンドで追加できます:「claude mcp add --transport http grep https://mcp.grep.app」。'/mcp' を実行して設定を確認してください。'grep' が表示されるはずです。
インライン TypeScript オプションはどのように機能しますか?
インライン TypeScript オプションを使用すると、カスタム検索やフィルタリングが可能になります。grep.app API を呼び出す TypeScript コードを記述し、その結果をローカルで処理して、必要に応じてデータをフィルタリングまたは変換することができます。これにより、複数のクエリ結果を結合したり、リポジトリ名でフィルタリングしたりするなど、高度なユースケースにおいてより柔軟な対応が可能になります。
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
github-code-searchをインストール
スキルファイルをダウンロードし、.claude/skills/ ディレクトリに解凍してください。
ZIPをダウンロードリポジトリをクローンし、スキルファイルをプロジェクトにコピーしてください。
git clone https://github.com/jaredpalmer/claude-plugins/blob/main/skills/github-code-search/SKILL.md # Copy SKILL.md to your .claude/skills/ directory
コピー





家
