用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
直接命令不会经过审查 Prompt;运行前请先检查来源。
npx skills add https://github.com/tomevault-io/skills-registry --skill docstring-generator命令会保持在同一行。复制前请横向滚动并检查完整内容。
想先保存到本地?可下载 SkillsMP 当前能够提供的文件。
正在显示 SKILL.md
基于 SOC 职业分类
| name | docstring-generator |
| description | > Use when this capability is needed. |
Generates or updates doc comments for TypeScript and Rust source files. The skill analyzes the public API surface (functions, methods, classes/structs, traits/interfaces, enums) and produces language-idiomatic documentation.
| Input | Type | Required | Description |
|---|---|---|---|
language | string | yes | "typescript" or "rust" |
file_path | string | yes | Path of the file being edited |
full_text | string | yes | Entire contents of the file |
selection_range | object | no | { start_line, end_line } (1-based, inclusive) |
mode | string | no | "update_missing" (default) or "update_all" |
public_only | boolean | no | If true (default), only document exported/public items |
Mentally parse full_text to find all declarations relevant to the language,
public_only, and selection_range settings.
TypeScript declarations to document:
Rust declarations to document:
pub fn (free functions and methods)pub struct and its pub fieldspub enum and its variantspub trait and its method signaturespub type and pub const itemspub mod (public modules)For each target declaration, follow the language-specific rules below.
Insert or update the doc comment immediately before the declaration, preserving
all existing formatting, indentation, and code. Return the full updated_text
with only doc comment lines changed.
update_all mode, preserve explicit warnings,
safety notes, panic documentation, and custom annotations.Comment style: Use /** ... */ TSDoc/JSDoc block comments immediately
before the declaration.
Functions & methods:
@param name - description for each parameter.@returns with a short description if the function returns non-void.Classes, interfaces, type aliases, enums:
Mode behavior:
update_missing: Do not rewrite existing comments unless they are obviously
placeholder (e.g., TODO, fix, FIXME, @todo).update_all: Improve unclear comments but preserve any explicit developer
notes or warnings.Example:
/** Loads a user by id from the primary data store.
* @param id - Unique identifier of the user.
* @returns The user if found, otherwise null.
*/
async function getUserById(id: string): Promise<User | null> {
// ...
}
Overloaded/union-heavy functions: Describe the general behavior rather than each possible overload or union variant.
Comment style: Use /// triple-slash line comments for item docs. Keep
lines around 80 characters.
Structure:
/// line, then details or examples as needed.# Errors section if the error conditions are
clear from the signature.`SomeType`.Scope: Only document public API by default (pub fn, pub struct,
pub enum, pub trait, pub methods on pub types).
Mode behavior:
update_missing: Only add docs to items without existing /// comments.update_all: Refine awkward wording but preserve explicit notes like
# Panics or # Safety.Example:
/// Calculates the checksum for the given buffer.
///
/// # Errors
///
/// Returns an error if the buffer length exceeds the supported maximum.
pub fn checksum(buf: &[u8]) -> Result<u32, ChecksumError> {
// ...
}
selection_range is provided: Only consider declarations that start
within the selected line range. Do not modify docs for items outside the
selection.selection_range is omitted: Apply the chosen mode to the entire file,
respecting public_only.doStuff,
handle), use surrounding code and types to infer a better description, but
stay conservative.Return these three values:
| Field | Type | Description |
|---|---|---|
updated_text | string | Full file text with updated doc comments |
summary | string | 1-3 sentence summary of what was documented |
touched_symbols | string[] | Names of functions/types that had docs added or updated |
Source: espennilsen/pi — distributed by TomeVault.