From 3b4f20114be4caeb9f455c24ff5d11ffd55f7db8 Mon Sep 17 00:00:00 2001 From: Cody De Arkland Date: Tue, 13 Jan 2026 23:15:36 -0800 Subject: [PATCH] feat: Add setup skills for React, Python, Ruby, and React Native --- README.md | 8 + skills/sentry-python-wizard/SKILL.md | 166 +++++++++++++++++++++ skills/sentry-react-native-wizard/SKILL.md | 138 +++++++++++++++++ skills/sentry-react-wizard/SKILL.md | 143 ++++++++++++++++++ skills/sentry-ruby-wizard/SKILL.md | 134 +++++++++++++++++ 5 files changed, 589 insertions(+) create mode 100644 skills/sentry-python-wizard/SKILL.md create mode 100644 skills/sentry-react-native-wizard/SKILL.md create mode 100644 skills/sentry-react-wizard/SKILL.md create mode 100644 skills/sentry-ruby-wizard/SKILL.md diff --git a/README.md b/README.md index 61c5b6d..e58b2e3 100644 --- a/README.md +++ b/README.md @@ -9,6 +9,10 @@ Official agent skills for integrating Sentry into your projects. These skills pr | Skill | Description | Platforms | Docs | |-------|-------------|-----------|------| | `sentry-nextjs-wizard` | Setup Sentry in Next.js using the wizard CLI | Next.js | [Next.js Guide](https://docs.sentry.io/platforms/javascript/guides/nextjs/) | +| `sentry-react-wizard` | Setup Sentry in React apps | React | [React Guide](https://docs.sentry.io/platforms/javascript/guides/react/) | +| `sentry-react-native-wizard` | Setup Sentry in React Native using the wizard CLI | React Native, Expo | [React Native Guide](https://docs.sentry.io/platforms/react-native/) | +| `sentry-python-wizard` | Setup Sentry in Python apps (Django, Flask, FastAPI) | Python | [Python Guide](https://docs.sentry.io/platforms/python/) | +| `sentry-ruby-wizard` | Setup Sentry in Ruby apps (Rails) | Ruby | [Ruby Guide](https://docs.sentry.io/platforms/ruby/) | | `sentry-setup-tracing` | Setup tracing, transactions, spans, and performance monitoring | JS, Python, Ruby | [Tracing](https://docs.sentry.io/platforms/javascript/tracing/) | | `sentry-setup-logging` | Setup structured logging and integrate Pino/Winston/Loguru | JS, Python, Ruby | [Logs](https://docs.sentry.io/platforms/javascript/logs/) | | `sentry-setup-metrics` | Setup custom metrics (counters, gauges, distributions) | JS, Python | [Metrics](https://docs.sentry.io/platforms/javascript/metrics/) | @@ -257,6 +261,10 @@ Once installed, your AI assistant will automatically discover the skills. Simply | What to Say | Skill Used | |-------------|------------| | "Set up Sentry in my Next.js app" | `sentry-nextjs-wizard` | +| "Add Sentry to my React app" | `sentry-react-wizard` | +| "Set up Sentry in React Native" | `sentry-react-native-wizard` | +| "Add Sentry to my Python/Django/Flask app" | `sentry-python-wizard` | +| "Set up Sentry in my Ruby/Rails app" | `sentry-ruby-wizard` | | "Add performance monitoring to my app" | `sentry-setup-tracing` | | "Enable Sentry logging" | `sentry-setup-logging` | | "Track custom metrics with Sentry" | `sentry-setup-metrics` | diff --git a/skills/sentry-python-wizard/SKILL.md b/skills/sentry-python-wizard/SKILL.md new file mode 100644 index 0000000..071b86a --- /dev/null +++ b/skills/sentry-python-wizard/SKILL.md @@ -0,0 +1,166 @@ +--- +name: sentry-python-wizard +description: Setup Sentry in Python apps. Use when asked to add Sentry to Python, install sentry-sdk, or configure error monitoring for Python applications, Django, Flask, FastAPI. +--- + +# Sentry Python Setup + +Install and configure Sentry in Python projects. + +## Invoke This Skill When + +- User asks to "add Sentry to Python" or "install Sentry" in a Python app +- User wants error monitoring, logging, or tracing in Python +- User mentions "sentry-sdk" or Python frameworks (Django, Flask, FastAPI) + +## Install + +```bash +pip install sentry-sdk +``` + +## Configure + +Initialize as early as possible in your application: + +```python +import sentry_sdk + +sentry_sdk.init( + dsn="YOUR_SENTRY_DSN", + send_default_pii=True, + + # Tracing + traces_sample_rate=1.0, + + # Profiling + profile_session_sample_rate=1.0, + profile_lifecycle="trace", + + # Logs + enable_logs=True, +) +``` + +### Async Applications + +For async apps, initialize inside an async function: + +```python +import asyncio +import sentry_sdk + +async def main(): + sentry_sdk.init( + dsn="YOUR_SENTRY_DSN", + send_default_pii=True, + traces_sample_rate=1.0, + enable_logs=True, + ) + # ... rest of app + +asyncio.run(main()) +``` + +## Framework Integrations + +### Django + +```python +# settings.py +import sentry_sdk + +sentry_sdk.init( + dsn="YOUR_SENTRY_DSN", + send_default_pii=True, + traces_sample_rate=1.0, + enable_logs=True, +) +``` + +### Flask + +```python +from flask import Flask +import sentry_sdk + +sentry_sdk.init( + dsn="YOUR_SENTRY_DSN", + send_default_pii=True, + traces_sample_rate=1.0, + enable_logs=True, +) + +app = Flask(__name__) +``` + +### FastAPI + +```python +from fastapi import FastAPI +import sentry_sdk + +sentry_sdk.init( + dsn="YOUR_SENTRY_DSN", + send_default_pii=True, + traces_sample_rate=1.0, + enable_logs=True, +) + +app = FastAPI() +``` + +## Configuration Options + +| Option | Description | Default | +|--------|-------------|---------| +| `dsn` | Sentry DSN | Required | +| `send_default_pii` | Include user data | `False` | +| `traces_sample_rate` | % of transactions traced | `0` | +| `profile_session_sample_rate` | % of sessions profiled | `0` | +| `enable_logs` | Send logs to Sentry | `False` | +| `environment` | Environment name | Auto-detected | +| `release` | Release version | Auto-detected | + +## Environment Variables + +```bash +SENTRY_DSN=https://xxx@o123.ingest.sentry.io/456 +SENTRY_AUTH_TOKEN=sntrys_xxx +SENTRY_ORG=my-org +SENTRY_PROJECT=my-project +``` + +Or use in code: + +```python +import os +import sentry_sdk + +sentry_sdk.init( + dsn=os.environ.get("SENTRY_DSN"), + # ... +) +``` + +## Verification + +```python +# Intentional error to test +division_by_zero = 1 / 0 +``` + +Or capture manually: + +```python +sentry_sdk.capture_message("Test message from Python") +``` + +## Troubleshooting + +| Issue | Solution | +|-------|----------| +| Errors not appearing | Ensure `init()` is called early, check DSN | +| No traces | Set `traces_sample_rate` > 0 | +| IPython errors not captured | Run from file, not interactive shell | +| Async errors missing | Initialize inside async function | diff --git a/skills/sentry-react-native-wizard/SKILL.md b/skills/sentry-react-native-wizard/SKILL.md new file mode 100644 index 0000000..460c0e0 --- /dev/null +++ b/skills/sentry-react-native-wizard/SKILL.md @@ -0,0 +1,138 @@ +--- +name: sentry-react-native-wizard +description: Setup Sentry in React Native using the wizard CLI. Use when asked to add Sentry to React Native, install @sentry/react-native, or configure error monitoring for React Native or Expo apps. +--- + +# Sentry React Native Wizard + +Install and configure Sentry in React Native projects using the official wizard CLI. + +## Invoke This Skill When + +- User asks to "add Sentry to React Native" or "install Sentry" in a React Native app +- User wants error monitoring, logging, or tracing in React Native or Expo +- User mentions "@sentry/react-native" or mobile error tracking + +## Wizard Setup (Recommended) + +```bash +npx @sentry/wizard@latest -i reactNative +``` + +### What the Wizard Does + +| Task | Description | +|------|-------------| +| Install SDK | Adds `@sentry/react-native` package | +| Metro config | Adds `@sentry/react-native/metro` to `metro.config.js` | +| Expo config | Adds `@sentry/react-native/expo` to `app.json` | +| Android setup | Enables Gradle build step for source maps | +| iOS setup | Wraps Xcode build phase, adds debug symbol upload | +| Pod install | Runs `pod install` for iOS | +| Credentials | Stores in `ios/sentry.properties`, `android/sentry.properties`, `.env.local` | +| Init code | Configures Sentry in `App.tsx` or `_layout.tsx` | + +## Manual Configuration + +If not using wizard, add to your app entry point: + +```javascript +import * as Sentry from "@sentry/react-native"; + +Sentry.init({ + dsn: "YOUR_SENTRY_DSN", + sendDefaultPii: true, + + // Tracing + tracesSampleRate: 1.0, + + // Logs + enableLogs: true, + + // Profiling + profilesSampleRate: 1.0, + + // Session Replay + replaysOnErrorSampleRate: 1.0, + replaysSessionSampleRate: 0.1, + integrations: [Sentry.mobileReplayIntegration()], +}); +``` + +### Wrap Your App + +```javascript +export default Sentry.wrap(App); +``` + +## Expo Projects + +For Expo, follow the [Expo-specific setup](https://docs.sentry.io/platforms/react-native/manual-setup/expo/): + +```bash +npx @sentry/wizard@latest -i reactNative +``` + +Works for both managed and bare Expo projects. + +## Configuration Options + +| Option | Description | Default | +|--------|-------------|---------| +| `dsn` | Sentry DSN | Required | +| `sendDefaultPii` | Include user data | `false` | +| `tracesSampleRate` | % of transactions traced | `0` | +| `profilesSampleRate` | % of traces profiled | `0` | +| `enableLogs` | Send logs to Sentry | `false` | +| `replaysOnErrorSampleRate` | % of error sessions replayed | `0` | +| `replaysSessionSampleRate` | % of all sessions replayed | `0` | + +## Files Created/Modified + +| File | Purpose | +|------|---------| +| `App.js` / `_layout.tsx` | Sentry initialization | +| `metro.config.js` | Metro bundler config | +| `app.json` | Expo config (if Expo) | +| `ios/sentry.properties` | iOS build credentials | +| `android/sentry.properties` | Android build credentials | +| `.env.local` | Environment variables | + +## Environment Variables + +```bash +SENTRY_DSN=https://xxx@o123.ingest.sentry.io/456 +SENTRY_AUTH_TOKEN=sntrys_xxx +SENTRY_ORG=my-org +SENTRY_PROJECT=my-project +``` + +## Verification + +Add test error: + +```javascript +throw new Error("My first Sentry error!"); +``` + +Or use a test button: + +```javascript + +``` + +## Troubleshooting + +| Issue | Solution | +|-------|----------| +| Errors not captured | Ensure `instrument.js` is imported first | +| Source maps not working | Run sourcemaps wizard, verify auth token | +| React Router spans missing | Add correct router integration for your version | diff --git a/skills/sentry-ruby-wizard/SKILL.md b/skills/sentry-ruby-wizard/SKILL.md new file mode 100644 index 0000000..d09db2e --- /dev/null +++ b/skills/sentry-ruby-wizard/SKILL.md @@ -0,0 +1,134 @@ +--- +name: sentry-ruby-wizard +description: Setup Sentry in Ruby apps. Use when asked to add Sentry to Ruby, install sentry-ruby gem, or configure error monitoring for Ruby applications or Rails. +--- + +# Sentry Ruby Setup + +Install and configure Sentry in Ruby projects. + +## Invoke This Skill When + +- User asks to "add Sentry to Ruby" or "install Sentry" in a Ruby app +- User wants error monitoring, logging, or tracing in Ruby +- User mentions "sentry-ruby" gem or Ruby on Rails + +## Requirements + +- Ruby 2.4+ or recent JRuby versions + +## Install + +Add to `Gemfile`: + +```ruby +gem "sentry-ruby" + +# For profiling, also add: +gem "stackprof" +``` + +Then run: + +```bash +bundle install +``` + +## Configure + +Initialize as early as possible: + +```ruby +require "sentry-ruby" + +Sentry.init do |config| + config.dsn = "YOUR_SENTRY_DSN" + config.send_default_pii = true + + # Breadcrumbs from logs + config.breadcrumbs_logger = [:sentry_logger, :http_logger] + + # Tracing + config.traces_sample_rate = 1.0 + + # Profiling (requires stackprof gem) + config.profiles_sample_rate = 1.0 + + # Logs + config.enable_logs = true +end +``` + +## Rails Integration + +For Rails, add to `config/initializers/sentry.rb`: + +```ruby +Sentry.init do |config| + config.dsn = ENV["SENTRY_DSN"] + config.send_default_pii = true + config.breadcrumbs_logger = [:active_support_logger, :http_logger] + config.traces_sample_rate = 1.0 + config.profiles_sample_rate = 1.0 + config.enable_logs = true +end +``` + +### Rails-specific Gems + +```ruby +# Gemfile +gem "sentry-ruby" +gem "sentry-rails" # Rails integration +gem "sentry-sidekiq" # If using Sidekiq +gem "sentry-delayed_job" # If using Delayed Job +gem "sentry-resque" # If using Resque +``` + +## Configuration Options + +| Option | Description | Default | +|--------|-------------|---------| +| `dsn` | Sentry DSN | Required | +| `send_default_pii` | Include user data | `false` | +| `traces_sample_rate` | % of transactions traced | `0` | +| `profiles_sample_rate` | % of traces profiled | `0` | +| `enable_logs` | Send logs to Sentry | `false` | +| `environment` | Environment name | Auto-detected | +| `release` | Release version | Auto-detected | + +## Breadcrumb Loggers + +| Logger | Description | +|--------|-------------| +| `:sentry_logger` | Sentry's own logger | +| `:http_logger` | HTTP request breadcrumbs | +| `:active_support_logger` | Rails ActiveSupport (Rails only) | + +## Environment Variables + +```bash +SENTRY_DSN=https://xxx@o123.ingest.sentry.io/456 +SENTRY_AUTH_TOKEN=sntrys_xxx +SENTRY_ORG=my-org +SENTRY_PROJECT=my-project +``` + +## Verification + +```ruby +# Capture test message +Sentry.capture_message("Test message from Ruby") + +# Or trigger intentional error +1 / 0 +``` + +## Troubleshooting + +| Issue | Solution | +|-------|----------| +| Errors not appearing | Ensure `Sentry.init` called early, check DSN | +| No traces | Set `traces_sample_rate` > 0 | +| No profiles | Add `stackprof` gem, set `profiles_sample_rate` | +| Rails errors missing | Use `sentry-rails` gem instead of `sentry-ruby` |