Emits structured logs with Pino using context-first signature, level thresholds, and a safe step wrapper for workflows. Use when adding logging to routes, libraries, or workflows.
Ships in andrelandgraf-fullstackrecipes. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
None: SKILL.md is the whole skill.
Emit structured logs with Pino throughout the app.
Complete these setup recipes first:
Import logger from @/lib/logging/logger. Pass a context object first, message second. For errors, put err in the context object.
import { logger } from "@/lib/logging/logger";
logger.info({ port: 3000 }, "Server started");
logger.warn({ endpoint: "/api/chat" }, "Rate limit reached");
logger.debug({ key: "user:123" }, "Cache miss");
logger.error({ err, userId: "123", endpoint: "/api/chat" }, "Request failed");
| Level | When to Use |
|---|---|
trace | Detailed debugging (rarely used) |
debug | Development troubleshooting |
info | Normal operations, business events |
warn | Recoverable issues, deprecation warnings |
error | Failures that need attention |
fatal | Critical failures, app cannot continue |
Set the active threshold via LOG_LEVEL (defaults to info). Use warn in production.
LOG_LEVEL="debug"
Log on the way out with timing context.
import { logger } from "@/lib/logging/logger";
export async function POST(request: Request) {
const start = Date.now();
try {
const result = await processRequest(request);
logger.info(
{ duration: Date.now() - start, status: 200 },
"Request completed",
);
return Response.json(result);
} catch (err) {
logger.error({ err, duration: Date.now() - start }, "Request failed");
return Response.json({ error: "Internal error" }, { status: 500 });
}
}
The workflow runtime can't import Node modules, so the logger can't be called directly. Wrap it in a "use step" function.
// src/workflows/chat/steps/logger.ts
import { logger } from "@/lib/logging/logger";
export async function log(
level: "info" | "warn" | "error" | "debug",
message: string,
data?: Record<string, unknown>,
): Promise<void> {
"use step";
if (data) {
logger[level](data, message);
} else {
logger[level](message);
}
}
import { log } from "./steps/logger";
export async function chatWorkflow({ chatId }) {
"use workflow";
await log("info", "Workflow started", { chatId });
}
What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
12 skills in this plugin
/analytics-best-practicesTrack custom events and conversions with Vercel Web Analytics via the track() call. Use when instrumenting user actions, conversions, or form submissions./authentication-best-practicesRead sessions client- and server-side, guard routes, and run sign in/up/out with Better Auth. Use when gating pages/APIs on auth or wiring auth flows./drizzle-queriesWrite type-safe Postgres queries with Drizzle ORM (select/insert/update/delete, relations, new tables). Use when querying or mutating the database or adding a Drizzle table./og-image-generationGenerate dynamic social preview images using Next.js file conventions and the next/og library. Server-rendered JSX images cached at build time./ralph-loop-workflowRun a coding agent in an autonomous loop via a /ralph command, gated by a preflight check that every CLI is installed, linked, and authenticated. Use when driving long-running autonomous development from a wide, outcome-focused prompt./sentry-best-practicesCapture exceptions, attach user/context, add spans and breadcrumbs, and log via the Sentry SDK. Use when instrumenting errors, performance, or context in app code./andrelandgraf-fullstackrecipes:logging-best-practicesfrom andrelandgraf-fullstackrecipes
andrelandgraf-fullstackrecipes@cascade-code-general-misc-3 is listed by joshuarweaver/cascade-code-general-misc-3 — review the source before installing
npx claudepluginhub joshuarweaver/cascade-code-general-misc-3 --plugin andrelandgraf-fullstackrecipesOther plugins' skills for the same job