Scope
Use this skill when adding new pages, flows, or interactions in LiveView.
Checklist
- •Create a LiveView under
lib/web/liveand pick the correct layout macro:- •
use Web, :live_view_app_layout(authenticated app pages) - •
use Web, :live_view_narrow_layout(narrow forms/settings) - •
use Web, :live_view_marketing_layout(public/marketing)
- •
- •Keep render templates focused on page content; layout handles nav + flash (
<.flash_group>stays inWeb.Layouts). - •Add routes in
lib/web/router.exunder the properlive_sessionandscope, usingon_mountfromWeb.UserAuth. - •Use
~pfor routes and<.link navigate>/<.link patch>withpush_navigate/push_patch. - •Forms: build changesets or params, assign with
to_form, use<.form id="...">and<.input field={@form[:field]}>. - •Lists: use LiveView streams with
phx-update="stream"and@streams. - •Add LiveView tests in
test/sartask_web/liveusingPhoenix.LiveViewTest, targeting the element IDs you added.