python-structured-logging
Installation
SKILL.md
Python Structured Logging
Core Rule
Logs are operational events, not developer diary entries.
Workflow
- Inspect the current stack first:
structlog, stdliblogging, or a project wrapper. - Preserve the current direction unless it is harmful or migration was explicitly requested.
- If the project uses stdlib
loggingintentionally, improve message shape andextrafields instead of forcingstructlog. - Replace prose or dynamic event names with stable
snake_caseevents. - Move variable data into structured fields and bind shared context once near the request or job boundary.
- Keep one meaningful exception log at the layer that owns the failure, with a traceback when needed.
- Remove or redact sensitive data before it reaches bound context or payload fields.
- Verify output shape, levels, and noise after the change.