python-docstring-standard
Skill2 starsChanged 58 days agoMITView on GitHub
Standardize Python function docstrings to a team format with a short summary, optional second-paragraph logic notes, optional Args/Returns sections. Default coding style uses four-space indentation and an object-oriented design mindset. Use when adding or normalizing docstrings in Python files, including class methods and nested callback functions.
In this repository8 other files it gives its agents.
The file
Show its rules and text
We split this skill into the rules it gives an agent
18 rules. About 0 are common, 13 are distinctive, and 5 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈13
Distinctive · estimate
This author's own choices. Worth a look.
5
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 9
When editing a runnable Python script, the very beginning of the script text (typically module docstring/header) must include:
- Distinctive: line 12
If invokable from CLI:
- Very specific: line 15
Add a Notes: section for caveats, environment assumptions, or operational reminders when needed.
- Very specific: line 16
If the script has no additional configurable parameters beyond the minimal command, omit both Full Command: and Options:.
- Distinctive: line 44
Use 4 spaces per indentation level in all Python code snippets and generated examples.
- Distinctive: line 45
Do not use tab characters for indentation.
- Distinctive: line 46
Prefer object-oriented decomposition when structure decisions are needed: model related state/behavior in classes, and keep method …
- Very specific: line 50
Use triple double quotes (""") for every function entry (def), including class methods and nested functions unless the user narrows scope.
- Distinctive: line 52
Write docstrings in this order:
- Distinctive: line 74
Write logic notes directly in the second paragraph.
- Very specific: line 78
Put operational cautions and assumptions under Notes: when applicable.
- Distinctive: line 79
Keep wording concise and concrete.
- Distinctive: line 80
Use exactly 4 spaces for indentation in Python code examples and edits.
- Distinctive: line 81
Prefer an object-oriented modeling approach by default unless the user explicitly asks for a different style.
- Distinctive: line 85
Add missing docstrings or normalize existing ones to the required format.
- Distinctive: line 87
Keep terminology consistent across related functions.
- Very specific: line 88
Run syntax validation after edits (python -m py_compile ...) when feasible.
- Distinctive: line 91
When reporting results, summarize:
≈ “Common” is an estimate: at least 1 in 5 of the 213,895 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Python Docstring Standard
Mandatory Opening Block (for Python script files)
When editing a runnable Python script, the very beginning of the script text (typically module docstring/header) must include:
- What the script does (core functionality).
- A brief usage overview.
- If invokable from CLI:
- Minimal startup command.
- Full startup command with configurable options explained (only when extra configurable parameters are needed).
- Add a
Notes:section for caveats, environment assumptions, or operational reminders when needed. - If the script has no additional configurable parameters beyond the minimal command, omit both
Full Command:andOptions:.
Recommended structure:
"""<Script purpose in one sentence>.
Overview:
<Brief description of workflow and expected input/output>.
Quick Start:
python path/to/script.py <required args>
Full Command:
python path/to/script.py --arg1 ... --arg2 ...
Options:
--arg1: <meaning>
--arg2: <meaning>
Notes:
<Important caveats or usage reminders>
"""Overview
Apply this skill when the user asks to add, rewrite, or normalize Python docstrings by team convention. Edit only documentation text and keep runtime behavior unchanged.
Coding Defaults
- Use 4 spaces per indentation level in all Python code snippets and generated examples.
- Do not use tab characters for indentation.
- Prefer object-oriented decomposition when structure decisions are needed: model related state/behavior in classes, and keep method responsibilities focused.
- For class methods, describe both the method action and its role within the class responsibility.
Required Format
Use triple double quotes (""") for every function entry (def), including class methods and nested functions unless the user narrows scope.
Write docstrings in this order:
- First paragraph: one brief sentence describing the function's functionality.
- Second paragraph: if needed, describe invocation/build logic directly as normal prose.
Args:section only when the function has input parameters worth documenting.Returns:section only when the function returns a meaningful value.
Use this template:
"""A brief description of the function's functionality.
If necessary, include the calling/build logic here as normal second-paragraph prose. Do not use subheadings.
Args:
arg1: Description for arg1.
arg2: Description for arg2.
Returns:
A description of the return value.
"""Strict Rules
- Write logic notes directly in the second paragraph.
- Omit
Args:when there are no meaningful inputs. - Omit
Returns:forNone-style procedures unless the user explicitly wants it documented. - In script header blocks, omit
Full Command:andOptions:when no extra configurable parameters are required. - Put operational cautions and assumptions under
Notes:when applicable. - Keep wording concise and concrete; avoid restating obvious type hints.
- Use exactly 4 spaces for indentation in Python code examples and edits; never use tabs.
- Prefer an object-oriented modeling approach by default unless the user explicitly asks for a different style.
Editing Workflow
- Find all target
defentries in scope. - Add missing docstrings or normalize existing ones to the required format.
- Preserve function signatures, decorators, and executable code.
- Keep terminology consistent across related functions.
- Run syntax validation after edits (
python -m py_compile ...) when feasible.
Output Expectations
When reporting results, summarize:
- Which files were updated.
- Whether syntax validation was run and passed.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

