rust-analyzer-api

Document rust-analyzer's public API crates for building Rust analysis tools.

2|1|Updated Apr 27, 2026
One-click install
npx skills add https://github.com/nikomatsakis/sage-dev --skill rust-analyzer-api
Or copy as Structured Prompt for Agentā–¼
Please help me install this Agent Skill.
Skill: rust-analyzer-api
Source: https://github.com/nikomatsakis/sage-dev/tree/main/.agents/skills/rust-analyzer-api
Command: npx skills add https://github.com/nikomatsakis/sage-dev --skill rust-analyzer-api

SYSTEM DOCUMENTATION & REQUIREMENTS

šŸ’” This Skill includes scripts (resource) and references (resource) components.

What problem does it solve?

This Skill provides a guide to rust-analyzer's public API crates, enabling the creation of Rust analysis tools, code intelligence, linters, refactoring tools, and more.

Core Features & Use Cases

  • API Documentation: Detailed guide to the public API crates (ra_ap_*).
  • Use Cases: Suitable for building IDE-grade analysis tools, custom linters, refactoring tools, or any programmatic consumer of rust-analyzer's libraries.
  • Notable Crates: Covers ide, hir, syntax, ide_db, vfs, load-cargo, project-model, and secondary crates for completions, SSR, hir_def, hir_ty, cfg, parser, paths, proc_macro_api.

Quick Start

Use the rust-analyzer-api skill to get started with building your Rust analysis tool.

Frequently Asked Questions about rust-analyzer-api

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

FAQPage Schema
How do I build custom linters and refactoring tools using the rust-analyzer API?ā–¼

To build custom linters and refactoring tools with the rust-analyzer API, use the public ra_ap_* crates like ide, hir, and ide_db for programmatic code intelligence and IDE-grade analysis.

What is the rust-analyzer public API used for in Rust code intelligence?ā–¼

The rust-analyzer public API provides crates like hir, syntax, and vfs for programmatic Rust code analysis, enabling developers to build code intelligence tools, completions, and structural search and replace (SSR) utilities.

Do I need prior Rust knowledge to use the rust-analyzer API for building analysis tools?ā–¼

Yes, using the rust-analyzer API requires existing knowledge of Rust and familiarity with its internal libraries to effectively consume crates like hir_ty, hir_def, and project-model for code analysis.

What's the best way to programmatically consume rust-analyzer libraries for IDE-grade analysis?ā–¼

The best way to programmatically consume rust-analyzer libraries is by integrating the public ra_ap_* crates, utilizing load-cargo and project-model for setup and ide_db for querying code intelligence.

Which public crates are available in the rust-analyzer API for syntax and type analysis?ā–¼

The rust-analyzer API offers crates including syntax for parsing, hir and hir_def for definitions, hir_ty for type inference, and parser, enabling comprehensive Rust code analysis and tool development.

Are there limitations to using rust-analyzer API crates for developing code intelligence tools?ā–¼

The rust-analyzer API crates are specialized for Rust code analysis, requiring familiarity with internal modules like proc_macro_api and cfg, meaning they are not suited for analyzing other programming languages.