SE

session-analyzer

Validates session logs against SKILL.md specs to ensure agents followed correct procedures and caught bugs.

Install

mkdir -p .claude/skills/session-analyzer && curl -L -o skill.zip "https://agentskills.codes/api/skills/download/5001" && unzip -o skill.zip -d .claude/skills/session-analyzer && rm skill.zip

Installs to .claude/skills/session-analyzer

Activation

This is the description your AI agent reads to decide when to run this skill — the better it matches your request, the more reliably it fires.

This skill should be used when the user asks to "analyze session", "세션 분석", "evaluate skill execution", "스킬 실행 검증", "check session logs", "로그 분석", provides a session ID with a skill path, or wants to verify that a skill executed correctly in a past session. Post-hoc analysis of Claude Code sessions to validate skill/agent/hook behavior against SKILL.md specifications.
370 chars✓ has a “when” triggerlonger than Claude Code's old 250-char listing cap (fine on current versions)
Advanced

Key capabilities

  • Validate session workflow against SKILL.md
  • Verify tool and subagent call correctness
  • Audit generated artifact files
  • Identify deviation from expected paths

How it works

Parses session JSONL files and cross-references event sequences with expected hooks defined in the target skill.

Inputs & outputs

You give it
Session ID and target SKILL.md path
You get back
Compliance report of agent behavior

When to use session-analyzer

  • Verify if a skill followed its workflow
  • Debug why an agent failed a task
  • Audit component invocation logs
  • Check for missed file generation

About this skill

Session Analyzer Skill

Post-hoc analysis tool for validating Claude Code session behavior against SKILL.md specifications.

Purpose

Analyze completed sessions to verify:

  1. Expected vs Actual Behavior - Did the skill follow SKILL.md workflow?
  2. Component Invocations - Were SubAgents, Hooks, and Tools called correctly?
  3. Artifacts - Were expected files created/deleted?
  4. Bug Detection - Any unexpected errors or deviations?

Input Requirements

ParameterRequiredDescription
sessionIdYESUUID of the session to analyze
targetSkillYESPath to SKILL.md to validate against
additionalRequirementsNOExtra validation criteria

Phase 1: Locate Session Files

Step 1.1: Find Session Files

Session files are located in ~/.claude/:

# Main session log
~/.claude/projects/-{encoded-cwd}/{sessionId}.jsonl

# Debug log (detailed)
~/.claude/debug/{sessionId}.txt

# Agent transcripts (if subagents were used)
~/.claude/projects/-{encoded-cwd}/agent-{agentId}.jsonl

Use script to locate files:

${baseDir}/scripts/find-session-files.sh {sessionId}

Step 1.2: Verify Files Exist

Check all required files exist before proceeding. If debug log is missing, analysis will be limited.


Phase 2: Parse Target SKILL.md

Step 2.1: Extract Expected Components

Read the target SKILL.md and identify:

From YAML Frontmatter:

  • hooks.PreToolUse - Expected PreToolUse hooks and matchers
  • hooks.PostToolUse - Expected PostToolUse hooks
  • hooks.Stop - Expected Stop hooks
  • hooks.SubagentStop - Expected SubagentStop hooks
  • allowed-tools - Tools the skill is allowed to use

From Markdown Body:

  • SubAgents mentioned (Task(subagent_type="..."))
  • Skills called (Skill("..."))
  • Artifacts created (.dev-flow/drafts/, .dev-flow/plans/, etc.)
  • Workflow steps and conditions

Step 2.2: Build Expected Behavior Checklist

Create checklist from SKILL.md analysis:

## Expected Behavior

### SubAgents
- [ ] Explore agent called (parallel, run_in_background)
- [ ] gap-analyzer called before plan generation
- [ ] reviewer called after plan creation

### Hooks
- [ ] PreToolUse[Edit|Write] triggers plan-guard.sh
- [ ] Stop hook validates reviewer approval

### Artifacts
- [ ] Draft file created at .dev-flow/drafts/{name}.md
- [ ] Plan file created at .dev-flow/plans/{name}.md
- [ ] Draft file deleted after OKAY

