
Sentry Best Practices
- 55 installs
- 18 repo stars
- Updated June 8, 2026
- andrelandgraf/fullstackrecipes
sentry-best-practices is a Claude Code skill for capturing exceptions, attaching context, tracing performance, and logging with the Sentry Next.js SDK.
About
This skill shows how to instrument errors and performance with the Sentry Next.js SDK: capturing exceptions, attaching user and per-exception context (tags and extra), adding performance spans and breadcrumbs, and logging via the Sentry logger. Developers use it when instrumenting errors, performance, or context in application code. It assumes the Sentry Setup recipe is already complete.
- Capture handled exceptions with Sentry.captureException
- Attach user, tags, and extra context per exception
- Performance tracing with startSpan and structured Sentry logger
Sentry Best Practices by the numbers
- 55 all-time installs (skills.sh)
- Ranked #300 of 596 Debugging skills by installs in the Skillselion catalog
- Data as of Jul 28, 2026 (Skillselion catalog sync)
sentry-best-practices capabilities & compatibility
Requires a Sentry project/DSN; Sentry offers a free tier and the @sentry/nextjs SDK is open source.
- Capabilities
- error tracking · performance tracing · observability
- Works with
- sentry
- Use cases
- debugging · devops
- Pricing
- Freemium
What sentry-best-practices says it does
Capture exceptions, add context, trace performance, and log with Sentry.
Wrap meaningful operations in `startSpan`. The sync form receives the `span` for attributes.
npx skills add https://github.com/andrelandgraf/fullstackrecipes --skill sentry-best-practicesAdd your badge
Show developers this skill is listed on Skillselion. Paste this into your README.
| Installs | 55 |
|---|---|
| repo stars | ★ 18 |
| Last updated | June 8, 2026 |
| Repository | andrelandgraf/fullstackrecipes ↗ |
What it does
Instrument error capture, context, performance tracing, and structured logging with the Sentry Next.js SDK.
Who is it for?
Developers instrumenting errors, performance, or context in application code with Sentry.
Skip if: Initial Sentry installation, which the Sentry Setup recipe handles.
When should I use this skill?
Instrumenting errors, performance, or context in app code.
What you get
- Exception capture code
- Context/tags instrumentation
- Performance spans and breadcrumbs
Files
Sentry Best Practices
Capture exceptions, add context, trace performance, and log with Sentry.
Prerequisites
Complete these setup recipes first:
- Sentry Setup
Capturing Exceptions
Capture errors that are handled but still worth tracking.
import * as Sentry from "@sentry/nextjs";
try {
await riskyOperation();
} catch (err) {
Sentry.captureException(err);
}Adding Context
setUser persists for the session. Attach tags (indexed, filterable) and extra (arbitrary detail) per exception.
import * as Sentry from "@sentry/nextjs";
Sentry.setUser({ id: session.user.id, email: session.user.email });
Sentry.captureException(err, {
tags: { feature: "checkout", plan: "pro" },
extra: { orderId: "order_123", items: cart.items },
});Clear the user on sign out.
Sentry.setUser(null);Performance Tracing
Wrap meaningful operations in startSpan. The sync form receives the span for attributes.
import * as Sentry from "@sentry/nextjs";
const users = await Sentry.startSpan(
{ op: "http.client", name: "GET /api/users" },
async () => (await fetch("/api/users")).json(),
);
Sentry.startSpan({ op: "ui.click", name: "Submit Button Click" }, (span) => {
span.setAttribute("form", "checkout");
processSubmit();
});Breadcrumbs
Console logs, fetches, and UI clicks are captured automatically. Add manual breadcrumbs for custom events.
import * as Sentry from "@sentry/nextjs";
Sentry.addBreadcrumb({
category: "auth",
message: "User signed in",
level: "info",
});Sentry Logger
Structured logs surface in the Logs tab.
import * as Sentry from "@sentry/nextjs";
const { logger } = Sentry;
logger.info("Payment processed", { orderId: "123", amount: 99.99 });
logger.warn("Rate limit approaching", { current: 90, max: 100 });
logger.error("Payment failed", { orderId: "123", reason: "declined" });---
References
Related skills
FAQ
How do I attach context to an error?
setUser persists for the session; attach tags (indexed, filterable) and extra (arbitrary detail) per exception in captureException.
How do I trace performance?
Wrap meaningful operations in Sentry.startSpan, using the sync form to set span attributes.