---
name: Docstring Expert
slug: docstring-expert
category: Writing
description: Docstring Expert helps write Python docstrings in the right style for a project. Use it to format summaries, Args, Returns, Raises, and examples for public APIs and classes.
github: "https://github.com/val1813/kwcode/tree/master/kaiwu/builtin_experts/docstring"
language: Python
stars: 688
forks: 92
install: "npx degit https://github.com/val1813/kwcode/tree/master/kaiwu/builtin_experts/docstring ~/.claude/skills/docstring"
installs_to: ~/.claude/skills/docstring
source_path: kaiwu/builtin_experts/docstring/SKILL.md
collection_size: 19
category_size: 1012
collection_url: "https://dirskills.com/collections/val1813/kwcode"
added: 2026-08-12T04:43:48.518Z
last_synced: 2026-08-12T04:43:48.518Z
canonical_url: "https://dirskills.com/skills/docstring-expert"
---

# Docstring Expert

Docstring Expert helps write Python docstrings in the right style for a project. Use it to format summaries, Args, Returns, Raises, and examples for public APIs and classes.

**Install:**

```bash
npx degit https://github.com/val1813/kwcode/tree/master/kaiwu/builtin_experts/docstring ~/.claude/skills/docstring
```

## README

## 领域知识

- 默认用Google风格docstring，项目已有NumPy风格则跟随
- 一行摘要用祈使句（"计算xxx"而非"这个函数计算xxx"）
- Args段：每个参数一行，格式 `name (type): 描述`
- Returns段：写明类型和含义，多返回值用tuple说明各元素
- Raises段：只列主动raise的异常，不列底层传播的
- 示例（Examples）：给出可直接运行的doctest片段
- 类docstring写在class行下方，描述职责而非实现
- 中文项目用中文写docstring，英文项目用英文，混合项目跟随已有风格
- 私有方法（_前缀）可省略docstring，公开API必须有
- 装饰器不影响docstring位置，始终写在def下一行

## 经验规则（自动生成）
