agentleFS
gurinderugurinderu/craft/skills/rust-navigation/SKILL.md

rust-navigation

Skill1 starsChanged 40 days agoMITView on GitHub

Navigate a Rust codebase with rust-analyzer over LSP instead of grepping blindly — go to definition, find references (impact before a rename), read a symbol's type/docs, find a trait's implementors, and trace a call hierarchy. Use when exploring an unfamiliar crate, locating a symbol, or assessing a change's blast radius. Triggers: where is X defined, who calls, find references, find implementations, call hierarchy, rust-analyzer, LSP.

The file

We split this skill into the rules it gives an agent

2 rules. About 0 are common, 0 are distinctive, and 2 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈0

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 2

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Very specific:

    Every LSP operation takes filePath, line, character (both 1-based, as shown in an editor) pointing at the symbol.

    line 18
  2. Very specific:

    Impact before a rename/signature change: Run findReferences on the item *first* — that set is the blast radius.

    line 55

≈ “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.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

Rust Navigation (LSP)

grep finds text; rust-analyzer understands the program. For "where is this defined", "who uses this", "who implements this trait", and "who calls this", use the LSP tool — it resolves through types, modules, generics, and re-exports that a text search gets wrong.

This is the Rust tool for navigation; the method for understanding an unfamiliar repo (map → seams → trace one flow → confirm by building) is codebase-onboarding, which calls this.

Positions are 1-based, so locate first, then operate

Every LSP operation takes filePath, line, character (both 1-based, as shown in an editor) pointing at the symbol. You rarely know the column up front, so it's a two-step move:

  1. Find the symbol by name: LSP(operation: "workspaceSymbol", query: "parse_config", …) (pass any filePath/line/character — they're required but ignored for this op), or just rg -n "fn parse_config" to get file:line.
  2. Operate at that position, pointing character at the symbol name itself.

Want X → operation

You wantOperationPoint at
Jump to where a symbol is definedgoToDefinitiona use site
Every place a symbol is used (impact of a change)findReferencesthe def or any use
A symbol's type + rustdoc, inlinehoverthe symbol
The outline of one file (items, methods)documentSymbolanywhere in the file (e.g. 1,1)
Find a symbol by name across the crateworkspaceSymbol + queryn/a (use query)
Who implements this trait / where a trait method is implementedgoToImplementationthe trait or method name
Who calls this functionprepareCallHierarchy → incomingCallsthe fn name
What this function callsprepareCallHierarchy → outgoingCallsthe fn name

Call hierarchy is two steps

incomingCalls/outgoingCalls need a hierarchy item, so call prepareCallHierarchy at the function name first, then the direction you want. Recurse to the depth you need and render it as a tree; stop at the layer boundary (handler / trait object / spawn) rather than chasing forever.

Callers of process_request          Callees of process_request
main                                 process_request
└─ run_server                        ├─ parse_headers
   └─ handle_connection              ├─ authenticate → check_token, load_user
      └─ process_request  ◄ here     └─ send_response

Two high-value uses

  • Impact before a rename/signature change. Run findReferences on the item first — that set is the blast radius. Feed it to refactoring (change under green tests, one site at a time).
  • "Who implements this trait?" goToImplementation on the trait answers the dispatch question directly; pair with rust-traits when deciding static vs dyn vs enum dispatch.

When there's no LSP

The tool errors if rust-analyzer isn't configured for the workspace. Suggest rustup component add rust-analyzer, and meanwhile fall back to text tools — they're coarser but always available:

LSP opFallback
goToDefinitionrg -n "(fn|struct|enum|trait|const) <name>"
findReferencesrg -nw "<name>" (over-reports: same name, different item)
goToImplementationrg -n "impl .*<Trait>( for |<)"
call hierarchyrg -nw "<fn>(" for callers; read the body for callees
documentSymbol / workspaceSymbolrg -n "^\s*(pub )?(fn|struct|enum|trait|mod) "

Macros and generated code defeat both LSP and grep equally — verify a surprising result by reading the site.

Boundary

  • The onboarding method (where to start, trace one flow) → codebase-onboarding.
  • Acting on a findReferences set safely → refactoring.
  • Static vs dynamic vs enum dispatch once you've found the impls → rust-traits.
  • Finding the commit that introduced a behavior (not the symbol) → debugging (git bisect).

Download now (ZIP)

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
What did you use it for? e.g. Reviewing pull requests in a Rails app

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.