Setup monitoring and observability for applications with Sentry, PostHog, Pino logging, and OpenTelemetry. Use when users need error tracking, product analytics, structured logging, metrics, or centralized exception handling. Covers AdonisJS-inspired error patterns.
/plugin marketplace add leobrival/topographic-studio-plugins/plugin install code-workflows@topographic-studio-pluginsThis skill inherits all available tools. When active, it can use any tool Claude has access to.
assets/exceptions/exception-handler.tsassets/exceptions/exception.tsassets/exceptions/with-error-handling.tsassets/logging/logger.tsassets/logging/middleware.tsassets/metrics/custom-metrics.tsassets/metrics/otel-config.tsassets/posthog/events.tsassets/posthog/posthog-client.tsassets/posthog/posthog-provider.tsxassets/sentry/sentry.client.tsassets/sentry/sentry.edge.tsassets/sentry/sentry.server.tsreferences/exception-handling.mdreferences/opentelemetry.mdreferences/posthog-analytics.mdreferences/sentry-setup.mdreferences/structured-logging.mdComplete observability stack for modern applications: error tracking, analytics, structured logging, metrics, and exception handling.
User request → What type of observability?
│
├─ Error Tracking
│ ├─ Sentry → Full-featured, session replay
│ ├─ BugSnag → Simpler, good stability
│ └─ Rollbar → Real-time monitoring
│
├─ Product Analytics
│ ├─ PostHog → Open source, feature flags
│ ├─ Mixpanel → Event tracking
│ └─ Amplitude → Product analytics
│
├─ Logging
│ ├─ Pino → Fast, structured JSON
│ ├─ Winston → Feature-rich
│ └─ Bunyan → JSON logging
│
├─ Metrics & Tracing
│ ├─ OpenTelemetry → Standard, vendor-agnostic
│ ├─ Datadog → All-in-one APM
│ └─ New Relic → Traditional APM
│
└─ Exception Handling
├─ AdonisJS pattern → Self-handling exceptions
├─ Centralized handler → One place for all errors
└─ Status pages → Custom error responses
// Create custom exception
import { Exception } from "@/lib/exceptions/exception";
export class PaymentException extends Exception {
static status = 402;
static code = "E_PAYMENT_FAILED";
// Self-handling: converts to HTTP response
async handle(error: this, ctx: ExceptionContext) {
return Response.json(
{ error: { message: error.message, code: error.code } },
{ status: error.status }
);
}
// Self-reporting: defines how to log
async report(error: this, ctx: ExceptionContext) {
ctx.logger.error({ err: error, paymentId: this.paymentId }, error.message);
}
}
import { createHandler } from "@/lib/exceptions/with-error-handling";
import { NotFoundException } from "@/lib/exceptions/exception";
export const GET = createHandler(async (request, ctx) => {
const user = await db.users.findUnique({ where: { id } });
if (!user) {
throw new NotFoundException(`User ${id} not found`);
}
return Response.json(user);
});
import * as Sentry from "@sentry/nextjs";
Sentry.captureException(error, {
tags: { feature: "checkout" },
extra: { userId, orderId }
});
import { posthog } from "@/lib/posthog";
posthog.capture("purchase_completed", {
amount: 99.99,
currency: "EUR"
});
import { logger } from "@/lib/logger";
logger.info({ userId, action: "login" }, "User logged in");
assets/
├── exceptions/
│ ├── exception-handler.ts # Centralized handler (AdonisJS-inspired)
│ ├── exception.ts # Exception classes with self-handle/report
│ └── with-error-handling.ts # Wrapper for API routes
├── sentry/
│ ├── sentry.client.ts # Client-side configuration
│ ├── sentry.server.ts # Server-side configuration
│ └── sentry.edge.ts # Edge runtime configuration
├── posthog/
│ ├── posthog-provider.tsx # React provider
│ ├── posthog-client.ts # PostHog client
│ └── events.ts # Event definitions
├── logging/
│ ├── logger.ts # Configured Pino logger
│ └── middleware.ts # HTTP logging middleware
└── metrics/
├── otel-config.ts # OpenTelemetry configuration
└── custom-metrics.ts # Custom metrics
| Exception | Status | Code |
|---|---|---|
BadRequestException | 400 | E_BAD_REQUEST |
UnauthorizedException | 401 | E_UNAUTHORIZED |
ForbiddenException | 403 | E_FORBIDDEN |
NotFoundException | 404 | E_NOT_FOUND |
ConflictException | 409 | E_CONFLICT |
ValidationException | 422 | E_VALIDATION_ERROR |
RateLimitException | 429 | E_RATE_LIMIT |
InternalServerException | 500 | E_INTERNAL_SERVER_ERROR |
BadGatewayException | 502 | E_BAD_GATEWAY |
ServiceUnavailableException | 503 | E_SERVICE_UNAVAILABLE |
RowNotFoundException | 404 | E_ROW_NOT_FOUND |
PaymentException | 402 | E_PAYMENT_FAILED |
ExternalServiceException | 502 | E_EXTERNAL_SERVICE |
NotFoundException vs generic Errorcause for original errorsThis skill should be used when the user asks to "create an agent", "add an agent", "write a subagent", "agent frontmatter", "when to use description", "agent examples", "agent tools", "agent colors", "autonomous agent", or needs guidance on agent structure, system prompts, triggering conditions, or agent development best practices for Claude Code plugins.
This skill should be used when the user asks to "create a slash command", "add a command", "write a custom command", "define command arguments", "use command frontmatter", "organize commands", "create command with file references", "interactive command", "use AskUserQuestion in command", or needs guidance on slash command structure, YAML frontmatter fields, dynamic arguments, bash execution in commands, user interaction patterns, or command development best practices for Claude Code.
This skill should be used when the user asks to "create a hook", "add a PreToolUse/PostToolUse/Stop hook", "validate tool use", "implement prompt-based hooks", "use ${CLAUDE_PLUGIN_ROOT}", "set up event-driven automation", "block dangerous commands", or mentions hook events (PreToolUse, PostToolUse, Stop, SubagentStop, SessionStart, SessionEnd, UserPromptSubmit, PreCompact, Notification). Provides comprehensive guidance for creating and implementing Claude Code plugin hooks with focus on advanced prompt-based hooks API.