All skills
brianlovin avatar

/sentry

@a271d44 official

Sentry error monitoring and performance tracing patterns for Next.js applications.

Use this Skill: https://skilld.dev/gh/brianlovin/claude-config/sentry

This session only. Nothing lands on disk.

SKILL.md

≈23 tokens always: the name and description. ≈505 when used: this file.

Sentry Integration

Guidelines for using Sentry for error monitoring and performance tracing.

Exception Catching

Use Sentry.captureException(error) in try/catch blocks:

try {
  await riskyOperation();
} catch (error) {
  Sentry.captureException(error);
  throw error;
}

Performance Tracing

Create spans for meaningful actions like button clicks, API calls, and function calls.

UI Actions

function handleClick() {
  Sentry.startSpan(
    { op: "ui.click", name: "Submit Form" },
    (span) => {
      span.setAttribute("formId", formId);
      submitForm();
    }
  );
}

API Calls

async function fetchData(id) {
  return Sentry.startSpan(
    { op: "http.client", name: `GET /api/items/${id}` },
    async () => {
      const response = await fetch(`/api/items/${id}`);
      return response.json();
    }
  );
}

Configuration (Next.js)

Sentry initialization files:

  • sentry.client.config.ts - Client-side
  • sentry.server.config.ts - Server-side
  • sentry.edge.config.ts - Edge runtime

Import with import * as Sentry from "@sentry/nextjs" - no need to initialize in other files.

Basic Setup

import * as Sentry from "@sentry/nextjs";

Sentry.init({
  dsn: process.env.NEXT_PUBLIC_SENTRY_DSN,
  enableLogs: true,
});

With Console Logging

Sentry.init({
  dsn: process.env.NEXT_PUBLIC_SENTRY_DSN,
  integrations: [
    Sentry.consoleLoggingIntegration({ levels: ["log", "warn", "error"] }),
  ],
});

Structured Logging

Use logger.fmt for template literals with variables:

const { logger } = Sentry;

logger.trace("Starting connection", { database: "users" });
logger.debug(logger.fmt`Cache miss for: ${userId}`);
logger.info("Updated profile", { profileId: 345 });
logger.warn("Rate limit reached", { endpoint: "/api/data" });
logger.error("Payment failed", { orderId: "order_123" });
logger.fatal("Connection pool exhausted", { activeConnections: 100 });

Source: SKILL.md on GitHub

1 warning16d5 checks · Risk SAFE
  • Gen Agent Trust Hub16d

    The skill provides safe, standard documentation and reference code snippets for integrating Sentry error monitoring and performance tracing into Next.js applications.

  • Socket16d

    No alerts

  • Snyk16d

    Risk: LOW · No issues

  • Runlayer7mo

    1/1 file flagged

  • ZeroLeaks5mo

    Score: 93/100 · 2 sections analyzed

Signed by skilld at a271d44. This ties the file your Agent reads to that commit on GitHub. It does not review the instructions.

Last checked against GitHub 2 months ago.

Dormantupdated 8 months ago
  • Next.js
  • sentry
  • error-monitoring
  • performance-tracing
  • observability
  • logging
  • javascript
  • exception-handling

README badge

README badge for brianlovin/claude-config/sentry

Configures Sentry error monitoring and performance tracing for Next.js applications, with patterns for exception catching, span creation, and structured logging. Covers client-side, server-side, and edge runtime initialization via separate config files.

Generated from the current SKILL.md.

Does this skill cover both client and server-side Sentry setup?
Yes. It includes configuration patterns for client-side, server-side, and edge runtime using separate config files (sentry.client.config.ts, sentry.server.config.ts, sentry.edge.config.ts) in Next.js applications.
What frameworks does this skill target?
This skill is specific to Next.js applications using @sentry/nextjs.
Does this cover performance tracing?
Yes. It includes patterns for tracing UI actions, API calls, and other meaningful operations using Sentry.startSpan with operation types like ui.click and http.client.
Can I use structured logging with this skill?
Yes. The skill includes Sentry's logger with support for trace, debug, info, warn, error, and fatal levels, plus logger.fmt for template literal logging with variables.

Generated from the current SKILL.md. These answers refresh after source changes.