Commenting

Use whenever writing or editing Python (or other) functions: every function must have a docstring with a description, Parameters, and Returns in exactly that format. Apply on every coding task, including new files from scratch.

mikaeltorni 1283313 1.1 KB Updated

File contents

Function commenting

Document every def / async def / method with a docstring that always uses exactly this format:

  1. A short description of what the function does.
  2. One line starting with Parameters: listing each parameter and meaning (Parameters: none or Parameters: None when there are no parameters).
  3. One line starting with Returns: describing the return value (Returns: None when there is no meaningful return).

Do not use Args: or other section names. Do not put Parameters: or Returns: on a line by themselves. A long parameter list may continue on the next line after the label already has content.

lambda expressions do not need docstrings. Missing docs on a lambda is not a failure.

Match this layout exactly:

"""Describes the function.

Parameters: name - meaning of name; count - meaning of count.

Returns: meaning of the return value.
"""

mikaeltorni/programming_prompts/tree/main/programming_prompt_rewritten_with_evals/prompts/programming-skills/commenting commit 1283313b17

Frequently asked questions

npx skillmds@latest add mikaeltorni/commenting