sourcegraph-integration

Search code across repositories using the Sourcegraph GraphQL API.

656|82|Updated Jan 20, 2026
One-click install
npx skills add https://github.com/incidentfox/incidentfox --skill sourcegraph-integration
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: sourcegraph-integration
Source: https://github.com/incidentfox/incidentfox/tree/main/sre-agent/.claude/skills/vcs-sourcegraph
Command: npx skills add https://github.com/incidentfox/incidentfox --skill sourcegraph-integration

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill requires httpx, and includes scripts (resource) components.

What problem does it solve?

Finding specific code patterns, function implementations, or usages across many repositories is slow when done manually. This Skill queries Sourcegraph to locate code matches across an entire codebase index in seconds.

Core Features & Use Cases

  • Cross-Repository Code Search: Run a single query that searches all indexed repositories and returns matching files with line-level context.
  • Flexible Filtering: Narrow results with repo, file, language, and type filters (e.g., repo:github.com/org/, file:.go, lang:python, type:symbol).
  • Structured Output: Get results as human-readable grouped listings or JSON for downstream processing.
  • Use Case: During incident investigation, search for func handleError across all services to find every implementation and understand how errors propagate through the system.

Quick Start

Search Sourcegraph for the query "func handleError" filtered to Go files and show me the matching files and lines.

Frequently Asked Questions about sourcegraph-integration

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I search code across multiple repositories with Sourcegraph?

Run the search.py script with a --query argument containing your search pattern. Add --repo-filter and --file-filter flags to narrow results, and use --limit to cap the number of returned file matches.

What search filters does Sourcegraph support?

Sourcegraph supports repo: for repository filtering, file: for file path patterns, lang: for programming languages, and type: for result kinds like symbol, file, diff, or commit. Regex patterns are supported directly in queries.

How do I get Sourcegraph search results as JSON?

Pass the --json flag to the search script. It outputs an array of match objects containing file_path, repository, url, and up to three matching lines with line numbers per file.

Does Sourcegraph search require authentication credentials?

Credentials are injected automatically by a proxy layer, so scripts run directly without manual setup. The client also supports SOURCEGRAPH_TOKEN, sandbox JWT, or tenant and team ID headers depending on the environment.

Why does my Sourcegraph search return no results?

Empty results usually mean the query pattern does not match indexed code or the repo and file filters are too restrictive. Broaden the query, verify the repository filter syntax, and confirm the target repositories are indexed in Sourcegraph.