[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M795PJYTCWXFM2JHM62WM6KX":3,"skill-same:01M795PJYTCWXFM2JHM62WM6KX":60},{"skillNo":4,"name":5,"nameZh":6,"description":7,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":16,"categories":17,"keywords":18,"publishedAt":19,"linkOnly":20,"markdownContent":21,"markdownBody":22,"frontMatter":23,"refName":37,"commitSha":38,"skillDirectory":39,"forksCount":40,"repositoryHtmlUrl":41,"repositoryHomepageUrl":6,"ownerHtmlUrl":42,"ownerBlogUrl":43,"ownerDescription":44,"updatedAt":45,"install":46,"resources":59},"01M795PJYTCWXFM2JHM62WM6KX","sentry-local-dev-loop",null,"Configure Sentry for local development with environment-aware settings.\nUse when setting up dev vs prod DSN routing, enabling debug mode,\ntuning sample rates for local work, or testing source maps locally.\nTrigger with phrases like \"sentry local dev\", \"sentry development config\",\n\"debug sentry locally\", \"sentry dev environment\", \"sentry spotlight\".","jukeyman\u002Fjukeyman-skills","jukeyman","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F142960420?v=4","01M78FR4Y3DHMMCBCC0GXXNB3F","RICK JEFFERSON","01M78FR4Z8RVQRAD31Y5J7V6EB",1,"MIT","https:\u002F\u002Fgithub.com\u002Fjukeyman\u002Fjukeyman-skills\u002Fblob\u002Fmain\u002Fskills\u002Fsaas-packs--sentry-pack--sentry-local-dev-loop\u002FSKILL.md",[],[],"2026-11-15 14:19:17",false,"---\nname: sentry-local-dev-loop\ndescription: |\n  Configure Sentry for local development with environment-aware settings.\n  Use when setting up dev vs prod DSN routing, enabling debug mode,\n  tuning sample rates for local work, or testing source maps locally.\n  Trigger with phrases like \"sentry local dev\", \"sentry development config\",\n  \"debug sentry locally\", \"sentry dev environment\", \"sentry spotlight\".\nallowed-tools: Read, Write, Edit, Bash(npm:*), Bash(node:*), Bash(npx:*), Bash(python:*), Grep, Glob\nversion: 1.0.0\nlicense: MIT\nauthor: Jeremy Longshore \u003Cjeremy@intentsolutions.io>\ncompatible-with: claude-code, codex, openclaw\ntags: [saas, sentry, development, debugging, workflow, devtools, environment]\n---\n# Sentry Local Dev Loop\n\n## Overview\n\nConfigure Sentry for local development with environment-aware DSN routing, debug-mode verbosity, full-capture sample rates, `beforeSend` inspection, Sentry Spotlight for offline event viewing, and `sentry-cli` source map verification. All configuration uses environment variables so nothing leaks into commits.\n\n## Prerequisites\n\n- `@sentry\u002Fnode` v8+ installed (TypeScript\u002FNode) or `sentry-sdk` v2+ installed (Python)\n- Separate Sentry project created for development (different DSN from production)\n- `.env` file with `SENTRY_DSN_DEV` and `NODE_ENV=development`\n- Network access to `*.ingest.sentry.io` (or use Spotlight for fully offline work)\n\n## Instructions\n\n### Step 1 -- Environment-Aware Configuration\n\nCreate an initialization file that routes events to the correct Sentry project based on environment, enables debug logging in dev, and captures 100% of traces locally:\n\n```typescript\n\u002F\u002F instrument.mjs — import via: node --import .\u002Finstrument.mjs app.mjs\nimport * as Sentry from '@sentry\u002Fnode';\n\nconst env = process.env.NODE_ENV || 'development';\nconst isDev = env !== 'production';\n\nSentry.init({\n  \u002F\u002F Route to dev project locally, prod project in production\n  dsn: isDev\n    ? process.env.SENTRY_DSN_DEV\n    : process.env.SENTRY_DSN,\n\n  environment: env,\n  release: isDev ? 'dev-local' : process.env.SENTRY_RELEASE,\n\n  \u002F\u002F Full capture in dev — you need every event for debugging\n  tracesSampleRate: isDev ? 1.0 : 0.1,\n  sampleRate: isDev ? 1.0 : 1.0,\n\n  \u002F\u002F Verbose SDK output to console in dev\n  debug: isDev,\n\n  \u002F\u002F Include PII locally for easier debugging (never in prod)\n  sendDefaultPii: isDev,\n\n  \u002F\u002F Sentry Spotlight — shows events in local browser UI\n  \u002F\u002F Install: npx @spotlightjs\u002Fspotlight\n  spotlight: isDev,\n\n  beforeSend(event, hint) {\n    if (isDev) {\n      const exc = event.exception?.values?.[0];\n      const label = exc\n        ? `${exc.type}: ${exc.value}`\n        : event.message || 'event';\n      console.log(`[Sentry Dev] ${label}`);\n      console.log(`  Tags: ${JSON.stringify(event.tags || {})}`);\n    }\n    return event;\n  },\n\n  beforeSendTransaction(event) {\n    if (isDev) {\n      const duration = event.timestamp && event.start_timestamp\n        ? ((event.timestamp - event.start_timestamp) * 1000).toFixed(0)\n        : '?';\n      console.log(`[Sentry Dev] Transaction: ${event.transaction} (${duration}ms)`);\n    }\n    return event;\n  },\n});\n```\n\nSet up environment files to keep DSNs out of source:\n\n```bash\n# .env.development\nSENTRY_DSN_DEV=https:\u002F\u002FexamplePublicKey@o0.ingest.sentry.io\u002F0\nSENTRY_ENVIRONMENT=development\nNODE_ENV=development\n\n# .env.production\nSENTRY_DSN=https:\u002F\u002FprodPublicKey@o0.ingest.sentry.io\u002F0\nSENTRY_ENVIRONMENT=production\nSENTRY_RELEASE=v1.2.3\nNODE_ENV=production\n```\n\nAdd DSN safety to `.gitignore`:\n\n```gitignore\n.env\n.env.development\n.env.production\n.env.local\n```\n\n### Step 2 -- Local Verification and Performance Debugging\n\nCreate a verification script that confirms the SDK works end-to-end and demonstrates `Sentry.startSpan()` for local performance profiling:\n\n```typescript\n\u002F\u002F scripts\u002Fverify-sentry.mjs — run: node --import .\u002Finstrument.mjs scripts\u002Fverify-sentry.mjs\nimport * as Sentry from '@sentry\u002Fnode';\n\nasync function verify() {\n  const client = Sentry.getClient();\n  if (!client) {\n    console.error('Sentry SDK not initialized — run with --import .\u002Finstrument.mjs');\n    process.exit(1);\n  }\n  console.log('--- Sentry Dev Loop Verification ---\\n');\n\n  \u002F\u002F 1. Test captureMessage\n  console.log('1. Sending test message...');\n  Sentry.captureMessage('Dev loop verification — captureMessage', 'info');\n\n  \u002F\u002F 2. Test captureException\n  console.log('2. Sending test exception...');\n  try {\n    throw new Error('Dev loop verification — captureException');\n  } catch (e) {\n    const eventId = Sentry.captureException(e);\n    console.log(`   Event ID: ${eventId}`);\n  }\n\n  \u002F\u002F 3. Test Sentry.startSpan for local performance profiling\n  console.log('3. Testing startSpan for performance...');\n  await Sentry.startSpan(\n    { name: 'dev.verification.database', op: 'db.query' },\n    async (span) => {\n      \u002F\u002F Simulate a slow database query\n      await new Promise((resolve) => setTimeout(resolve, 150));\n\n      \u002F\u002F Nested span for a sub-operation\n      await Sentry.startSpan(\n        { name: 'dev.verification.serialize', op: 'serialize' },\n        async () => {\n          await new Promise((resolve) => setTimeout(resolve, 50));\n        }\n      );\n    }\n  );\n\n  \u002F\u002F 4. Test breadcrumb trail\n  console.log('4. Testing breadcrumbs...');\n  Sentry.addBreadcrumb({\n    category: 'dev',\n    message: 'Verification script started',\n    level: 'info',\n  });\n  Sentry.addBreadcrumb({\n    category: 'dev',\n    message: 'All checks passed',\n    level: 'info',\n  });\n  Sentry.captureMessage('Dev verification complete with breadcrumbs', 'info');\n\n  \u002F\u002F 5. Flush — critical for scripts that exit immediately\n  console.log('5. Flushing events...');\n  const flushed = await Sentry.flush(5000);\n  console.log(flushed\n    ? '\\nAll events sent — check Sentry dashboard or Spotlight UI'\n    : '\\nFlush timed out — check DSN and network'\n  );\n}\n\nverify();\n```\n\nUse `Sentry.startSpan()` in your application code to profile specific operations during development:\n\n```typescript\n\u002F\u002F Profile a real endpoint handler locally\napp.get('\u002Fapi\u002Fsearch', async (req, res) => {\n  const results = await Sentry.startSpan(\n    { name: 'search.execute', op: 'db.query', attributes: { 'search.query': req.query.q } },\n    async () => {\n      return await db.search(req.query.q);\n    }\n  );\n\n  const formatted = await Sentry.startSpan(\n    { name: 'search.format', op: 'serialize' },\n    async () => {\n      return results.map(formatResult);\n    }\n  );\n\n  res.json(formatted);\n});\n```\n\n### Step 3 -- Sentry Spotlight and Offline Development\n\nSentry Spotlight runs a local sidecar that intercepts Sentry events and displays them in a browser UI at `http:\u002F\u002Flocalhost:8969` (Spotlight's default port) — no network required:\n\n```bash\n# Install and run Spotlight sidecar (runs alongside your dev server)\nnpx @spotlightjs\u002Fspotlight\n```\n\nThe `spotlight: true` option in Step 1's `Sentry.init()` routes events to the local sidecar. This gives you a full Sentry-style event viewer without sending anything to `sentry.io`.\n\nFor fully offline development or CI environments with no Sentry access:\n\n```typescript\n\u002F\u002F Offline mode — SDK loads but sends nothing\nSentry.init({\n  dsn: '',        \u002F\u002F Empty DSN = all capture calls become no-ops\n  debug: false,   \u002F\u002F No debug output since nothing is sent\n});\n\n\u002F\u002F All Sentry.captureException() and captureMessage() calls still work\n\u002F\u002F without throwing — your code runs without modification\n```\n\nTest source maps locally before deploying with `sentry-cli`:\n\n```bash\n# Install sentry-cli\nnpm install -g @sentry\u002Fcli\n\n# Verify authentication\nsentry-cli info\n\n# Upload source maps for a test release\nsentry-cli sourcemaps upload \\\n  --org your-org \\\n  --project your-dev-project \\\n  --release dev-local \\\n  .\u002Fdist\n\n# Verify source maps are correctly linked\nsentry-cli sourcemaps explain \\\n  --org your-org \\\n  --project your-dev-project \\\n  --release dev-local\n```\n\nAdd a git pre-push hook to prevent hardcoded DSNs from leaking into the repo:\n\n```bash\n#!\u002Fbin\u002Fbash\nset -e\n# .git\u002Fhooks\u002Fpre-push — block commits with hardcoded DSNs\nif grep -rn \"ingest\\.sentry\\.io\" --include=\"*.ts\" --include=\"*.js\" \\\n   --exclude-dir=node_modules --exclude-dir=dist src\u002F lib\u002F; then\n  echo \"ERROR: Hardcoded Sentry DSN found in source. Use environment variables.\"\n  exit 1\nfi\n```\n\n## Output\n\n- Environment-aware `Sentry.init()` routing dev events to a separate Sentry project\n- Debug logging printing captured events and transaction durations to the console\n- Verification script confirming captureMessage, captureException, and startSpan work\n- Sentry Spotlight integration for browsing events locally without network\n- Source map upload and verification workflow with `sentry-cli`\n- Pre-push hook preventing hardcoded DSNs from entering version control\n\n## Error Handling\n\n| Error | Cause | Solution |\n|-------|-------|----------|\n| Events going to prod project | Wrong DSN loaded for environment | Verify `SENTRY_DSN_DEV` is set; log `process.env.NODE_ENV` at startup |\n| Debug output too verbose | `debug: true` left on in production | Gate with `debug: isDev` as shown in Step 1 |\n| Events not appearing in Spotlight | Sidecar not running | Run `npx @spotlightjs\u002Fspotlight` in a separate terminal |\n| `Sentry.flush()` times out | No network or invalid DSN | Check DSN, test with `curl https:\u002F\u002Fsentry.io\u002Fapi\u002F0\u002F` |\n| Rate-limited during dev | 100% sample rate hitting project quota | Use a dedicated dev project with separate quota |\n| Source maps not resolving | Release mismatch between upload and init | Ensure `--release` in `sentry-cli` matches `release` in `Sentry.init()` |\n| `getClient()` returns undefined | SDK not initialized before check | Import `instrument.mjs` via `--import` flag before any app code |\n| `beforeSend` dropping events | Returns `undefined` instead of event | Always return `event` to keep it, or `null` to explicitly drop |\n\n## Examples\n\n### TypeScript — Conditional Init Helper\n\n```typescript\n\u002F\u002F lib\u002Fsentry.ts — reusable initialization for any Node.js app\nimport * as Sentry from '@sentry\u002Fnode';\n\nexport function initSentry() {\n  const env = process.env.NODE_ENV || 'development';\n  const isDev = env !== 'production';\n\n  \u002F\u002F Option A: Skip Sentry entirely if no dev DSN is configured\n  if (isDev && !process.env.SENTRY_DSN_DEV) {\n    console.log('[Sentry] Skipped — no SENTRY_DSN_DEV configured');\n    return;\n  }\n\n  Sentry.init({\n    dsn: isDev ? process.env.SENTRY_DSN_DEV : process.env.SENTRY_DSN,\n    environment: env,\n    debug: isDev,\n    tracesSampleRate: isDev ? 1.0 : 0.1,\n    spotlight: isDev,\n    sendDefaultPii: isDev,\n\n    beforeSend(event) {\n      if (isDev) {\n        const exc = event.exception?.values?.[0];\n        console.log(`[Sentry] ${exc?.type || 'Event'}: ${exc?.value || event.message}`);\n      }\n      return event;\n    },\n  });\n\n  console.log(`[Sentry] Initialized for ${env}`);\n}\n```\n\n### Python — Environment-Aware Setup\n\n```python\n# sentry_config.py — environment-aware initialization\nimport os\nimport sentry_sdk\n\ndef init_sentry():\n    env = os.getenv(\"SENTRY_ENVIRONMENT\", \"development\")\n    is_dev = env != \"production\"\n\n    dsn = (\n        os.getenv(\"SENTRY_DSN_DEV\")\n        if is_dev\n        else os.getenv(\"SENTRY_DSN\")\n    )\n\n    if is_dev and not dsn:\n        print(\"[Sentry] Skipped — no SENTRY_DSN_DEV configured\")\n        return\n\n    sentry_sdk.init(\n        dsn=dsn,\n        environment=env,\n        release=\"dev-local\" if is_dev else os.getenv(\"SENTRY_RELEASE\"),\n\n        # Full capture in dev\n        traces_sample_rate=1.0 if is_dev else 0.1,\n        sample_rate=1.0,\n\n        # Verbose SDK logging in dev\n        debug=is_dev,\n\n        # Sentry Spotlight for local event viewing\n        spotlight=True if is_dev else False,\n\n        # Inspect events before they are sent\n        before_send=_before_send_dev if is_dev else None,\n    )\n\n    print(f\"[Sentry] Initialized for {env}\")\n\n\ndef _before_send_dev(event, hint):\n    \"\"\"Log events to console during local development.\"\"\"\n    exc_info = hint.get(\"exc_info\")\n    if exc_info:\n        exc_type, exc_value, _ = exc_info\n        print(f\"[Sentry Dev] {exc_type.__name__}: {exc_value}\")\n    elif event.get(\"message\"):\n        print(f\"[Sentry Dev] Message: {event['message']}\")\n    return event\n```\n\n```python\n# verify_sentry.py — verification script\nimport os\nimport sentry_sdk\n\nsentry_sdk.init(\n    dsn=os.getenv(\"SENTRY_DSN_DEV\"),\n    debug=True,\n    environment=\"verification\",\n    spotlight=True,\n)\n\n# Test captureMessage\nsentry_sdk.capture_message(\"Dev verification — Python\", \"info\")\n\n# Test captureException\ntry:\n    raise ValueError(\"Dev verification error — Python\")\nexcept Exception as e:\n    event_id = sentry_sdk.capture_exception(e)\n    print(f\"Event ID: {event_id}\")\n\n# Test performance span\nwith sentry_sdk.start_span(op=\"test\", description=\"verification span\"):\n    import time\n    time.sleep(0.1)\n\nsentry_sdk.flush()\nprint(\"Verification complete — check Sentry dashboard or Spotlight\")\n```\n\n## Resources\n\n- [Configuration Options](https:\u002F\u002Fdocs.sentry.io\u002Fplatforms\u002Fjavascript\u002Fconfiguration\u002Foptions\u002F) -- all `Sentry.init()` options reference\n- [Environments](https:\u002F\u002Fdocs.sentry.io\u002Fplatforms\u002Fjavascript\u002Fconfiguration\u002Fenvironments\u002F) -- environment tagging\n- [Debug Mode](https:\u002F\u002Fdocs.sentry.io\u002Fplatforms\u002Fjavascript\u002Fconfiguration\u002Foptions\u002F#debug) -- verbose SDK logging\n- [Sentry Spotlight](https:\u002F\u002Fspotlightjs.com\u002F) -- local event viewer\n- [Source Maps with sentry-cli](https:\u002F\u002Fdocs.sentry.io\u002Fplatforms\u002Fjavascript\u002Fsourcemaps\u002Fuploading\u002Fcli\u002F) -- upload and verify source maps\n- [Performance Instrumentation](https:\u002F\u002Fdocs.sentry.io\u002Fplatforms\u002Fjavascript\u002Ftracing\u002Finstrumentation\u002Fcustom-instrumentation\u002F) -- `startSpan()` API\n- [Python SDK Configuration](https:\u002F\u002Fdocs.sentry.io\u002Fplatforms\u002Fpython\u002Fconfiguration\u002Foptions\u002F) -- Python `sentry_sdk.init()` options\n\n## Next Steps\n\n- **sentry-multi-env-setup** -- Extend to staging, canary, and multi-region environment routing\n- **sentry-performance-tracing** -- Production-grade tracing with custom spans and distributed traces\n- **sentry-debug-bundle** -- Advanced debugging with session replay and profiling\n- **sentry-ci-integration** -- Automate source map uploads and release creation in CI\u002FCD\n","# Sentry Local Dev Loop\n\n## Overview\n\nConfigure Sentry for local development with environment-aware DSN routing, debug-mode verbosity, full-capture sample rates, `beforeSend` inspection, Sentry Spotlight for offline event viewing, and `sentry-cli` source map verification. All configuration uses environment variables so nothing leaks into commits.\n\n## Prerequisites\n\n- `@sentry\u002Fnode` v8+ installed (TypeScript\u002FNode) or `sentry-sdk` v2+ installed (Python)\n- Separate Sentry project created for development (different DSN from production)\n- `.env` file with `SENTRY_DSN_DEV` and `NODE_ENV=development`\n- Network access to `*.ingest.sentry.io` (or use Spotlight for fully offline work)\n\n## Instructions\n\n### Step 1 -- Environment-Aware Configuration\n\nCreate an initialization file that routes events to the correct Sentry project based on environment, enables debug logging in dev, and captures 100% of traces locally:\n\n```typescript\n\u002F\u002F instrument.mjs — import via: node --import .\u002Finstrument.mjs app.mjs\nimport * as Sentry from '@sentry\u002Fnode';\n\nconst env = process.env.NODE_ENV || 'development';\nconst isDev = env !== 'production';\n\nSentry.init({\n  \u002F\u002F Route to dev project locally, prod project in production\n  dsn: isDev\n    ? process.env.SENTRY_DSN_DEV\n    : process.env.SENTRY_DSN,\n\n  environment: env,\n  release: isDev ? 'dev-local' : process.env.SENTRY_RELEASE,\n\n  \u002F\u002F Full capture in dev — you need every event for debugging\n  tracesSampleRate: isDev ? 1.0 : 0.1,\n  sampleRate: isDev ? 1.0 : 1.0,\n\n  \u002F\u002F Verbose SDK output to console in dev\n  debug: isDev,\n\n  \u002F\u002F Include PII locally for easier debugging (never in prod)\n  sendDefaultPii: isDev,\n\n  \u002F\u002F Sentry Spotlight — shows events in local browser UI\n  \u002F\u002F Install: npx @spotlightjs\u002Fspotlight\n  spotlight: isDev,\n\n  beforeSend(event, hint) {\n    if (isDev) {\n      const exc = event.exception?.values?.[0];\n      const label = exc\n        ? `${exc.type}: ${exc.value}`\n        : event.message || 'event';\n      console.log(`[Sentry Dev] ${label}`);\n      console.log(`  Tags: ${JSON.stringify(event.tags || {})}`);\n    }\n    return event;\n  },\n\n  beforeSendTransaction(event) {\n    if (isDev) {\n      const duration = event.timestamp && event.start_timestamp\n        ? ((event.timestamp - event.start_timestamp) * 1000).toFixed(0)\n        : '?';\n      console.log(`[Sentry Dev] Transaction: ${event.transaction} (${duration}ms)`);\n    }\n    return event;\n  },\n});\n```\n\nSet up environment files to keep DSNs out of source:\n\n```bash\n# .env.development\nSENTRY_DSN_DEV=https:\u002F\u002FexamplePublicKey@o0.ingest.sentry.io\u002F0\nSENTRY_ENVIRONMENT=development\nNODE_ENV=development\n\n# .env.production\nSENTRY_DSN=https:\u002F\u002FprodPublicKey@o0.ingest.sentry.io\u002F0\nSENTRY_ENVIRONMENT=production\nSENTRY_RELEASE=v1.2.3\nNODE_ENV=production\n```\n\nAdd DSN safety to `.gitignore`:\n\n```gitignore\n.env\n.env.development\n.env.production\n.env.local\n```\n\n### Step 2 -- Local Verification and Performance Debugging\n\nCreate a verification script that confirms the SDK works end-to-end and demonstrates `Sentry.startSpan()` for local performance profiling:\n\n```typescript\n\u002F\u002F scripts\u002Fverify-sentry.mjs — run: node --import .\u002Finstrument.mjs scripts\u002Fverify-sentry.mjs\nimport * as Sentry from '@sentry\u002Fnode';\n\nasync function verify() {\n  const client = Sentry.getClient();\n  if (!client) {\n    console.error('Sentry SDK not initialized — run with --import .\u002Finstrument.mjs');\n    process.exit(1);\n  }\n  console.log('--- Sentry Dev Loop Verification ---\\n');\n\n  \u002F\u002F 1. Test captureMessage\n  console.log('1. Sending test message...');\n  Sentry.captureMessage('Dev loop verification — captureMessage', 'info');\n\n  \u002F\u002F 2. Test captureException\n  console.log('2. Sending test exception...');\n  try {\n    throw new Error('Dev loop verification — captureException');\n  } catch (e) {\n    const eventId = Sentry.captureException(e);\n    console.log(`   Event ID: ${eventId}`);\n  }\n\n  \u002F\u002F 3. Test Sentry.startSpan for local performance profiling\n  console.log('3. Testing startSpan for performance...');\n  await Sentry.startSpan(\n    { name: 'dev.verification.database', op: 'db.query' },\n    async (span) => {\n      \u002F\u002F Simulate a slow database query\n      await new Promise((resolve) => setTimeout(resolve, 150));\n\n      \u002F\u002F Nested span for a sub-operation\n      await Sentry.startSpan(\n        { name: 'dev.verification.serialize', op: 'serialize' },\n        async () => {\n          await new Promise((resolve) => setTimeout(resolve, 50));\n        }\n      );\n    }\n  );\n\n  \u002F\u002F 4. Test breadcrumb trail\n  console.log('4. Testing breadcrumbs...');\n  Sentry.addBreadcrumb({\n    category: 'dev',\n    message: 'Verification script started',\n    level: 'info',\n  });\n  Sentry.addBreadcrumb({\n    category: 'dev',\n    message: 'All checks passed',\n    level: 'info',\n  });\n  Sentry.captureMessage('Dev verification complete with breadcrumbs', 'info');\n\n  \u002F\u002F 5. Flush — critical for scripts that exit immediately\n  console.log('5. Flushing events...');\n  const flushed = await Sentry.flush(5000);\n  console.log(flushed\n    ? '\\nAll events sent — check Sentry dashboard or Spotlight UI'\n    : '\\nFlush timed out — check DSN and network'\n  );\n}\n\nverify();\n```\n\nUse `Sentry.startSpan()` in your application code to profile specific operations during development:\n\n```typescript\n\u002F\u002F Profile a real endpoint handler locally\napp.get('\u002Fapi\u002Fsearch', async (req, res) => {\n  const results = await Sentry.startSpan(\n    { name: 'search.execute', op: 'db.query', attributes: { 'search.query': req.query.q } },\n    async () => {\n      return await db.search(req.query.q);\n    }\n  );\n\n  const formatted = await Sentry.startSpan(\n    { name: 'search.format', op: 'serialize' },\n    async () => {\n      return results.map(formatResult);\n    }\n  );\n\n  res.json(formatted);\n});\n```\n\n### Step 3 -- Sentry Spotlight and Offline Development\n\nSentry Spotlight runs a local sidecar that intercepts Sentry events and displays them in a browser UI at `http:\u002F\u002Flocalhost:8969` (Spotlight's default port) — no network required:\n\n```bash\n# Install and run Spotlight sidecar (runs alongside your dev server)\nnpx @spotlightjs\u002Fspotlight\n```\n\nThe `spotlight: true` option in Step 1's `Sentry.init()` routes events to the local sidecar. This gives you a full Sentry-style event viewer without sending anything to `sentry.io`.\n\nFor fully offline development or CI environments with no Sentry access:\n\n```typescript\n\u002F\u002F Offline mode — SDK loads but sends nothing\nSentry.init({\n  dsn: '',        \u002F\u002F Empty DSN = all capture calls become no-ops\n  debug: false,   \u002F\u002F No debug output since nothing is sent\n});\n\n\u002F\u002F All Sentry.captureException() and captureMessage() calls still work\n\u002F\u002F without throwing — your code runs without modification\n```\n\nTest source maps locally before deploying with `sentry-cli`:\n\n```bash\n# Install sentry-cli\nnpm install -g @sentry\u002Fcli\n\n# Verify authentication\nsentry-cli info\n\n# Upload source maps for a test release\nsentry-cli sourcemaps upload \\\n  --org your-org \\\n  --project your-dev-project \\\n  --release dev-local \\\n  .\u002Fdist\n\n# Verify source maps are correctly linked\nsentry-cli sourcemaps explain \\\n  --org your-org \\\n  --project your-dev-project \\\n  --release dev-local\n```\n\nAdd a git pre-push hook to prevent hardcoded DSNs from leaking into the repo:\n\n```bash\n#!\u002Fbin\u002Fbash\nset -e\n# .git\u002Fhooks\u002Fpre-push — block commits with hardcoded DSNs\nif grep -rn \"ingest\\.sentry\\.io\" --include=\"*.ts\" --include=\"*.js\" \\\n   --exclude-dir=node_modules --exclude-dir=dist src\u002F lib\u002F; then\n  echo \"ERROR: Hardcoded Sentry DSN found in source. Use environment variables.\"\n  exit 1\nfi\n```\n\n## Output\n\n- Environment-aware `Sentry.init()` routing dev events to a separate Sentry project\n- Debug logging printing captured events and transaction durations to the console\n- Verification script confirming captureMessage, captureException, and startSpan work\n- Sentry Spotlight integration for browsing events locally without network\n- Source map upload and verification workflow with `sentry-cli`\n- Pre-push hook preventing hardcoded DSNs from entering version control\n\n## Error Handling\n\n| Error | Cause | Solution |\n|-------|-------|----------|\n| Events going to prod project | Wrong DSN loaded for environment | Verify `SENTRY_DSN_DEV` is set; log `process.env.NODE_ENV` at startup |\n| Debug output too verbose | `debug: true` left on in production | Gate with `debug: isDev` as shown in Step 1 |\n| Events not appearing in Spotlight | Sidecar not running | Run `npx @spotlightjs\u002Fspotlight` in a separate terminal |\n| `Sentry.flush()` times out | No network or invalid DSN | Check DSN, test with `curl https:\u002F\u002Fsentry.io\u002Fapi\u002F0\u002F` |\n| Rate-limited during dev | 100% sample rate hitting project quota | Use a dedicated dev project with separate quota |\n| Source maps not resolving | Release mismatch between upload and init | Ensure `--release` in `sentry-cli` matches `release` in `Sentry.init()` |\n| `getClient()` returns undefined | SDK not initialized before check | Import `instrument.mjs` via `--import` flag before any app code |\n| `beforeSend` dropping events | Returns `undefined` instead of event | Always return `event` to keep it, or `null` to explicitly drop |\n\n## Examples\n\n### TypeScript — Conditional Init Helper\n\n```typescript\n\u002F\u002F lib\u002Fsentry.ts — reusable initialization for any Node.js app\nimport * as Sentry from '@sentry\u002Fnode';\n\nexport function initSentry() {\n  const env = process.env.NODE_ENV || 'development';\n  const isDev = env !== 'production';\n\n  \u002F\u002F Option A: Skip Sentry entirely if no dev DSN is configured\n  if (isDev && !process.env.SENTRY_DSN_DEV) {\n    console.log('[Sentry] Skipped — no SENTRY_DSN_DEV configured');\n    return;\n  }\n\n  Sentry.init({\n    dsn: isDev ? process.env.SENTRY_DSN_DEV : process.env.SENTRY_DSN,\n    environment: env,\n    debug: isDev,\n    tracesSampleRate: isDev ? 1.0 : 0.1,\n    spotlight: isDev,\n    sendDefaultPii: isDev,\n\n    beforeSend(event) {\n      if (isDev) {\n        const exc = event.exception?.values?.[0];\n        console.log(`[Sentry] ${exc?.type || 'Event'}: ${exc?.value || event.message}`);\n      }\n      return event;\n    },\n  });\n\n  console.log(`[Sentry] Initialized for ${env}`);\n}\n```\n\n### Python — Environment-Aware Setup\n\n```python\n# sentry_config.py — environment-aware initialization\nimport os\nimport sentry_sdk\n\ndef init_sentry():\n    env = os.getenv(\"SENTRY_ENVIRONMENT\", \"development\")\n    is_dev = env != \"production\"\n\n    dsn = (\n        os.getenv(\"SENTRY_DSN_DEV\")\n        if is_dev\n        else os.getenv(\"SENTRY_DSN\")\n    )\n\n    if is_dev and not dsn:\n        print(\"[Sentry] Skipped — no SENTRY_DSN_DEV configured\")\n        return\n\n    sentry_sdk.init(\n        dsn=dsn,\n        environment=env,\n        release=\"dev-local\" if is_dev else os.getenv(\"SENTRY_RELEASE\"),\n\n        # Full capture in dev\n        traces_sample_rate=1.0 if is_dev else 0.1,\n        sample_rate=1.0,\n\n        # Verbose SDK logging in dev\n        debug=is_dev,\n\n        # Sentry Spotlight for local event viewing\n        spotlight=True if is_dev else False,\n\n        # Inspect events before they are sent\n        before_send=_before_send_dev if is_dev else None,\n    )\n\n    print(f\"[Sentry] Initialized for {env}\")\n\n\ndef _before_send_dev(event, hint):\n    \"\"\"Log events to console during local development.\"\"\"\n    exc_info = hint.get(\"exc_info\")\n    if exc_info:\n        exc_type, exc_value, _ = exc_info\n        print(f\"[Sentry Dev] {exc_type.__name__}: {exc_value}\")\n    elif event.get(\"message\"):\n        print(f\"[Sentry Dev] Message: {event['message']}\")\n    return event\n```\n\n```python\n# verify_sentry.py — verification script\nimport os\nimport sentry_sdk\n\nsentry_sdk.init(\n    dsn=os.getenv(\"SENTRY_DSN_DEV\"),\n    debug=True,\n    environment=\"verification\",\n    spotlight=True,\n)\n\n# Test captureMessage\nsentry_sdk.capture_message(\"Dev verification — Python\", \"info\")\n\n# Test captureException\ntry:\n    raise ValueError(\"Dev verification error — Python\")\nexcept Exception as e:\n    event_id = sentry_sdk.capture_exception(e)\n    print(f\"Event ID: {event_id}\")\n\n# Test performance span\nwith sentry_sdk.start_span(op=\"test\", description=\"verification span\"):\n    import time\n    time.sleep(0.1)\n\nsentry_sdk.flush()\nprint(\"Verification complete — check Sentry dashboard or Spotlight\")\n```\n\n## Resources\n\n- [Configuration Options](https:\u002F\u002Fdocs.sentry.io\u002Fplatforms\u002Fjavascript\u002Fconfiguration\u002Foptions\u002F) -- all `Sentry.init()` options reference\n- [Environments](https:\u002F\u002Fdocs.sentry.io\u002Fplatforms\u002Fjavascript\u002Fconfiguration\u002Fenvironments\u002F) -- environment tagging\n- [Debug Mode](https:\u002F\u002Fdocs.sentry.io\u002Fplatforms\u002Fjavascript\u002Fconfiguration\u002Foptions\u002F#debug) -- verbose SDK logging\n- [Sentry Spotlight](https:\u002F\u002Fspotlightjs.com\u002F) -- local event viewer\n- [Source Maps with sentry-cli](https:\u002F\u002Fdocs.sentry.io\u002Fplatforms\u002Fjavascript\u002Fsourcemaps\u002Fuploading\u002Fcli\u002F) -- upload and verify source maps\n- [Performance Instrumentation](https:\u002F\u002Fdocs.sentry.io\u002Fplatforms\u002Fjavascript\u002Ftracing\u002Finstrumentation\u002Fcustom-instrumentation\u002F) -- `startSpan()` API\n- [Python SDK Configuration](https:\u002F\u002Fdocs.sentry.io\u002Fplatforms\u002Fpython\u002Fconfiguration\u002Foptions\u002F) -- Python `sentry_sdk.init()` options\n\n## Next Steps\n\n- **sentry-multi-env-setup** -- Extend to staging, canary, and multi-region environment routing\n- **sentry-performance-tracing** -- Production-grade tracing with custom spans and distributed traces\n- **sentry-debug-bundle** -- Advanced debugging with session replay and profiling\n- **sentry-ci-integration** -- Automate source map uploads and release creation in CI\u002FCD\n",{"name":5,"tags":24,"author":32,"license":15,"version":33,"description":34,"allowed-tools":35,"compatible-with":36},[25,26,27,28,29,30,31],"saas","sentry","development","debugging","workflow","devtools","environment","Jeremy Longshore \u003Cjeremy@intentsolutions.io>","1.0.0","Configure Sentry for local development with environment-aware settings.\nUse when setting up dev vs prod DSN routing, enabling debug mode,\ntuning sample rates for local work, or testing source maps locally.\nTrigger with phrases like \"sentry local dev\", \"sentry development config\",\n\"debug sentry locally\", \"sentry dev environment\", \"sentry spotlight\".\n","Read, Write, Edit, Bash(npm:*), Bash(node:*), Bash(npx:*), Bash(python:*), Grep, Glob","claude-code, codex, openclaw","main","99825ad3f3bcc6597ddcc7294a14e6e922f2b67b","skills\u002Fsaas-packs--sentry-pack--sentry-local-dev-loop",0,"https:\u002F\u002Fgithub.com\u002Fjukeyman\u002Fjukeyman-skills","https:\u002F\u002Fgithub.com\u002Fjukeyman","https:\u002F\u002FRJBUSINESSSOLUTIONS.ORG","Credit and Finance Expert | Developer\r\n\r\nI'm Rick Jefferson, a seasoned credit and finance expert with over a decade of experience in financial literacy,","2026-07-13 07:03:29",{"source":8,"skillName":5,"commands":47,"prompt":57,"zipAvailable":58},[48,51,54],{"tool":49,"command":50},"npx","npx skills add jukeyman\u002Fjukeyman-skills --skill sentry-local-dev-loop",{"tool":52,"command":53},"bunx","bunx skills add jukeyman\u002Fjukeyman-skills --skill sentry-local-dev-loop",{"tool":55,"command":56},"pnpm","pnpm dlx skills add jukeyman\u002Fjukeyman-skills --skill sentry-local-dev-loop","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002Fjukeyman\u002Fjukeyman-skills\u002Fblob\u002Fmain\u002Fskills\u002Fsaas-packs--sentry-pack--sentry-local-dev-loop\u002FSKILL.md",true,[],[61,68,75,82,89,97],{"skillNo":62,"name":63,"nameZh":6,"description":64,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":65,"categories":66,"keywords":67,"publishedAt":19},"01M79ANS2SM329NEP5ZCX106RR","zustand-store-creator","Create zustand store creator operations. Auto-activating skill for Frontend Development.\nTriggers on: zustand store creator, zustand store creator\nPart of the Frontend Development skill category. Use when working with zustand store creator functionality. Trigger with phrases like \"zustand store creator\", \"zustand creator\", \"zustand\".","https:\u002F\u002Fgithub.com\u002Fjukeyman\u002Fjukeyman-skills\u002Fblob\u002Fmain\u002Fskills\u002Fzustand-store-creator\u002FSKILL.md",[],[],{"skillNo":69,"name":70,"nameZh":6,"description":71,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":72,"categories":73,"keywords":74,"publishedAt":19},"01M79AMZKP4YDEZ7EHG1Y7PP74","zero-trust-config-helper","Configure with zero trust config helper operations. Auto-activating skill for Security Advanced.\nTriggers on: zero trust config helper, zero trust config helper\nPart of the Security Advanced skill category. Use when configuring systems or services. Trigger with phrases like \"zero trust config helper\", \"zero helper\", \"zero\".","https:\u002F\u002Fgithub.com\u002Fjukeyman\u002Fjukeyman-skills\u002Fblob\u002Fmain\u002Fskills\u002Fzero-trust-config-helper\u002FSKILL.md",[],[],{"skillNo":76,"name":77,"nameZh":6,"description":78,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":79,"categories":80,"keywords":81,"publishedAt":19},"01M79AMJSBCEJQNBTYNAHYN5HM","zapier-integration-helper","Assist with zapier integration helper operations. Auto-activating skill for Business Automation.\nTriggers on: zapier integration helper, zapier integration helper\nPart of the Business Automation skill category. Use when working with APIs or building integrations. Trigger with phrases like \"zapier integration helper\", \"zapier helper\", \"zapier\".","https:\u002F\u002Fgithub.com\u002Fjukeyman\u002Fjukeyman-skills\u002Fblob\u002Fmain\u002Fskills\u002Fzapier-integration-helper\u002FSKILL.md",[],[],{"skillNo":83,"name":84,"nameZh":6,"description":85,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":86,"categories":87,"keywords":88,"publishedAt":19},"01M79AHJZGVMARS13VFQYRR1MP","yaml-config-validator","Validate yaml config validator operations. Auto-activating skill for DevOps Basics.\nTriggers on: yaml config validator, yaml config validator\nPart of the DevOps Basics skill category. Use when configuring systems or services. Trigger with phrases like \"yaml config validator\", \"yaml validator\", \"yaml\".","https:\u002F\u002Fgithub.com\u002Fjukeyman\u002Fjukeyman-skills\u002Fblob\u002Fmain\u002Fskills\u002Fyaml-config-validator\u002FSKILL.md",[],[],{"skillNo":90,"name":91,"nameZh":6,"description":92,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":93,"sourceHtmlUrl":94,"categories":95,"keywords":96,"publishedAt":19},"01M79AHGDZRN0020RDQSQDPAM8","xvary-stock-research","Thesis-driven equity analysis from public SEC EDGAR and market data; \u002Fanalyze, \u002Fscore, \u002Fcompare workflows with bundled Python tools (Claude Code, Cursor, Codex).","https:\u002F\u002Fgithub.com\u002Fjukeyman\u002Fjukeyman-skills\u002Fblob\u002Fmain\u002Fskills\u002Fxvary-stock-research\u002FLICENSE","https:\u002F\u002Fgithub.com\u002Fjukeyman\u002Fjukeyman-skills\u002Fblob\u002Fmain\u002Fskills\u002Fxvary-stock-research\u002FSKILL.md",[],[],{"skillNo":98,"name":99,"nameZh":6,"description":100,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":101,"categories":102,"keywords":103,"publishedAt":19},"01M79AHCYJ9FV9RMHQ24HDRN33","xss-vulnerability-scanner","Scan xss vulnerability scanner operations. Auto-activating skill for Security Fundamentals.\nTriggers on: xss vulnerability scanner, xss vulnerability scanner\nPart of the Security Fundamentals skill category. Use when working with xss vulnerability scanner functionality. Trigger with phrases like \"xss vulnerability scanner\", \"xss scanner\", \"xss\".","https:\u002F\u002Fgithub.com\u002Fjukeyman\u002Fjukeyman-skills\u002Fblob\u002Fmain\u002Fskills\u002Fxss-vulnerability-scanner\u002FSKILL.md",[],[]]