sourcegraph-integration

Search code across repositories using Sourcegraph GraphQL queries with repo and file filters.

Updated Mar 26, 2026
One-click install
npx skills add https://github.com/erwinv2k-TKG/AgentesVSC --skill sourcegraph-integration-erwinv2k-tkg
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: sourcegraph-integration
Source: https://github.com/erwinv2k-TKG/AgentesVSC/tree/main/packs/incidentfox/sre-agent/.claude/skills/vcs-sourcegraph
Command: npx skills add https://github.com/erwinv2k-TKG/AgentesVSC --skill sourcegraph-integration-erwinv2k-tkg

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 runs Sourcegraph code searches directly from the agent environment, returning matching files, repositories, and line-level context. ## Core Features & Use Cases - Cross-Repository Code Search: Query Sourcegraph with plain text or regex patterns and get structured file matches with line numbers. - Scoped Filtering: Narrow results by repository (repo:), file path (file:), language (lang:), or search type (type:symbol, diff, commit). - Structured Output: Return results as human-readable listings or JSON for downstream processing. - Use Case: During incident investigation, search for every occurrence of a failing function like "func handleError" across all organization repositories to locate affected services quickly. ## Quick Start Ask the agent to search Sourcegraph for a code pattern such as "find all implementations of handleError in our Go repositories" and it will run the search script with the appropriate filters.

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 script with a query string, optionally adding repo and file filters. It sends a GraphQL search request to Sourcegraph and returns matching files with repository names, URLs, and matching line content.

What search filters does Sourcegraph code search support?

Supported filters include repo: for repository patterns, file: for file paths, lang: for programming languages, and type: for search kinds like symbol, file, diff, or commit. Regex patterns are also supported directly in queries.

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, a sandbox JWT, or tenant and team ID headers as fallbacks.

Can I get Sourcegraph search results as JSON?

Yes, pass the --json flag to the search script to output structured JSON containing file paths, repositories, URLs, and matched lines. Without the flag, results print as a grouped human-readable listing.

Why does my Sourcegraph search return no results?

Empty results usually come from overly restrictive repo or file filters, or queries that do not match indexed content. Broaden the repo filter, check regex syntax, and verify the target repositories are indexed by the Sourcegraph instance.