Back to Skills

documenting-rust-code

Rust documentation practices for HASH codebase. Use when writing doc comments, documenting functions and types, creating error documentation sections, using intra-doc links, documenting traits and modules, writing examples, or following rustdoc conventions.

1,401stars110forksUpdated 1/23/2026

Security Assessment

Safe(100/100)
Security Score100/100

About documenting-rust-code

The 'documenting-rust-code' skill is designed to streamline the process of documenting Rust code within the HASH codebase. It follows Rust's standardized documentation conventions, particularly those outlined by rustdoc, to ensure consistency and readability across the project. By providing clear guidelines on how to structure doc comments, document functions, types, traits, and modules, and incorporate error sections, this skill makes writing Rust documentation efficient and standardized. It solves the common problem of inconsistent or incomplete code documentation, ensuring that developers can quickly add high-quality, well-structured documentation to their codebase.

FAQ

How do I use this skill for documenting functions in Rust?

This skill provides specific guidelines on documenting functions, including inline parameter descriptions for simple functions (0-2 params) and explicit 'Arguments' sections for more complex functions (3+ params). It also emphasizes including error conditions using the '# Errors' section and linking to related types using intra-doc links.

Is this skill compatible with all Rust projects?

Yes, this skill follows the standard rustdoc conventions, which are applicable to any Rust project. It is specifically tailored for the HASH codebase but can be easily adapted for other projects that follow similar documentation practices.

What are the limitations of this skill?

This skill is designed to be used for documenting code using standard rustdoc practices. It does not include functionality for generating documentation for non-standard Rust constructs or for generating code examples automatically. Additionally, it suggests best practices but does not enforce them strictly during coding.

Can this skill help document error handling in Rust?

Yes, the skill provides specific guidance on how to document error handling in Rust code. It includes examples of how to list potential errors using the '# Errors' section and link to custom error types using intra-doc links.

Does this skill generate documentation automatically?

No, this skill provides guidelines and templates for developers to follow when writing documentation. It does not automatically generate documentation but helps developers create consistent and high-quality doc comments.

Install documenting-rust-code

Download and extract the skill files to your .claude/skills/ directory.

Quick Setup:

  1. Copy the skill folder to .claude/skills/
  2. Claude will automatically detect and use the skill

Repository

hashintel/hash