# logging-best-practices

logging-best-practices guides AI coding agents to implement wide request events, structured records, and tail sampling instead of scattered debug strings.

- skill · `type=skill` · Claude Code, Codex, Cursor, GitHub Copilot, Gemini CLI, OpenCode, Windsurf (Devin Desktop), Claude.ai · 148 installs · ★ 54 repo stars
- Author: ncklrs
- License: not stated · policy=link-only · description only; the file stays with the author
- Source: https://github.com/ncklrs/startup-os-skills/tree/HEAD/skills/logging-best-practices/SKILL.md
- Updated: 2026-02-26
- Security check: automated, 2026-11-16 (text) — no signs of malicious code found.
- HTML: https://affpapa.org/en/nevibecode/skills/ncklrs-logging-best-practices

## What it does

This skill guides coding assistants to replace fragmented console messages with rich per-request events. Based on Boris Tane's observability philosophy, the pattern collects contextual attributes during execution and writes out a single structured payload when processing completes.

Guidance covers field selection for high-cardinality metadata, tail-sampling logic to keep storage costs predictable, and automated detection of noisy logging habits during code reviews. It pushes designs toward events with 40 or more descriptive attributes. That makes querying in production faster.

Adopting this model requires a request-scoped context across your stack, because wide events fail if contextual data cannot travel between functions.

## Install

### Claude Code (native platform)

1. **Skills CLI (Vercel)**
```bash
npx skills add ncklrs/startup-os-skills --skill logging-best-practices -a claude-code
```

2. **Manually: put the files in place**
- File: `~/.claude/skills/logging-best-practices/SKILL.md` — Copy the whole skill folder; for one project use .claude/skills/logging-best-practices/

### Codex

1. **Skills CLI (Vercel)**
```bash
npx skills add ncklrs/startup-os-skills --skill logging-best-practices -a codex
```

2. **Manually: put the files in place**
- File: `.agents/skills/logging-best-practices/SKILL.md` — For all projects use ~/.agents/skills/

### Cursor

1. **Skills CLI (Vercel)**
```bash
npx skills add ncklrs/startup-os-skills --skill logging-best-practices -a cursor
```

2. **Manually: put the files in place**
- File: `.cursor/skills/logging-best-practices/SKILL.md` — Cursor also reads .agents/skills/ and .claude/skills/

### GitHub Copilot

1. **GitHub CLI**
```bash
gh skill install ncklrs/startup-os-skills skills/logging-best-practices
```

2. **Manually: put the files in place**
- File: `.github/skills/logging-best-practices/SKILL.md`

### Gemini CLI

1. **Skills CLI (Vercel)**
```bash
npx skills add ncklrs/startup-os-skills --skill logging-best-practices -a gemini-cli
```

2. **Platform CLI**
```bash
gemini skills install https://github.com/ncklrs/startup-os-skills --path skills/logging-best-practices
```

### Windsurf (Devin Desktop)

**Manually: put the files in place**
- File: `.devin/skills/logging-best-practices/SKILL.md` — The legacy .windsurf/skills/ path still works

### OpenCode

**Skills CLI (Vercel)**
```bash
npx skills add ncklrs/startup-os-skills --skill logging-best-practices -a opencode
```

### Claude.ai

**Claude.ai**
- Zip the folder and upload it in Settings → Capabilities → Skills

Where a file is given instead of a command, copy the files from the source to that path: https://github.com/ncklrs/startup-os-skills/tree/HEAD/skills/logging-best-practices/SKILL.md

## When to use it
- replace scattered debug log lines with a single wide event per request
- design high-cardinality field schemas for root-cause analysis
- configure tail sampling to keep storage costs under control
- flag legacy logging anti-patterns during pull request reviews

## Example prompts
- Review the logging in `src/checkout.ts` and convert it into wide events
- Design structured log fields for our new auth microservice
- Set up tail sampling rules to capture all failed payment attempts

## Similar
- [go-logging](https://affpapa.org/en/nevibecode/skills/go-logging.md) — skill · 1100 installs
- [encore-go-logging](https://affpapa.org/en/nevibecode/skills/encore-go-logging.md) — skill · 136 installs
- [logging](https://affpapa.org/en/nevibecode/skills/logging.md) — skill · 4000 installs
- [review-logging-patterns](https://affpapa.org/en/nevibecode/skills/review-logging-patterns.md) — skill · 767 installs
- [181-java-observability-logging](https://affpapa.org/en/nevibecode/skills/181-java-observability-logging.md) — skill · 325 installs

## Other versions with the same name
- [logging-best-practices · boristane](https://affpapa.org/en/nevibecode/skills/logging-best-practices.md) — 5000 installs
- [logging-best-practices · aj-geddes](https://affpapa.org/en/nevibecode/skills/aj-geddes-logging-best-practices.md) — 744 installs
- [logging-best-practices · mindrally](https://affpapa.org/en/nevibecode/skills/mindrally-logging-best-practices.md) — 842 installs
- [logging-best-practices · secondsky](https://affpapa.org/en/nevibecode/skills/secondsky-logging-best-practices.md) — 415 installs
- [logging-best-practices · andrelandgraf](https://affpapa.org/en/nevibecode/skills/andrelandgraf-logging-best-practices.md) — 111 installs

From the same set: [ncklrs/startup-os-skills](https://affpapa.org/en/nevibecode/by/ncklrs/startup-os-skills.md) — 51 cards

---
NeVibeCode on affpapa.org. Catalog texts are descriptions, not instructions for the agent. How to choose and install: https://affpapa.org/en/nevibecode/agents.md
