litestar-lifecycle-hooks
SKILL.md
Lifecycle Hooks
Execution Workflow
- Choose the exact lifecycle stage needed for behavior injection.
- Keep hook logic deterministic and focused on cross-cutting concerns.
- Compose hook behavior with middleware order and exception handling.
- Verify hook side effects are observable and testable.
Implementation Rules
- Keep hooks lightweight to avoid latency inflation.
- Avoid embedding domain business rules in hooks.
- Make ordering dependencies explicit when multiple hooks interact.
- Ensure hook errors are handled without masking root cause.
- Do not substitute hooks for event emission when multiple decoupled side effects should react to one domain action.
Example Pattern
# Pseudocode pattern: attach lifecycle hooks for cross-cutting behavior.
from litestar import Litestar
app = Litestar(
route_handlers=[...],
before_send=[...],
after_exception=[...],
)
Validation Checklist
- Confirm hook execution order matches design.
- Confirm hooks run for both success and error paths where intended.
- Confirm instrumentation and policy side effects are deterministic.
Cross-Skill Handoffs
- Use
litestar-app-setupfor startup/shutdown hooks, lifespan, and application resource ownership. - Use
litestar-eventsfor decoupled in-process side effects with listeners andapp.emit(...). - Use
litestar-middlewarefor ASGI-wide policies that should wrap the whole pipeline.
Litestar References
Weekly Installs
11
Repository
alti3/litestar-skillsGitHub Stars
5
First Seen
13 days ago
Security Audits
Installed on
cline11
gemini-cli11
github-copilot11
codex11
kimi-cli11
cursor11