search-code
$
npx mdskill add TheBushidoCollective/han/search-codeSearch code snippets across GitHub repositories instantly.
- Locates specific implementations using keywords or GitHub syntax.
- Depends on the GitHub MCP server and OAuth authentication.
- Prioritizes matches by relevance to the provided search query.
- Delivers file paths, line numbers, and context with direct links.
SKILL.md
.github/skills/search-codeView on GitHub ↗
---
name: search-code
description: Search for code across GitHub repositories
---
# Search GitHub Code
## Name
github:search-code - Search for code across GitHub repositories
## Synopsis
```
/search-code [arguments]
```
## Description
Search for code across GitHub repositories
## Implementation
Search for code, files, or implementations across GitHub repositories.
## Usage
```
/search-code [query]
```
This command helps you find relevant code across repositories.
## What This Command Does
1. Accepts a search query (keywords or GitHub search syntax)
2. Searches across accessible repositories using `search_code`
3. Returns relevant code snippets with:
- File paths and line numbers
- Repository names
- Code context around matches
- Links to view full files
## Prerequisites
- GitHub MCP server must be installed and configured
- OAuth authentication must be completed
## Example Interaction
```
User: /search-code JWT token validation
Claude: Searching for "JWT token validation"...
Found 4 relevant code snippets:
### 1. my-org/auth-service - src/middleware/validateToken.ts
```typescript
export function validateJWT(token: string): UserPayload {
try {
const decoded = jwt.verify(token, process.env.JWT_SECRET);
return decoded as UserPayload;
} catch (error) {
throw new UnauthorizedError('Invalid token');
}
}
```
### 2. my-org/api-gateway - lib/security/jwt.ts
```typescript
async function verifyToken(req: Request): Promise<boolean> {
const token = req.headers.authorization?.split(' ')[1];
if (!token) return false;
return await jwt.verify(token, publicKey, { algorithms: ['RS256'] });
}
```
Would you like to see more results or explore any of these files?
```
## Search Syntax
GitHub code search supports advanced syntax:
- **Exact phrase**: `"function authenticate"`
- **File type**: `language:typescript`
- **Path filter**: `path:src/auth`
- **Repository**: `repo:owner/repo-name`
- **Organization**: `org:my-org`
- **Extension**: `extension:ts`
### Examples
```
## Find all TypeScript files with "authenticate"
authenticate language:typescript
## Search in specific path
validate path:src/middleware
## Search specific repository
JWT repo:my-org/auth-service
## Combine filters
async function org:my-org language:javascript
```
## Tips
- Use specific keywords for better results
- Filter by language to reduce noise
- Search across an organization with `org:`
- Combine with path filters to narrow scope
- Use quotes for exact phrases
- Review multiple implementations for patterns
## Related Commands
- `/review-pr`: Review PRs that modify found code
- `/create-issue`: File issues for problems found
- `/create-pr`: Create PR to fix or improve code
More from TheBushidoCollective/han
- absinthe-resolversUse when implementing GraphQL resolvers with Absinthe. Covers resolver patterns, dataloader integration, batching, and error handling.
- absinthe-schemaUse when designing GraphQL schemas with Absinthe. Covers type definitions, interfaces, unions, enums, and schema organization patterns.
- absinthe-subscriptionsUse when implementing real-time GraphQL subscriptions with Absinthe. Covers Phoenix channels, PubSub, and subscription patterns.
- act-docker-setupUse when configuring Docker environments for act, selecting runner images, managing container resources, or troubleshooting Docker-related issues with local GitHub Actions testing.
- act-local-testingUse when testing GitHub Actions workflows locally with act. Covers act CLI usage, Docker configuration, debugging workflows, and troubleshooting common issues when running workflows on your local machine.
- act-workflow-syntaxUse when creating or modifying GitHub Actions workflow files. Provides guidance on workflow syntax, triggers, jobs, steps, and expressions for creating valid GitHub Actions workflows that can be tested locally with act.
- ameba-configurationUse when configuring Ameba rules and settings for Crystal projects including .ameba.yml setup, rule management, severity levels, and code quality enforcement.
- ameba-custom-rulesUse when creating custom Ameba rules for Crystal code analysis including rule development, AST traversal, issue reporting, and rule testing.
- ameba-integrationUse when integrating Ameba into development workflows including CI/CD pipelines, pre-commit hooks, GitHub Actions, and automated code review processes.
- analyze-performanceAnalyze performance metrics and identify slow transactions in Sentry