agentleFS
wty-yywty-yy/skills/python-docstring-standard/SKILL.md

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.

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
  1. Distinctive:

    When editing a runnable Python script, the very beginning of the script text (typically module docstring/header) must include:

    line 9
  2. Distinctive:

    If invokable from CLI:

    line 12
  3. Very specific:

    Add a Notes: section for caveats, environment assumptions, or operational reminders when needed.

    line 15
  4. Very specific:

    If the script has no additional configurable parameters beyond the minimal command, omit both Full Command: and Options:.

    line 16
  5. Distinctive:

    Use 4 spaces per indentation level in all Python code snippets and generated examples.

    line 44
  6. Distinctive:

    Do not use tab characters for indentation.

    line 45
  7. Distinctive:

    Prefer object-oriented decomposition when structure decisions are needed: model related state/behavior in classes, and keep method …

    line 46
  8. Very specific:

    Use triple double quotes (""") for every function entry (def), including class methods and nested functions unless the user narrows scope.

    line 50
  9. Distinctive:

    Write docstrings in this order:

    line 52
  10. Distinctive:

    Write logic notes directly in the second paragraph.

    line 74
  11. Very specific:

    Put operational cautions and assumptions under Notes: when applicable.

    line 78
  12. Distinctive:

    Keep wording concise and concrete.

    line 79
  13. Distinctive:

    Use exactly 4 spaces for indentation in Python code examples and edits.

    line 80
  14. Distinctive:

    Prefer an object-oriented modeling approach by default unless the user explicitly asks for a different style.

    line 81
  15. Distinctive:

    Add missing docstrings or normalize existing ones to the required format.

    line 85
  16. Distinctive:

    Keep terminology consistent across related functions.

    line 87
  17. Very specific:

    Run syntax validation after edits (python -m py_compile ...) when feasible.

    line 88
  18. Distinctive:

    When reporting results, summarize:

    line 91

≈ “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.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

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:

  1. What the script does (core functionality).
  2. A brief usage overview.
  3. If invokable from CLI:
    • Minimal startup command.
    • Full startup command with configurable options explained (only when extra configurable parameters are needed).
  4. Add a Notes: section for caveats, environment assumptions, or operational reminders when needed.
  5. If the script has no additional configurable parameters beyond the minimal command, omit both Full Command: and Options:.

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:

  1. First paragraph: one brief sentence describing the function's functionality.
  2. Second paragraph: if needed, describe invocation/build logic directly as normal prose.
  3. Args: section only when the function has input parameters worth documenting.
  4. 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: for None-style procedures unless the user explicitly wants it documented.
  • In script header blocks, omit Full Command: and Options: 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

  1. Find all target def entries in scope.
  2. Add missing docstrings or normalize existing ones to the required format.
  3. Preserve function signatures, decorators, and executable code.
  4. Keep terminology consistent across related functions.
  5. 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.

Download now (ZIP)

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
What did you use it for? e.g. Reviewing pull requests in a Rails app

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.