| name | litestar-data-services |
| description | Auto-activate for SQLAlchemyAsyncRepositoryService, SQLSpecAsyncService, create_filter_dependencies, LimitOffsetFilter, OffsetPagination, filters, or CRUD services. Not for raw drivers. |
Litestar Data Services
Use this skill for repositories, service layers, CRUD boundaries, filters, and pagination.
Code Style Rules
- Match the existing persistence stack before choosing patterns.
- Keep handlers out of query construction and transaction management.
- Use filter dependency objects rather than ad hoc query params.
- Return typed pagination envelopes for collection endpoints.
Quick Reference
Workflow
- Identify the project's data stack.
- Put persistence operations behind a service boundary.
- Add filters and pagination through the stack's native pattern.
- Return DTO-ready data to Controllers.
Guardrails
- Do not mix repository stacks in one feature.
- Do not place SQL or ORM session handling in route handlers.
- Do not hand-roll pagination query params.
- Do not return persistence internals when DTOs are required.
Validation Checkpoint
Example
class UserService(SQLAlchemyAsyncRepositoryService[User]):
repository_type = UserRepository
References Index
Official References
Shared Styleguide Baseline