Rust doc comment generator

From mxsm/rocketmq-rust · View interactive version

Rust doc comment generator is an AI agent skill from the GitHub repository mxsm/rocketmq-rust. Generate idiomatic, production-grade Rust comments and documentation strictly following official Rustdoc and Rust API documentation conventions. Designed for real-world Rust projects with zero AI-identifiable markers.

How to use this skill

Skill file

Rust Documentation & Comment Generator Skill

Overview

This skill generates standard-compliant Rust comments and documentation for Rust source code.

It strictly follows Rust’s official documentation guidelines and produces output suitable for

production-quality open-source and enterprise Rust projects.

The generated comments are:

Standards & References

This skill MUST comply with the following authoritative sources:

https://rust-lang.github.io/api-guidelines/documentation.html

https://doc.rust-lang.org/rustdoc/

https://doc.rust-lang.org/style-guide/

Supported Targets

This skill applies to the following Rust items:

Comment & Documentation Rules

1. Comment Types

| Context | Format |

|-------------------------------|-----------------------|

| Public item | /// Rustdoc comment |

| Module-level documentation | //! |

| Private implementation detail | // |

| Unsafe API explanation | /// # Safety |

2. Rustdoc Section Usage

Rustdoc sections MUST be included only when semantically relevant:

Empty or boilerplate sections are not allowed.

3. Language & Tone

✅ Correct:

Represents the configuration used by the message consumer.

❌ Incorrect:

This struct is very useful and highly optimized.

4. Blocking vs Async Behavior

Blocking APIs

Blocking behavior MUST be explicitly documented.

/// Blocks the current thread until a message is available.
Async / Non-Blocking APIs

Async behavior MUST be explicitly documented.

/// Asynchronously waits for the next message.
///
/// This function does not block the calling thread.

5. Unsafe Code Documentation

Any unsafe function or block MUST include a # Safety section.

/// # Safety
///
/// The caller must ensure that the pointer is valid and properly aligned
/// for the duration of the call.

Vague or generic safety statements are forbidden.

Forbidden Content

The output MUST NOT contain:

Input Expectations

The user may provide:

Output Expectations

The skill MUST:

  1. Preserve existing correct Rustdoc comments
  2. Rewrite non-standard comments into idiomatic Rustdoc
  3. Add missing documentation where appropriate
  4. Never change code semantics
  5. Never introduce new APIs or rename identifiers

Example

Input

pub struct MessageQueue {
    capacity: usize,
}

Output

/// Represents a bounded message queue.
///
/// The queue can store messages up to a fixed capacity.
pub struct MessageQueue {
    capacity: usize,
}

Non-Goals

This skill does NOT:

Compatibility

This skill is designed to work alongside:

Each skill operates independently and does not overlap responsibilities.

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.