advanced-alchemy-services
SKILL.md
Services
Execution Workflow
- Start from the repository and wrap it with
SQLAlchemyAsyncRepositoryServiceorSQLAlchemySyncRepositoryService. - Define schema types for create, update, and read flows only where service boundaries need validation or conversion.
- Set
repository_type, loader options, andmatch_fieldsexplicitly. - Override
create(),update(), orto_model()only for real domain rules such as slug generation or multi-model coordination. - Convert outbound models with
to_schema()instead of leaking ORM instances to transport layers.
Implementation Rules
- Keep services responsible for business rules, not controller or router concerns.
- Accept dictionaries or schema objects, but normalize them consistently through the service.
- Use schema conversion intentionally: Pydantic, Msgspec, and attrs are all supported.
- Keep multi-repository workflows atomic and explicit about commit behavior.
Example Pattern
from advanced_alchemy.service import SQLAlchemyAsyncRepositoryService
class PostService(SQLAlchemyAsyncRepositoryService[Post, PostRepository]):
repository_type = PostRepository
Validation Checklist
- Confirm service input can be converted into models for both create and update paths.
- Confirm
to_schema()returns the expected response shape for the chosen schema library. - Confirm custom service overrides preserve repository invariants.
- Confirm complex operations load the relationships they depend on.
Cross-Skill Handoffs
- Use
advanced-alchemy-repositoriesfor persistence operations beneath the service. - Use
advanced-alchemy-routingwhen mapping service methods onto CRUD endpoints. - Use
advanced-alchemy-litestar,advanced-alchemy-fastapi, oradvanced-alchemy-flaskfor framework DI and request handling.
Advanced Alchemy References
Weekly Installs
6
Repository
alti3/litestar-skillsGitHub Stars
5
First Seen
7 days ago
Security Audits
Installed on
opencode6
gemini-cli6
github-copilot6
codex6
kimi-cli6
cursor6