agentsclimarketplace

Assigns audit

Skill oliver-kriska/claude-elixir-phoenix/plugins/elixir-phoenix/skills/assigns-audit

Claude Code plugin for Elixir/Phoenix/LiveView — 20 specialist agents, Iron Laws enforcement, and Tidewave MCP integration. Plan features with parallel research agents, execute with automatic verification, review with 4-agent parallel audits, and capture learnings as reusable knowledge.

Install
npx -y skills add oliver-kriska/claude-elixir-phoenix --skill assigns-audit

Assembled from the repository path, not quoted from the project. Check it against their README if it does not work.

What its author says it does

Copied from the file, not written here

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.

SKILL.md

3.0 KB, as published. Nobody here has run it

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

PatternProblemSolution
assign(:items, Repo.all(...))Unbounded listUse stream/3
assign(:user, Repo.get!(...))Full schemaSelect only needed fields
assign(:file_data, binary)Large binaryStore reference, not data
Nested preloadsExcessive dataPreload only what's rendered

2. Missing temporary_assigns

Should use temporary_assigns:

  • Flash messages
  • Form errors after submission
  • One-time notifications
  • Upload progress
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

# 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 TypeApprox SizeConcern Level
Integer8 bytesLow
String (100 chars)~200 bytesLow
List of 100 maps~10-50 KBMedium
List of 1000 items~100-500 KBHigh
Binary (image)VariesCritical
Full Ecto schema~1-5 KB eachMedium

Usage

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

Keep looking

Skills are one crate of 328,083. Ordering is by how many stacks a row turns up in, so the top of any crate is what has actually been picked rather than what has the most stars.