一键导入
python-decorators
Choose and design ordinary Python decorators that preserve signature transparency, keep behavior explicit, and avoid hiding lifetime-driven work.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
Choose and design ordinary Python decorators that preserve signature transparency, keep behavior explicit, and avoid hiding lifetime-driven work.
用 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-decorators |
| description | Choose and design ordinary Python decorators that preserve signature transparency, keep behavior explicit, and avoid hiding lifetime-driven work. |
| complexity | medium |
| risk_profile | ["ambiguity_sensitive"] |
| inputs | ["the callable being wrapped and whether it is public or internal","whether the added behavior is call-driven or lifetime-driven","whether the decorator is meant to stay transparent to callers","whether the decorator has side effects such as retries, caching, auth, or error translation","whether a decorator factory is needed","whether the code sits in a framework that depends on inspectable signatures or naming"] |
| outputs | ["decision on whether a decorator is clearer than an explicit helper call or context manager","transparent decorator pattern for functions, methods, or decorator factories","boundary guidance for hidden side effects, lifetime-driven work, and contract-changing wrappers","light framework notes for developer-authored decorators when relevant"] |
| use_when | ["deciding whether repeated call-time behavior belongs in a decorator instead of an explicit helper call","writing or reviewing function decorators, method decorators, or decorator factories","preserving wrapped-callable metadata and caller-visible typing","deciding whether retries, caching, auth checks, logging, or error translation are explicit enough to live in a decorator","adding a custom decorator in framework code and wanting to keep it aligned with ordinary Python rules"] |
| do_not_use_when | ["the main task is general strict-typing policy or checker configuration","the behavior is resource lifetime, setup/cleanup, or ambient-state restoration; use python-context-management","the task is mainly about class decorators, descriptors, metaclasses, or framework-private decorator internals","the decorator intentionally changes the caller-visible contract and that contract change is the main design goal"] |
Choose when a decorator is the right tool and design ordinary Python decorators so transparent wrappers stay explicit, readable, and type-safe.
Use this skill when:
Do not use this skill when:
python-context-managementpython-context-management or an explicit helper instead of hiding it behind
decoration.functools.wraps. For transparent
wrappers, thread ParamSpec and TypeVar through Callable[P, R]. Do not
erase the signature with Callable[..., Any] when the decorator claims to be
transparent.functools.wraps plus ParamSpec / TypeVar
so logging or retry behavior stays transparent to callers.Callable[..., Any] wrapper and still present it as a normal transparent
decorator.functools.wraps is used when metadata should be preservedParamSpec / TypeVar
instead of Callable[..., Any]SOFT FAIL — ask and wait before continuing:
BLOCKED — stop and redirect:
python-context-managementCallable[..., Any] in a wrapper that claims to preserve the original
callable contractAny is fine."with even if it hides setup and
cleanup."functools.wraps alone is enough even if the static type checker loses
the callable contract."functools.wraps + ParamSpec) and note it may need revision.python-type-hints-strict.python-api-signature.python-class-design.python-module-boundaries.python-context-management.reference.md: overview for the local reference layer and navigation to split
topicsreferences/signature-integrity.md: transparent-wrapper typing, wraps,
ParamSpec, TypeVar, and signature-preservation anti-patternsreferences/behavior-visibility.md: explicitness rules for side effects,
caching, retries, auth, error translation, and lifetime boundariesreferences/framework-notes.md: light framework notes for developer-authored
decorators in common ecosystemsexamples.md: detailed positive and negative examples for transparent
wrappers, decorator factories, framework notes, and anti-patterns