← ClaudeAtlas

scaffold-archipy-logiclisted

Scaffold an ArchiPy logic class with unit-of-work decorator and domain DTO I/O. Use when adding a use-case under logics/{domain}/.
SyntaxArc/archipy-plugin · ★ 2 · AI & Automation · score 75
Install: claude install-skill SyntaxArc/archipy-plugin
# Scaffold ArchiPy Logic ## Before writing files 1. Inspect the target domain's DTOs, repository contract, neighboring logics, DI wiring, and tests. 2. Infer naming and sync/async style from existing code and installed extras. 3. Ask only for an unresolved domain/use-case name or transaction choice. Default to sync for `postgres` + `sqlalchemy` and async for `postgres` + `sqlalchemy-async`. 4. Preserve existing use cases; do not overwrite logic or DTO files. ## Prefer ArchiPy ```bash uv add "archipy[postgres,sqlalchemy]" # or: uv add "archipy[postgres,sqlalchemy-async]" ``` ## Generate ```text logics/<domain>/ └── <name>_logic.py ``` Stub shape: - Google-style class/method docstrings; double quotes; `X | Y` typing. - Constructor injects the domain repository (or port) — do not construct adapters. - Public method: domain `*InputDTO` in → domain `*OutputDTO` out. - Decorate with `postgres_sqlalchemy_atomic_decorator` or `async_postgres_sqlalchemy_atomic_decorator`. ```python from archipy.helpers.decorators.sqlalchemy_atomic import postgres_sqlalchemy_atomic_decorator class UserRegistrationLogic: """Handles user registration within a single database transaction.""" def __init__(self, user_repository: UserRepository) -> None: self._user_repository = user_repository @postgres_sqlalchemy_atomic_decorator def register_user(self, input_dto: UserRegistrationInputDTO) -> UserRegistrationOutputDTO: """Validate and create a user. A