$npx -y skills add getsentry/sentry-for-ai --skill sentry-elixir-sdkFull Sentry SDK setup for Elixir. Use when asked to "add Sentry to Elixir", "install sentry for Elixir", or configure error monitoring, tracing, logging, or crons for Elixir, Phoenix, or Plug applications. Supports Phoenix, Plug, LiveView, Oban, and Quantum.
| 1 | > [All Skills](../../SKILL_TREE.md) > [SDK Setup](../sentry-sdk-setup/SKILL.md) > Elixir SDK |
| 2 | |
| 3 | # Sentry Elixir SDK |
| 4 | |
| 5 | Opinionated wizard that scans your Elixir project and guides you through complete Sentry setup. |
| 6 | |
| 7 | ## Invoke This Skill When |
| 8 | |
| 9 | - User asks to "add Sentry to Elixir" or "set up Sentry" in an Elixir or Phoenix app |
| 10 | - User wants error monitoring, tracing, logging, or crons in Elixir or Phoenix |
| 11 | - User mentions `sentry` hex package, `getsentry/sentry-elixir`, or Elixir Sentry SDK |
| 12 | - User wants to monitor exceptions, Plug errors, LiveView errors, or scheduled jobs |
| 13 | |
| 14 | > **Note:** SDK versions and APIs below reflect Sentry docs at time of writing (sentry v13.2.0, requires Elixir ~> 1.13). |
| 15 | > Always verify against [docs.sentry.io/platforms/elixir/](https://docs.sentry.io/platforms/elixir/) before implementing. |
| 16 | |
| 17 | --- |
| 18 | |
| 19 | ## Phase 1: Detect |
| 20 | |
| 21 | Run these commands to understand the project before making any recommendations: |
| 22 | |
| 23 | ```bash |
| 24 | # Check existing Sentry dependency |
| 25 | grep -i sentry mix.exs 2>/dev/null |
| 26 | |
| 27 | # Detect Elixir version |
| 28 | cat .tool-versions 2>/dev/null | grep elixir |
| 29 | grep "elixir:" mix.exs 2>/dev/null |
| 30 | |
| 31 | # Detect Phoenix or Plug |
| 32 | grep -E '"phoenix"|"plug"' mix.exs 2>/dev/null |
| 33 | |
| 34 | # Detect Phoenix LiveView |
| 35 | grep "phoenix_live_view" mix.exs 2>/dev/null |
| 36 | |
| 37 | # Detect Oban (job queue / crons) |
| 38 | grep "oban" mix.exs 2>/dev/null |
| 39 | |
| 40 | # Detect Quantum (cron scheduler) |
| 41 | grep "quantum" mix.exs 2>/dev/null |
| 42 | |
| 43 | # Detect OpenTelemetry usage |
| 44 | grep "opentelemetry" mix.exs 2>/dev/null |
| 45 | |
| 46 | # Check for companion frontend |
| 47 | ls assets/ frontend/ web/ client/ 2>/dev/null |
| 48 | ``` |
| 49 | |
| 50 | **What to note:** |
| 51 | |
| 52 | | Signal | Impact | |
| 53 | |--------|--------| |
| 54 | | `sentry` already in `mix.exs`? | Skip install; go to Phase 2 (configure features) | |
| 55 | | Phoenix detected? | Add `Sentry.PlugCapture`, `Sentry.PlugContext`, optionally `Sentry.LiveViewHook` | |
| 56 | | LiveView detected? | Add `Sentry.LiveViewHook` to the `live_view` macro in `my_app_web.ex` | |
| 57 | | Oban detected? | Recommend Crons + error capture via Oban integration | |
| 58 | | Quantum detected? | Recommend Crons via Quantum integration | |
| 59 | | OpenTelemetry already present? | Tracing setup only needs `Sentry.OpenTelemetry.*` config | |
| 60 | | Frontend directory found? | Trigger Phase 4 cross-link suggestion | |
| 61 | |
| 62 | --- |
| 63 | |
| 64 | ## Phase 2: Recommend |
| 65 | |
| 66 | Based on what you found, present a concrete recommendation. Don't ask open-ended questions — lead with a proposal: |
| 67 | |
| 68 | **Recommended (core coverage):** |
| 69 | - ✅ **Error Monitoring** — always; captures exceptions and crash reports |
| 70 | - ✅ **Logging** — `Sentry.LoggerHandler` forwards crash reports and error logs to Sentry |
| 71 | - ✅ **Tracing** — if Phoenix, Plug, or Ecto detected (via OpenTelemetry) |
| 72 | |
| 73 | **Optional (enhanced observability):** |
| 74 | - ⚡ **Crons** — detect silent failures in scheduled jobs (Oban, Quantum, or manual GenServer) |
| 75 | - ⚡ **Sentry Logs** — forward structured logs to Sentry Logs Protocol (sentry v12.0.0+) |
| 76 | |
| 77 | **Recommendation logic:** |
| 78 | |
| 79 | | Feature | Recommend when... | |
| 80 | |---------|------------------| |
| 81 | | Error Monitoring | **Always** — non-negotiable baseline | |
| 82 | | Logging | **Always** — `LoggerHandler` captures crashes that aren't explicit `capture_exception` calls | |
| 83 | | Tracing | Phoenix, Plug, Ecto, or OpenTelemetry imports detected | |
| 84 | | Crons | Oban, Quantum, or periodic `GenServer`/`Task` patterns detected | |
| 85 | | Sentry Logs | sentry v12.0.0+ in use and structured log search is needed | |
| 86 | |
| 87 | Propose: *"I recommend setting up Error Monitoring + Logging [+ Tracing if Phoenix/Ecto detected]. Want me to also add Crons or Sentry Logs?"* |
| 88 | |
| 89 | --- |
| 90 | |
| 91 | ## Phase 3: Guide |
| 92 | |
| 93 | ### Option 1: Igniter Installer (Recommended) |
| 94 | |
| 95 | > **You need to run this yourself** — the Igniter installer requires interactive terminal input that the agent can't handle. Copy-paste into your terminal: |
| 96 | > |
| 97 | > ```bash |
| 98 | > mix igniter.install sentry |
| 99 | > ``` |
| 100 | > |
| 101 | > Available since sentry v11.0.0. It auto-configures `config/config.exs`, `config/prod.exs`, `config/runtime.exs`, and `lib/my_app/application.ex`. |
| 102 | > |
| 103 | > **Once it finishes, come back and skip to [Verification](#verification).** |
| 104 | |
| 105 | If the user skips the Igniter installer, proceed with Option 2 (Manual Setup) below. |
| 106 | |
| 107 | --- |
| 108 | |
| 109 | ### Option 2: Manual Setup |
| 110 | |
| 111 | #### Install |
| 112 | |
| 113 | Add to `mix.exs` dependencies: |
| 114 | |
| 115 | ```elixir |
| 116 | # mix.exs |
| 117 | defp deps do |
| 118 | [ |
| 119 | {:sentry, "~> 13.0"}, |
| 120 | {:finch, "~> 0.21"} |
| 121 | # Add jason if using Elixir < 1.18: |
| 122 | # {:jason, "~> 1.4"}, |
| 123 | ] |
| 124 | end |
| 125 | ``` |
| 126 | |
| 127 | ```bash |
| 128 | mix deps.get |
| 129 | ``` |
| 130 | |
| 131 | #### Configure |
| 132 | |
| 133 | ```elixir |
| 134 | # config/config.exs |
| 135 | config :sentry, |
| 136 | dsn: System.get_env("SENTRY_DSN"), |
| 137 | environment_name: config_env(), |
| 138 | enable_source_code_context: true, |
| 139 | root_source_code_paths: [File.cwd!()], |
| 140 | in_app_otp_apps: [:my_app] |
| 141 | ``` |
| 142 | |
| 143 | For runtime configuration (recommended for |