[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M7340F6BAKDN37WD95NGF2NA":3,"skill-same:01M7340F6BAKDN37WD95NGF2NA":63},{"skillNo":4,"name":5,"nameZh":6,"description":7,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":16,"categories":17,"keywords":18,"publishedAt":19,"linkOnly":20,"markdownContent":21,"markdownBody":22,"frontMatter":23,"refName":42,"commitSha":43,"skillDirectory":44,"forksCount":14,"repositoryHtmlUrl":45,"repositoryHomepageUrl":6,"ownerHtmlUrl":46,"ownerBlogUrl":6,"ownerDescription":47,"updatedAt":48,"install":49,"resources":62},"01M7340F6BAKDN37WD95NGF2NA","phoenix-liveview",null,"Phoenix Framework with LiveView on the BEAM","julio211916\u002FTlantiCAD-Studio-V0.1-alpha","julio211916","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F128201165?v=4","01M730ENY015MHFY82VKR6AGGR","José Carlos amador garcia","01M730ENYT83EWH6EXRHF9FTXV",0,"MIT","https:\u002F\u002Fgithub.com\u002Fjulio211916\u002FTlantiCAD-Studio-V0.1-alpha\u002Fblob\u002Fmain\u002Fskills\u002Fju\u002Fskills\u002Fphoenix-liveview\u002FSKILL.md",[],[],"2026-11-11 15:11:14",false,"---\nname: phoenix-liveview\ndescription: \"Phoenix Framework with LiveView on the BEAM\"\nversion: 1.0.0\ncategory: toolchain\nauthor: Claude MPM Team\nlicense: MIT\nprogressive_disclosure:\n  entry_point:\n    summary: \"Phoenix + LiveView on the BEAM for fault-tolerant, real-time web apps (OTP, Ecto, PubSub, Presence).\"\n    when_to_use:\n      - \"Building real-time, resilient web apps with minimal client-side JS\"\n      - \"Needing fault tolerance, supervision, and soft-realtime latency on the BEAM\"\n      - \"Using Ecto + Phoenix contexts for clear domain boundaries\"\n      - \"Delivering interactive UI via LiveView without a heavy SPA bundle\"\n    quick_start:\n      - \"Install Erlang\u002FElixir (asdf or brew); mix archive.install hex phx_new\"\n      - \"mix phx.new my_app --live && cd my_app && mix deps.get\"\n      - \"mix ecto.create && mix phx.server (visit http:\u002F\u002Flocalhost:4000)\"\n  token_estimate:\n    entry: 180\n    full: 5600\n---\n\n# Phoenix + LiveView (Elixir\u002FBEAM)\n\nPhoenix builds on Elixir and the BEAM VM to deliver fault-tolerant, real-time web applications with minimal JavaScript. LiveView keeps UI state on the server while streaming HTML diffs over WebSockets. The BEAM provides lightweight processes, supervision trees, hot code upgrades, and soft-realtime scheduling.\n\n**Key ideas**\n- OTP supervision keeps web, data, and background processes isolated and restartable.\n- Contexts encode domain boundaries (e.g., Accounts, Billing) around Ecto schemas and queries.\n- LiveView renders HTML on the server, syncing UI state over WebSockets with minimal client code.\n- PubSub + Presence enable fan-out updates, tracking, and collaboration features.\n\n---\n\n## Environment and Project Setup\n\n```bash\n# Erlang + Elixir via asdf (recommended)\nasdf install erlang 27.0\nasdf install elixir 1.17.3\nasdf global erlang 27.0 elixir 1.17.3\n\n# Install Phoenix generator\nmix archive.install hex phx_new\n\n# Create project with LiveView + Ecto + esbuild\nmix phx.new my_app --live\ncd my_app\nmix deps.get\nmix ecto.create\nmix phx.server\n```\n\nProject layout (key pieces):\n- `lib\u002Fmy_app\u002Fapplication.ex` — OTP supervision tree (Repo, Endpoint, Telemetry, PubSub, Oban, etc.)\n- `lib\u002Fmy_app_web\u002Fendpoint.ex` — Endpoint, plugs, sockets, LiveView config\n- `lib\u002Fmy_app_web\u002Frouter.ex` — Pipelines, scopes, routes, LiveSessions\n- `lib\u002Fmy_app\u002F` — Contexts (domain modules) and Ecto schemas\n- `test\u002Fsupport\u002F{conn_case,data_case}.ex` — Testing helpers for Ecto + Phoenix\n\n---\n\n## BEAM + OTP Essentials\n\n**Supervision tree (application.ex)**: keep short, isolated children.\n```elixir\ndef start(_type, _args) do\n  children = [\n    MyApp.Repo,\n    {Phoenix.PubSub, name: MyApp.PubSub},\n    MyAppWeb.Endpoint,\n    {Oban, Application.fetch_env!(:my_app, Oban)},\n    MyApp.Metrics\n  ]\n\n  Supervisor.start_link(children, strategy: :one_for_one, name: MyApp.Supervisor)\nend\n```\n\n**GenServer pattern**: wrap stateful services.\n```elixir\ndefmodule MyApp.Counter do\n  use GenServer\n\n  def start_link(initial \\\\ 0), do: GenServer.start_link(__MODULE__, initial, name: __MODULE__)\n  def increment(), do: GenServer.call(__MODULE__, :inc)\n\n  @impl true\n  def handle_call(:inc, _from, state) do\n    new_state = state + 1\n    {:reply, new_state, new_state}\n  end\nend\n```\n\n**BEAM principles**\n- Prefer many small processes; processes are cheap and isolated.\n- Supervise everything with clear restart strategies.\n- Use message passing (`GenServer.cast`\u002F`send`) to avoid shared state.\n- Use ETS\u002FCachex for in-memory caches; keep them supervised.\n\n---\n\n## Phoenix Anatomy and Routing\n\n**Pipelines and scopes (router.ex)**: keep browser\u002Fapi concerns separated.\n```elixir\ndefmodule MyAppWeb.Router do\n  use MyAppWeb, :router\n\n  pipeline :browser do\n    plug :accepts, [\"html\"]\n    plug :fetch_session\n    plug :fetch_live_flash\n    plug :protect_from_forgery\n    plug :put_secure_browser_headers\n    plug :fetch_current_user\n  end\n\n  pipeline :api do\n    plug :accepts, [\"json\"]\n  end\n\n  scope \"\u002F\", MyAppWeb do\n    pipe_through :browser\n    live \"\u002F\", HomeLive\n    resources \"\u002Fusers\", UserController\n  end\n\n  scope \"\u002Fapi\", MyAppWeb do\n    pipe_through :api\n    resources \"\u002Fusers\", Api.UserController, except: [:new, :edit]\n  end\nend\n```\n\n**Plugs**: composable request middleware. Keep plugs pure and short; prefer pipeline plugs over controller plugs when cross-cutting.\n\n---\n\n## Contexts and Ecto\n\n**Schema + changeset**\n```elixir\ndefmodule MyApp.Accounts.User do\n  use Ecto.Schema\n  import Ecto.Changeset\n\n  schema \"users\" do\n    field :email, :string\n    field :hashed_password, :string\n    field :confirmed_at, :naive_datetime\n    timestamps()\n  end\n\n  def registration_changeset(user, attrs) do\n    user\n    |> cast(attrs, [:email, :password])\n    |> validate_required([:email, :password])\n    |> validate_format(:email, ~r\u002F@\u002F)\n    |> validate_length(:password, min: 12)\n    |> unique_constraint(:email)\n    |> put_password_hash()\n  end\n\n  defp put_password_hash(%{valid?: true} = changeset),\n    do: put_change(changeset, :hashed_password, Argon2.hash_pwd_salt(get_change(changeset, :password)))\n  defp put_password_hash(changeset), do: changeset\nend\n```\n\n**Context API**\n```elixir\ndefmodule MyApp.Accounts do\n  import Ecto.Query, warn: false\n  alias MyApp.{Repo, Accounts.User}\n\n  def list_users, do: Repo.all(User)\n  def get_user!(id), do: Repo.get!(User, id)\n\n  def register_user(attrs) do\n    %User{}\n    |> User.registration_changeset(attrs)\n    |> Repo.insert()\n  end\nend\n```\n\n**Transactions with Ecto.Multi**\n```elixir\nalias Ecto.Multi\n\ndef register_and_welcome(attrs) do\n  Multi.new()\n  |> Multi.insert(:user, User.registration_changeset(%User{}, attrs))\n  |> Multi.run(:welcome_email, fn _repo, %{user: user} ->\n    MyApp.Mailer.deliver_welcome(user)\n    {:ok, :sent}\n  end)\n  |> Repo.transaction()\nend\n```\n\n---\n\n## LiveView Patterns\n\n**LiveView module (stateful UI on server)**\n```elixir\ndefmodule MyAppWeb.CounterLive do\n  use MyAppWeb, :live_view\n\n  def mount(_params, _session, socket) do\n    {:ok, assign(socket, count: 0)}\n  end\n\n  def handle_event(\"inc\", _params, socket) do\n    {:noreply, update(socket, :count, &(&1 + 1))}\n  end\n\n  def render(assigns) do\n    ~H\"\"\"\n    \u003Cdiv class=\"space-y-4\">\n      \u003Cp class=\"text-lg\">Count: \u003C%= @count %>\u003C\u002Fp>\n      \u003Cbutton phx-click=\"inc\" class=\"btn\">Increment\u003C\u002Fbutton>\n    \u003C\u002Fdiv>\n    \"\"\"\n  end\nend\n```\n\n**HEEx tips**\n- Prefer `assign_new\u002F3` to lazily compute expensive data only once per connected session.\n- Use `stream\u002F3` for large lists to minimize diff payloads.\n- Handle params in `handle_params\u002F3` for URL-driven state; avoid storing socket state in params.\n\n**Live Components**\n```elixir\ndefmodule MyAppWeb.NavComponent do\n  use MyAppWeb, :live_component\n  def render(assigns) do\n    ~H\"\"\"\n    \u003Cnav>\n      \u003C%= for item \u003C- @items do %>\n        \u003C.link navigate={item.href}>\u003C%= item.label %>\u003C\u002F.link>\n      \u003C% end %>\n    \u003C\u002Fnav>\n    \"\"\"\n  end\nend\n```\n\n**PubSub-driven LiveView**\n```elixir\n@impl true\ndef mount(_params, _session, socket) do\n  if connected?(socket), do: Phoenix.PubSub.subscribe(MyApp.PubSub, \"orders\")\n  {:ok, assign(socket, orders: [])}\nend\n\n@impl true\ndef handle_info({:order_created, order}, socket) do\n  {:noreply, update(socket, :orders, fn orders -> [order | orders] end)}\nend\n```\n\n---\n\n## PubSub, Channels, and Presence\n\n**Broadcast changes from contexts**\n```elixir\ndef create_order(attrs) do\n  with {:ok, order} \u003C- %Order{} |> Order.changeset(attrs) |> Repo.insert() do\n    Phoenix.PubSub.broadcast(MyApp.PubSub, \"orders\", {:order_created, order})\n    {:ok, order}\n  end\nend\n```\n\n**Presence for online\u002Ftyping indicators**\n```elixir\ndefmodule MyAppWeb.RoomChannel do\n  use Phoenix.Channel\n  alias Phoenix.Presence\n\n  def join(\"room:\" \u003C> room_id, _payload, socket) do\n    send(self(), :after_join)\n    {:ok, assign(socket, :room_id, room_id)}\n  end\n\n  def handle_info(:after_join, socket) do\n    Presence.track(socket, socket.assigns.user_id, %{online_at: System.system_time(:second)})\n    push(socket, \"presence_state\", Presence.list(socket))\n    {:noreply, socket}\n  end\nend\n```\n\n**Security**: authorize topics in `join\u002F3`, verify user tokens in params\u002Fsession, and limit payload size.\n\n---\n\n## Testing Phoenix + LiveView\n\nUse `mix test` with the generated helpers.\n\n```elixir\n# test\u002Fsupport\u002Fconn_case.ex\nuse MyAppWeb.ConnCase, async: true\n\ntest \"renders home\", %{conn: conn} do\n  conn = get(conn, \"\u002F\")\n  assert html_response(conn, 200) =~ \"Welcome\"\nend\n```\n\n```elixir\n# LiveView test\nuse MyAppWeb.ConnCase, async: true\nimport Phoenix.LiveViewTest\n\ntest \"counter increments\", %{conn: conn} do\n  {:ok, view, _html} = live(conn, \"\u002Fcounter\")\n  view |> element(\"button\", \"Increment\") |> render_click()\n  assert render(view) =~ \"Count: 1\"\nend\n```\n\n**DataCase**: provide sandboxed DB connections; wrap tests in transactions to isolate data.\n\n**Fixtures**: build factories with `ExMachina` or simple helper modules under `test\u002Fsupport\u002Ffixtures`.\n\n---\n\n## Performance, Ops, and Deployment\n\n- **Telemetry**: Phoenix exposes events (`[:phoenix, :endpoint, ...]`). Export via `:telemetry_poller`, `OpentelemetryPhoenix`, and `OpentelemetryEcto`.\n- **Assets**: `mix assets.deploy` runs npm install, esbuild, tailwind (if configured), and digests.\n- **Releases**: `MIX_ENV=prod mix release`. Configure runtime env in `config\u002Fruntime.exs`. Start with `PHX_SERVER=true _build\u002Fprod\u002Frel\u002Fmy_app\u002Fbin\u002Fmy_app start`.\n- **Clustering**: add `libcluster` with DNS\u002Fepmd strategy for horizontal scale; use distributed PubSub\u002FPresence.\n- **Caching**: use ETS\u002FCachex for hot paths; prefer short TTLs and invalidate on write.\n- **Background jobs**: Oban for retries\u002Fbackoff; supervise it in application tree.\n- **Hot path checks**: enable `:telemetry` metrics, check LiveView diff sizes, avoid large assigns; prefer streams.\n\n---\n\n## Common Pitfalls\n\n- Forgetting to subscribe LiveViews to PubSub after `connected?\u002F1` check — events will be missed on initial render.\n- Doing heavy work inside LiveView render; move to contexts and precompute assigns.\n- Not using `Ecto.Multi` for multi-step writes; failures leave partial state.\n- Blocking BEAM schedulers with long NIFs or heavy CPU work; offload to ports\u002FOban jobs.\n- Overusing global ETS without supervision or limits; leak memory.\n\n---\n\n## Reference Commands\n\n- `mix phx.routes` — list routes and LiveView paths.\n- `mix phx.gen.live Accounts User users email:string confirmed_at:naive_datetime` — generate LiveView CRUD (review context boundaries afterward).\n- `mix format && mix credo --strict` — formatting and linting.\n- `mix test --seed 0 --max-failures 1` — deterministic failures; pair with `mix test.watch`.\n\nPhoenix + LiveView excels when domain logic stays in contexts, LiveViews stay thin, and the BEAM supervises every component for resilience.\n","# Phoenix + LiveView (Elixir\u002FBEAM)\n\nPhoenix builds on Elixir and the BEAM VM to deliver fault-tolerant, real-time web applications with minimal JavaScript. LiveView keeps UI state on the server while streaming HTML diffs over WebSockets. The BEAM provides lightweight processes, supervision trees, hot code upgrades, and soft-realtime scheduling.\n\n**Key ideas**\n- OTP supervision keeps web, data, and background processes isolated and restartable.\n- Contexts encode domain boundaries (e.g., Accounts, Billing) around Ecto schemas and queries.\n- LiveView renders HTML on the server, syncing UI state over WebSockets with minimal client code.\n- PubSub + Presence enable fan-out updates, tracking, and collaboration features.\n\n---\n\n## Environment and Project Setup\n\n```bash\n# Erlang + Elixir via asdf (recommended)\nasdf install erlang 27.0\nasdf install elixir 1.17.3\nasdf global erlang 27.0 elixir 1.17.3\n\n# Install Phoenix generator\nmix archive.install hex phx_new\n\n# Create project with LiveView + Ecto + esbuild\nmix phx.new my_app --live\ncd my_app\nmix deps.get\nmix ecto.create\nmix phx.server\n```\n\nProject layout (key pieces):\n- `lib\u002Fmy_app\u002Fapplication.ex` — OTP supervision tree (Repo, Endpoint, Telemetry, PubSub, Oban, etc.)\n- `lib\u002Fmy_app_web\u002Fendpoint.ex` — Endpoint, plugs, sockets, LiveView config\n- `lib\u002Fmy_app_web\u002Frouter.ex` — Pipelines, scopes, routes, LiveSessions\n- `lib\u002Fmy_app\u002F` — Contexts (domain modules) and Ecto schemas\n- `test\u002Fsupport\u002F{conn_case,data_case}.ex` — Testing helpers for Ecto + Phoenix\n\n---\n\n## BEAM + OTP Essentials\n\n**Supervision tree (application.ex)**: keep short, isolated children.\n```elixir\ndef start(_type, _args) do\n  children = [\n    MyApp.Repo,\n    {Phoenix.PubSub, name: MyApp.PubSub},\n    MyAppWeb.Endpoint,\n    {Oban, Application.fetch_env!(:my_app, Oban)},\n    MyApp.Metrics\n  ]\n\n  Supervisor.start_link(children, strategy: :one_for_one, name: MyApp.Supervisor)\nend\n```\n\n**GenServer pattern**: wrap stateful services.\n```elixir\ndefmodule MyApp.Counter do\n  use GenServer\n\n  def start_link(initial \\\\ 0), do: GenServer.start_link(__MODULE__, initial, name: __MODULE__)\n  def increment(), do: GenServer.call(__MODULE__, :inc)\n\n  @impl true\n  def handle_call(:inc, _from, state) do\n    new_state = state + 1\n    {:reply, new_state, new_state}\n  end\nend\n```\n\n**BEAM principles**\n- Prefer many small processes; processes are cheap and isolated.\n- Supervise everything with clear restart strategies.\n- Use message passing (`GenServer.cast`\u002F`send`) to avoid shared state.\n- Use ETS\u002FCachex for in-memory caches; keep them supervised.\n\n---\n\n## Phoenix Anatomy and Routing\n\n**Pipelines and scopes (router.ex)**: keep browser\u002Fapi concerns separated.\n```elixir\ndefmodule MyAppWeb.Router do\n  use MyAppWeb, :router\n\n  pipeline :browser do\n    plug :accepts, [\"html\"]\n    plug :fetch_session\n    plug :fetch_live_flash\n    plug :protect_from_forgery\n    plug :put_secure_browser_headers\n    plug :fetch_current_user\n  end\n\n  pipeline :api do\n    plug :accepts, [\"json\"]\n  end\n\n  scope \"\u002F\", MyAppWeb do\n    pipe_through :browser\n    live \"\u002F\", HomeLive\n    resources \"\u002Fusers\", UserController\n  end\n\n  scope \"\u002Fapi\", MyAppWeb do\n    pipe_through :api\n    resources \"\u002Fusers\", Api.UserController, except: [:new, :edit]\n  end\nend\n```\n\n**Plugs**: composable request middleware. Keep plugs pure and short; prefer pipeline plugs over controller plugs when cross-cutting.\n\n---\n\n## Contexts and Ecto\n\n**Schema + changeset**\n```elixir\ndefmodule MyApp.Accounts.User do\n  use Ecto.Schema\n  import Ecto.Changeset\n\n  schema \"users\" do\n    field :email, :string\n    field :hashed_password, :string\n    field :confirmed_at, :naive_datetime\n    timestamps()\n  end\n\n  def registration_changeset(user, attrs) do\n    user\n    |> cast(attrs, [:email, :password])\n    |> validate_required([:email, :password])\n    |> validate_format(:email, ~r\u002F@\u002F)\n    |> validate_length(:password, min: 12)\n    |> unique_constraint(:email)\n    |> put_password_hash()\n  end\n\n  defp put_password_hash(%{valid?: true} = changeset),\n    do: put_change(changeset, :hashed_password, Argon2.hash_pwd_salt(get_change(changeset, :password)))\n  defp put_password_hash(changeset), do: changeset\nend\n```\n\n**Context API**\n```elixir\ndefmodule MyApp.Accounts do\n  import Ecto.Query, warn: false\n  alias MyApp.{Repo, Accounts.User}\n\n  def list_users, do: Repo.all(User)\n  def get_user!(id), do: Repo.get!(User, id)\n\n  def register_user(attrs) do\n    %User{}\n    |> User.registration_changeset(attrs)\n    |> Repo.insert()\n  end\nend\n```\n\n**Transactions with Ecto.Multi**\n```elixir\nalias Ecto.Multi\n\ndef register_and_welcome(attrs) do\n  Multi.new()\n  |> Multi.insert(:user, User.registration_changeset(%User{}, attrs))\n  |> Multi.run(:welcome_email, fn _repo, %{user: user} ->\n    MyApp.Mailer.deliver_welcome(user)\n    {:ok, :sent}\n  end)\n  |> Repo.transaction()\nend\n```\n\n---\n\n## LiveView Patterns\n\n**LiveView module (stateful UI on server)**\n```elixir\ndefmodule MyAppWeb.CounterLive do\n  use MyAppWeb, :live_view\n\n  def mount(_params, _session, socket) do\n    {:ok, assign(socket, count: 0)}\n  end\n\n  def handle_event(\"inc\", _params, socket) do\n    {:noreply, update(socket, :count, &(&1 + 1))}\n  end\n\n  def render(assigns) do\n    ~H\"\"\"\n    \u003Cdiv class=\"space-y-4\">\n      \u003Cp class=\"text-lg\">Count: \u003C%= @count %>\u003C\u002Fp>\n      \u003Cbutton phx-click=\"inc\" class=\"btn\">Increment\u003C\u002Fbutton>\n    \u003C\u002Fdiv>\n    \"\"\"\n  end\nend\n```\n\n**HEEx tips**\n- Prefer `assign_new\u002F3` to lazily compute expensive data only once per connected session.\n- Use `stream\u002F3` for large lists to minimize diff payloads.\n- Handle params in `handle_params\u002F3` for URL-driven state; avoid storing socket state in params.\n\n**Live Components**\n```elixir\ndefmodule MyAppWeb.NavComponent do\n  use MyAppWeb, :live_component\n  def render(assigns) do\n    ~H\"\"\"\n    \u003Cnav>\n      \u003C%= for item \u003C- @items do %>\n        \u003C.link navigate={item.href}>\u003C%= item.label %>\u003C\u002F.link>\n      \u003C% end %>\n    \u003C\u002Fnav>\n    \"\"\"\n  end\nend\n```\n\n**PubSub-driven LiveView**\n```elixir\n@impl true\ndef mount(_params, _session, socket) do\n  if connected?(socket), do: Phoenix.PubSub.subscribe(MyApp.PubSub, \"orders\")\n  {:ok, assign(socket, orders: [])}\nend\n\n@impl true\ndef handle_info({:order_created, order}, socket) do\n  {:noreply, update(socket, :orders, fn orders -> [order | orders] end)}\nend\n```\n\n---\n\n## PubSub, Channels, and Presence\n\n**Broadcast changes from contexts**\n```elixir\ndef create_order(attrs) do\n  with {:ok, order} \u003C- %Order{} |> Order.changeset(attrs) |> Repo.insert() do\n    Phoenix.PubSub.broadcast(MyApp.PubSub, \"orders\", {:order_created, order})\n    {:ok, order}\n  end\nend\n```\n\n**Presence for online\u002Ftyping indicators**\n```elixir\ndefmodule MyAppWeb.RoomChannel do\n  use Phoenix.Channel\n  alias Phoenix.Presence\n\n  def join(\"room:\" \u003C> room_id, _payload, socket) do\n    send(self(), :after_join)\n    {:ok, assign(socket, :room_id, room_id)}\n  end\n\n  def handle_info(:after_join, socket) do\n    Presence.track(socket, socket.assigns.user_id, %{online_at: System.system_time(:second)})\n    push(socket, \"presence_state\", Presence.list(socket))\n    {:noreply, socket}\n  end\nend\n```\n\n**Security**: authorize topics in `join\u002F3`, verify user tokens in params\u002Fsession, and limit payload size.\n\n---\n\n## Testing Phoenix + LiveView\n\nUse `mix test` with the generated helpers.\n\n```elixir\n# test\u002Fsupport\u002Fconn_case.ex\nuse MyAppWeb.ConnCase, async: true\n\ntest \"renders home\", %{conn: conn} do\n  conn = get(conn, \"\u002F\")\n  assert html_response(conn, 200) =~ \"Welcome\"\nend\n```\n\n```elixir\n# LiveView test\nuse MyAppWeb.ConnCase, async: true\nimport Phoenix.LiveViewTest\n\ntest \"counter increments\", %{conn: conn} do\n  {:ok, view, _html} = live(conn, \"\u002Fcounter\")\n  view |> element(\"button\", \"Increment\") |> render_click()\n  assert render(view) =~ \"Count: 1\"\nend\n```\n\n**DataCase**: provide sandboxed DB connections; wrap tests in transactions to isolate data.\n\n**Fixtures**: build factories with `ExMachina` or simple helper modules under `test\u002Fsupport\u002Ffixtures`.\n\n---\n\n## Performance, Ops, and Deployment\n\n- **Telemetry**: Phoenix exposes events (`[:phoenix, :endpoint, ...]`). Export via `:telemetry_poller`, `OpentelemetryPhoenix`, and `OpentelemetryEcto`.\n- **Assets**: `mix assets.deploy` runs npm install, esbuild, tailwind (if configured), and digests.\n- **Releases**: `MIX_ENV=prod mix release`. Configure runtime env in `config\u002Fruntime.exs`. Start with `PHX_SERVER=true _build\u002Fprod\u002Frel\u002Fmy_app\u002Fbin\u002Fmy_app start`.\n- **Clustering**: add `libcluster` with DNS\u002Fepmd strategy for horizontal scale; use distributed PubSub\u002FPresence.\n- **Caching**: use ETS\u002FCachex for hot paths; prefer short TTLs and invalidate on write.\n- **Background jobs**: Oban for retries\u002Fbackoff; supervise it in application tree.\n- **Hot path checks**: enable `:telemetry` metrics, check LiveView diff sizes, avoid large assigns; prefer streams.\n\n---\n\n## Common Pitfalls\n\n- Forgetting to subscribe LiveViews to PubSub after `connected?\u002F1` check — events will be missed on initial render.\n- Doing heavy work inside LiveView render; move to contexts and precompute assigns.\n- Not using `Ecto.Multi` for multi-step writes; failures leave partial state.\n- Blocking BEAM schedulers with long NIFs or heavy CPU work; offload to ports\u002FOban jobs.\n- Overusing global ETS without supervision or limits; leak memory.\n\n---\n\n## Reference Commands\n\n- `mix phx.routes` — list routes and LiveView paths.\n- `mix phx.gen.live Accounts User users email:string confirmed_at:naive_datetime` — generate LiveView CRUD (review context boundaries afterward).\n- `mix format && mix credo --strict` — formatting and linting.\n- `mix test --seed 0 --max-failures 1` — deterministic failures; pair with `mix test.watch`.\n\nPhoenix + LiveView excels when domain logic stays in contexts, LiveViews stay thin, and the BEAM supervises every component for resilience.\n",{"name":5,"author":24,"license":15,"version":25,"category":26,"description":7,"progressive_disclosure":27},"Claude MPM Team","1.0.0","toolchain",{"entry_point":28,"token_estimate":39},{"summary":29,"quick_start":30,"when_to_use":34},"Phoenix + LiveView on the BEAM for fault-tolerant, real-time web apps (OTP, Ecto, PubSub, Presence).",[31,32,33],"Install Erlang\u002FElixir (asdf or brew); mix archive.install hex phx_new","mix phx.new my_app --live && cd my_app && mix deps.get","mix ecto.create && mix phx.server (visit http:\u002F\u002Flocalhost:4000)",[35,36,37,38],"Building real-time, resilient web apps with minimal client-side JS","Needing fault tolerance, supervision, and soft-realtime latency on the BEAM","Using Ecto + Phoenix contexts for clear domain boundaries","Delivering interactive UI via LiveView without a heavy SPA bundle",{"full":40,"entry":41},5600,180,"main","590aa4fe05d1ec71a02ee9cc76c9a20508b5bcea","skills\u002Fju\u002Fskills\u002Fphoenix-liveview","https:\u002F\u002Fgithub.com\u002Fjulio211916\u002FTlantiCAD-Studio-V0.1-alpha","https:\u002F\u002Fgithub.com\u002Fjulio211916","Estudiante de ing sistemas y psicologia","2026-05-22 04:43:54",{"source":8,"skillName":5,"commands":50,"prompt":60,"zipAvailable":61},[51,54,57],{"tool":52,"command":53},"npx","npx skills add julio211916\u002FTlantiCAD-Studio-V0.1-alpha --skill phoenix-liveview",{"tool":55,"command":56},"bunx","bunx skills add julio211916\u002FTlantiCAD-Studio-V0.1-alpha --skill phoenix-liveview",{"tool":58,"command":59},"pnpm","pnpm dlx skills add julio211916\u002FTlantiCAD-Studio-V0.1-alpha --skill phoenix-liveview","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002Fjulio211916\u002FTlantiCAD-Studio-V0.1-alpha\u002Fblob\u002Fmain\u002Fskills\u002Fju\u002Fskills\u002Fphoenix-liveview\u002FSKILL.md",true,[],[64,71,78,85,92,99],{"skillNo":65,"name":66,"nameZh":6,"description":67,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":68,"categories":69,"keywords":70,"publishedAt":19},"01M735PMP7K29TEC1BC5A3VJ3Z","simpy","Process-based discrete-event simulation framework in Python. Use this skill when building simulations of systems with processes, queues, resources, and time-based events such as manufacturing systems, service operations, network traffic, logistics, or any system where entities interact with shared resources over time.","https:\u002F\u002Fgithub.com\u002Fjulio211916\u002FTlantiCAD-Studio-V0.1-alpha\u002Fblob\u002Fmain\u002Fskills\u002Fju\u002Fskills\u002Fsimpy\u002FSKILL.md",[],[],{"skillNo":72,"name":73,"nameZh":6,"description":74,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":75,"categories":76,"keywords":77,"publishedAt":19},"01M735NX56AZHYMV3BQ8GYZ7J0","shopify-expert","Builds and debugs Shopify themes (.liquid files, theme.json, sections), develops custom Shopify apps (shopify.app.toml, OAuth, webhooks), and implements Storefront API integrations for headless storefronts. Use when building or customizing Shopify themes, creating Hydrogen or custom React storefronts, developing Shopify apps, implementing checkout UI extensions or Shopify Functions, optimizing performance, or integrating third-party services. Invoke for Liquid templating, Storefront API, app development, checkout customization, Shopify Plus features, App Bridge, Polaris, or Shopify CLI workflows.","https:\u002F\u002Fgithub.com\u002Fjulio211916\u002FTlantiCAD-Studio-V0.1-alpha\u002Fblob\u002Fmain\u002Fskills\u002Fju\u002Fskills\u002Fshopify-expert\u002FSKILL.md",[],[],{"skillNo":79,"name":80,"nameZh":6,"description":81,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":82,"categories":83,"keywords":84,"publishedAt":19},"01M735N9WTN69TVA2T5VS9W1CA","shap","Model interpretability and explainability using SHAP (SHapley Additive exPlanations). Use this skill when explaining machine learning model predictions, computing feature importance, generating SHAP plots (waterfall, beeswarm, bar, scatter, force, heatmap), debugging models, analyzing model bias or fairness, comparing models, or implementing explainable AI. Works with tree-based models (XGBoost, LightGBM, Random Forest), deep learning (TensorFlow, PyTorch), linear models, and any black-box model.","https:\u002F\u002Fgithub.com\u002Fjulio211916\u002FTlantiCAD-Studio-V0.1-alpha\u002Fblob\u002Fmain\u002Fskills\u002Fju\u002Fskills\u002Fshap\u002FSKILL.md",[],[],{"skillNo":86,"name":87,"nameZh":6,"description":88,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":89,"categories":90,"keywords":91,"publishedAt":19},"01M735N3VQ8R56TXFF16BMF19H","shadcn-ui","Deep expertise on shadcn\u002Fui component library including installation, customization, theming, and accessibility patterns. Use when building UI with shadcn\u002Fui components, integrating Radix UI primitives, configuring Tailwind CSS v4 themes, or implementing dark mode. Covers Next.js App Router, Pages Router, and Vite setups.","https:\u002F\u002Fgithub.com\u002Fjulio211916\u002FTlantiCAD-Studio-V0.1-alpha\u002Fblob\u002Fmain\u002Fskills\u002Fju\u002Fskills\u002Fshadcn-ui\u002FSKILL.md",[],[],{"skillNo":93,"name":94,"nameZh":6,"description":95,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":96,"categories":97,"keywords":98,"publishedAt":19},"01M735KH64KS6Z58H6BJWX89BV","seoul-subway-arrival","Look up Seoul real-time subway arrival information with the official Seoul Open Data API. Use when the user asks when a train arrives, which trains are approaching a station, or how crowded Seoul subway timing looks right now.","https:\u002F\u002Fgithub.com\u002Fjulio211916\u002FTlantiCAD-Studio-V0.1-alpha\u002Fblob\u002Fmain\u002Fskills\u002Fju\u002Fskills\u002Fseoul-subway-arrival\u002FSKILL.md",[],[],{"skillNo":100,"name":101,"nameZh":6,"description":102,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":103,"categories":104,"keywords":105,"publishedAt":19},"01M735K7KAFBZNACQ66PMDQMQD","seo-optimization","Comprehensive 7-phase SEO optimization workflow covering technical SEO auditing, keyword research strategy, on-page optimization, content SEO and E-E-A-T, structured data implementation, link building, and AI search optimization. Use when auditing search engine visibility, diagnosing ranking issues, implementing schema markup, conducting keyword research, optimizing content for E-E-A-T signals, or adapting for AI-driven search (AI Overviews, SGE).","https:\u002F\u002Fgithub.com\u002Fjulio211916\u002FTlantiCAD-Studio-V0.1-alpha\u002Fblob\u002Fmain\u002Fskills\u002Fju\u002Fskills\u002Fseo-optimization\u002FSKILL.md",[],[]]