# Add Structured Error Logging

Distributed services are difficult to debug when errors lack shared context. This skill guides Claude, Codex, and Claude Code to add JSON logs with correlation IDs.

## Install

```bash
npx skillstore add barissozen/error-logger
```

## Metadata

- - Status: approved
- - Slug: barissozen-error-logger
- - Version: 1.0.0
- - Author: BarisSozen
- - GitHub username: BarisSozen
- - License: MIT
- - Repository: https://github.com/BarisSozen/claude/tree/main/.claude/skills/error-logger
- - Ref: main
- - Supported tools: Claude, Codex, Claude Code
- - Risk level: safe
- - Quality score: 81
- - Quality tier: silver
- - Public page: https://skillstore.pages.dev/skills/barissozen-error-logger
- - Manifest: https://skillstore.pages.dev/api/skills/barissozen-error-logger/manifest

## Capabilities

- Defines a structured JSON log format for error events.
- Recommends correlation IDs for related log entries.
- Shows how to propagate correlation IDs through HTTP headers.
- Provides log level guidance for errors, warnings, info, and debug data.
- Suggests operation prefixes for different service workflows.

## Use Cases

- Add tracing to service failures: Use the skill to add correlation IDs and consistent error fields across related service calls.
- Standardize operational logs: Use the skill to align log levels, event names, and contextual fields across a codebase.
- Improve incident debugging: Use the skill to make production failures easier to follow during incident review.

## Prompt Templates

### Add basic error logs

```
Use the error-logger skill to add structured error logging to this function. Include a correlation ID and clear event type.
```

### Trace a request path

```
Use the error-logger skill to trace this request flow. Propagate the correlation ID through each service boundary.
```

### Review logging consistency

```
Use the error-logger skill to review these logging patterns. Identify missing fields, unclear event types, and inconsistent log levels.
```

### Design an error logging plan

```
Use the error-logger skill to design a structured logging plan for this architecture. Include correlation ID rules, event naming, and level guidance.
```

## Limitations

- Does not include a logging library implementation.
- Does not enforce schemas at runtime.
- Does not configure log storage, alerts, or dashboards.
- Does not define privacy rules for sensitive log fields.

## Best Practices

- Create one correlation ID at the start of each operation.
- Use stable event type names that can be searched reliably.
- Keep sensitive user data out of log context fields.

## Anti Patterns

- Do not create a new correlation ID for every log line in one operation.
- Do not place secrets, tokens, or private data in logs.
- Do not use DEBUG logs for required production incident data.

## Security Audit

- - Safe to publish: true
- - Audited at: 2026-06-28T12:46:28.861\+00:00
- - Summary: Static findings were reviewed against the single skill file. The external command, weak cryptography, and reconnaissance detections are false positives from Markdown examples and descriptive text, with no executable code or prompt injection found.

## Stats

- - Views: 254
- - Downloads: 5
- - Favorites: 0
- - Popularity score: 0
