Skip to content
Back to skills

Logging Rules

ASecurity

Standing rules for logs an assistant writes, with structured fields, meaningful levels, no secrets or personal data, correlation IDs and errors logged once where they are handled.

  • 2 stars
  • 0 votes
  • 0 copies
  • 1 view
  • Added November 26, 2026
ai-agentsrustgoapi

Works with

  • api

Security analysis

A100/100

Pro scans all 2 files and shows the line behind each finding

Scanned November 26, 2026

npx -y skills add hermes-hq/hodios-dist --skill logging-rules --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Logging Rules?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Logging Rules
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/hermes-hq-logging-rules/badge)](https://www.skillsdirectory.com/skills/hermes-hq-logging-rules)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
name: logging-rules
description: Standing rules for logs an assistant writes, with structured fields, meaningful levels, no secrets or personal data, correlation IDs and errors logged once where they are handled.
license: CC0-1.0
metadata:
  version: 1.0.0
  kind: rule
  category: incident
  source: https://hermes-ide.com/prompts/logging-rules
  catalog: 2026.1014.1
---

# Logging rules

When you add or change logging, follow these rules. Logs are read at 3 a.m. by someone who did not write the code, and they are stored, copied and searched by many people, so write them for that reader and that exposure.

Format
- Use the project's existing logger and its structured API. Never use `print`, `console.log` or string-built log lines in application code.
- Keep the message a constant, human-readable phrase ("payment captured") and put variable data in named fields (`order_id`, `amount_cents`, `provider`). Do not interpolate values into the message; it breaks grouping and search.
- Follow the project's field naming convention. Put units in field names (`duration_ms`, `size_bytes`).

Levels
- ERROR: something failed and needs a human or an automated response. Every ERROR should be actionable.
- WARN: something unexpected happened and was handled, but may need attention if it repeats.
- INFO: significant business or lifecycle events (started, order placed, job finished), not every function call.
- DEBUG: detail for diagnosing problems; assume it is off in production.
- Do not log expected outcomes, like a validation failure caused by user input, as errors.

What never goes in logs
- Secrets of any kind: passwords, API keys, tokens, session cookies, `Authorization` headers, private keys, connection strings with credentials.
- Personal data beyond what is necessary to act: no full names, email addresses, phone numbers, addresses, government ids, card numbers or health data. Log an internal id instead, or a masked value if the user asks for one.
- Full request or response bodies. Log selected, safe fields.
- If you are unsure whether a field is sensitive, leave it out and mention it.

Context and correlation
- Include the request id, trace id or correlation id on every log line in a request or job, propagated from incoming headers or the tracing context, and pass it to downstream calls.
- Include the identifiers someone needs to act: which order, tenant, job or resource.

Errors
- Log an error once, where it is handled, with the exception and stack trace attached through the logger's error field. Do not log and rethrow at every layer.
- Error messages say what failed and with which identifiers, not just "error occurred".

Volume and safety
- Do not log inside tight loops or per item in large batches; log a summary with counts.
- Treat user-supplied values in fields as untrusted: rely on the structured logger to escape them, and never write them raw into a line-based format where newlines could forge entries.
- Where a metric or trace span fits better (counts, latencies), emit that instead of a log line.

Files in this skill

  • SKILL.md3 KB
  • agents/openai.yaml285 B

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

View all in ai-agents →

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.