Enforces project server-side Sentry monitoring conventions when implementing error tracking, performance monitoring, and breadcrumb logging in server actions, facades, middleware, and API routes...
This skill enforces the project server-side Sentry monitoring conventions automatically during error tracking implementation. It ensures consistent patterns for context setting, breadcrumb categories, error capture, performance spans, and middleware integration.
Note: For client-side/front-end Sentry patterns, use the sentry-client skill instead.
This skill activates when working on server-side code:
src/lib/actions/src/lib/facades/)src/middleware.ts, src/lib/middleware/)src/app/api/)src/instrumentation.ts)@sentry/nextjs in server files)references/Sentry-Server-Conventions.mdSentry.setContext(SENTRY_CONTEXTS.*, {...})level: 'warning'Sentry.withScope and Sentry.startSpan for performance trackingonRequestError = Sentry.captureRequestError for RSC error capture| Constant | Import Path | Purpose |
|---|---|---|
SENTRY_CONTEXTS |
@/lib/constants/sentry |
Context names for setContext |
SENTRY_BREADCRUMB_CATEGORIES |
@/lib/constants/sentry |
Breadcrumb category values |
SENTRY_LEVELS |
@/lib/constants/sentry |
Breadcrumb level values |
SENTRY_TAGS |
@/lib/constants/sentry |
Tag names for setTag |
SENTRY_OPERATIONS |
@/lib/constants/sentry |
Operation names for spans |
Import from @/lib/utils/sentry-server/breadcrumbs.server:
| Function | Purpose |
|---|---|
withActionErrorHandling() |
Wrap action with automatic breadcrumbs + error handling |
withActionBreadcrumbs() |
Wrap action with breadcrumbs only (no error handling) |
trackActionEntry() |
Track action operation start |
trackActionSuccess() |
Track action success with optional result data |
trackActionWarning() |
Track action warning for partial failures |
trackCacheInvalidation() |
Track cache invalidation with automatic warning on failure |
setActionContext() |
Set Sentry context with type-safe keys |
| Function | Purpose |
|---|---|
withFacadeBreadcrumbs() |
Wrap facade method with automatic breadcrumbs |
trackFacadeEntry() |
Track facade operation start |
trackFacadeSuccess() |
Track facade success with optional result data |
trackFacadeWarning() |
Track facade warning for partial failures |
trackFacadeError() |
Track facade error |
facadeBreadcrumb() |
Add a simple breadcrumb for facade operations |
captureFacadeWarning() |
Capture non-critical exception with warning level and tags |
See references/Sentry-Server-Conventions.md for complete documentation with examples.
| Use Case | Primary Method | Level |
|---|---|---|
| Action start | Sentry.setContext |
N/A |
| Successful operation | Sentry.addBreadcrumb |
INFO |
| Non-critical failure | Sentry.captureException |
warning |
| Critical failure | Let error propagate | error |
| Performance tracking | Sentry.startSpan |
N/A |
This skill applies to:
src/lib/actions/**/*.tssrc/lib/facades/**/*.tssrc/lib/middleware/**/*.tssrc/middleware.tssrc/app/api/**/*.tssrc/instrumentation.tssentry.server.config.tssentry.edge.config.tsreferences/Sentry-Server-Conventions.md - Complete server-side Sentry monitoring conventions