skills/smithery.ai/liveview-guidelines

liveview-guidelines

Installation
SKILL.md

Phoenix LiveView Guidelines

General

  • Never use the deprecated live_redirect and live_patch functions, instead always use <.link navigate={href}> and <.link patch={href}> in templates, and push_navigate and push_patch in LiveViews
  • Avoid LiveComponents unless you have a strong, specific need for them
  • LiveViews should be named like AppWeb.WeatherLive, with a Live suffix. When adding routes, the default :browser scope is already aliased with the AppWeb module, so you can just do live "/weather", WeatherLive

LiveView Streams

  • Always use LiveView streams for collections instead of assigning regular lists to avoid memory ballooning and runtime termination:

    • Basic append: stream(socket, :messages, [new_msg])
    • Reset stream: stream(socket, :messages, [new_msg], reset: true) (e.g. for filtering)
    • Prepend: stream(socket, :messages, [new_msg], at: -1)
    • Delete: stream_delete(socket, :messages, msg)
  • When using streams, the template must:

    1. Set phx-update="stream" on the parent element with a DOM id
    2. Consume @streams.stream_name and use the id as the DOM id for each child:
Installs
1
First Seen
Apr 29, 2026