application-logging — Claude Code skill: structured logs and ELK
A skill that walks your agent through structured logging: levels, context, request tracing and centralized aggregation.
npx skills add aj-geddes/useful-ai-prompts --skill application-logging -a claude-codeWhat application-logging does
The skill gives your agent a procedure for adding structured logging to an application: JSON output, sensible levels, context attached to error messages, request IDs for tracing. It ships a short working winston logger example for Node.js plus reference guides in the references/ directory covering Node.js and Python logging, Express HTTP request logging, Flask integration, ELK stack setup and Logstash configuration.
Reach for it when something misbehaves in production and the logs don't tell you why, or when logs exist but sit in one flat file with no structure. The skill also spells out hygiene rules: keep passwords and secrets out of logs, don't log every operation at INFO, don't let log files grow without a bound. One piece of advice is worth a second look — it says not to log to stdout in production, yet containers and Kubernetes collect logs from stdout in the first place.
The reference material targets Node.js and Python, so other stacks get the general guidance only. Install runs through npx skills add for Claude, Codex, Cursor, Gemini CLI and OpenCode; GitHub Copilot uses gh skill install.
What it helps with
- split application logs into levels and structure instead of flat lines
- attach request IDs so a request can be traced across services
- stand up an ELK stack and write a Logstash config for your logs
- set up log rotation so files don't grow without a bound
- strip passwords and secrets out of what gets logged
Example prompts for the agent
- set up structured logging with winston in my Node.js service
- add request IDs to the Express logs and keep tokens out of them
- help me deploy the ELK stack and write a Logstash config for our logs
How to install application-logging
1Skills CLI (Vercel)
npx skills add aj-geddes/useful-ai-prompts --skill application-logging -a claude-code2Manually: put the files in place
~/.claude/skills/application-logging/SKILL.mdCopy the whole skill folder; for one project use .claude/skills/application-logging/
1Skills CLI (Vercel)
npx skills add aj-geddes/useful-ai-prompts --skill application-logging -a codex2Manually: put the files in place
.agents/skills/application-logging/SKILL.mdFor all projects use ~/.agents/skills/
1Skills CLI (Vercel)
npx skills add aj-geddes/useful-ai-prompts --skill application-logging -a cursor2Manually: put the files in place
.cursor/skills/application-logging/SKILL.mdCursor also reads .agents/skills/ and .claude/skills/
1GitHub CLI
gh skill install aj-geddes/useful-ai-prompts application-logging2Manually: put the files in place
.github/skills/application-logging/SKILL.md1Skills CLI (Vercel)
npx skills add aj-geddes/useful-ai-prompts --skill application-logging -a gemini-cli2Platform CLI
gemini skills install https://github.com/aj-geddes/useful-ai-prompts --path skills/application-loggingManually: put the files in place
.devin/skills/application-logging/SKILL.mdThe legacy .windsurf/skills/ path still works
Skills CLI (Vercel)
npx skills add aj-geddes/useful-ai-prompts --skill application-logging -a opencodeClaude.ai
Zip the folder and upload it in Settings → Capabilities → Skills
Step by step, with commands for each platform: How to install skills in Claude Code: five ways
Questions about application-logging
How do I install application-logging in Claude?
Run npx skills add aj-geddes/useful-ai-prompts --skill application-logging -a claude-code. The skill file then lands at ~/.claude/skills/application-logging/SKILL.md.
What does application-logging do?
It guides your agent through structured logging: JSON format, levels, error context, request IDs. It also bundles reference guides for Node.js, Python, Express, Flask and the ELK stack.
Which languages have ready-made examples?
The guides under references/ cover Node.js and Python, including Express HTTP request logging and Flask integration. Other languages get the general rules only.
Source text
SKILL.md · MIT
---
name: application-logging
description: >
Implement structured logging across applications with log aggregation and
centralized analysis. Use when setting up application logging, implementing
ELK stack, or analyzing application behavior.
---
# Application Logging
## Table of Contents
- [Overview](#overview)
- [When to Use](#when-to-use)
- [Quick Start](#quick-start)
- [Reference Guides](#reference-guides)
- [Best Practices](#best-practices)
## Overview
Implement comprehensive structured logging with proper levels, context, and centralized aggregation for effective debugging and monitoring.
## When to Use
- Application debugging
- Audit trail creation
- Performance analysis
- Compliance requirements
- Centralized log aggregation
## Quick Start
Minimal working example:
```javascript
// logger.js
const winston = require("winston");
const logFormat = winston.format.combine(
winston.format.timestamp({ format: "YYYY-MM-DD HH:mm:ss" }),
winston.format.errors({ stack: true }),
winston.format.json(),
);
const logger = winston.createLogger({
level: process.env.LOG_LEVEL || "info",
format: logFormat,
defaultMeta: {
service: "api-service",
environment: process.env.NODE_ENV || "development",
},
transports: [
new winston.transports.Console({
format: winston.format.combine(
winston.format.colorize(),
winston.format.simple(),
),
}),
new winston.transports.File({
filename: "logs/error.log",
// ... (see reference guides for full implementation)
```
## Reference Guides
Detailed implementations in the `references/` directory:
| Guide | Contents |
|---|---|
| [Node.js Structured Logging with Winston](references/nodejs-structured-logging-with-winston.md) | Node.js Structured Logging with Winston |
| [Express HTTP Request Logging](references/express-http-request-logging.md) | Express HTTP Request Logging |
| [Python Structured Logging](references/python-structured-logging.md) | Python Structured Logging |
| [Flask Integration](references/flask-integration.md) | Flask Integration |
| [ELK Stack Setup](references/elk-stack-setup.md) | ELK Stack Setup |
| [Logstash Configuration](references/logstash-configuration.md) | Logstash Configuration |
## Best Practices
### ✅ DO
- Use structured JSON logging
- Include request IDs for tracing
- Log at appropriate levels
- Add context to error logs
- Implement log rotation
- Use timestamps consistently
- Aggregate logs centrally
- Filter sensitive data
### ❌ DON'T
- Log passwords or secrets
- Log at INFO for every operation
- Use unstructured messages
- Ignore log storage limits
- Skip context information
- Log to stdout in production
- Create unbounded log files
© aj-geddes · MIT · aj-geddes/useful-ai-prompts