Sets up structured JSON logging with context enrichment, request logging, log levels, redaction, sinks, and log-trace correlation across .NET, Node.js, Python, Java/Kotlin, and Go stacks.
Ships in AI for Developers Toolkit. 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.
Read when SKILL.md points to them.
Wire up structured (JSON) logs with context enrichment, one tidy line per request, sensible levels, redaction, and a sink - correlated with your traces. The rules are the same in every language; only the library differs.
Works on a target: a project, a folder, or a GitHub URL (git clone --depth 1 <url> /tmp/repo). Inspect the current logging setup before generating anything. If OpenTelemetry is present, wire log/trace correlation.
| Manifest | Stack | Look for | Recommended |
|---|---|---|---|
*.csproj | .NET | Serilog, UseSerilog, AddSerilog, ILogger<, AddJsonConsole | Serilog (or built-in JSON console for minimal setups) |
package.json | Node / TS | pino, pino-http, winston, console.log | pino (+ pino-http); keep winston if already used |
pyproject.toml, requirements*.txt | Python | structlog, logging.basicConfig, python-json-logger, loguru | structlog (or stdlib + JSON formatter) |
pom.xml, build.gradle(.kts) | Java / Kotlin | logback, log4j2, logstash-logback-encoder, logging.structured | SLF4J + Logback with JSON output |
go.mod | Go | log/slog, go.uber.org/zap, github.com/rs/zerolog | log/slog (stdlib); keep zap/zerolog if present |
grep -rn "UseSerilog\|AddSerilog\|Log.Logger\|AddJsonConsole" --include=*.cs <target>
grep -rn "pino\|winston\|console\.log" --include=*.ts --include=*.js <target> | grep -v node_modules
grep -rn "structlog\|logging\.\(basicConfig\|getLogger\)\|print(" --include=*.py <target>
grep -rn "LoggerFactory\|@Slf4j\|logback\|System.out.println" <target>/src <target>/src/main/resources 2>/dev/null
grep -rn "slog\.\|zap\.\|zerolog\|log\.Printf" --include=*.go <target>
"Order {OrderId} placed", id or log.info("order placed", order_id=id) - never f"Order {id} placed". Structure is the whole point: fields are queryable, interpolated text is not.context.Context), so every line carries them.Info for business events, Warn for recoverable oddities, Error with the exception object (stack trace), Debug only in dev. Turn noisy framework namespaces down to Warn. Configure via config/env, not code.trace_id/span_id when OTel is active (see opentelemetry-setup).trace_id, service, env, duration_ms) so queries work everywhere.dotnet add package Serilog.AspNetCore
dotnet add package Serilog.Enrichers.Environment # WithMachineName
dotnet add package Serilog.Sinks.Seq # or Elasticsearch / Grafana Loki / OpenTelemetry sink
builder.Host.UseSerilog((ctx, services, lc) => lc
.ReadFrom.Configuration(ctx.Configuration)
.ReadFrom.Services(services)
.Enrich.FromLogContext()
.Enrich.WithMachineName()
.Enrich.WithProperty("service", "orders")
.WriteTo.Console(new RenderedCompactJsonFormatter()) // structured JSON
.WriteTo.Seq(ctx.Configuration["Seq:Url"]!));
app.UseSerilogRequestLogging(); // one tidy log line per request instead of the default noise
// GOOD: message template + properties (queryable)
logger.LogInformation("Order {OrderId} placed by {CustomerId} for {Total}", id, customerId, total);
// BAD: interpolated string (loses structure)
logger.LogInformation($"Order {id} placed");
// Errors: pass the exception, not ex.Message
logger.LogError(ex, "Payment failed for {OrderId}", id);
appsettings.json Serilog:MinimumLevel with overrides for Microsoft / Microsoft.AspNetCore set to Warning.Activity.Current carries TraceId/SpanId; recent Serilog versions capture them on events - verify they appear in the JSON output, and enrich explicitly if not.LoggerMessage source generators ([LoggerMessage]) avoid boxing and template parsing.builder.Logging.AddJsonConsole() gives structured JSON with built-in logging and BeginScope for context.import pino from 'pino';
import pinoHttp from 'pino-http';
export const logger = pino({
level: process.env.LOG_LEVEL ?? 'info',
base: { service: 'orders', env: process.env.NODE_ENV },
redact: ['req.headers.authorization', 'req.headers.cookie', '*.password'],
});
app.use(pinoHttp({ logger })); // one line per request, req.log child logger
logger.info({ orderId, customerId, total }, 'order placed'); // fields first, message second
logger.error({ err, orderId }, 'payment failed'); // pino serializes `err` with stack
req.log (child logger) or AsyncLocalStorage for code outside the handler.pino-pretty as a dev transport); JSON in prod.format.combine(format.timestamp(), format.errors({ stack: true }), format.json()).@opentelemetry/instrumentation-pino / -winston inject trace_id/span_id.import logging, structlog
structlog.configure(
processors=[
structlog.contextvars.merge_contextvars,
structlog.processors.add_log_level,
structlog.processors.TimeStamper(fmt="iso"),
structlog.processors.dict_tracebacks,
structlog.processors.JSONRenderer(),
],
wrapper_class=structlog.make_filtering_bound_logger(logging.INFO),
)
log = structlog.get_logger(service="orders")
log.info("order placed", order_id=order_id, customer_id=customer_id, total=total)
log.exception("payment failed", order_id=order_id) # inside except: includes the traceback
structlog.contextvars.clear_contextvars() then bind_contextvars(request_id=..., route=...).logging + python-json-logger's JSON formatter; use extra={...} for fields, logger.exception(...) for errors.otelTraceID/otelSpanID to stdlib records; for structlog add a processor that reads the current span context.logging.structured.format.console=ecs (or logstash, gelf).net.logstash.logback:logstash-logback-encoder with <encoder class="net.logstash.logback.encoder.LogstashEncoder"/> in logback-spring.xml.log.info("Order placed {}", kv("orderId", orderId)); // logstash StructuredArguments
log.atInfo().addKeyValue("orderId", orderId).log("Order placed"); // SLF4J 2 fluent API
log.error("Payment failed for order {}", orderId, ex); // exception last = stack trace
MDC.put("correlationId", id) in a servlet filter / WebFlux filter, cleared in finally. MDC is thread-bound - propagate it explicitly across executors and reactive chains.org.springframework and org.hibernate down to WARN.trace_id/span_id (or traceId/spanId) into the MDC.logger := slog.New(slog.NewJSONHandler(os.Stdout, &slog.HandlerOptions{Level: slog.LevelInfo}))
logger = logger.With("service", "orders", "env", os.Getenv("ENV"))
slog.SetDefault(logger)
slog.InfoContext(ctx, "order placed", "order_id", id, "total", total)
slog.ErrorContext(ctx, "payment failed", "order_id", id, "err", err)
http.ResponseWriter to capture status and logs once with duration.ctx and use the *Context methods; a custom handler (or the otelslog bridge) pulls trace_id from the span context.zap.NewProduction(), zap.String(...) fields) and zerolog (log.Info().Str("order_id", id).Msg("order placed")) are fine if already in use - don't migrate for its own sake.## Current state
<stack, logger found, what's missing>
## Packages
<install commands>
## Wiring
<logger config + request logging + context enrichment + redaction>
## Usage examples
<good vs bad log calls in their code style>
## Config
<levels per environment, sink settings>
"Set up Serilog with JSON logs and Seq", "add pino with request logging to my Express app", "configure structlog for FastAPI", "make Logback emit JSON in Spring Boot", "switch my Go service to slog with trace ids", "correlate my logs with traces". Pairs with opentelemetry-setup and correlation-id-middleware.
What SKILL.md sets; muted values are Claude Code's defaults
/ai-dev-toolkit:structured-logging-setupfrom AI for Developers Toolkit
npx claudepluginhub stefanthecode/ai-for-developers --plugin ai-dev-toolkit45 skills in this plugin
/api-endpoint-scaffolderScaffold HTTP API endpoints in any stack - ASP.NET Core Minimal APIs or controllers, Express, Fastify, NestJS, FastAPI, Django REST Framework, Spring Boot controllers, Go net/http, chi, Gin - one feature per endpoint (REPR style) with request validation, typed responses, route grouping, auth, and OpenAPI metadata. Use this skill whenever the user wants to add an endpoint or route, convert controllers to minimal APIs, structure routes or routers, set up endpoint groups, TypedResults, route handlers, request DTOs/schemas (zod, Pydantic, Bean Validation, binding tags), or asks "how do I add an endpoint / structure my API routes". Always use this skill for endpoint scaffolding; it generates a complete, validated endpoint that matches the project's conventions./architecture-test-generatorGenerate architecture tests / fitness functions that fail the build when architectural rules are violated - layer dependencies, module boundaries, cycles, naming, and visibility conventions - in any stack: NetArchTest or ArchUnitNET (.NET), ArchUnit or Konsist (Java/Kotlin), dependency-cruiser or eslint-plugin-boundaries (TypeScript/JavaScript), import-linter (Python), go-arch-lint or depguard (Go). Use this skill whenever the user wants architecture tests, to enforce layering or the dependency rule, dependency rules as tests, import rules, forbidden imports, no circular dependencies, naming conventions, fitness functions, or asks "how do I stop people breaking the architecture / enforce my layers / keep modules from importing each other". Always use this skill for architecture-test requests; it generates rules matching the project's real structure.Other plugins' skills for the same job