Command Palette

Search for a command to run...

UnylyUnyly
Назад к скиллам

debug-log-analysis

БесплатноЗапускает вложенные скриптыНе проверен

Structured debug log analysis for Claude Code sessions — auto-discovers most recent log, runs reducer, extracts error patterns, correlates with full log…

oimiragieoот oimiragieo★ 48 звёзд на GitHub

Об этом скилле

Mode: Cognitive/Prompt-Driven — No standalone utility script; use via agent context.

Debug Log Analysis

Structured workflow for extracting actionable signal from Claude Code session debug logs. Use during reflection cycles, incident response, or when diagnosing agent failures.

When to Use

  • After any session with unexpected agent failures or stalls
  • When reflection-agent needs telemetry to contextualize task completions
  • When debugging hook errors that appear opaque in task outputs
  • When the router reports "agent completed but didn't call TaskUpdate"

Prerequisites

The scripts/reduce-debug-log.mjs script auto-detects the most recent log when no file argument is provided. It copies the log to .tmp/ and produces a reduced version there.

Step 0: Determine Analysis Mode

Two modes are available:

Auto mode (recommended): Let pnpm debug:reduce find and process the most recent log automatically.

Manual mode: Provide a specific session UUID or log file path.

Step 1: Locate and Reduce the Debug Log

IMPORTANT: Always find the most recent log dynamically. NEVER hardcode session UUIDs.

Auto mode (preferred)

# Auto-detect most recent log, copy to .tmp/, reduce in place
cd /c/dev/projects/agent-studio && node scripts/reduce-debug-log.mjs 2>&1

# The script prints:
# Auto-detected debug log: /home/user/.claude/debug/{session-uuid}.txt
# Copied to: .tmp/{session-uuid}.txt
# Original: N lines -> kept (issue-like): M -> ... -> after dedupe: K
# Output: .tmp/{session-uuid}-reduced.txt

Capture the output paths from the script output for subsequent steps.

Manual mode (when a specific session is needed)

# List recent debug logs sorted by modification time (most recent first)
ls -t "$HOME/.claude/debug/"*.txt 2>/dev/null | head -5

# Or on Windows (Git Bash):
ls -t "$USERPROFILE/.claude/debug/"*.txt 2>/dev/null | head -5

Pick the target log path, then:

# Copy to temp (never operate on the original)
mkdir -p .claude/context/tmp
cp "$HOME/.claude/debug/{session-uuid}.txt" ".claude/context/tmp/debug-session-copy.txt"

# Run reducer with explicit output path
node scripts/reduce-debug-log.mjs \
  ".claude/context/tmp/debug-session-copy.txt" \
  --output ".claude/context/tmp/debug-session-reduced.txt"

Verify reduction succeeded

# Check sizes
wc -l ".claude/context/tmp/debug-session-copy.txt"
wc -l ".claude/context/tmp/debug-session-reduced.txt"

Expected: reduced file is 1-5% of original line count (98%+ noise removed).

Step 2: Compare Original vs Reduced

Calculate what was filtered out to understand the filter quality:

ORIGINAL_LINES=$(wc -l < ".claude/context/tmp/debug-session-copy.txt")
REDUCED_LINES=$(wc -l < ".claude/context/tmp/debug-session-reduced.txt")
echo "Original: $ORIGINAL_LINES lines | Reduced: $REDUCED_LINES lines"
echo "Kept: $(echo "scale=1; $REDUCED_LINES * 100 / $ORIGINAL_LINES" | bc)%"

Note any anomalies — e.g., if reduction is less than 90%, the session had unusually many errors.

Step 3: Read Reduced Log

Read .claude/context/tmp/debug-session-reduced.txt in full.

Step 4: Categorize Error Patterns in Reduced Log

For each line in the reduced log, classify into:

Category Signal Pattern Action
Hook Block (Write) PreToolUse:Write + block Count; find triggering agent + file path
Hook Block (TaskUpdate) PreToolUse:TaskUpdate + burst Count; find looping agent
Read Miss File does not exist or placeholder text Count; list missing files
Token Overflow FileTooLargeError or token limit Count; identify large files
Streaming Stall Gap > 60s between log entries Sum duration; note what preceded stall
Agent Drop TaskUpdate not called or agent returned without completion List by task ID
Tool Error EISDIR, ENOENT, sibling tool call errored Categorize by tool

Step 5: Cross-Reference Top Errors in Full Log

For the top 3 most frequent error categories:

  1. Grep the FULL (unreduced) log copy for the error signature
  2. Find the 10 lines before and after each occurrence
  3. Identify: which tool call triggered it, which agent was running, what it was trying to do
# Use the full copy (not the original, not the reduced)
grep -n "PreToolUse:Write" ".claude/context/tmp/debug-session-copy.txt" | head -30
grep -n "File does not ex
Полный SKILL.md на GitHub

Установить debug-log-analysis в Claude Code и Claude Desktop

Зарегайся, чтобы установить скилл

Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.

  • Открой команду установки в одну строку
  • Сохраняй скиллы в синхронизируемую библиотеку
  • Уведомления, когда скиллы обновляются
Зарегаться бесплатноУ меня уже есть аккаунт

Разрешённые инструменты

Инструменты, которые скиллу разрешено вызывать.

Read
Write
Bash
Grep

Вложенные файлы

commands/debug-log-analysis.mdhooks/post-execute.cjshooks/pre-execute.cjsreferences/research-requirements.mdrules/debug-log-analysis.mdschemas/input.schema.jsonschemas/output.schema.jsonscripts/main.cjstemplates/implementation-template.md

FAQ

Что делает скилл debug-log-analysis?

Structured debug log analysis for Claude Code sessions — auto-discovers most recent log, runs reducer, extracts error patterns, correlates with full log, produces observability report. Fills 5 identified gaps: hook error body capture, agent identity, file path tracking, stall correlation, success visibility.

Как установить скилл debug-log-analysis?

Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.

Скилл debug-log-analysis запускает скрипты?

Да, скилл несёт исполняемые скрипты. Проверь исходник перед установкой.

Похожие скиллы

Сравнить debug-log-analysis с