ワンクリックで
python-docstrings
Write clear, contract-first docstrings using Google Style format with explicit intent and boundaries
Codex または Claude でインストール この Prompt をコピーして Codex、Claude、または他のアシスタントに貼り付けると、Skill ページを確認してインストールできます。
メニュー
Write clear, contract-first docstrings using Google Style format with explicit intent and boundaries
Codex または Claude でインストール この Prompt をコピーして Codex、Claude、または他のアシスタントに貼り付けると、Skill ページを確認してインストールできます。
SOC 職業分類に基づく
| name | python-docstrings |
| description | Write clear, contract-first docstrings using Google Style format with explicit intent and boundaries |
Guide developers to write clear, contract-first docstrings in Google Style format that emphasize explicit over implicit. Docstrings should capture callable intent, boundary semantics, and error contracts so code is self-documenting without invented rationale.
Use this skill when:
Raises: vs business-return patterns (e.g., Result[T, E])Do NOT use this skill for:
Optional vs Union) — delegate to python-type-hints-strictpython-model-selectionpython-namingStep-by-step docstring workflow:
Identify scope: Is this a public API (class, public method, public function, dataclass field) or private helper?
Extract explicit signals:
None)Result, Union[Success, Failure])Derive semantic intent:
Identify error paths:
Raises: and when they occurResult[T, E] or Union[Success, Failure], document both Ok and Err paths in Returns: sectionFill Google Style sections:
Returns:: when and why exceptions/errors occurdef authenticate_user(token: str, secret_key: str) -> User:
"""Authenticate a user using a JWT token.
Verifies signature against the secret key and extracts user identity.
Primary entry point for REST API authentication.
Args:
token: JWT-formatted bearer token from Authorization header.
secret_key: HMAC secret key to verify token signature.
Returns:
User object with id, email, and roles from token claims.
Raises:
JWTError: Token signature invalid or expired.
ValueError: Token malformed or missing required claims.
"""
Why correct: Captures why and when from explicit context (function name, parameters, return type, exception types). No invented rationale.
def process_order(order_id: int) -> Order:
"""Process an order to generate revenue for the platform.
This is important for business growth. Called from payment service
during checkout.
Args:
order_id: The order ID. It's a number.
Returns:
An Order object. Main data structure.
Raises:
OrderNotFound: Probably from user deletion or race condition.
"""
Why wrong: (1) Invented rationale not in code, (2) Over-explains obvious, (3) Speculates on error causes, (4) Restates type info
A complete Google Style docstring following the contract-first philosophy:
OUT of scope (delegate to other skills):
Optional vs Union, int vs float) → python-type-hints-strictpython-model-selectionpython-namingIN scope (this skill owns):
Raises: and business-return patterns like Result[T, E])Raises: vs business-return patterns (Result[T,E]); error documentation without choosing design patternWrapper workflow recipe for parent Codex sessions that need to coordinate Python topic delivery with repo-local planner, implementer, and reviewer agents while preserving shared artifact-contract boundaries.
Shared contract for repo-local Codex workflow artifacts. Use when creating, updating, or reviewing custom agents, wrapper skills, and their validation so paths, minimal schemas, and role boundaries stay consistent.
Implement one source SDK API or safe same-family batch from planner output using request-test-first porting, minimal implementation, response and error contract checks, optional tracker updates, and an explicit final decision.
Plan a source SDK API client port before implementation by collecting source evidence, drafting request contracts, classifying risk and stop flags, and preparing implementer handoff output for one endpoint family or safe same-family batch.
Query step status (pending/done) in plan/<topic>/<topic>.step.md with minimal token cost and explicit blocking when incomplete.
Run the sense_env.py scaffold to discover or assert facts about the repository environment. Use this when you need a structured JSON snapshot of the current environment state, or when you need to evaluate a contract's sensing assertions.