locate-code
Skill1 starsChanged 36 days agoMITView on GitHub
Use when locating something in code before reading it (a symbol, syntactic shape, structural relation, refactor site) — bounded reading, a native-search fallback, and ast-grep for AST shapes. Not the entry point for relationships or impact: that's Code discovery routing's structural provider.
In this repository41 other files it gives its agents.
- AGENTS.mdAGENTS.md
- patient/AGENTS.mdAGENTS.md
- CLAUDE.mdCLAUDE.md
- patient/CLAUDE.mdCLAUDE.md
- author-skillSkill
- context-intakeSkill
- debug-failureSkill
- dominioSkill
- follow-up-prsSkill
- master-planSkill
- plan-advancedSkill
- plan-simpleSkill
- pytestSkill
- quality-attributesSkill
- resolve-ticketSkill
- review-diffSkill
- scoped-gateSkill
- secure-by-designSkill
- security-invariantsSkill
- solution-designSkill
- spec-bootstrapSkill
- verify-before-doneSkill
- author-skillSkill
- context-intakeSkill
- debug-failureSkill
- dominioSkill
- follow-up-prsSkill
- locate-codeSkill
- master-planSkill
- plan-advancedSkill
- plan-simpleSkill
- pytestSkill
- quality-attributesSkill
- resolve-ticketSkill
- review-diffSkill
- scoped-gateSkill
- secure-by-designSkill
- security-invariantsSkill
- solution-designSkill
- spec-bootstrapSkill
- verify-before-doneSkill
The file
We split this skill into the rules it gives an agent
8 rules. About 0 are common, 5 are distinctive, and 3 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈5
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
- Very specific: line 24
Read the minimum correct amount: confirm the region before opening it, and use ast-grep only for genuine syntactic shapes — it is not a …
- Distinctive: line 38
Start narrow: a file, directory or type you already have from routing or from the task itself.
- Very specific: line 39
Ask first for files (Grep files mode) or file:line with at most two lines of context — never a bare full-file read as a first move.
- Distinctive: line 64
Don't read whole files by reflex.
- Distinctive: line 65
Don't run wide grep without scope.
- Distinctive: line 66
Don't use regex as AST.
- Distinctive: line 67
If the search consumes ~15% of the context, stop: reduce scope or act on the available evidence.
- Very specific: line 68
Don't set up LSP/Serena — the structural provider covers relationships, ast-grep covers shapes.
≈ “Common” is an estimate: at least 1 in 5 of the 408,460 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
<!-- navori:managed id="locate-code-base" hash="ce861fbd" version="0.11.1" source="@navori/core" fmkeys="name,description,metadata" -->locate-code — bounded reading and AST shapes
Read the minimum correct amount: confirm the region before opening it, and use ast-grep only for genuine syntactic shapes — it is not a call-graph.
When to reach for this skill
Apply Code discovery routing (project instructions) first to pick the right lane. Come here when routing lands you on one of these:
- The structural provider is unavailable, disabled, or already answered and you only need to open the confirming span.
- You're searching for a syntactic shape (a function signature, a hook call, a component prop pattern), not a relationship or a literal string.
- You need a multi-site structural refactor (rewrite the same shape across files).
This is not a replacement ladder for routing: relationships, definitions and impact go to the structural provider; literal text, regex, comments and config go to native search.
Bounded reading
- Start narrow: a file, directory or type you already have from routing or from the task itself.
- Ask first for files (
Grepfiles mode) orfile:linewith at most two lines of context — never a bare full-file read as a first move. - Dedup hits before reading.
- Open only the span that confirms the hypothesis.
Both lanes defer to the enabled provider
Textual and structural discovery both route through Code discovery routing's enabled provider first: the textual lane resolves through tgrep when the plugin is enabled, the structural lane through CodeGraph when its plugin is enabled. Native Grep/Glob are pre-approved, read-only, and only the fallback for the textual lane and for filename/path patterns; manual reading is the fallback for the structural lane. Both fallbacks apply only when no provider is enabled or available — never as the default lane ahead of it. find is for what none of those cover (FS metadata like -size/-mtime) and isn't pre-approved because -exec/-delete make it non-read-only, so the prompt there is a safety net, not a nuisance; commit history goes to git log/git blame, never a content-search shell verb.
Silent skipping: an unavailable fallback (no textual or structural provider, no ast-grep) is not zero matches. Report the outage instead of folding it into "nothing found" — every optional piece here already states its own fallback (native search covers the absence of a provider; targeted Grep and manual reading cover the absence of ast-grep), so a new one should too.
ast-grep for AST shapes
ast-grep is the canonical binary for syntactic patterns — it matches shape, not text. Spell it out in full:
ast-grep -p 'async function $N($$$) { $$$ }' -l ts src/
ast-grep -p 'useAuth($$$)' -l tsx apps/Homebrew also installs it as sg, and that alias is deliberately NOT pre-approved: on Linux sg is shadow-utils — sg <group> -c "<command>" runs an arbitrary command, so allowlisting it would bypass the whole permission layer.
To rewrite, first test the pattern without --rewrite, limit paths/language and review the diff before applying. It finds occurrences of a shape; it does not resolve call graphs or cross-file relationships — that question belongs to the structural provider under Code discovery routing. If ast-grep isn't installed, fall back to Grep and targeted reading: don't invent its syntax and don't block the task.
Limits
- Don't read whole files by reflex.
- Don't run wide grep without scope.
- Don't use regex as AST.
- If the search consumes ~15% of the context, stop: reduce scope or act on the available evidence.
- Don't set up LSP/Serena — the structural provider covers relationships,
ast-grepcovers shapes.
<!-- /navori:managed id="locate-code-base" -->The project's structural patterns
<!-- user: document here proven ast-grep patterns, frequent languages and paths. Save reusable patterns; don't paste results nor current lines. -->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.

