Scaffold archipy decorator
Skill SyntaxArc/archipy-plugin/skills/scaffold-archipy-decorator
Scaffold or wire a helpers/decorators module for an ArchiPy app. Prefer ArchiPy decorators (ttl_cache_decorator, postgres_sqlalchemy_atomic_decorator, capture_span / capture_transaction, …) before custom ones.From its SKILL.md
npx -y skills add SyntaxArc/archipy-plugin --skill scaffold-archipy-decoratorAssembled from the repository path, not quoted from the project. Check it against their README if it does not work.
One thing to look at
- 2 stars2 stars. Stars are a popularity signal and not a quality one, but at this level it is likely that nobody has read this closely except its author, and you would be relying on your own review.
SKILL.md
2.5 KB, as published. Nobody here has run it
Scaffold ArchiPy Decorator
Scope
Only helpers/decorators/. Do not create utils or interceptors here.
Before writing files
Ask:
- Decorator purpose (cache, atomic, retry, timing, …)
- Prefer ArchiPy built-in vs custom
- Sync, async, or both
Prefer ArchiPy
Examples:
from archipy.helpers.decorators.cache import ttl_cache_decoratorfrom archipy.helpers.decorators.sqlalchemy_atomic import postgres_sqlalchemy_atomic_decoratorfrom archipy.helpers.decorators.sqlalchemy_atomic import async_postgres_sqlalchemy_atomic_decoratorcapture_span/capture_transaction,timeout_decorator,retry_decorator,singleton_decorator,timing_decorator,grpc_rate_limit_decoratorunderarchipy.helpers.decorators
Show correct usage on a sample function; do not reimplement. UoW decorators belong on logics, not services/repositories.
Custom decorator
Create helpers/decorators/<name>.py:
from __future__ import annotations
import functools
import logging
import time
from collections.abc import Callable
from typing import ParamSpec, TypeVar
logger = logging.getLogger(__name__)
P = ParamSpec("P")
R = TypeVar("R")
def timed(func: Callable[P, R]) -> Callable[P, R]:
"""Log wall-clock duration of a sync call.
Args:
func: Callable to wrap.
Returns:
Wrapped callable that logs elapsed milliseconds.
Example:
@timed
def build_report(order_id: str) -> str:
...
"""
@functools.wraps(func)
def wrapper(*args: P.args, **kwargs: P.kwargs) -> R:
started = time.perf_counter()
try:
return func(*args, **kwargs)
finally:
elapsed_ms = (time.perf_counter() - started) * 1000
logger.debug("%s took %.2f ms", func.__qualname__, elapsed_ms)
return wrapper
- Use
functools.wraps - Preserve types where practical (
ParamSpec/TypeVar) - Google-style docstring with Args/Returns and a usage example
- No concrete adapter imports at module level
- Separate sync/async wrappers if both needed
Docs
- https://syntaxarc.github.io/ArchiPy/tutorials/helpers/
- Bundled skill reference:
../archipy-docs/reference.md(Decorators section)