### Workflow
- [ ] Interview Mode before Plan Generation
- [ ] User explicit request triggers plan generation
- [ ] Reviewer REJECT causes revision loop

Phase 3: Analyze Debug Log

The debug log (~/.claude/debug/{sessionId}.txt) contains detailed execution traces.

Step 3.1: Extract SubAgent Calls

Search patterns:

SubagentStart with query: {agent-name}
SubagentStop with query: {agent-id}

Use script:

${baseDir}/scripts/extract-subagent-calls.sh {debug-log-path}

Step 3.2: Extract Hook Events

Search patterns:

Getting matching hook commands for {HookEvent} with query: {tool-name}
Matched {N} unique hooks for query "{query}"
Hooks: Processing prompt hook with prompt: {prompt}
Hooks: Prompt hook condition was met/not met
permissionDecision: allow/deny

Use script:

${baseDir}/scripts/extract-hook-events.sh {debug-log-path}

Step 3.3: Extract Tool Calls

Search patterns:

executePreToolHooks called for tool: {tool-name}
File {path} written atomically

Step 3.4: Extract Hook Results

For prompt-based hooks, find the model response:

Hooks: Model response: {
  "ok": true/false,
  "reason": "..."
}

Phase 4: Verify Artifacts

Step 4.1: Check File Creation

For each expected artifact:

  1. Search debug log for FileHistory: Tracked file modification for {path}
  2. Search for File {path} written atomically
  3. Verify current filesystem state

Step 4.2: Check File Deletion

For files that should be deleted:

  1. Search for rm commands in Bash calls
  2. Verify file no longer exists on filesystem

Phase 5: Compare Expected vs Actual

Step 5.1: Build Comparison Table

| Component | Expected | Actual | Status |
|-----------|----------|--------|--------|
| Explore agent | 2 parallel calls | 2 calls at 09:39:26 | ✅ |
| gap-analyzer | Called before plan | Called at 09:43:08 | ✅ |
| reviewer | Called after plan | 2 calls (REJECT→OKAY) | ✅ |
| PreToolUse hook | Edit\|Write matcher | Triggered for Write | ✅ |
| Stop hook | Validates approval | Returned ok:true | ✅ |
| Draft file | Created then deleted | Created→Deleted | ✅ |
| Plan file | Created | Exists (10KB) | ✅ |

Step 5.2: Identify Deviations

Flag any mismatches:

  • Missing component calls
  • Wrong order of operations
  • Hook failures
  • Missing artifacts
  • Unexpected errors

Phase 6: Generate Report

Report Template

# Session Analysis Report

## Session Info
- **Session ID**: {sessionId}
- **Target Skill**: {skillPath}
- **Analysis Date**: {date}

---

## 1. Expected Behavior (from SKILL.md)

[Summary of expected workflow]

---

## 2. Skill/SubAgent/Hook Verification

### SubAgents
| SubAgent | Expected | Actual | Time | Result |
|----------|----------|--------|------|--------|
| ... | ... | ... | ... | ✅/❌ |

### Hooks
| Hook | Matcher | Triggered | Result |
|------|---------|-----------|--------|
| ... | ... | ... | ✅/❌ |

---

## 3. Artifacts Verification

| Artifact | Path | Expected State | Actual State |
|----------|------|----------------|--------------|
| ... | ... | ... | ✅/❌ |

---

## 4. Issues/Bugs

| Severity | Description | Location |
|----------|-------------|----------|
| ... | ... | ... |

---

## 5. Overall Result

**Verdict**: ✅ PASS / ❌ FAIL

**Summary**: [1-2 sentence summary]

Scripts Reference

ScriptPurpose
find-session-files.shLocate all files for a session ID
extract-subagent-calls.shParse subagent invocations from debug log
extract-hook-events.shParse hook events from debug log

Usage Example

User: "Analyze session 3cc71c9f-d27a-4233-9dbc-c4f07ea6ec5b against .claude/skills/specify/SKILL.md"

1. Find session files
2. Parse SKILL.md → Expected: Explore, gap-analyzer, reviewer, hooks
3. Analyze debug log → Extract actual calls
4. Verify artifacts → Check .dev-flow/
5. Compare → Build verification table
6. Generate report → PASS/FAIL with details

