一键导入
python-api-signature
Design or review public Python function and method signatures for safe defaults, clear parameter ordering, and explicit call-site contracts.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
Design or review public Python function and method signatures for safe defaults, clear parameter ordering, and explicit call-site contracts.
用 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-api-signature |
| description | Design or review public Python function and method signatures for safe defaults, clear parameter ordering, and explicit call-site contracts. |
| complexity | medium |
| risk_profile | ["ambiguity_sensitive"] |
| inputs | ["whether the API is public or internal","whether None is a legal business value or only a missing/default signal","whether the call site becomes ambiguous with positional arguments","whether flags, modes, or repeated related values are crowding the signature","whether the signature is wide enough to deserve a parameter object"] |
| outputs | ["a review-ready public Python API-signature rule set or review guide","defaults for safe parameter values, sentinel usage, ordering, keyword-only choices, and refactor signals","local examples for common signature smells, safer alternatives, and split signals"] |
| use_when | ["designing or reviewing a public Python function or method signature","deciding whether defaults, keyword-only parameters, or sentinel patterns make an API safer","reviewing boolean flags, broad *args / **kwargs, or crowded parameter lists","deciding when a signature should be refactored into a clearer parameter object"] |
| do_not_use_when | ["the main task is type-annotation syntax, strict typing policy, or container-type selection","the main task is choosing Enum, dataclass, ABC, or Protocol","the main task is ordinary class-shape design, naming policy, or error hierarchy design"] |
Choose clear, safe public Python signature rules without drifting into full type-hint policy, class design, or runtime model selection.
Use this skill when:
*args / **kwargs, or crowded parameter listsDo not use this skill when:
Enum, dataclass, ABC, or ProtocolNone is a legal business value or only a missing/default signalpython-type-hints-strict.[], {}, set(), and other shared mutable objects; prefer None plus fresh per-call initialization when emptiness is the real default.None, numbers, strings, booleans, tuples, frozensets, enum members, and stable constants when they match the API contract.None as the default missing signal when None is not itself a valid business value; use a private sentinel such as _MISSING only when the API must distinguish "not provided" from "explicitly passed as None".*args / **kwargs by default; allow them only for narrow wrapper, adapter, or framework-required signatures, and extract a parameter object when the explicit signature becomes too wide.tags: tuple[str, ...] = () for a fixed immutable default, or items: list[str] | None = None plus per-call initialization; force send_notify to be keyword-only when the flag must remain.def send(items: list[str] = []): ..., hide public options in **kwargs, or stack multiple boolean flags into one crowded signature.python-type-hints-strict for that.python-model-selection when the API should extract one./) in the first draft except as an explicit out-of-scope note.Before proceeding, confirm:
None is a legal business value and whether the API is public or internalSOFT FAIL — ask and wait before continuing:
None is a legal business value or only a missing-signal is unstated → ask before choosing None vs a private sentinelBLOCKED — stop and redirect:
python-type-hints-strictEnum, dataclass, ABC, or Protocol for the parameter object → redirect to python-model-selectionNone-semantics, public-vs-internal scope, or call-site ambiguity are unknown, ask once clearly before applying defaults.examples.md: mutable-default examples, sentinel patterns, keyword-only and flag cases, fat-signature refactors, and split signals