Skip to content
Skills Library
Programming · Review & audit

lv-assigns

/lv-assigns

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.

Licence
MIT
Last repository change
22.10.2026

Assessment and security

100/ 100Class: good
Format25 / 25
Frontmatter with name and description, valid name, description up to 1,024 characters, name matching the folder.
Discoverability25 / 25
Description explains when to use the skill, has a reasonable length and uses third person.
Content35 / 35
At least 150 words and at most 500 lines, headings, step lists, examples or code.
Hygiene15 / 15
No placeholders such as TODO, no Windows paths, with a licence.
Riskno signals detected in the scan
Files in this package
1
Scripts
0
HTML comments
0
URLs in SKILL.md
0
Deprecation

No signals detected. Repository changed on 22.10.2026, without references to retired models or APIs.

Licence

MIT, open: use and modify while retaining author attribution.

What it does and when to use it

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.

Original author 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.

How it works

  1. Iron Laws - Never Violate These
  2. Quick Audit Commands
  3. Audit Checklist
  4. Memory Estimation
  5. Usage
Original SKILL.md headings · 86 lines, 416 words
SKILL.md preview
---
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.
---

# 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.

### Find Large Data Patterns

Use Grep to find large data patterns: lists stored in assigns (`assign.*\[\]`, `assign.*Repo\.all`) and full schema storage (`assign.*Repo\.get`) in the target file.

## Audit Checklist

### 1. Memory Issues

| Pattern | Problem | Solution |
|---------|---------|----------|
| `assign(:items, Repo.all(...))` | Unbounded list | Use `stream/3` |
| `assign(:user, Repo.get!(...))` | Full schema | Select only needed fields |
| `assign(:file_data, binary)` | Large binary | Store reference, not data |
| Nested preloads | Excessive data | Preload only what's rendered |

### 2. Missing temporary_assigns

Should use `temporary_assigns`:

- Flash messages
- Form errors after submission
- One-time notifications
- Upload progress

```elixir
def mount(_params, _session, socket) do
  {:ok, socket, temporary_assigns: [flash_message: nil]}
end
```

### 3. Unused Assigns

Search for assigns defined but never used in templates:

Use Grep to extract all assign names (`assign\(:(\w+)`) from the LiveView file, then use Grep to find all `@\w+` references in the corresponding `.heex` template. Compare to find unused assigns.

### 4. Missing Initialization

```elixir
# BAD: @items might not exist
def render(assigns) do
  ~H"<%= for item <- @items do %>"
end

# GOOD: Initialize in mount
def mount(_params, _session, socket) do
  {:ok, assign(socket, items: [])}
end
```

## Memory Estimation

For each assign, estimate memory footprint:

| Data Type | Approx Size | Concern Level |
|-----------|-------------|---------------|
| Integer | 8 bytes | Low |
| String (100 chars) | ~200 bytes | Low |
| List of 100 maps | ~10-50 KB | Medium |
| List of 1000 items | ~100-500 KB | High |
| Binary (image) | Varies | Critical |
| Full Ecto schema | ~1-5 KB each | Medium |

## Usage

Run `/lv-assigns path/to/live_view.ex` to generate an assigns inventory with memory estimates and optimization recommendations.

Versions

RepositoryScoreLicence
This page · oliver-kriska/claude-elixir-phoenix100MIT
oliver-kriska/claude-elixir-phoenix100MIT
oliver-kriska/claude-elixir-phoenix100MIT
oliver-kriska/claude-elixir-phoenix100MIT

Identical content appears in 1 other GitHub folders. We show one copy with the highest score.

Database snapshot: 13.11.2026 · package version 1fe8b69cd346 (SHA-256 digest of the entire package)

Downloads in the last 30 days: 2 · ranking

Report a problem with this skill: harmful content, incorrect descriptions or an author’s removal request.

Similar skills

  • 100assigns-audit
    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.
  • 100liveview-code-review
    Reviews Phoenix LiveView code for lifecycle patterns, assigns/streams usage, components, and security. Use when reviewing LiveView modules, .heex templates, or LiveComponents.
  • 100phoenix-thinking
    This skill should be used when the user asks to "add a LiveView page", "create a form", "handle real-time updates", "broadcast changes to users", "add a new route", "create an API endpoint", "fix this LiveView bug", "why is mount called twice?", or mentions handle_event,…
  • 100estack-liveview
    Build Phoenix LiveView forms, streams, components, hooks, and authenticated screens. Use when editing HEEx, LiveView events, UI styling, live_session, or asynchronous UI work.
  • 100liveview-patterns
    Build LiveView: async data (assign_async), PubSub (check connected?), phx-change events, form components/modals/uploads, streams for lists, live_patch. Use when handling interactions, debugging events, or tracking Presence.
  • 100phoenix-liveview-essentials
    Use when writing LiveView modules or HEEx templates — mount/handle_params lifecycle, forms with to_form and phx-change, streams, assign_async/start_async, JS commands, hooks, function components.

Feedback and reports

Your message goes to Bartosz Sokoliński. An email address is needed only for a reply. See the privacy policy.