$npx -y skills add getsentry/sentry-for-ai --skill sentry-node-sdkFull Sentry SDK setup for Node.js, Bun, and Deno. Use when asked to "add Sentry to Node.js", "add Sentry to Bun", "add Sentry to Deno", "install @sentry/node", "@sentry/bun", or "@sentry/deno", or configure error monitoring, tracing, logging, profiling, metrics, crons, or AI moni
| 1 | > [All Skills](../../SKILL_TREE.md) > [SDK Setup](../sentry-sdk-setup/SKILL.md) > Node.js / Bun / Deno SDK |
| 2 | |
| 3 | # Sentry Node.js / Bun / Deno SDK |
| 4 | |
| 5 | Opinionated wizard that scans your project and guides you through complete Sentry setup for server-side JavaScript and TypeScript runtimes: Node.js, Bun, and Deno. |
| 6 | |
| 7 | ## Invoke This Skill When |
| 8 | |
| 9 | - User asks to "add Sentry to Node.js", "Bun", or "Deno" |
| 10 | - User wants to install or configure `@sentry/node`, `@sentry/bun`, or `@sentry/deno` |
| 11 | - User wants error monitoring, tracing, logging, profiling, crons, metrics, or AI monitoring for a backend JS/TS app |
| 12 | - User asks about `instrument.js`, `--import ./instrument.mjs`, `bun --preload`, or `npm:@sentry/deno` |
| 13 | - User wants to monitor Express, Fastify, Koa, Hapi, Connect, Bun.serve(), or Deno.serve() |
| 14 | |
| 15 | > **NestJS?** Use [`sentry-nestjs-sdk`](../sentry-nestjs-sdk/SKILL.md) instead — it uses `@sentry/nestjs` with NestJS-native decorators and filters. |
| 16 | > **Next.js?** Use [`sentry-nextjs-sdk`](../sentry-nextjs-sdk/SKILL.md) instead — it handles the three-runtime architecture (browser, server, edge). |
| 17 | |
| 18 | > **Note:** SDK versions below reflect current Sentry docs at time of writing (`@sentry/node` ≥10.42.0, `@sentry/bun` ≥10.42.0, `@sentry/deno` ≥10.42.0). |
| 19 | > Always verify against [docs.sentry.io/platforms/javascript/guides/node/](https://docs.sentry.io/platforms/javascript/guides/node/) before implementing. |
| 20 | |
| 21 | --- |
| 22 | |
| 23 | ## Phase 1: Detect |
| 24 | |
| 25 | Run these commands to identify the runtime, framework, and existing Sentry setup: |
| 26 | |
| 27 | ```bash |
| 28 | # Detect runtime |
| 29 | bun --version 2>/dev/null && echo "Bun detected" |
| 30 | deno --version 2>/dev/null && echo "Deno detected" |
| 31 | node --version 2>/dev/null && echo "Node.js detected" |
| 32 | |
| 33 | # Detect existing Sentry packages |
| 34 | cat package.json 2>/dev/null | grep -E '"@sentry/' |
| 35 | cat deno.json deno.jsonc 2>/dev/null | grep -i sentry |
| 36 | |
| 37 | # Detect Node.js framework |
| 38 | cat package.json 2>/dev/null | grep -E '"express"|"fastify"|"@hapi/hapi"|"koa"|"@nestjs/core"|"connect"' |
| 39 | |
| 40 | # Detect Bun-specific frameworks |
| 41 | cat package.json 2>/dev/null | grep -E '"elysia"|"hono"' |
| 42 | |
| 43 | # Detect Deno frameworks (deno.json imports) |
| 44 | cat deno.json deno.jsonc 2>/dev/null | grep -E '"oak"|"hono"|"fresh"' |
| 45 | |
| 46 | # Detect module system (Node.js) |
| 47 | cat package.json 2>/dev/null | grep '"type"' |
| 48 | ls *.mjs *.cjs 2>/dev/null | head -5 |
| 49 | |
| 50 | # Detect existing instrument file |
| 51 | ls instrument.js instrument.mjs instrument.ts instrument.cjs 2>/dev/null |
| 52 | |
| 53 | # Detect logging libraries |
| 54 | cat package.json 2>/dev/null | grep -E '"winston"|"pino"|"bunyan"' |
| 55 | |
| 56 | # Detect cron / scheduling |
| 57 | cat package.json 2>/dev/null | grep -E '"node-cron"|"cron"|"agenda"|"bull"|"bullmq"' |
| 58 | |
| 59 | # Detect AI / LLM usage |
| 60 | cat package.json 2>/dev/null | grep -E '"openai"|"@anthropic-ai"|"@langchain"|"@vercel/ai"|"@google/generative-ai"' |
| 61 | |
| 62 | # Detect OpenTelemetry tracing |
| 63 | cat package.json 2>/dev/null | grep -E '"@opentelemetry/sdk-node"|"@opentelemetry/sdk-trace-node"|"@opentelemetry/sdk-trace-base"' |
| 64 | grep -rn "NodeTracerProvider\|trace\.getTracer\|startActiveSpan" \ |
| 65 | --include="*.ts" --include="*.js" --include="*.mjs" 2>/dev/null | head -5 |
| 66 | |
| 67 | # Check for companion frontend |
| 68 | ls frontend/ web/ client/ ui/ 2>/dev/null |
| 69 | cat package.json 2>/dev/null | grep -E '"react"|"vue"|"svelte"|"next"' |
| 70 | ``` |
| 71 | |
| 72 | **What to determine:** |
| 73 | |
| 74 | | Question | Impact | |
| 75 | |----------|--------| |
| 76 | | Which runtime? (Node.js / Bun / Deno) | Determines package, init pattern, and preload flag | |
| 77 | | Node.js: ESM or CJS? | ESM requires `--import ./instrument.mjs`; CJS uses `require("./instrument")` | |
| 78 | | Framework detected? | Determines which error handler to register | |
| 79 | | `@sentry/*` already installed? | Skip install, go straight to feature config | |
| 80 | | `instrument.js` / `instrument.mjs` already exists? | Merge into it rather than overwrite | |
| 81 | | Logging library detected? | Recommend Sentry Logs | |
| 82 | | Cron / job scheduler detected? | Recommend Crons monitoring | |
| 83 | | AI library detected? | Recommend AI Monitoring | |
| 84 | | OpenTelemetry tracing detected? | Use OTLP path instead of native tracing | |
| 85 | | Companion frontend found? | Trigger Phase 4 cross-link | |
| 86 | |
| 87 | --- |
| 88 | |
| 89 | ## Phase 2: Recommend |
| 90 | |
| 91 | Present a concrete recommendation based on what you found. Don't ask open-ended questions — lead with a proposal: |
| 92 | |
| 93 | **Route from OTel detection:** |
| 94 | - **OTel tracing detected** (`@opentelemetry/sdk-node` or `@opentelemetry/sdk-trace-node` in `package.json`, or `NodeTracerProvider` in source) → use OTLP path: `otlpIntegration()` via `@sentry/node-core/light`; do **not** set `tracesSampleRate`; Sentry links errors to OTel traces automatically |
| 95 | |
| 96 | **Recommended (core coverage):** |
| 97 | - ✅ **Erro |