بنقرة واحدة
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 المهني
Create a new single-purpose Agent Skill folder that reaches review-ready with a clear trigger, risk-appropriate validation, concise positive and negative examples, and explicit roles for all local files. Use this when asked to draft or scaffold a new Agent Skill for this repository.
Review a review-ready Agent Skill folder for required core files, complexity-gated sections, YAML-body alignment, risk-appropriate validation, concise positive and negative examples, declared local file roles, single responsibility, portability, independence, and explicit trigger clarity. Use this when a skill draft is ready to be approved or sent back for rework.
Provide the canonical structure for a review-ready, portable, single-purpose Agent Skill in this repository, including complexity-gated sections and risk-based validation guidance. Use this when asked for the standard shape of a new skill or when building a new skill manually from a template.
Generate or backfill the minimum v1 spec document set for one explicit `spec-name` using only the local templates, while preserving existing authored content and refusing out-of-scope outputs.
Build one minimal task-specific handoff package for a real subAgent dispatch without carrying unrelated history, registry hints, or workflow reconstruction.
Enforce a strict release gate for PR readiness, version-source synchronization, tagging safety, emergency exceptions, and release repair guidance without bypassing core quality checks.
| name | python-docstrings |
| description | Write clear, contract-first docstrings using Google Style format with explicit intent and boundaries |
| complexity | low |
| risk_profile | [] |
| inputs | ["public or private method/class/function signature with type hints","explicit code-adjacent context (parameter names, return types, error types, module/class role)","business contract signals (preconditions, postconditions, error paths, domain semantics)"] |
| outputs | ["a complete Google Style docstring following the contract-first philosophy","clear one-liner summarizing intent","Args / Returns / Raises sections stating the contract"] |
| use_when | ["writing or reviewing public API docstrings (classes, public methods, module-level functions, dataclass fields)","deciding when a private helper method needs more than a one-liner",{"choosing between traditional Raises":"vs business-return patterns"},"documenting semantic intent without guessing at hidden business rationale","capturing error semantics and field-level contracts in structured data"] |
| do_not_use_when | ["choosing type hint shapes (Optional vs Union) — use python-type-hints-strict","deciding whether to use a dataclass, ABC, or enum — use python-model-selection","defining naming conventions — use python-naming","framework-specific auto-docs (FastAPI, Pydantic, SQLAlchemy) are the focus","writing inline comments on algorithms or control flow"] |
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 pattern