Skip to main content
skill CX Codex

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.

Install into Claude Code · Skills CLI (Vercel) All methods and platforms ↓
npx skills add aj-geddes/useful-ai-prompts --skill log-analysis -a claude-code
Open on GitHub

What 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.log to 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-code

2Manually: put the files in place

~/.claude/skills/log-analysis/SKILL.md

Copy the whole skill folder; for one project use .claude/skills/log-analysis/

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.

From the same set118

security-compliance-audit A skill that walks through security compliance checks for SOC 2, GDPR, HIPAA, PCI-DSS and ISO 27001. Useful before certification or an annual audit. CX Codex +1 665installs gitlab-cicd-pipeline A skill that steers your agent through writing .gitlab-ci.yml: stages, jobs, caching, artifacts, Kubernetes deploys. Useful when a pipeline needs building or reworking. CX Codex +1 664installs websocket-implementation A coding skill that walks you through building a WebSocket server: connection management, message routing, and Redis-based scaling. CX Codex +1 663installs project-estimation A skill that helps the agent estimate project scope, timeline and resources. Useful when you need a budget or a plan you can defend. CX Codex +1 659installs image-optimization A skill that walks your agent through compressing images and picking modern formats. Useful before a deploy, when pages drag on mobile networks. CX Codex +1 656installs requirements-gathering Walks your agent through collecting and documenting stakeholder requirements before development starts. Useful at project kickoff and feature planning. CX Codex +1 655installs ruby-rails-application Guides building Ruby on Rails applications with Active Record models, RESTful controllers, and JWT authentication. Best for structuring Rails APIs and managing database schemas. CX Codex +1 655installs api-rate-limiting Guides the implementation of token bucket and sliding window rate limiting. Protects APIs from brute force attacks and traffic surges using Redis or Flask. CX Codex +1 640installs

Project sponsors

Companies that keep this analytics open
Gold sponsor

Impressions, clicks and code copies — open statistics. We keep the numbers public for the same reason NeBlask itself is public. Become a sponsor