sourcegraph-search
Skill1 starsChanged 3 months agoMITView on GitHub
Search code, commits, and diffs across millions of open source and private repositories using the Sourcegraph CLI (src).
In this repository22 other files it gives its agents.
- alloy-structural-analysisSkill
- analyzing-architectureSkill
- color-accessibilitySkill
- daily-briefingSkill
- design-docSkill
- diagramSkill
- eng-career-goals-writerSkill
- gh-repo-managementSkill
- git-commit-helperSkill
- jiraSkill
- jqSkill
- morphirSkill
- newrelic-cliSkill
- oli-storage-managerSkill
- project-instructorSkill
- qmd-searchSkill
- rigorous-reviewSkill
- save-zkSkill
- scalaSkill
- smart-initSkill
- structured-memorySkill
- visualizeSkill
The file
We split this skill into the rules it gives an agent
5 rules. About 0 are common, 2 are distinctive, and 3 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈2
Distinctive · estimate
This author's own choices. Worth a look.
3
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 14
Use this skill when:
- Very specific: line 45
Use patternType:structural to match code structures rather than exact strings.
- Very specific: line 47
Syntax: Use :[name] as a placeholder (hole) to match any code between delimiters.
- Distinctive: line 57
Use these specific patterns for high-value tasks:
- Very specific: line 76
Check package.json files for a specific vulnerable library version.
≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
What I do
I help you perform large-scale code analysis and discovery by searching Sourcegraph. I use the src CLI to execute precise queries that can match literal strings, regular expressions, or structural code patterns. I can filter results by repository, file type, language, commit history, and time ranges. I am particularly effective at finding usage examples, security vulnerabilities, deprecated patterns, and architectural inconsistencies across massive codebases.
When to use me
Use this skill when:
- You need to search across a large codebase or multiple repositories for specific patterns, functions, or dependencies.
- You need to find real-world usage examples of a function or API across many repositories.
- You are auditing a codebase for security tokens, keys, or vulnerable dependencies.
- You want to perform "structural search" to match code patterns regardless of whitespace or formatting (e.g., finding all try-catch blocks with empty catches).
- You need to track recent changes or history using
type:diffortype:commit(e.g., "what changed in the last week"). - You want to find projects that use specific dependencies (e.g., "who relies on
lodashversion 4.17.19"). - You need to identify repositories that are contributor-friendly (e.g., contain
CONTRIBUTING.md).
Instructions
1. Basic Search
Execute searches using the src search command. Always use the -json flag to ensure the output is machine-readable and easy to parse. Enclose your query in single quotes to prevent shell expansion.
src search -json 'query'
2. Advanced Filtering
Refine your search results using these standard filters within your query string:
- Repository:
repo:^github\.com/owner/name$(supports regex) - File:
file:\.js$orfile:package\.json - Language:
lang:TypeScript - Content:
content:"string to find"(optional, content is searched by default) - Boolean Operators:
AND,OR,NOT(e.g.,error AND NOT file:test)
3. Structural Search
Use patternType:structural to match code structures rather than exact strings. This is powerful for finding code regardless of line breaks or formatting.
- Syntax: Use
:[name]as a placeholder (hole) to match any code between delimiters. - Example: Find
console.logwith any argument:
src search -json 'console.log(:[args]) patternType:structural'
4. Search Tricks & Best Practices
Use these specific patterns for high-value tasks:
Find Usage of a Method (Structural) Find where a method is called, even with different arguments or formatting.
src search -json 'myMethod(:[args]) patternType:structural'
Find Security Vulnerabilities (Regex) Scan for potential leaked secrets or keys.
src search -json '(key|secret|token)-[\w+]{32,} patternType:regexp'
Find Specific Dependency Versions
Check package.json files for a specific vulnerable library version.
src search -json 'file:package.json lodash 4.17.19'
Find Recent Changes (Diffs/Commits) See what changed in a repository recently.
src search -json 'repo:^github\.com/owner/repo$ type:diff after:"1 week ago"'
Find Contributor-Friendly Projects Locate repositories with contribution guidelines.
src search -json 'contributing lang:Markdown'
5. Output Interpretation
The -json output will provide a list of matches. Key fields to observe:
repository: The repository name.file: The path to the matching file.lineMatches: Specific lines and line numbers where the match occurred.commit: If searching history, the commit hash and author.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

