write-docstring

Writes numpy-style Python docstrings for functions, classes, and modules using routed reference guides.

3|Updated Feb 15, 2025
One-click install
npx skills add https://github.com/mark-torres10/ai_tools --skill write-docstring-mark-torres10
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: write-docstring
Source: https://github.com/mark-torres10/ai_tools/tree/main/skills/write-docstring
Command: npx skills add https://github.com/mark-torres10/ai_tools --skill write-docstring-mark-torres10

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Python code often ships with missing, vague, or stale docstrings that restate names instead of describing behavior. This Skill produces accurate, behavior-focused docstrings that follow numpy-style conventions and stay useful as code evolves. ## Core Features & Use Cases - Target-based routing: Classifies the target as a function, class, or module and loads the matching guide with criteria and good/bad examples. - Numpy-style conventions: Applies structured sections (Parameters, Returns, Raises) only when they add information beyond the signature. - Anti-rot guidance: Strips version numbers, provisioning notes, and other details that go stale, keeping docstrings at the right abstraction level. - Use Case: You have a data pipeline function with no documentation. Ask for a docstring, and the Skill inspects the signature and behavior, then returns a ready-to-paste numpy-style docstring covering parameters, return semantics, and raised exceptions. ## Quick Start Write a numpy-style docstring for the normalize function in my data processing module.

Frequently Asked Questions about write-docstring

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I write a good Python function docstring?

Start with a one-line summary of the outcome, then add numpy-style sections only where they add information beyond the signature. Document non-obvious parameters, return semantics, exceptions callers must handle, and any side effects or preconditions.

What is numpy-style docstring format?

Numpy-style docstrings use labeled sections like Parameters, Returns, and Raises with dashed underlines. Each parameter is documented with its name, type, and description, making the format readable in plain text and parseable by documentation tools.

Should a class docstring list constructor parameters?

No. A class docstring should describe the abstraction the class represents, its responsibilities, invariants, and lifecycle. Constructor parameters belong on the __init__ method docstring, not duplicated at the class level.

What should a Python module docstring include?

A module docstring should state why the file exists and its role in the architecture, optionally naming key public entrypoints or showing how to run a script. It should omit version numbers, provisioning details, and runbook references that go stale.

When should I not add a Parameters section to a docstring?

Skip the Parameters section when the signature and type hints already convey everything, such as obvious names and types with no constraints. Only document parameters with non-obvious meaning, units, ordering, or preconditions.