- Home
- Skills
- Bobmatnyc
- Claude Mpm Skills
- Phoenix Liveview
phoenix-liveview_skill
- Python
13
GitHub Stars
2
Bundled Files
2 months ago
Catalog Refreshed
4 months ago
First Indexed
Readme & install
Copy the install command, review bundled files from the catalogue, and read any extended description pulled from the listing source.
Installation
Preview and clipboard use veilstrat where the catalogue uses aiagentskills.
npx veilstrat add skill bobmatnyc/claude-mpm-skills --skill phoenix-liveview- metadata.json574 B
- SKILL.md10.5 KB
Overview
This skill packages practical guidance for building fault-tolerant, real-time web apps with Phoenix and LiveView on the BEAM. It focuses on OTP supervision, context-driven domain design, LiveView patterns, PubSub/Presence, and production concerns like telemetry, releases, and scaling. The content is pragmatic and aimed at teams that want minimal client JS while keeping UI state on the server.
How this skill works
The skill inspects common Phoenix project structure and recommends patterns for application supervision, context APIs, Ecto changesets, and LiveView modules. It highlights where to place responsibilities (contexts vs LiveViews), how to use PubSub and Presence for realtime updates, and which BEAM/OTP primitives (GenServer, Supervisor, ETS) to prefer. It also covers testing, deployment commands, and operational telemetry for performance monitoring.
When to use it
- When building server-driven realtime UIs that minimize client-side JavaScript
- When you need resilient background processing and restartable components
- When designing domain boundaries and Ecto-based data APIs
- When you plan to scale across nodes and need clustered PubSub/Presence
- When preparing apps for production with releases, telemetry, and caching
Best practices
- Keep LiveViews thin: push business logic into contexts and use assign_new/3 for expensive work
- Supervise all stateful pieces with clear restart strategies and small isolated processes
- Use Ecto.Multi for multi-step DB operations to ensure atomicity and predictable rollbacks
- Subscribe to PubSub only after connected?/1 in LiveView to avoid missed events
- Measure LiveView diff sizes, use stream/3 for large lists, and prefer ETS/Cachex for hot caches
Example use cases
- A collaborative dashboard that broadcasts order events to many connected users using PubSub and Presence
- An authenticated user area where LiveView manages session-driven UIs and server-side state updates
- A background-job pipeline with Oban supervised in the application tree for retries and backoff
- A CRUD admin generated via mix phx.gen.live with domain logic encapsulated in contexts
- A clustered deployment using libcluster for distributed PubSub and presence across nodes
FAQ
Move expensive computations into contexts or background jobs (Oban) and compute lazily with assign_new/3; never perform long CPU-bound tasks on the main BEAM scheduler.
When should I use PubSub vs Channels?
Use Phoenix.PubSub for simple fan-out and LiveView notifications. Use Channels for raw websocket patterns needing low-level event handling or third-party integrations.