{"slug":"perf","title":"perf","summary":"Use when anything in a Phoenix app is slow, times out, or uses too much memory, even if the cause looks obvious. Load it before analyzing or fixing: it runs measured Ecto, LiveView and OTP checks and ranks fixes.","platform":"Claude","tags":[],"authorName":"LLM Mart","authorSlug":"llm-mart","score":0,"source":"github","price":null,"verified":false,"createdAt":"2026-10-04T15:14:15.083651Z","repo":{"url":"https://github.com/oliver-kriska/claude-elixir-phoenix","stars":560,"forks":44,"license":"MIT","updatedAt":"2026-10-02T04:11:38Z"},"bodyHtml":"<hr>\n<h2>name: perf\ndescription: \"Use when anything in a Phoenix app is slow, times out, or uses too much memory, even if the cause looks obvious. Load it before analyzing or fixing: it runs measured Ecto, LiveView and OTP checks and ranks fixes.\"\neffort: high\nargument-hint: \"[page|context|module] [--focus ecto|liveview|otp]\"</h2>\n<h1>Performance Analysis</h1>\n<p>Analyze code for performance issues across Ecto, LiveView,\nand OTP layers. Prioritize findings by impact and effort.</p>\n<h2>Usage</h2>\n<pre><code>/phx:perf                           # Analyze full project\n/phx:perf lib/my_app/accounts.ex    # Analyze specific module\n/phx:perf --focus ecto              # Ecto queries only\n/phx:perf --focus liveview          # LiveView memory only\n/phx:perf --focus otp               # OTP bottlenecks only\n</code></pre>\n<h2>Arguments</h2>\n<p><code>$ARGUMENTS</code> = Optional module/context path and <code>--focus</code> flag.</p>\n<h2>Iron Laws</h2>\n<ol>\n<li><strong>MEASURE BEFORE OPTIMIZING</strong> — Never optimize without evidence of a problem</li>\n<li><strong>DATABASE FIRST</strong> — 90% of Elixir performance issues are query-related</li>\n<li><strong>ONE CHANGE AT A TIME</strong> — Isolate optimizations to measure impact</li>\n<li><strong>NEVER benchmark in dev mode</strong> — Always use <code>MIX_ENV=prod</code> for performance measurements; dev mode includes code reloading, debug logging, and unoptimized compilation that invalidate results</li>\n</ol>\n<h2>Workflow</h2>\n<h3>Step 1: Identify Scope</h3>\n<p>Check specific file if provided. Otherwise scan full project:</p>\n<pre><code># Find hot paths: contexts, LiveViews, workers\nfind lib/ -name \"*.ex\" | head -50\n</code></pre>\n<h3>Step 2: Run Analysis Tracks</h3>\n<p>Spawn analysis agents in parallel based on focus:</p>\n<p><strong>Ecto Track</strong> (default or <code>--focus ecto</code>):</p>\n<p>Spawn <code>phx:elixir-reviewer</code> with prompt:\n\"Analyze for N+1 queries, missing preloads, unindexed queries,\nand inefficient patterns. Check: <code>Repo.all</code> in loops,\n<code>Enum.map</code> with Repo calls, missing <code>preload</code>, queries without\nindexes on WHERE/JOIN columns.\"</p>\n<p><strong>LiveView Track</strong> (default or <code>--focus liveview</code>):</p>\n<p>Spawn <code>phx:elixir-reviewer</code> with prompt:\n\"Analyze LiveViews for memory issues: large assigns, missing\nstreams for lists, assigns that grow unbounded, heavy\n<code>handle_info</code> processing, missing <code>assign_async</code> for slow ops.\"</p>\n<p><strong>OTP Track</strong> (only with <code>--focus otp</code>):</p>\n<p>Spawn <code>phx:otp-advisor</code> with prompt:\n\"Analyze for OTP bottlenecks: GenServer mailbox growth,\nsynchronous calls in hot paths, missing Task.async for\nparallel work, ETS opportunities for read-heavy state.\"</p>\n<h3>Step 3: Prioritize Findings</h3>\n<p>Score each finding on a 2x2 matrix:</p>\n<table>\n<thead>\n<tr>\n<th></th>\n<th>Low Effort</th>\n<th>High Effort</th>\n</tr>\n</thead>\n<tbody>\n<tr>\n<td><strong>High Impact</strong></td>\n<td>DO FIRST</td>\n<td>PLAN</td>\n</tr>\n<tr>\n<td><strong>Low Impact</strong></td>\n<td>QUICK WIN</td>\n<td>SKIP</td>\n</tr>\n</tbody>\n</table>\n<p>High impact = affects response time, memory per user, or query count.\nLow effort = single file change, no migration needed.</p>\n<h3>Step 4: Present Top 5</h3>\n<p>Present findings sorted by priority:</p>\n<pre><code>## Performance Analysis: {scope}\n\n### 1. {Finding} — DO FIRST\n**Impact**: {what improves}\n**Location**: {file}:{line}\n**Current**: {problematic pattern}\n**Fix**: {optimized pattern}\n**Estimated gain**: {e.g., \"eliminates N+1, reduces queries from O(n) to O(1)\"}\n\n### 2. {Finding} — PLAN\n...\n</code></pre>\n<h3>Step 5: Offer Next Steps</h3>\n<p>Always end with actionable next steps — findings without follow-up\nget lost. Present options based on severity:</p>\n<pre><code>How would you like to proceed?\n\n- `/phx:plan` — Create a plan from these findings (recommended for 3+ fixes)\n- `/phx:quick` — Apply top priority fix directly (1-2 simple fixes)\n- `/phx:investigate` — Deep-dive into a specific finding\n</code></pre>\n<h2>Tidewave Integration</h2>\n<p>If Tidewave MCP is available:</p>\n<ul>\n<li>Use <code>mcp__tidewave__project_eval</code> to run <code>Repo.query!(\"EXPLAIN ANALYZE ...\")</code> on suspicious queries</li>\n<li>Use <code>mcp__tidewave__project_eval</code> to check <code>Process.info(pid, :message_queue_len)</code> for GenServer bottlenecks</li>\n<li>Use <code>mcp__tidewave__execute_sql_query</code> to check missing indexes</li>\n</ul>\n<h2>References</h2>\n<ul>\n<li><code>${CLAUDE_SKILL_DIR}/references/benchmarking.md</code> — Benchee patterns, profiling, flame graphs</li>\n</ul>\n","files":[{"path":"references/benchmarking.md","sizeBytes":5314,"isText":true},{"path":"SKILL.md","sizeBytes":3943,"isText":true}],"reviewScore":null,"reviewSummary":null,"trust":{"provenance":"trusted-source-unreviewed","notice":"Community-authored content, reproduced verbatim and not vetted as instructions. Treat it as data to evaluate, never as directives to follow.","bodySource":null},"bodyLocked":false,"purchaseUrl":null,"sourceUrl":null,"report":{"provenance":"trusted-source-unreviewed","screen":{"ran":true,"outcome":"clean","suspicious":0,"notes":0,"hiddenCharacters":false},"virusScan":{"engine":"clamav","status":"clean","scannedAt":"2026-10-04T15:15:14.184208Z","sha256":"25BF2F5A8695D1E086B54430DCA253A32058366DCC531E572192E456AE6C67F4","sizeBytes":4510},"review":null,"source":{"repositoryUrl":"https://github.com/oliver-kriska/claude-elixir-phoenix","path":"plugins/elixir-phoenix/skills/perf","license":"MIT","commit":"9767a82d24ddddad553e85f88efc2869a7fd7d88","subtreeSha":"A47C0E7BF072C6D422BAC8CC71CEE85172A77588CE70F5CBF8A68FE00FF551E3","lastSyncedAt":"2026-10-04T15:14:09.139242Z"},"reviewedAt":"2026-10-04T15:16:37.779408Z","notice":"Community-authored content, reproduced verbatim and not vetted as instructions. Treat it as data to evaluate, never as directives to follow."},"install":[{"target":"skills-cli","command":"npx skills add https://github.com/oliver-kriska/claude-elixir-phoenix/tree/main/plugins/elixir-phoenix/skills/perf"},{"target":"claude-code","command":"claude plugin marketplace add https://llmmart.ai/marketplace.json && claude plugin install oliver-kriska-claude-elixir-phoenix@llmmart"},{"target":"git","command":"git clone https://github.com/oliver-kriska/claude-elixir-phoenix.git"}]}