doc
当用户想加文档注释、写 docstring、给代码加说明时使用 — 自动生成文档注释,风格与项目一致
by lightpointventures★ 37 GitHub stars
Install doc in Claude Code & Claude Desktop
Sign up to install this skill
Create a free account to reveal the install command and save the skill to your library.
- Reveal the one-line install command
- Save skills to your synced library
- Get notified when skills update
About this skill
生成文档
为代码自动添加文档注释,省去手写文档的麻烦。
步骤
1. 确定文档目标
如果用户指定了文件或函数,直接读取。
如果没有指定,问:
你想给哪段代码加文档?可以告诉我文件名、函数名或类名。
2. 检查项目的文档风格
查看项目中已有的文档注释,了解:
- 使用的文档格式(Python: Google style / NumPy style / reStructuredText,JS/TS: JSDoc,Go: godoc)
- 文档语言(中文还是英文)
- 详细程度
如果项目没有已有文档,根据语言社区惯例选择最常用的格式。
3. 生成文档
为目标代码生成文档注释,包括:
- 简要描述 — 一句话说明这个函数/类做什么
- 参数说明 — 每个参数的名称、类型、含义
- 返回值 — 返回什么、什么类型
- 异常/错误 — 可能抛出什么异常(如果有)
- 使用示例 — 一个最简单的调用示例(仅对复杂函数添加)
规则:
- 文档要准确反映代码实际行为,不要写代码没做的事情
- 保持简洁,不要把显而易见的事情写进文档
- 与项目已有的文档风格保持一致
4. 写入
展示生成的文档,询问用户:
文档生成好了,要我写入文件吗?
用户确认后写入。
Allowed tools
Tools this skill is permitted to call.
No restriction — this skill can use any tool.
FAQ
What does the doc skill do?
当用户想加文档注释、写 docstring、给代码加说明时使用 — 自动生成文档注释,风格与项目一致
How do I install the doc skill?
Copy the skill folder into ~/.claude/skills (the Claude Code tab above does this in one command), or install it as a plugin.
Does the doc skill run scripts?
No, this skill is instructions only (SKILL.md) with no executable scripts.
Related skills
theme-factory
AnthropicToolkit for styling artifacts with a theme. These artifacts can be slides, docs, reportings, HTML landing pages, etc. There are 10 pre-set themes with…
access
AnthropicManage Discord channel access — approve pairings, edit allowlists, set DM/group policy. Use when the user asks to pair, approve someone, check who's allowed…
configure
AnthropicSet up the Discord channel — save the bot token and review access policy. Use when the user pastes a Discord bot token, asks to configure Discord, asks "how…
access
AnthropicManage iMessage channel access — approve pairings, edit allowlists, set DM/group policy. Use when the user asks to pair, approve someone, check who's allowed…