src/skills/api-observability-setup-axiom-pino-sentry/SKILL.md
Pino, Axiom, Sentry installation - one-time project setup for logging and error tracking with source maps upload
npx skillsauth add agents-inc/skills api-observability-setup-axiom-pino-sentryInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
Quick Guide: One-time project setup for observability. Install
pino,next-axiom,@sentry/nextjs. Configure Axiom dataset + Vercel integration. Set up Sentry DSN and config files. Wrapnext.config.tswithwithAxiomthenwithSentryConfig. Addinstrumentation.tsfor runtime-specific Sentry init. Source maps are uploaded automatically whenSENTRY_AUTH_TOKENis set in CI.
Detailed Resources:
<critical_requirements>
All code must follow project conventions in CLAUDE.md (kebab-case, named exports, import ordering,
import type, named constants)
(You MUST create separate Axiom datasets for each environment - development, staging, production)
(You MUST configure all three Sentry config files - sentry.client.config.ts, sentry.server.config.ts, sentry.edge.config.ts)
(You MUST add source maps upload to CI/CD - Sentry needs source maps for readable stack traces)
(You MUST install pino-pretty as a devDependency only - never use in production)
</critical_requirements>
Auto-detection: pino, next-axiom, @sentry/nextjs, Axiom, Sentry, observability setup, logging setup, error tracking setup, source maps, sentry.client.config, sentry.server.config, sentry.edge.config, withAxiom, withSentryConfig
When to use:
When NOT to use:
Key patterns covered:
.env.example)next.config.ts with withAxiom() and withSentryConfig() wrappersinstrumentation.ts for Sentry initializationObservability is not optional for production apps. Without logging and error tracking, debugging production issues becomes guesswork. The Pino + Axiom + Sentry stack provides:
This skill covers one-time setup only. For ongoing usage patterns (log levels, structured fields, correlation IDs, alert configuration), use your observability usage skill.
</philosophy>Install all observability packages with correct dependency types.
# Production dependencies
npm install pino next-axiom @sentry/nextjs
# Development dependencies (pretty printing for local dev)
npm install -D pino-pretty
Why: pino-pretty as devDependency prevents production bundle bloat (~500KB), all core packages are production dependencies for runtime use.
For detailed code examples with good/bad comparisons, see examples/core.md.
Create .env.example with all required observability variables documented. Group by service, use comments to explain where to get each value, and maintain separate datasets per environment.
Key variables needed:
NEXT_PUBLIC_AXIOM_DATASET - Dataset name (e.g., myapp-dev, myapp-prod)NEXT_PUBLIC_AXIOM_TOKEN - API token with ingest permissionNEXT_PUBLIC_SENTRY_DSN - Sentry DSN from project settingsSENTRY_AUTH_TOKEN - For source maps upload in CISENTRY_ORG / SENTRY_PROJECT - Organization and project slugsFor complete template with all variables, see examples/core.md.
Wrap Next.js config with withAxiom for logging integration, then withSentryConfig for source map handling.
Key configuration points:
withAxiom wraps first (inner), Sentry wraps outersilent: !process.env.CI suppresses source map upload logs locallyhideSourceMaps needed)sourcemaps.deleteSourcemapsAfterUpload to clean up after uploadimport { withSentryConfig } from "@sentry/nextjs";
import { withAxiom } from "next-axiom";
const nextConfig = {
/* your config */
};
export default withSentryConfig(withAxiom(nextConfig), {
org: process.env.SENTRY_ORG,
project: process.env.SENTRY_PROJECT,
authToken: process.env.SENTRY_AUTH_TOKEN,
silent: !process.env.CI,
});
For complete configuration example, see examples/core.md.
Create all three Sentry config files for client, server, and edge runtimes.
Required files:
sentry.client.config.ts - Client-side with replay integrationsentry.server.config.ts - Server-side with local variables capturesentry.edge.config.ts - Edge runtime with limited featuresKey considerations:
beforeSendhideSourceMaps and enableTracing removed, source maps hidden by defaultFor complete file templates, see examples/sentry-config.md.
Create instrumentation.ts for proper Sentry initialization in Next.js. Uses dynamic imports to load the correct config for each runtime.
import * as Sentry from "@sentry/nextjs";
export async function register() {
if (process.env.NEXT_RUNTIME === "nodejs") {
await import("./sentry.server.config");
}
if (process.env.NEXT_RUNTIME === "edge") {
await import("./sentry.edge.config");
}
}
// Next.js 15+ error handling hook
export const onRequestError = Sentry.captureRequestError;
Why: Dynamic imports prevent loading wrong config for runtime, onRequestError hook captures Server Component errors automatically (Next.js 15+).
Add <AxiomWebVitals /> component to root layout for automatic Core Web Vitals (LCP, INP, CLS) reporting to Axiom.
Note: Web Vitals are only sent from production deployments, not local development.
For implementation example, see examples/axiom-integration.md.
Configure CI/CD to upload source maps to Sentry on deployment. Key requirements:
SENTRY_AUTH_TOKEN in build environment enables automatic uploadgetsentry/action-release@v3 for release creationFor complete workflow template, see examples/ci-cd.md.
Add health check endpoints that integrate with your observability stack:
For implementation examples, see examples/health-check.md.
Configure Pino with development/production modes:
pino-pretty for human-readable outputFor complete configuration, see examples/pino-logger.md.
After setting up, create initial dashboards in Axiom:
For APL query examples, see examples/axiom-integration.md.
</patterns><decision_framework>
See reference.md for complete decision trees:
</decision_framework>
<red_flags>
See reference.md for complete list.
High Priority:
Common Mistakes:
next.config.ts with withAxiominstrumentation.tshideSourceMaps, enableTracing, disableServerWebpackPlugin)</red_flags>
<critical_reminders>
All code must follow project conventions in CLAUDE.md
(You MUST create separate Axiom datasets for each environment - development, staging, production)
(You MUST configure all three Sentry config files - sentry.client.config.ts, sentry.server.config.ts, sentry.edge.config.ts)
(You MUST add source maps upload to CI/CD - Sentry needs source maps for readable stack traces)
(You MUST install pino-pretty as a devDependency only - never use in production)
Failure to follow these rules will result in missing logs, unreadable errors, and security vulnerabilities.
</critical_reminders>
development
Material Design component library for Vue 3
development
VitePress 1.x — Vue-powered static site generator for documentation sites, built on Vite
tools
Docusaurus 3.x documentation framework — site configuration, docs/blog plugins, sidebars, versioning, MDX, swizzling, and deployment
development
TanStack Form patterns - useForm, form.Field, validators, arrays, linked fields, createFormHook, type safety