oliver-kriska/claude-elixir-phoenix / plugins/elixir-phoenix/skills/investigate
investigate
VerifiedFind the root cause of Elixir/Phoenix bugs — crashes, exceptions, stack traces, compile errors, LiveView that won't update, silent failures. Use when something is broken or misbehaves. --parallel for 4 tracks.
| File | Kind | Size |
|---|---|---|
| SKILL.md | skill md | 5.5 KB |
| references/debug-commands.md | markdown | 2.0 KB |
| references/error-patterns.md | markdown | 1.2 KB |
| references/investigation-template.md | markdown | 934 B |
references/debug-commands.md
View on GitHub# Quick Debug Commands & Common Fixes
## Quick Debug Commands
Common debug commands:
- Clean rebuild: `rm -rf _build deps && mix deps.get && mix compile`
- Check module exports: `mix run -e "IO.inspect MyModule.__info__(:functions)"`
- Interactive debugging: `iex -S mix phx.server` (then `recompile()`)
- Run single test with output: `mix test test/file_test.exs:42 --trace`
## Common Fixes
### String vs Atom Keys
```elixir
# External data (JSON, params) = strings
params["key"]
# Internal data = atoms
struct.field
map.key
```
### Missing Preload
```elixir
# Before
user = Repo.get(User, id)
user.posts # BOOM
# After
user = Repo.get(User, id) |> Repo.preload(:posts)
```
### Nil Propagation
```elixir
# Before
user.profile.name # Crashes if profile nil
# After
case user.profile do
nil -> nil
profile -> profile.name
end
# Or use get_in/2
```
## Telemetry-Based Debugging
When Tidewave is unavailable, use telemetry to diagnose
performance and behavior issues:
```elixir
# Attach a temporary handler to see all Ecto queries
:telemetry.attach(
"debug-queries",
[:my_app, :repo, :query],
fn _event, measurements, metadata, _config ->
IO.puts("Query: #{metadata.query}")
IO.puts(" Time: #{measurements.total_time / 1_000_000}ms")
end,
nil
)
# Detach when done: :telemetry.detach("debug-queries")
```
### Common Telemetry Events to Attach
| Event | What It Shows |
|-------|---------------|
| `[:my_app, :repo, :query]` | All Ecto queries with timing |
| `[:phoenix, :endpoint, :stop]` | Request duration |
| `[:phoenix, :router_dispatch, :stop]` | Per-route timing |
| `[:oban, :job, :stop]` | Oban job execution time |
| `[:oban, :job, :exception]` | Oban job failures |
### LiveDashboard in Dev
Add to router for real-time metrics visualization:
```elixir
if Mix.env() in [:dev, :test] do
import Phoenix.LiveDashboard.Router
scope "/" do
pipe_through :browser
live_dashboard "/dashboard",
metrics: MyAppWeb.Telemetry
end
end
```
Related skills
| Skill | Stars | Updated | Works with | Status | Install |
|---|---|---|---|---|---|
| slack-gif-creatoranthropics/skillsKnowledge and utilities for creating animated GIFs optimized for Slack. Provides constraints, validation tools, and animation concepts. Use when users request animated GIFs for Slack like "make me a GIF of X doing Y for Slack." | Stars: 198k | Updated | Claude CodeCodex | Verified | Install |
| ponytailDietrichGebert/ponytailLazy senior dev mode for any coding task: the smallest change that fully solves it, and a reply a busy human understands in one read. | Stars: 194k | Updated | Claude CodeCodex | Verified | Install |
| ponytail-debtDietrichGebert/ponytailHarvest every shortcut: comment into one debt ledger, so deferrals get tracked instead of forgotten. One-shot report. | Stars: 194k | Updated | Claude CodeCodex | Verified | Install |
| ponytail-debtDietrichGebert/ponytailList every `shortcut:` comment (and older `ponytail:` ones) as a debt ledger. One-shot report, changes nothing. Use for "ponytail debt", "what did ponytail defer", "list the shortcuts", /ponytail-debt. | Stars: 194k | Updated | Claude CodeCodex | Verified | Install |