session-analyzer
過去のセッションIDとスキル定義書(SKILL.md)を基に、スキルやエージェントの動作が仕様通りに実行されたかを検証し、セッションログを分析して問題点を特定するSkill。
📜 元の英語説明(参考)
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.
🇯🇵 日本人クリエイター向け解説
過去のセッションIDとスキル定義書(SKILL.md)を基に、スキルやエージェントの動作が仕様通りに実行されたかを検証し、セッションログを分析して問題点を特定するSkill。
※ jpskill.com 編集部が日本のビジネス現場向けに補足した解説です。Skill本体の挙動とは独立した参考情報です。
下記のコマンドをコピーしてターミナル(Mac/Linux)または PowerShell(Windows)に貼り付けてください。 ダウンロード → 解凍 → 配置まで全自動。
mkdir -p ~/.claude/skills && cd ~/.claude/skills && curl -L -o session-analyzer.zip https://jpskill.com/download/16461.zip && unzip -o session-analyzer.zip && rm session-analyzer.zip
$d = "$env:USERPROFILE\.claude\skills"; ni -Force -ItemType Directory $d | Out-Null; iwr https://jpskill.com/download/16461.zip -OutFile "$d\session-analyzer.zip"; Expand-Archive "$d\session-analyzer.zip" -DestinationPath $d -Force; ri "$d\session-analyzer.zip"
完了後、Claude Code を再起動 → 普通に「動画プロンプト作って」のように話しかけるだけで自動発動します。
💾 手動でダウンロードしたい(コマンドが難しい人向け)
- 1. 下の青いボタンを押して
session-analyzer.zipをダウンロード - 2. ZIPファイルをダブルクリックで解凍 →
session-analyzerフォルダができる - 3. そのフォルダを
C:\Users\あなたの名前\.claude\skills\(Win)または~/.claude/skills/(Mac)へ移動 - 4. Claude Code を再起動
⚠️ ダウンロード・利用は自己責任でお願いします。当サイトは内容・動作・安全性について責任を負いません。
🎯 このSkillでできること
下記の説明文を読むと、このSkillがあなたに何をしてくれるかが分かります。Claudeにこの分野の依頼をすると、自動で発動します。
📦 インストール方法 (3ステップ)
- 1. 上の「ダウンロード」ボタンを押して .skill ファイルを取得
- 2. ファイル名の拡張子を .skill から .zip に変えて展開(macは自動展開可)
- 3. 展開してできたフォルダを、ホームフォルダの
.claude/skills/に置く- · macOS / Linux:
~/.claude/skills/ - · Windows:
%USERPROFILE%\.claude\skills\
- · macOS / Linux:
Claude Code を再起動すれば完了。「このSkillを使って…」と話しかけなくても、関連する依頼で自動的に呼び出されます。
詳しい使い方ガイドを見る →- 最終更新
- 2026-05-18
- 取得日時
- 2026-05-18
- 同梱ファイル
- 6
📖 Skill本文(日本語訳)
※ 原文(英語/中国語)を Gemini で日本語化したものです。Claude 自身は原文を読みます。誤訳がある場合は原文をご確認ください。
Session Analyzer Skill
SKILL.md の仕様に対して Claude Code セッションの動作を検証するための事後分析ツールです。
目的
完了したセッションを分析して、以下を検証します。
- 期待される動作 vs 実際の動作 - スキルは SKILL.md のワークフローに従ったか?
- コンポーネントの呼び出し - SubAgent、Hook、Tool は正しく呼び出されたか?
- 成果物 - 期待されるファイルは作成/削除されたか?
- バグの検出 - 予期しないエラーや逸脱はないか?
入力要件
| パラメータ | 必須 | 説明 |
|---|---|---|
sessionId |
YES | 分析するセッションの UUID |
targetSkill |
YES | 検証対象の SKILL.md へのパス |
additionalRequirements |
NO | 追加の検証基準 |
フェーズ 1: セッションファイルの特定
ステップ 1.1: セッションファイルの検索
セッションファイルは ~/.claude/ にあります。
# メインセッションログ
~/.claude/projects/-{encoded-cwd}/{sessionId}.jsonl
# デバッグログ (詳細)
~/.claude/debug/{sessionId}.txt
# エージェントトランスクリプト (subagent が使用された場合)
~/.claude/projects/-{encoded-cwd}/agent-{agentId}.jsonl
スクリプトを使用してファイルを検索します。
${baseDir}/scripts/find-session-files.sh {sessionId}
ステップ 1.2: ファイルの存在確認
続行する前に、必要なファイルがすべて存在することを確認します。デバッグログがない場合、分析は制限されます。
フェーズ 2: ターゲット SKILL.md の解析
ステップ 2.1: 期待されるコンポーネントの抽出
ターゲット SKILL.md を読み取り、以下を特定します。
YAML Frontmatter から:
hooks.PreToolUse- 期待される PreToolUse hook と matcherhooks.PostToolUse- 期待される PostToolUse hookhooks.Stop- 期待される Stop hookhooks.SubagentStop- 期待される SubagentStop hookallowed-tools- スキルが使用を許可されている Tool
Markdown 本文から:
- 言及されている SubAgent (
Task(subagent_type="...")) - 呼び出される Skill (
Skill("...")) - 作成される成果物 (
.dev-flow/drafts/,.dev-flow/plans/, など) - ワークフローステップと条件
ステップ 2.2: 期待される動作チェックリストの作成
SKILL.md の分析からチェックリストを作成します。
## 期待される動作
### SubAgent
- [ ] Explore agent が呼び出された (parallel, run_in_background)
- [ ] gap-analyzer がプラン生成前に呼び出された
- [ ] reviewer がプラン作成後に呼び出された
### Hook
- [ ] PreToolUse[Edit|Write] が plan-guard.sh をトリガーする
- [ ] Stop hook が reviewer の承認を検証する
### 成果物
- [ ] Draft ファイルが .dev-flow/drafts/{name}.md に作成された
- [ ] Plan ファイルが .dev-flow/plans/{name}.md に作成された
- [ ] Draft ファイルが OKAY 後に削除された
### ワークフロー
- [ ] プラン生成前のインタビューモード
- [ ] ユーザーの明示的なリクエストがプラン生成をトリガーする
- [ ] Reviewer の REJECT がリビジョンループを引き起こす
フェーズ 3: デバッグログの分析
デバッグログ (~/.claude/debug/{sessionId}.txt) には、詳細な実行トレースが含まれています。
ステップ 3.1: SubAgent の呼び出しの抽出
検索パターン:
SubagentStart with query: {agent-name}
SubagentStop with query: {agent-id}
スクリプトの使用:
${baseDir}/scripts/extract-subagent-calls.sh {debug-log-path}
ステップ 3.2: Hook イベントの抽出
検索パターン:
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
スクリプトの使用:
${baseDir}/scripts/extract-hook-events.sh {debug-log-path}
ステップ 3.3: Tool の呼び出しの抽出
検索パターン:
executePreToolHooks called for tool: {tool-name}
File {path} written atomically
ステップ 3.4: Hook の結果の抽出
プロンプトベースの hook の場合、モデルの応答を見つけます。
Hooks: Model response: {
"ok": true/false,
"reason": "..."
}
フェーズ 4: 成果物の検証
ステップ 4.1: ファイルの作成の確認
期待される成果物ごとに:
- デバッグログで
FileHistory: Tracked file modification for {path}を検索します File {path} written atomicallyを検索します- 現在のファイルシステムの状態を検証します
ステップ 4.2: ファイルの削除の確認
削除されるべきファイルの場合:
- Bash 呼び出しで
rmコマンドを検索します - ファイルがファイルシステムに存在しなくなったことを確認します
フェーズ 5: 期待される動作 vs 実際の動作の比較
ステップ 5.1: 比較テーブルの作成
| コンポーネント | 期待される動作 | 実際の動作 | ステータス |
|-----------|----------|--------|--------|
| Explore agent | 2 つの並列呼び出し | 09:39:26 に 2 つの呼び出し | ✅ |
| gap-analyzer | プランの前に呼び出される | 09:43:08 に呼び出された | ✅ |
| reviewer | プランの後に呼び出される | 2 つの呼び出し (REJECT→OKAY) | ✅ |
| PreToolUse hook | Edit\|Write matcher | Write に対してトリガーされた | ✅ |
| Stop hook | 承認を検証する | ok:true を返した | ✅ |
| Draft ファイル | 作成後削除される | 作成→削除 | ✅ |
| Plan ファイル | 作成される | 存在する (10KB) | ✅ |
ステップ 5.2: 逸脱の特定
不一致をすべてフラグします。
- コンポーネントの呼び出しの欠落
- 操作の順序の間違い
- Hook の失敗
- 成果物の欠落
- 予期しないエラー
フェーズ 6: レポートの生成
レポートテンプレート
# セッション分析レポート
## セッション情報
- **セッション ID**: {sessionId}
- **ターゲットスキル**: {skillPath}
- **分析日**: {date}
---
## 1. 期待される動作 (SKILL.md から)
[期待されるワークフローの概要]
---
## 2. スキル/SubAgent/Hook の検証
### SubAgent
| SubAgent | 期待される動作 | 実際の動作 | 時間 | 結果 |
|----------|----------|--------|------|--------|
| ... | ... | ... | ... | ✅/❌ |
### Hook
| Hook | Matcher | トリガーされたか | 結果 |
|------|---------|-----------|--------|
| ... | ... | ... | ✅/❌ |
---
## 3. 成果物の検証
| 成果物 | パス | 期待される状態 | 実際の状態 |
|----------|------|----------------|--------------|
| ... | ... | ... | ✅/❌ |
---
## 4. 問題/バグ
| 重大度 | 説明 | 場所 |
|----------|-------------|----------|
| ... | ... | ... |
---
## 5. 全体的な結果
**判定**: ✅ PASS / ❌ FAIL
**概要**: [1-2 文の概要]
スクリプトリファレンス
| スクリプト | 目的 |
|---|---|
find-session-files.sh |
セッション ID のすべてのファイルを検索します |
| `extract-suba |
📜 原文 SKILL.md(Claudeが読む英語/中国語)を展開
Session Analyzer Skill
Post-hoc analysis tool for validating Claude Code session behavior against SKILL.md specifications.
Purpose
Analyze completed sessions to verify:
- Expected vs Actual Behavior - Did the skill follow SKILL.md workflow?
- Component Invocations - Were SubAgents, Hooks, and Tools called correctly?
- Artifacts - Were expected files created/deleted?
- Bug Detection - Any unexpected errors or deviations?
Input Requirements
| Parameter | Required | Description |
|---|---|---|
sessionId |
YES | UUID of the session to analyze |
targetSkill |
YES | Path to SKILL.md to validate against |
additionalRequirements |
NO | Extra 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 matchershooks.PostToolUse- Expected PostToolUse hookshooks.Stop- Expected Stop hookshooks.SubagentStop- Expected SubagentStop hooksallowed-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:
- Search debug log for
FileHistory: Tracked file modification for {path} - Search for
File {path} written atomically - Verify current filesystem state
Step 4.2: Check File Deletion
For files that should be deleted:
- Search for
rmcommands in Bash calls - 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
| Script | Purpose |
|---|---|
find-session-files.sh |
Locate all files for a session ID |
extract-subagent-calls.sh |
Parse subagent invocations from debug log |
extract-hook-events.sh |
Parse 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 analysisreferences/common-issues.md- Known issues and troubleshooting
Scripts
scripts/find-session-files.sh- Session file locatorscripts/extract-subagent-calls.sh- SubAgent call extractorscripts/extract-hook-events.sh- Hook event extractor
同梱ファイル
※ ZIPに含まれるファイル一覧。`SKILL.md` 本体に加え、参考資料・サンプル・スクリプトが入っている場合があります。
- 📄 SKILL.md (7,447 bytes)
- 📎 references/analysis-patterns.md (5,636 bytes)
- 📎 references/common-issues.md (5,977 bytes)
- 📎 scripts/extract-hook-events.sh (3,840 bytes)
- 📎 scripts/extract-subagent-calls.sh (2,272 bytes)
- 📎 scripts/find-session-files.sh (1,465 bytes)