docs-guardian-lang-python
Python documentation: docstring conventions, API doc extraction, Python patterns.
来源信息
- 仓库
- xiaolai/docs-guardian-for-claude
- 最近来源活动
- 2026年9月30日 17:34
- 检测到的 SKILL.md 语言
- 英语
- 星标
- 7
- Forks
- 0
安装方式
默认使用会先检查来源的 Prompt;你也可以切换为直接命令,或下载本地副本。
检查来源文件
决定是否安装前,请先阅读 SKILL.md,以及 SkillsMP 当前展示的配套文件。
文件资源管理器
2 个文件正在显示 SKILL.md
SKILL.md
来源说明 · 只读预览- name
- docs-guardian-lang-python
- description
- Python documentation: docstring conventions, API doc extraction, Python patterns.
# Python Language Adapter
## Public API Detection
A symbol is **public** if:
1. It is listed in `__all__` (if `__all__` exists, only listed names are public)
2. Its name does not start with `_` (single underscore = internal convention)
3. It is defined at module level or is a method of a public class
### Priority
- If `__all__` exists → only those names are public
- If `__all__` does not exist → all non-underscore module-level names are public
## Symbol Types to Document
| Type | Detection | Documentation Expected |
|------|-----------|----------------------|
| Functions | `def name(` at module level | Docstring with params, returns, raises |
| Classes | `class Name:` or `class Name(Base):` | Class docstring + `__init__` params |
| Methods | `def name(self` inside class, not `_`-prefixed | Docstring with params, returns |
| Constants | `NAME = value` (UPPER_CASE at module level) | Inline comment or module docstring mention |
| Type aliases | `Name = TypeAlias` or `type Name = ...` | Docstring or inline comment |
## Docstring Formats
Recognize and parse these formats:
### Google Style
```python
def foo(bar: int, baz: str) -> bool:
"""One-line summary.
Args:
bar: Description of bar.
baz: Description of baz.
Returns:
True if successful.
Raises:
ValueError: If bar is negative.
"""
```
### NumPy Style
```python
def foo(bar, baz):
"""One-line summary.
Parameters
----------
bar : int
Description of bar.
baz : str
Description of baz.
Returns
-------
bool
True if successful.
"""
```
### Sphinx Style
```python
def foo(bar, baz):
"""One-line summary.
:param bar: Description of bar.
:type bar: int
:param baz: Description of baz.
:returns: True if successful.
:raises ValueError: If bar is negative.
"""
```
## Documentation Completeness Check
A Python symbol is **fully documented** when:
1. Has a docstring (not empty)
2. All parameters are described
3. Return value is described (if not `None`)
4. Raised exceptions are listed (if any `raise` statements exist)
## File Patterns
Source files: `**/*.py` (exclude `__pycache__`, `*.pyc`, test files)
## Scope
Covers Python doc-comment conventions and API extraction only. `$docs-guardian-detection` selects this adapter; `$docs-guardian-lang-generic` is the fallback for languages without an adapter; output format per doc framework is in the `docs-guardian-fw-*` skills. For Sphinx autodoc and its docstring style, see `$docs-guardian-fw-sphinx`.
在 GitHub 查看