apply-phoenix-liveview-conventions
Installation
SKILL.md
Apply Phoenix LiveView Conventions
Use this skill when writing new LiveView modules or modifying existing LiveView code to ensure consistent, idiomatic Phoenix patterns.
Precondition: Invoke phoenix-liveview-essentials before this skill for the full callback lifecycle reference.
Quick Reference
| Pattern | Convention |
|---|---|
@impl true |
Before every callback (mount, handle_event, handle_info, handle_params) |
| Assigns in mount | Static defaults in mount; URL-dependent in handle_params |
| Side effects | Guard with if connected?(socket) — only run when WebSocket connected |
| Return value | {:noreply, socket} from handle_event/handle_info |
| Error handling | Assign errors to socket with put_flash; never raise |
| Components | Use def (exported), not defp |
| Multi-step errors | Use with instead of nested case |