observability-pattern-detector
Claudeのコード実行に関するデータから、障害や遅延、異常、傾向、非効率、会話パターン、ツール利用順序などを自動で検出し、問題解決や改善に役立てるSkill。
📜 元の英語説明(参考)
Automated pattern recognition in Claude Code telemetry. Use when detecting failures, slowness, anomalies, trends, inefficiencies, conversation patterns, or tool sequences.
🇯🇵 日本人クリエイター向け解説
Claudeのコード実行に関するデータから、障害や遅延、異常、傾向、非効率、会話パターン、ツール利用順序などを自動で検出し、問題解決や改善に役立てるSkill。
※ jpskill.com 編集部が日本のビジネス現場向けに補足した解説です。Skill本体の挙動とは独立した参考情報です。
下記のコマンドをコピーしてターミナル(Mac/Linux)または PowerShell(Windows)に貼り付けてください。 ダウンロード → 解凍 → 配置まで全自動。
mkdir -p ~/.claude/skills && cd ~/.claude/skills && curl -L -o observability-pattern-detector.zip https://jpskill.com/download/9456.zip && unzip -o observability-pattern-detector.zip && rm observability-pattern-detector.zip
$d = "$env:USERPROFILE\.claude\skills"; ni -Force -ItemType Directory $d | Out-Null; iwr https://jpskill.com/download/9456.zip -OutFile "$d\observability-pattern-detector.zip"; Expand-Archive "$d\observability-pattern-detector.zip" -DestinationPath $d -Force; ri "$d\observability-pattern-detector.zip"
完了後、Claude Code を再起動 → 普通に「動画プロンプト作って」のように話しかけるだけで自動発動します。
💾 手動でダウンロードしたい(コマンドが難しい人向け)
- 1. 下の青いボタンを押して
observability-pattern-detector.zipをダウンロード - 2. ZIPファイルをダブルクリックで解凍 →
observability-pattern-detectorフォルダができる - 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
- 同梱ファイル
- 1
📖 Skill本文(日本語訳)
※ 原文(英語/中国語)を Gemini で日本語化したものです。Claude 自身は原文を読みます。誤訳がある場合は原文をご確認ください。
Observability Pattern Detector
拡張されたフックからの Claude Code テレメトリデータにおける、自動化されたパターン認識と異常検知。
データソース
プライマリ: Loki の {job="claude_code_enhanced"}
オペレーション
detect-failures
類似したエラーをグループ化し、パターンを特定します。
{job="claude_code_enhanced", event_type="tool_result", status="error"} | json
アルゴリズム: error_type でグループ化 → 頻度を計算 → 影響度でランク付け。 出力: 発生回数、影響を受けるツール、初回/最終確認日時、トレンドを含むエラーパターン。
detect-slowness
大きなレスポンスパターン(遅延のプロキシ)を特定します。
{job="claude_code_enhanced", event_type="tool_result"} | json | response_length > 100000
アルゴリズム: 10万文字を超えるレスポンスにフラグを立てる → ツールでグループ化 → パターンを特定。 出力: レスポンスサイズ、影響を受けるツールを含む遅いオペレーション。
detect-anomalies
セッションにおける統計的な異常検知。
{job="claude_code_enhanced", event_type="session_end"} | json | turn_count > 50
手法: 高いターン数、長い継続時間、セッションあたりのエラー数が多い。 出力: メトリクス、考えられる原因を含む異常なセッション。
detect-trends
長期的なトレンド分析。
sum(count_over_time({job="claude_code_enhanced", event_type="tool_call"} [1d]))
メトリクス: ツールの使用トレンド、エラー率トレンド、セッション頻度トレンド。 出力: 方向(増加/減少/安定)、レートを含むトレンド。
detect-waste
非効率性(冗長なオペレーション)を特定します。
{job="claude_code_enhanced", event_type="tool_call"} | json | line_format "{{.tool_name}}:{{.previous_tool}}"
パターン:
- 同じファイルの複数回の読み取り (Read→Read)
- 繰り返される失敗したオペレーション
- Read 前の過剰な Glob
- 1つの大きな編集に対する多くの小さな編集 出力: 発生回数、推奨事項を含む無駄なパターン。
detect-conversation-patterns
ユーザープロンプトのパターンを分析します。
sum by (pattern) (count_over_time({job="claude_code_enhanced", event_type="user_prompt"} | json [24h]))
パターン:
- 質問頻度 (pattern="question")
- デバッグセッション (pattern="debugging")
- 作成タスク (pattern="creation")
- Ultrathink の使用 (pattern="ultrathink") 出力: 会話スタイルの分布、トレンド。
detect-tool-sequences
一般的なツール呼び出しシーケンスを特定します。
{job="claude_code_enhanced", event_type="tool_call"} | json | line_format "{{.previous_tool}} → {{.tool_name}}"
一般的なパターン:
- Glob → Read (ファイル探索)
- Read → Edit (読み取り後の修正)
- Grep → Read (検索してから開く)
- Task → Task (並列エージェント) 出力: シーケンス頻度、異常なパターン。
detect-subagent-patterns
Task ツールの使用パターンを分析します。
{job="claude_code_enhanced", event_type="tool_call", tool="Task"} | json
パターン:
- サブエージェントタイプの分布
- 並列スポーンパターン
- サブエージェントの成功率 出力: サブエージェントの使用状況分析、推奨事項。
detect-context-issues
コンテキストウィンドウの問題を特定します。
{job="claude_code_enhanced", event_type="context_compact"} | json
パターン:
- 頻繁な自動圧縮
- 高いコンテキスト使用率のセッション
- 大きなレスポンスの蓄積 出力: コンテキスト管理の問題、最適化の提案。
detect-permission-patterns
パーミッションリクエストのパターンを分析します。
{job="claude_code_enhanced", event_type="permission_request"} | json
パターン:
- 頻繁なパーミッションリクエスト
- パーミッションタイプの分布
- パーミッションの拒否 出力: パーミッションの摩擦点、自動化の機会。
detect-repo-patterns
リポジトリのアクティビティパターン。
sum by (repo) (count_over_time({job="claude_code_enhanced", event_type="tool_call"} | json [7d]))
パターン:
- 最もアクティブなリポジトリ
- リポジトリごとのツールの使用状況
- リポジトリごとのエラー率 出力: プロジェクトレベルの洞察、リポジトリ間の比較。
出力例
{
"failure_patterns": [
{
"pattern_id": "file_not_found",
"signature": "File does not exist",
"occurrences": 23,
"affected_tools": ["Read", "Edit"],
"trend": "stable",
"recommendation": "Add file existence check before operations"
}
],
"tool_sequence_patterns": [
{
"sequence": "Glob → Read → Edit",
"occurrences": 156,
"context": "Standard file modification flow"
}
],
"conversation_patterns": [
{
"pattern": "debugging",
"percentage": 35,
"avg_turns": 12,
"common_tools": ["Bash", "Read", "Grep"]
}
],
"context_issues": [
{
"issue": "auto_compaction_frequent",
"sessions_affected": 5,
"recommendation": "Use more focused queries, split large tasks"
}
]
}
パターン検出クエリ
エラーパターン
# エラーをタイプ別にグループ化
sum by (error_type, tool) (count_over_time({job="claude_code_enhanced", event_type="tool_result", status="error"} | json [24h]))
# エラーのタイムライン
{job="claude_code_enhanced", event_type="tool_result", status="error"} | json | line_format "{{.timestamp}} {{.tool_name}}: {{.error_type}}"
ツールシーケンスパターン
# 最も一般的なトランジション
{job="claude_code_enhanced", event_type="tool_call"} | json | previous_tool != "" | line_format "{{.previous_tool}} → {{.tool_name}}"
セッションの異常
# 長いセッション
{job="claude_code_enhanced", event_type="session_end"} | json | duration_seconds > 3600
# エラーが多いセッション
{job="claude_code_enhanced", event_type="session_end"} | json | error_count > 5
# ターンの多いセッション
{job="claude_code_enhanced", event_type="session_end"} | json | turn_count > 30
コンテキストパターン
# 自動圧縮
{job="claude_code_enhanced", event_type="context_compact", trigger="auto"} | json
# 高い使用率
{job="claude_code_enhanced", event_type="context_utilization"} | json | context_percentage > 80
スクリプト
scripts/detect-failures.sh- エラーパターン検出scripts/detect-anomalies.sh-
(原文がここで切り詰められています)
📜 原文 SKILL.md(Claudeが読む英語/中国語)を展開
Observability Pattern Detector
Automated pattern recognition and anomaly detection in Claude Code telemetry data from enhanced hooks.
Data Source
Primary: {job="claude_code_enhanced"} in Loki
Operations
detect-failures
Group similar failures and identify patterns.
{job="claude_code_enhanced", event_type="tool_result", status="error"} | json
Algorithm: Group by error_type → Calculate frequency → Rank by impact. Output: Failure patterns with occurrences, affected tools, first/last seen, trend.
detect-slowness
Identify large response patterns (proxy for slowness).
{job="claude_code_enhanced", event_type="tool_result"} | json | response_length > 100000
Algorithm: Flag responses >100k chars → Group by tool → Identify patterns. Output: Slow operations with response sizes, affected tools.
detect-anomalies
Statistical anomaly detection in sessions.
{job="claude_code_enhanced", event_type="session_end"} | json | turn_count > 50
Methods: High turn count, long duration, many errors per session. Output: Anomalous sessions with metrics, likely cause.
detect-trends
Long-term trend analysis.
sum(count_over_time({job="claude_code_enhanced", event_type="tool_call"} [1d]))
Metrics: Tool usage trend, error rate trend, session frequency trend. Output: Trends with direction (increasing/decreasing/stable), rate.
detect-waste
Identify inefficiencies (redundant operations).
{job="claude_code_enhanced", event_type="tool_call"} | json | line_format "{{.tool_name}}:{{.previous_tool}}"
Patterns:
- Multiple reads of same file (Read→Read)
- Repeated failed operations
- Excessive Glob before Read
- Many small edits vs one large edit Output: Waste patterns with occurrences, recommendations.
detect-conversation-patterns
Analyze user prompt patterns.
sum by (pattern) (count_over_time({job="claude_code_enhanced", event_type="user_prompt"} | json [24h]))
Patterns:
- Question frequency (pattern="question")
- Debugging sessions (pattern="debugging")
- Creation tasks (pattern="creation")
- Ultrathink usage (pattern="ultrathink") Output: Conversation style distribution, trends.
detect-tool-sequences
Identify common tool call sequences.
{job="claude_code_enhanced", event_type="tool_call"} | json | line_format "{{.previous_tool}} → {{.tool_name}}"
Common Patterns:
- Glob → Read (file discovery)
- Read → Edit (modify after read)
- Grep → Read (search then open)
- Task → Task (parallel agents) Output: Sequence frequencies, unusual patterns.
detect-subagent-patterns
Analyze Task tool usage patterns.
{job="claude_code_enhanced", event_type="tool_call", tool="Task"} | json
Patterns:
- Subagent types distribution
- Parallel spawning patterns
- Subagent success rates Output: Subagent usage analytics, recommendations.
detect-context-issues
Identify context window problems.
{job="claude_code_enhanced", event_type="context_compact"} | json
Patterns:
- Frequent auto-compaction
- High context usage sessions
- Large response accumulation Output: Context management issues, optimization suggestions.
detect-permission-patterns
Analyze permission request patterns.
{job="claude_code_enhanced", event_type="permission_request"} | json
Patterns:
- Frequent permission requests
- Permission types distribution
- Permission denials Output: Permission friction points, automation opportunities.
detect-repo-patterns
Repository activity patterns.
sum by (repo) (count_over_time({job="claude_code_enhanced", event_type="tool_call"} | json [7d]))
Patterns:
- Most active repos
- Tool usage by repo
- Error rates by repo Output: Project-level insights, cross-repo comparisons.
Example Output
{
"failure_patterns": [
{
"pattern_id": "file_not_found",
"signature": "File does not exist",
"occurrences": 23,
"affected_tools": ["Read", "Edit"],
"trend": "stable",
"recommendation": "Add file existence check before operations"
}
],
"tool_sequence_patterns": [
{
"sequence": "Glob → Read → Edit",
"occurrences": 156,
"context": "Standard file modification flow"
}
],
"conversation_patterns": [
{
"pattern": "debugging",
"percentage": 35,
"avg_turns": 12,
"common_tools": ["Bash", "Read", "Grep"]
}
],
"context_issues": [
{
"issue": "auto_compaction_frequent",
"sessions_affected": 5,
"recommendation": "Use more focused queries, split large tasks"
}
]
}
Pattern Detection Queries
Failure Patterns
# Group errors by type
sum by (error_type, tool) (count_over_time({job="claude_code_enhanced", event_type="tool_result", status="error"} | json [24h]))
# Error timeline
{job="claude_code_enhanced", event_type="tool_result", status="error"} | json | line_format "{{.timestamp}} {{.tool_name}}: {{.error_type}}"
Tool Sequence Patterns
# Most common transitions
{job="claude_code_enhanced", event_type="tool_call"} | json | previous_tool != "" | line_format "{{.previous_tool}} → {{.tool_name}}"
Session Anomalies
# Long sessions
{job="claude_code_enhanced", event_type="session_end"} | json | duration_seconds > 3600
# High error sessions
{job="claude_code_enhanced", event_type="session_end"} | json | error_count > 5
# High turn sessions
{job="claude_code_enhanced", event_type="session_end"} | json | turn_count > 30
Context Patterns
# Auto compactions
{job="claude_code_enhanced", event_type="context_compact", trigger="auto"} | json
# High utilization
{job="claude_code_enhanced", event_type="context_utilization"} | json | context_percentage > 80
Scripts
scripts/detect-failures.sh- Failure pattern detectionscripts/detect-anomalies.sh- Statistical anomaly detectionscripts/detect-trends.sh- Trend analysisscripts/detect-sequences.sh- Tool sequence analysisscripts/generate-pattern-report.sh- Full pattern report