ワンクリックで
numpy-docstring-format
Formatting and styling rules for NumPy docstrings. Use when checking or generating docstrings.
Codex または Claude でインストール この Prompt をコピーして Codex、Claude、または他のアシスタントに貼り付けると、Skill ページを確認してインストールできます。
メニュー
Formatting and styling rules for NumPy docstrings. Use when checking or generating docstrings.
Codex または Claude でインストール この Prompt をコピーして Codex、Claude、または他のアシスタントに貼り付けると、Skill ページを確認してインストールできます。
SOC 職業分類に基づく
Enforces style rules for docstrings. Use when checking or generating docstrings.
Enforces Prometheus-specific text style rules for docstrings, markdown, and other prose. Use when checking or generating any non-code text (docstrings, .md files, comments-as-prose).
| name | numpy-docstring-format |
| description | Formatting and styling rules for NumPy docstrings. Use when checking or generating docstrings. |
Use this skill whenever you review or generate Python docstrings.
Use the NumPy docstring style guide: https://numpydoc.readthedocs.io/en/latest/format.html.
Enclose docstrings in triple quotes (""") and always start the docstring text on the same line as opening quotes.
def some_method
"""The docstrings for this method."""
def some_method
"""Short summary of the method.
More details on what it does.
"""
def some_method
"""
Summary starting on the next line.
More details.
"""
Start docstrings with a short one-line summary, sentence-cased and ending with a period.
Use these section headers when relevant:
Parameters for functions, Attributes for classes.ReturnsRaisesYieldsNotesExamplesSee AlsoSection Header Name
-------------------Examples:
"""A docstring for a method.
Parameters
----------
Returns
-------
Raises
------
Notes
-----
"""
When generating docstrings, prefer shorter sentences for the summary lines to comply with the 75-characters line length limit, recommended by NumPy docstring style guide.
If you have to use a longer sentence that will exceed the character limit, or if you are editing an existing docstring with a long summary line, do not break the line with a new line. If you do, the documentation generation tool we use will not render the line correctly on the documentation website.
Examples:
"""Simulate the propagation of a particle and of any photons resulting from
the energy losses of this particle."""
# The part after the line break ("the energy losses of this particle") does not render on the documentation site
"""Simulate the propagation of a particle and of any photons resulting from the energy losses of this particle."""
# The entire line renders on the website.
name : type or name : type, optionallist of Module, np.ndarray).rng where default is set), add , optional to the type when appropriate.name : type
<indented sentence describing the value, starting with a capital letter and ending with a period.>For each exception, use this format:
ExceptionType
<indented sentence starting with "Raised if ..." or similar, capitalized and ending with a period.>
Example:
"""
Raises
------
IncompatibleSerialNumbersError
Raised if serial numbers length doesn't match number of DOMs.
"""
Prefer "Raised if ..." or "Raised when ..." phrasing.
"""
Notes
-----
Some additional information.
Some more additional information.
"""
"""
Examples
--------
>>> np.add(1, 2)
3
Comment explaining the second example.
>>> np.add([[1, 2], [3, 4]],
... [[5, 6], [7, 8]])
array([[ 6, 8],
[10, 12]])
"""
Within each Parameters / Returns / Raises / Notes / other section block, ensure every description starts with a capital letter and ends with a period.
Examples:
x : float / X-position of the line.length of ...); convert to Length of ....When referencing anything code-related inside docstrings: variables, expressions, class names etc., enclose them in double backticks like so: variable.
For example:
def t_geo(x, t_0, direc, x_0):
"""
Calculate the expected arrival time of unscattered photons at position ``x``, emitted by a muon with direction ``direc`` and time ``t_0`` at position ``x_0``.
Parameters
----------
x : (3,1) np.ndarray
Position of the sensor.
t_0 : float
Time at which the muon is at ``x_0``.
direc : (3,1) np.ndarray
Normalized direction vector of the muon.
x_0 : (3, 1) np.ndarray
Position of the muon at time ``t_0``.
"""
Notes
-----
Read more: <https://harvard-neutrino.github.io/prometheus/>