sentry
brianlovin/agent-config
Sentry error monitoring and performance tracing for Next.js applications.
What is sentry?
Integrates Sentry into Next.js apps to capture exceptions, trace performance, and log structured events. Use this when you need production error tracking, performance insights, and centralized logging across client, server, and edge runtimes.
- Capture and report exceptions with Sentry.captureException() in try/catch blocks
- Create performance spans for UI actions, API calls, and function execution
- Configure Sentry for client-side, server-side, and edge runtime environments
- Log structured events with multiple severity levels (trace, debug, info, warn, error, fatal)
- Track form submissions, button clicks, and API requests with custom attributes
How to install sentry
npx skills add https://github.com/brianlovin/agent-config --skill sentry- Sentry account and project DSN
- Next.js application with @sentry/nextjs package installed
- Environment variable NEXT_PUBLIC_SENTRY_DSN configured
How to use sentry
- 1.Create sentry.client.config.ts, sentry.server.config.ts, and sentry.edge.config.ts files in your project root
- 2.Initialize Sentry in each config file with your DSN and desired integrations
- 3.Wrap risky operations in try/catch blocks and call Sentry.captureException(error)
- 4.Use Sentry.startSpan() to create performance spans around UI actions and API calls
- 5.Use Sentry.logger methods to emit structured logs at appropriate severity levels
Use cases
- Monitor production errors and stack traces in a Next.js application
- Measure performance of critical user interactions like form submissions
- Track API call latency and failures across client and server
- Aggregate structured logs from different runtime environments for debugging
- Identify performance bottlenecks in UI actions and data fetching
- Next.js developers building production applications
- Teams needing centralized error monitoring and alerting
- Performance-conscious developers tracking user-facing latency
- Full-stack engineers managing both client and server-side observability
sentry FAQ
No. Import Sentry in other files with `import * as Sentry from "@sentry/nextjs"` after initializing in the config files.
Wrap your fetch call in Sentry.startSpan() with op: "http.client" and include the endpoint name.
sentry.client.config.ts handles browser-side errors, sentry.server.config.ts handles Node.js backend, and sentry.edge.config.ts handles Vercel Edge Runtime.
Yes, use Sentry.logger methods (trace, debug, info, warn, error, fatal) for structured logging without exceptions.
Use span.setAttribute() when creating spans, or pass an object with context data to logger methods.
Full instructions (SKILL.md)
Source of truth, from brianlovin/agent-config.
name: sentry description: Sentry error monitoring and performance tracing patterns for Next.js applications.
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-sidesentry.server.config.ts- Server-sidesentry.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 });
Related skills
More from brianlovin/agent-config and the wider catalog.

simplify
Simplify and refine recently modified code for clarity and consistency.

tdd
Test-driven development with red-green-refactor loop for building features and fixing bugs.

workflow
Workflow orchestration for complex coding tasks with planning, verification, and autonomous bug fixing.

agent-browser
Browser automation CLI for AI agents to navigate, interact with, and test websites programmatically.

bright-data-best-practices
Reference documentation for building production-ready Bright Data integrations with best practices.

bright-data-mcp
|