log-analysis · aj-geddes — Claude Code skill: parse logs, find root causes
A skill that helps the agent read application and system logs: spot errors, recurring patterns and the root cause of a failure. Useful when a service breaks and you need answers.
npx skills add aj-geddes/useful-ai-prompts --skill log-analysis -a claude-codeWhat log-analysis does
The skill teaches the agent to treat logs as data, not prose. It ships JavaScript examples of structured logging: an object with level, timestamp, service, user_id, action, status, duration_ms and ip_address instead of one line nobody can parse later. There is also a JSON shape built for Elasticsearch, with trace_id and a nested error block.
Four reference guides sit in references/: structured logging, log levels and patterns, analysis tools, and common queries. The agent pulls from them when you ask why something failed or how often an error fires.
The skill describes an approach; it does not attach to your log stream. If your code still writes single-line console.log output, switch to structured output first, because there will be nothing to parse otherwise.
What it helps with
- trace a service crash back to its root cause
- move logging from
console.logto structured JSON - build Elasticsearch queries for frequent errors
- walk through a security incident via user actions
- judge application health from log levels and patterns
Example prompts for the agent
- read this log and find the root cause of the error
- rewrite logging in auth-service to structured format
- which Elasticsearch queries show the error spike in the last hour
How to install log-analysis
1Skills CLI (Vercel)
npx skills add aj-geddes/useful-ai-prompts --skill log-analysis -a claude-code2Manually: put the files in place
~/.claude/skills/log-analysis/SKILL.mdCopy the whole skill folder; for one project use .claude/skills/log-analysis/
1Skills CLI (Vercel)
npx skills add aj-geddes/useful-ai-prompts --skill log-analysis -a codex2Manually: put the files in place
.agents/skills/log-analysis/SKILL.mdFor all projects use ~/.agents/skills/
1Skills CLI (Vercel)
npx skills add aj-geddes/useful-ai-prompts --skill log-analysis -a cursor2Manually: put the files in place
.cursor/skills/log-analysis/SKILL.mdCursor also reads .agents/skills/ and .claude/skills/
1GitHub CLI
gh skill install aj-geddes/useful-ai-prompts log-analysis2Manually: put the files in place
.github/skills/log-analysis/SKILL.md1Skills CLI (Vercel)
npx skills add aj-geddes/useful-ai-prompts --skill log-analysis -a gemini-cli2Platform CLI
gemini skills install https://github.com/aj-geddes/useful-ai-prompts --path skills/log-analysisManually: put the files in place
.devin/skills/log-analysis/SKILL.mdThe legacy .windsurf/skills/ path still works
Skills CLI (Vercel)
npx skills add aj-geddes/useful-ai-prompts --skill log-analysis -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 log-analysis
How do I install log-analysis in Claude?
Run npx skills add aj-geddes/useful-ai-prompts --skill log-analysis -a claude-code. The skill lands in ~/.claude/skills/log-analysis/SKILL.md.
What does log-analysis do?
It guides the agent through application and system logs: finding errors, recurring patterns and the root cause of a failure. It leans on structured logging and reference guides for analysis tools.
Which platforms support the skill?
Claude, Codex, Cursor, GitHub Copilot, Gemini CLI and OpenCode. Each platform has its own install command.
Source text
SKILL.md · MIT
---
name: log-analysis
description: >
Analyze application and system logs to identify errors, patterns, and root
causes. Use log aggregation tools and structured logging for effective
debugging.
---
# Log Analysis
## Table of Contents
- [Overview](#overview)
- [When to Use](#when-to-use)
- [Quick Start](#quick-start)
- [Reference Guides](#reference-guides)
- [Best Practices](#best-practices)
## Overview
Logs are critical for debugging and monitoring. Effective log analysis quickly identifies issues and enables root cause analysis.
## When to Use
- Troubleshooting errors
- Performance investigation
- Security incident analysis
- Auditing user actions
- Monitoring application health
## Quick Start
Minimal working example:
```javascript
// Good: Structured logs (machine-readable)
logger.info({
level: 'INFO',
timestamp: '2024-01-15T10:30:00Z',
service: 'auth-service',
user_id: '12345',
action: 'user_login',
status: 'success',
duration_ms: 150,
ip_address: '192.168.1.1'
});
// Bad: Unstructured logs (hard to parse)
console.log('User 12345 logged in successfully in 150ms from 192.168.1.1');
// JSON Format (Elasticsearch friendly)
{
"@timestamp": "2024-01-15T10:30:00Z",
"level": "ERROR",
"service": "api-gateway",
"trace_id": "abc123",
"message": "Database connection failed",
"error": {
"type": "ConnectionError",
"code": "ECONNREFUSED"
// ... (see reference guides for full implementation)
```
## Reference Guides
Detailed implementations in the `references/` directory:
| Guide | Contents |
|---|---|
| [Structured Logging](references/structured-logging.md) | Structured Logging |
| [Log Levels & Patterns](references/log-levels-patterns.md) | Log Levels & Patterns |
| [Log Analysis Tools](references/log-analysis-tools.md) | Log Analysis Tools |
| [Common Log Analysis Queries](references/common-log-analysis-queries.md) | Common Log Analysis Queries |
## Best Practices
### ✅ DO
- Follow established patterns and conventions
- Write clean, maintainable code
- Add appropriate documentation
- Test thoroughly before deploying
### ❌ DON'T
- Skip testing or validation
- Ignore error handling
- Hard-code configuration values
© aj-geddes · MIT · aj-geddes/useful-ai-prompts
Similar skills
Everything for DevOps and infrastructure →log-analysis by other authors comes first.