logging-error-handling

Design structured logging and error handling with correlation IDs and RFC 7807 responses.

4|Updated May 16, 2026
One-click install
npx skills add https://github.com/machenjie/rd-skills --skill logging-error-handling
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: logging-error-handling
Source: https://github.com/machenjie/rd-skills/tree/main/src/foundation/capabilities/logging-error-handling
Command: npx skills add https://github.com/machenjie/rd-skills --skill logging-error-handling

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

This Skill helps you design structured logging and error handling that enables fast incident diagnosis while protecting sensitive data and keeping client error responses stable and non-leaky.

Core Features & Use Cases

  • Structured, traceable logging: Ensures every log entry includes correlation IDs and W3C trace context for end-to-end debugging across HTTP requests, queues, and scheduled jobs.
  • Explicit error taxonomy: Separates User, System, ThirdParty, and Security errors with appropriate log levels, audit behavior, and client-safe responses.
  • Sensitive-data protection by design: Prevents secrets, tokens, and personal data from reaching log sinks by enforcing “exclude at the call site” rules, not downstream redaction.

Quick Start

Use this capability to update your services so all errors are consistently categorized, logged as JSON with correlation context, and returned to clients using RFC 7807 without internal details.

Frequently Asked Questions about logging-error-handling

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I prevent sensitive data like PII from leaking into structured logs?

To prevent PII redaction failures, enforce “exclude at the call site” rules so secrets and personal data never enter log streams, rather than relying on downstream scrubbing filters.

How does RFC 7807 help return client-safe error responses in APIs?

RFC 7807 standardizes API error responses, allowing services to return structured problem details without exposing internal system errors or sensitive stack traces to clients.

How do I propagate correlation IDs and traceparent across async queues and scheduled jobs?

Propagate correlation IDs and W3C trace context by injecting traceparent headers into inbound HTTP, async queue payloads, and scheduled job metadata for end-to-end distributed tracing.

What is the best way to categorize system, user, and third-party errors for incident diagnosis?

Use an explicit error taxonomy to separate User, System, ThirdParty, and Security errors, applying distinct log levels and audit behaviors for faster incident diagnosis.

When should I write append-only audit logs for security-relevant events?

Write append-only audit logs for security-relevant events to maintain an immutable record of access and changes, satisfying compliance and security investigation requirements.

Does this logging and error handling approach work for outbound external calls?

Yes, this structured logging and error handling design spans outbound external calls, ensuring trace propagation and sensitive-data protection across all distributed system boundaries.