| 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"] |