Additional Resources

Reference Files

  • references/analysis-patterns.md - Detailed grep patterns for log analysis
  • references/common-issues.md - Known issues and troubleshooting

Scripts

  • scripts/find-session-files.sh - Session file locator
  • scripts/extract-subagent-calls.sh - SubAgent call extractor
  • scripts/extract-hook-events.sh - Hook event extractor

When not to use it

  • When debugging live coding issues
  • When session files are missing

Limitations

  • Analysis quality depends on log detail level
  • Requires access to local `~/.claude/` directories

How it compares

It performs automated audit of past interactions whereas manual verification requires reading raw logs.

Compared to similar skills

session-analyzer side by side with the closest alternatives in the catalog.

SkillInstallsUpdatedSafetyDifficulty
session-analyzer (this skill)26moReviewAdvanced
analyzing-logs1425dReviewBeginner
sentry104moCautionBeginner
obsidian-incident-runbook325dReviewIntermediate

Try saying

Example prompts that trigger this skill in your AI assistant.

More by team-attention

View all by team-attention

gmail

team-attention

This skill should be used when the user asks to "check email", "read emails", "send email", "reply to email", "search inbox", or manages Gmail. Supports multi-account Gmail integration for reading, searching, sending, and label management.

169

agent-council

team-attention

Collect and synthesize opinions from multiple AI agents. Use when users say "summon the council", "ask other AIs", or want multiple AI perspectives on a question.

29

youtube-digest

team-attention

This skill should be used when the user asks to "유튜브 정리", "영상 요약", "transcript 번역", "YouTube digest", "영상 퀴즈", or provides a YouTube URL for analysis. Extracts transcript, generates summary/insights/Korean translation, and tests comprehension with 9 quiz questions across 3 difficulty levels. Optional Deep Research for web-based follow-up.

23

dev-scan

team-attention

개발 커뮤니티에서 기술 주제에 대한 다양한 의견 수집. "개발자 반응", "커뮤니티 의견", "developer reactions" 요청에 사용. Reddit, HN, Dev.to, Lobsters 등 종합.

10

google-calendar

team-attention

Google 캘린더 일정 조회/생성/수정/삭제. "오늘 일정", "이번 주 일정", "미팅 추가해줘" 요청에 사용. 여러 계정(work, personal) 통합 조회 지원.

11

kakaotalk

team-attention

This skill should be used when the user asks to "카톡 보내줘", "카카오톡 메시지", "KakaoTalk message", "채팅 읽어줘", "~에게 메시지 보내줘", or needs to send/read messages via KakaoTalk on macOS.

19

You might also like

analyzing-logs

jeremylongshore

Analyze application logs to detect performance issues, identify error patterns, and improve stability by extracting key insights.

14123

sentry

openai

Use when the user asks to inspect Sentry issues or events, summarize recent production errors, or pull basic Sentry health data via the Sentry API; perform read-only queries with the bundled script and require `SENTRY_AUTH_TOKEN`.

1048

obsidian-incident-runbook

jeremylongshore

Troubleshoot Obsidian plugin failures with systematic incident response. Use when plugins crash, data is corrupted, or users report critical issues with your Obsidian plugin. Trigger with phrases like "obsidian crash", "obsidian plugin broken", "obsidian incident", "debug obsidian failure", "obsidian emergency".

346

obsidian-observability

jeremylongshore

Set up comprehensive logging and monitoring for Obsidian plugins. Use when implementing debug logging, tracking plugin performance, or setting up error reporting for your Obsidian plugin. Trigger with phrases like "obsidian logging", "obsidian monitoring", "obsidian debug", "track obsidian plugin".

534

langsmith-observability

davila7

LLM observability platform for tracing, evaluation, and monitoring. Use when debugging LLM applications, evaluating model outputs against datasets, monitoring production systems, or building systematic testing pipelines for AI applications.

430

network-info

UKGovernmentBEIS

Gather network configuration and connectivity information including interfaces, routes, and DNS

329

Search skills

Search the agent skills registry