From omniagents-python
Use when writing or reviewing Python docstrings for public modules, classes, functions, methods, properties, generators, overloads, doctest examples, or generated Sphinx API documentation, especially when choosing NumPy vs Sphinx style or deciding which Parameters, Returns, Yields, Raises, Warns, Attributes, Notes, See Also, and Examples sections belong.
How this skill is triggered — by the user, by Claude, or both
Slash command
/omniagents-python:docstringsWhen to use
Trigger for Python public API documentation, numpydoc / Sphinx Napoleon output, missing or noisy docstrings, doctest examples, properties, dataclasses, Pydantic models, generators, async APIs, overloads, deprecated APIs, module docstrings, or reviews where docstrings repeat type annotations instead of documenting semantics, invariants, side effects, and edge cases.
inherit**/*.py**/docs/**/*.rst**/docs/**/*.md**/pyproject.tomlbashThe summary Claude sees in its skill listing — used to decide when to auto-load this skill
The default style is **NumPy docstrings rendered through Sphinx Napoleon**.
The default style is NumPy docstrings rendered through Sphinx Napoleon. Public APIs carry structured docstrings when the name alone does not explain the contract. Type annotations are the source of truth for static types; docstrings document semantics, invariants, side effects, examples, and interface-level exceptions.
This policy is anchored to PEP 257 for Python docstring placement and summary conventions, the numpydoc style guide for NumPy section structure, and Sphinx Napoleon for rendered documentation behavior.
Prefer a short, useful docstring over a complete but noisy one. Omit sections that do not apply.
:meta public: /
:meta private:, but do that only when the project already relies on those
markers.uv run python -m doctest <module>.py
unless the project has a dedicated doctest target. Python's doctest
module executes interactive examples and verifies that they work as shown... version-deprecated:: <version>
and a migration note. In Sphinx 9+, version-deprecated is the current
directive name; deprecated remains an alias for older docs.Use section names with underlines of matching length. Keep this order when sections apply:
ParametersAttributesReturns / YieldsRaisesWarnsSee AlsoNotesExamplesdef divmod_safe(numerator: int, denominator: int) -> tuple[int, int]:
"""Return the quotient and remainder from integer division.
Wraps ``divmod`` with an explicit zero-denominator contract so callers can
recover without inspecting implementation details.
Parameters
----------
numerator
Dividend used for integer division.
denominator
Divisor. Must be non-zero.
Returns
-------
tuple[int, int]
``(quotient, remainder)`` as returned by ``divmod``.
Raises
------
ZeroDivisionError
If ``denominator`` is zero.
Examples
--------
>>> divmod_safe(7, 3)
(2, 1)
"""
return divmod(numerator, denominator)
name, not name : str, unless the parameter is unannotated for a specific
reason.Returns / Yields so
Sphinx and numpydoc render the section correctly. The prose below that line
explains semantics.TypeVar, Literal, or Annotated mechanics in prose.
Explain the user-visible contract.Wrong:
def get(self, key: str) -> int | None:
"""Get a value.
Parameters
----------
key : str
The key as a string.
Returns
-------
int | None
The int or None.
"""
Right:
def get(self, key: str) -> int | None:
"""Look up a value without mutating cache order.
Parameters
----------
key
Cache key. A miss is silent.
Returns
-------
int | None
Stored value when present, otherwise ``None``.
"""
Parameters when it accepts
arguments other than self / cls; Returns when it returns a value;
Raises for exceptions that are part of the interface; Examples for
non-obvious behavior.Yields, not Returns, for yielded
values. Mention cleanup or cancellation semantics in Notes when relevant.Attributes
for public instance attributes; Examples for construction and common use.
Method-specific behavior belongs on the method.Attributes
unless the class is purely internal. Put validation constraints in prose
when they affect callers.Attributes section or
inline after the assignment; do not mix both styles in one module.@overload stub. Explain the dispatch rule once.Doctest examples use interactive-prompt style and include expected output. Keep them short enough to scan in review.
"""
Examples
--------
>>> cache = LRUCache[str, int](maxsize=2)
>>> cache.set("a", 1)
>>> cache.get("a")
1
>>> cache.get("missing") is None
True
"""
Avoid examples that silently pass without asserting anything:
"""
Examples
--------
>>> result = expensive_operation()
"""
Use this only when the consuming project already uses field-list docstrings. Do not mix with NumPy style in the same project.
def divmod_safe(numerator: int, denominator: int) -> tuple[int, int]:
"""Return the quotient and remainder from integer division.
:param numerator: Dividend used for integer division.
:param denominator: Divisor. Must be non-zero.
:returns: ``(quotient, remainder)`` as returned by ``divmod``.
:raises ZeroDivisionError: If ``denominator`` is zero.
"""
return divmod(numerator, denominator)
Raises\n------\nNone.key: str or items: Iterable[ItemT]."""Get a value.""" on a method named get adds
no information.:param: tags.Parameters, Returns,
Yields, Raises, Warns, See Also, Notes, and Examples.version-deprecated.doctest:
source for executable interactive examples in docstrings and documentation.This skill is project policy, not a complete upstream reference. When applying it to unfamiliar APIs, version-sensitive behavior, tool/checker disagreement, or anything that may have changed since the skill was written, verify current behavior against primary docs. Prefer Context7 MCP when available. If it is unavailable, use web search restricted to official sources.
Primary sources:
Fetches up-to-date documentation from Context7 for libraries and frameworks like React, Next.js, Prisma. Use for setup questions, API references, and code examples.
Applies a firm's KYC/AML rules grid to parsed onboarding records: assigns risk rating, checks required documents, outputs rule outcomes with citations, and routes for escalation.
Generates daily or weekly digests of activity from connected sources (chat, email, docs, tasks, CRM), highlighting action items, decisions, mentions, and project updates.
npx claudepluginhub gao-hongnan/omniagents --plugin omniagents-python