phoenix-liveview-essentials
Installation
SKILL.md
Phoenix LiveView Essentials
Use this skill before writing ANY LiveView module or .heex template.
RULES — Follow these with no exceptions
- Always add
@impl truebefore every callback (mount, handle_event, handle_info, render) - Initialize assigns before they're accessed in render/1 — use mount/3 for static defaults, handle_params/3 for URL-dependent assigns
- Check
connected?(socket)before PubSub subscriptions, timers, or side effects - Use
Map.get(assigns, :key, default)for optional assigns in helper functions - Return proper tuples —
{:ok, socket}from mount,{:noreply, socket}from handle_event - Use
withfor error handling in event handlers — assign errors to socket, don't crash - Never use
auto_upload: truewith form submission — use manual uploads instead - Check
core_components.exfor existing components before creating custom ones - Never query the database directly from LiveViews — call context functions instead
- Use streams for large collections — see
liveview-streamsskill for details