sentry-sdk-patterns

Featured

Best practices for using Sentry SDK in TypeScript and Python. Use when implementing structured error context with scopes, breadcrumb strategies, beforeSend/beforeBreadcrumb filtering, custom fingerprinting, user context, or performance span creation. Trigger: "sentry best practices", "sentry patterns", "sentry sdk usage", "sentry scope", "sentry breadcrumbs", "sentry beforeSend", "sentry fingerprint".

AI & Automation 2,926 stars 433 forks Updated yesterday MIT

Install

View on GitHub

Quality Score: 99/100

Stars 20%
100
Recency 20%
100
Frontmatter 20%
70
Documentation 15%
100
Issue Health 10%
50
License 10%
100
Description 5%
100

Skill Content

# Sentry SDK Patterns ## Overview Production patterns for `@sentry/node` (v8+) and `sentry-sdk` (Python 2.x+) covering scoped error context, breadcrumb strategies, event filtering with `beforeSend`, custom fingerprinting for issue grouping, and performance instrumentation with spans. All examples use real Sentry SDK APIs. ## Prerequisites - Sentry SDK v8+ installed (`@sentry/node`, `@sentry/react`, or `sentry-sdk`) - `SENTRY_DSN` environment variable configured - Familiarity with async/await (TypeScript) or context managers (Python) ## Instructions ### Step 1 -- Structured Error Context with Scopes Use `Sentry.withScope()` (TypeScript) or `sentry_sdk.new_scope()` (Python) to attach context to individual events without leaking state across requests. **TypeScript -- Scoped error capture:** ```typescript import * as Sentry from '@sentry/node'; type ErrorSeverity = 'low' | 'medium' | 'high' | 'critical'; interface ErrorOptions { severity?: ErrorSeverity; tags?: Record<string, string>; context?: Record<string, unknown>; user?: { id: string; email?: string }; fingerprint?: string[]; } const SEVERITY_MAP: Record<ErrorSeverity, Sentry.SeverityLevel> = { low: 'info', medium: 'warning', high: 'error', critical: 'fatal', }; export function captureError(error: Error, options: ErrorOptions = {}) { Sentry.withScope((scope) => { scope.setLevel(SEVERITY_MAP[options.severity || 'medium']); if (options.tags) { Object.entries(options.tags).forEach...

Details

Author
jeremylongshore
Repository
jeremylongshore/claude-code-plugins-plus-skills
Created
1 years ago
Last Updated
yesterday
Language
Python
License
MIT

Integrates with

Bundled in these plugins

Similar Skills

Semantically similar based on skill content — not just same category

AI & Automation Featured

sentry-error-capture

Implement advanced error capture and context enrichment with Sentry. Use when adding captureException/captureMessage calls, enriching errors with user context, tags, breadcrumbs, or custom fingerprinting. Trigger with "sentry error capture", "sentry context", "enrich sentry errors", "sentry exception handling", "sentry breadcrumbs", "sentry fingerprint".

2,926 Updated yesterday
jeremylongshore
AI & Automation Featured

sentry-reliability-patterns

Build reliable Sentry integrations with graceful degradation, circuit breakers, and offline queuing. Use when implementing fault-tolerant error tracking, handling SDK initialization failures, building retry logic for Sentry transports, or ensuring apps survive Sentry outages. Trigger with "sentry reliability", "sentry circuit breaker", "sentry offline queue", "sentry graceful degradation", "sentry failover", or "resilient sentry setup".

2,926 Updated yesterday
jeremylongshore
DevOps & Infrastructure Featured

sentry-architecture-variants

Configure Sentry error tracking and performance monitoring for different application architectures. Use when setting up Sentry for monoliths, microservices, serverless functions, event-driven systems, frontend SPAs, mobile apps, or hybrid deployments. Trigger: "sentry monolith setup", "sentry microservices tracing", "sentry serverless lambda", "sentry event-driven kafka", "sentry react native", "sentry architecture pattern".

2,926 Updated yesterday
jeremylongshore