by bossjones
手动创建 API 文档既耗时又容易过时。此技能通过提取文档字符串、类型提示和代码结构,自动生成组织良好的综合 markdown 参考文档。
1. 打开 Claude 聊天界面
2. 点击下方 "📋 复制" 按钮
3. 粘贴到 Claude 聊天框中并发送
4. 输入 "使用 doc-generator 技能" 开始使用
=== doc-generator 技能 === 作者: bossjones 描述: 手动创建 API 文档既耗时又容易过时。此技能通过提取文档字符串、类型提示和代码结构,自动生成组织良好的综合 markdown 参考文档。 使用方法: 1. 调用技能: "使用 doc-generator 技能" 2. 提供相关信息: 根据技能要求提供必要参数 3. 查看结果: 技能会返回处理结果 示例: "使用 doc-generator 技能,帮我分析一下这段代码"
这种方法适用于所有 Claude 用户,不需要安装额外工具。
documentation
safe
Generate comprehensive markdown documentation from Python source code.
Accept either:
Generate standard markdown with:
# Module Name
Brief description from module docstring.
## Classes
### ClassName
Description from class docstring.
**Methods:**
- `method_name(param: type) -> return_type`: Brief description
## Functions
### function_name(param: type) -> return_type
Description from docstring.
**Parameters:**
- `param` (type): Description
**Returns:**
- type: Description
## Usage Examples
```python
# Extract from docstring examples or generate basic usage
## Analysis Approach
1. **Parse Python files** using AST or inspection
2. **Extract key elements:**
- Module-level docstrings
- Class definitions and docstrings
- Function/method signatures with type hints
- Docstring content (support Google, NumPy, Sphinx formats)
3. **Organize hierarchically** (modules -> classes -> methods -> functions)
4. **Generate clean markdown** with consistent formatting
## Quality Guidelines
- Preserve original docstring formatting when meaningful
- Include type hints prominently in signatures
- Group related items (all classes together, all functions together)
- Add table of contents for large modules
- Skip private members (leading underscore) unless explicitly requested
- Handle missing docstrings gracefully (note "No description provided")
## Python Tools
Prefer standard library:
- `ast` module for parsing
- `inspect` module for runtime introspection
- `pathlib` for file handling
No external dependencies required for basic documentation generation.
## Error Handling
- Skip files with syntax errors (log warning)
- Handle missing type hints gracefully
- Warn if no docstrings found but continue processing
- Validate file paths exist before processing
View Count
0
Download Count
0
Favorite Count
0
Quality Score
71