mcpbeat Sign in

Session Debug Skill for Claude

> Debug a specific session by inspecting its full event chain (PreToolUse, PostToolUse, Stop, SubagentStop, Compaction, APIError, TurnDuration, Notification events), agent hierarchy (recursive parent/child tree with subagent_type and depth), token usage with compaction baselines, workflow intelligence data (orchestration DAG, error propagation by depth), and session metadata (thinking_blocks, turn_count, total_turn_duration_ms).

708 tokens
context cost
the whole folder, loaded on every use
1
files
instructions only
0
copies elsewhere
how many repositories repackaged it
867
stars on the repo
on the repository, not the skill itself

Install

one command, takes just this skill from the repository
npx skills add https://github.com/hoangsonww/Claude-Code-Agent-Monitor --skill session-debug

The instruction itself

9 sections, as written by the author

Session Debug

Debug and inspect a Claude Code session from Agent Monitor data.

Input

The user provides: $ARGUMENTS

This may be:

  • A session ID to debug
  • "latest" or "last" for the most recent session
  • "errors" to find and debug the most recent errored session

Procedure

  • Identify the target session:
  • If session ID given: GET /api/sessions/{id} from http://localhost:4820
  • If "latest": GET /api/sessions?limit=1 (default sort: most recently updated first)
  • If "errors": GET /api/sessions?limit=10&status=error
  • Collect full session data:
  • Session metadata: status, model, cwd, timestamps, duration
  • Events: GET /api/events?session_id={session_id} — full event timeline
  • Agents: GET /api/agents?session_id={session_id} — all agents in session
  • Cost: GET /api/pricing/cost/{session_id}
  • Analyze the session:

Session Lifecycle

  • Start time → first event → last event → end time
  • Status transitions (active → working → completed/error)
  • Total duration and active-vs-idle time

Event Chain Analysis

  • Chronological event list with timestamps and durations
  • Identify the critical path (longest chain of dependent events)
  • Flag events that took unusually long
  • Highlight error events with full error context

Agent Inspection

  • List all agents: type, task, status, duration
  • Subagent tree visualization (parent → children)
  • Agents that failed and their last known state
  • Agent switching patterns (when and why new agents spawned)

Tool Execution Trace

  • Every tool invocation in order with: tool name, duration, success/failure
  • Failed tool calls with error messages
  • Tool retry patterns (same tool called multiple times)

Anomaly Detection

  • Events out of expected order
  • Gaps in event timeline (>30s with no events)
  • Duplicate events or agent states
  • Token usage spikes (compaction indicators)
  • Diagnosis:
  • Root cause hypothesis (if errors present)
  • Contributing factors
  • Remediation suggestions

Output Format

Present as a debug report with:

  • Session summary header (ID, status, model, duration, cost)
  • Color-coded timeline (✅ success, ❌ error, ⚠️ warning, ℹ️ info)
  • Agent tree diagram
  • Diagnosis section with numbered findings

Other skills for the same job

different authors, same section of the catalogue
Skill Creator
by anthropics
vendor ×10

Create new skills, modify and improve existing skills, and measure skill performance. Use when users want to create a skill from scratch, edit, or optimize an existing skill, run evals to test a skill, benchmark skill performance with variance analysis, or optimize a skill's description for better triggering accuracy.

56k tokens scripts
Skill Creator
by vercel-labs
vendor ×10

Guide for creating effective skills. This skill should be used when users want to create a new skill (or update an existing skill) that extends Claude's capabilities with specialized knowledge, workflows, or tool integrations.

12k tokens scripts
Skill Creator
by JayZeeDesign
×9

Guide for creating effective skills. This skill should be used when users want to create a new skill (or update an existing skill) that extends Claude's capabilities with specialized knowledge, workflows, or tool integrations.

10k tokens scripts
Template Skill
by JayZeeDesign
×7

Replace with description of the skill and when Claude should use it.

35 tokens
Dispatching Parallel Agents
by ZhanlinCui
×5

Use when facing 2+ independent tasks that can be worked on without shared state or sequential dependencies

2k tokens
Skill Development
by anthropics
vendor ×4

This skill should be used when the user wants to "create a skill", "add a skill to plugin", "write a new skill", "improve skill description", "organize skill content", or needs guidance on skill structure, progressive disclosure, or skill development best practices for Claude Code plugins.

9k tokens
Find Skills
by sanity-io
vendor ×4

Helps users discover and install agent skills when they ask questions like "how do I do X", "find a skill for X", "is there a skill that can...", or express interest in extending capabilities. This skill should be used when the user is looking for functionality that might exist as an installable skill.

1k tokens
Writing Skills
by ZhanlinCui
×4

Use when creating new skills, editing existing skills, or verifying skills work before deployment

26k tokens scripts

How to use it

Copy the folder

Take hoangsonww/session-debug from the repository into ~/.claude/skills for personal use, or into .claude/skills inside a project.

Check the name does not clash

The agent identifies a skill by the name field in its header. Two skills with the same name cannot sit side by side — one of them will be ignored.