rust-doc-comment-generator

A guide for writing Rust comments and documentation in the format supported by Rustdoc, Rust's documentation generator. It covers functions, types, traits, modules, and unsafe code.

In plain words
What is it for?
Use it to add or improve documentation comments for Rust source code, including public APIs and unsafe operations.
Why use it?
It helps produce consistent documentation that matches established Rust conventions and can be used in real projects.

Skill for Claude CodeCodex

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add skills/mxsm/rocketmq-rust/rust-doc-comment-generator
Any agent
npx skills add mxsm/rocketmq-rust --skill rust-doc-comment-generator
Clone the repo
git clone --depth 1 https://github.com/mxsm/rocketmq-rust

Made for: Claude Code, Codex.

Per session 39 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 873 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5 $0.00039 $0.00873
Opus 5 $0.00019 $0.00436
Sonnet 5 $0.00008 $0.00175
Haiku 4.5 $0.00004 $0.00087

Measured 3d ago against content hash 76cab3e0082f, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

rust-doc-comment-generator scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 3d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

.agents/skills/rust-doc-comment-generator/SKILL.md · 182 lines

How it starts

The opening of the file, as written. The whole thing — 182 lines — stays where its author put it; the contents beside it link to each section on GitHub.

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:

  • Idiomatic and precise
  • Free of AI-identifiable artifacts
  • Fully aligned with Rustdoc conventions
  • Suitable for blocking, async, and unsafe code

Standards & References

This skill MUST comply with the following authoritative sources:

Supported Targets

This skill applies to the following Rust items:

  • struct, enum, union
  • trait
  • impl blocks
  • fn / async fn
  • Modules (mod)
  • unsafe blocks and functions

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:

  • # Examples
  • # Panics
  • # Errors
  • # Safety
  • # Performance

Empty or boilerplate sections are not allowed.

3. Language & Tone

  • Use formal, neutral, technical language
  • Avoid conversational or instructional phrasing
  • Avoid marketing or subjective language
  • Describe behavior, constraints, and guarantees precisely

✅ Correct:

Represents the configuration used by the message consumer.

❌ Incorrect:

This struct is very useful and highly optimized.

4. Blocking vs Async Behavior

Read the full file on GitHub · 182 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 3d ago First seen · 182 lines · 39 tokens per session scan A 76cab3e0082f

Subscribe to this mod's changes

rust-doc-comment-generator is a skill published in the GitHub repository mxsm/rocketmq-rust (1,508 stars, last pushed yesterday), licensed Apache-2.0. It adds 39 tokens to every session and 873 once invoked, about $0.0002 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.