plugins/agentskill-kaizen/skills/transcript-analysis/SKILL.md
This skill should be used when analyzing Claude Code session transcripts, reviewing agent performance, finding anti-patterns or tool misuse, detecting user frustration signals, mining workflow patterns, running kaizen analysis, debugging agent behavior, or performing session forensics. Provides JSONL schema (kaizen-analysis get_transcript_jsonl_schema or MCP resource kaizen://session-log/schema or references/jsonl-schema.md), arbitrary DuckDB SQL over JSONL via kaizen-duckdb execute_query, cookbook query patterns, 10 analysis dimensions, and PM4Py process mining methodology.
npx skillsauth add jamie-bitflight/claude_skills transcript-analysisInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
Analyze Claude Code JSONL session transcripts to detect anti-patterns, inefficiencies, user frustration, and workflow improvement opportunities.
Find transcripts under ~/.claude/projects/ in project-specific directories named after the project path (with hyphens replacing slashes).
DuckDB’s role: Load the full field/path reference from kaizen-analysis via get_transcript_jsonl_schema or MCP resources/read kaizen://session-log/schema, then use kaizen-duckdb execute_query to run any DuckDB SQL over those files (see DuckDB Query Patterns for examples and the arbitrary-query workflow). Session history stays in JSONL on disk. Path rules for the DuckDB MCP (absolute paths, no ~ in SQL).
~/.claude/projects/{project-key}/
├── {uuid}.jsonl # Main session transcripts
├── agent-{id}.jsonl # Orphan agent transcripts
└── {uuid}/
├── subagents/
│ └── agent-{id}.jsonl # Subagent transcripts
└── tool-results/
└── {tool-use-id}.txt # Async task outputs
Each JSONL line is a JSON object discriminated by the type field.
Primary record types for analysis:
assistant — LLM response turns containing tool calls and textuser — Human input and tool resultssystem — Metadata events (stop_hook_summary, turn_duration, compact_boundary, api_error, local_command)progress — Hook execution and subagent streamingfile-history-snapshot — File edit trackingsummary — Session title/summaryFor full schema details including JSON structures for each record type, see JSONL Schema Reference.
Ten analysis dimensions, each with extraction methodology.
Extract from assistant.message.content[] where name == "Bash". Parse input.command for file-operation patterns that should use built-in tools. For SQL extraction queries, see DuckDB Query Patterns.
Parse tool_use blocks for Bash commands matching:
grep → should use Grep toolfind -name → should use Glob toolcat, head, tail → should use Read toolls → should use Glob or Bash(ls) with descriptionsed, awk → should use Edit toolExclude legitimate uses in pipelines (git ... | grep, uv run ... | head).
Extract from tool results where is_error: true. Classify error types:
Extract from user records where toolUseResult is absent. Match patterns:
[Request interrupted by user] — Ctrl+C[Request interrupted by user for tool use] — tool denialFilter out system-generated content (XML tags, session continuation messages, skill injections).
Identify repeated multi-step manual workflows across sessions via tool-sequence trigram analysis. High-frequency trigrams like Bash → Bash → Bash or Read → Read → Read suggest missing scripts or skills.
Extract from Task tool_use blocks. Track subagent_type, description, model. Flag when general-purpose is used where a specialized agent exists.
Compare successful vs failed attempts at the same goal. Measure tool-call count between goal statement (user turn) and successful outcome (final assistant turn). High variance across sessions for similar goals indicates wasted steps.
Track investigation branches that get abandoned. Signal: a sequence of Read/Grep/Bash calls on a topic followed by compact_boundary or direction change without resolution. Cross-session frequency of the same abandoned paths reveals systematic red herrings.
Extract system.compact_boundary, system.api_error, and hook-related progress events. Map their position relative to active work to identify when system processes derailed correct execution paths.
Identify manual corrections that recur across sessions. When the same correction appears 3+ times, it is a candidate for automated prevention via PreToolUse hook (deny + redirect) or SubagentStart hook (inject context).
Use kaizen-analysis get_transcript_jsonl_schema or resource kaizen://session-log/schema for the full path reference, then kaizen-duckdb execute_query for any SQL over JSONL (read_ndjson_auto with absolute paths). You are not limited to the cookbook queries.
For the arbitrary-query workflow and examples, see DuckDB Query Patterns.
Use the kaizen-analysis MCP server tools for analyses SQL cannot express:
extract_tool_sequences — Convert JSONL → ordered tool-call arrays per sessiondiscover_process_model — PM4Py Heuristic Miner on tool-call event logscheck_conformance — Compare sessions against a reference process modelfind_frequent_patterns — PrefixSpan sequential pattern miningdetect_frustration_signals — NLP extraction from user turnscluster_sessions — Trace clustering by behavioral similarityflowchart TD
Start([Receive analysis task]) --> Scope{Scope defined?}
Scope -->|--project flag| Project[Filter to project transcripts]
Scope -->|No flag| Default[Use current project]
Project --> Discover[SQL — count sessions, date range, record types]
Default --> Discover
Discover --> Dimensions{Which dimensions?}
Dimensions -->|All| RunAll[Run all 10 dimensions]
Dimensions -->|Specified| RunSelected[Run selected dimensions]
RunAll --> Aggregate[Aggregate findings]
RunSelected --> Aggregate
Aggregate --> Write[Write to .planning/kaizen/analysis-DATE.md]
Write analysis findings to .planning/kaizen/ as structured markdown with:
development
When an application needs to store config, data, cache, or state files. When designing where user-specific files should live. When code writes to ~/.appname or hardcoded home paths. When implementing cross-platform file storage with platformdirs.
testing
Enforce mandatory pre-action verification checkpoints to prevent pattern-matching from overriding explicit reasoning. Use this skill when about to execute implementation actions (Bash, Write, Edit) to verify hypothesis-action alignment. Blocks execution when hypothesis unverified or action targets different system than hypothesis identified. Critical for preventing cognitive dissonance where correct diagnosis leads to wrong implementation.
tools
Reference guide for the Twelve-Factor App methodology — 15 principles (12 original + 3 modern extensions) for building portable, resilient, cloud-native applications. Use when evaluating application architecture, designing cloud-native services, reviewing codebases for methodology compliance, advising on configuration, scaling, observability, security, and deployment patterns. Incorporates the 2025 open-source community evolution and cloud-native reinterpretations of each factor.
tools
Converts user-facing documentation (how-to guides, tutorials, API references, examples) in any format — Markdown, PDF, DOCX, PPTX, XLSX, AsciiDoc, RST, HTML, Jupyter notebooks, man pages, TOML/YAML/JSON configs, and plain text — into Claude Code skill directories with SKILL.md plus thematically grouped references/*.md files. Use when given a docs directory or mixed-format documentation to transform into an AI skill. Uses MCP file-reader server for binary formats.