Inspect LiveView socket assigns for memory bloat - missing temporary_assigns, unused assigns, unbounded lists needing streams, memory estimates. Use when LiveView memory grows or you need to add temporary_assigns.
---
name: lv:assigns
description: "Inspect LiveView socket assigns for memory bloat — missing temporary_assigns, unused assigns, unbounded lists needing streams, memory estimates. Use when LiveView memory grows or you need to add temporary_assigns."
effort: medium
argument-hint: path/to/live_view.ex
allowed-tools: Read, Grep, Glob, Bash
---
# LiveView Assigns Audit
Analyze LiveView socket assigns for memory efficiency, clarity, and best practices.
## Iron Laws - Never Violate These
1. **Use streams for lists > 100 items** - Never store large lists directly in assigns
2. **Use temporary_assigns for transient data** - Flash messages, temp errors, notifications
3. **Preload only needed fields** - Don't store full Ecto schemas when only needing subset
4. **Initialize all assigns in mount** - Never access assigns that might not exist
5. **NEVER modify assigns or code during audit** — this is a read-only diagnostic; report findings only
## Quick Audit Commands
### Extract All Assigns
Use Grep to find all `assign(` and `assign_new(` calls in the target LiveView file.… install to load the full skill