exploring-rust-crates

通过生成和浏览 Rust 项目文档,帮助理解 crate 的模块结构、公共 API 接口、类型与 trait 关系、错误处理方式及典型用法示例,适用于在 HASH 工作区中快速掌握 Rust 包的设计意图与使用方法。

快捷安装

在终端运行此命令,即可一键安装该 Skill 到您的 Claude 中

npx skills add hashintel/hash --skill "exploring-rust-crates"

Exploring Rust Crates

Generate and use Rust documentation to understand crate APIs, structure, and code organization in the HASH workspace.

Generating Documentation

For a Specific Package

cargo doc --no-deps --all-features --package <package-name>

For the Entire Workspace

cargo doc --no-deps --all-features --workspace

Key Flags

  • --no-deps: Document local code only (faster, less noise)
  • --all-features: Include all feature-gated APIs
  • --package <name>: Target a specific crate
  • --workspace: Document all crates in the workspace
  • --document-private-items: Include internal implementation details

What Generated Docs Provide

  1. Crate organization - Module hierarchy and component relationships
  2. Public API surface - All public functions, types, traits, and constants
  3. Usage examples - Code examples from doctest blocks
  4. Error documentation - Documented error conditions and handling
  5. Type relationships - Trait implementations, type aliases, associated types

Viewing Documentation

Docs are generated at:

target/doc/<crate_name>/index.html

Tips

  • Generate docs before diving into unfamiliar Rust code
  • Cross-reference # Errors sections for error handling patterns
  • Look for # Examples sections for idiomatic usage patterns