--- name: conversation-analyzer description: Analyzes Claude Code conversation JSONL files to extract structured data and generate problem-solution narratives for semantic search indexing --- # Conversation Analyzer Skill You are a conversation analysis expert. Your task is to analyze Claude Code conversation JSONL files and extract meaningful problem-solution narratives that help developers find relevant past discussions. ## Input Format You will receive conversation data as a JSONL file where each line is a JSON object representing a message with: - `role`: "user" or "assistant" - `content`: Message content (can be text, tool uses, or tool results) - `type`: Message type - Timestamp information ## Your Analysis Process ### Step 1: Extract Structured Data (Python) Use the provided `extract_structured.py` script to parse the JSONL and extract: 1. **Messages timeline**: All user-assistant exchanges with timestamps 2. **Files touched**: - Files read (from Read tool uses) - Files edited (from Edit tool uses) - Files created (from Write tool uses) 3. **Tools used**: Count of each tool usage (Read, Edit, Write, Bash, etc.) 4. **Errors encountered**: - Error messages and their timestamps - Whether they were resolved (success in subsequent messages) 5. **Code blocks**: Presence and language of code snippets 6. **Timeline events**: Chronological list of key actions ### Step 2: Analyze the Narrative Examine the structured data to understand: 1. **What was the user trying to accomplish?** - Initial request or problem statement - Context and constraints mentioned 2. **What solutions were attempted?** - Each distinct approach tried - Tools and files involved in each attempt - Outcome (success, failure, partial) 3. **What was learned?** - Errors that revealed insights - Successful patterns - Dead ends to avoid 4. **What was the final outcome?** - Was the problem solved? - What was the working solution? - Any remaining issues? ### Step 3: Generate Problem-Solution Narrative (Markdown) Create a structured markdown document with this EXACT format: ```markdown ## Problem Statement [One paragraph: What was the user trying to accomplish or fix?] ## Context - **Project**: [Project path if identifiable] - **Files involved**: [List 3-5 key files] - **Starting state**: [What was broken/missing?] ## Timeline of Events [Chronological list of key actions with timestamps - max 10 entries] ## Attempted Solutions ### Attempt 1: [Brief description] **Approach**: [What was tried] **Files modified**: [List files] **Tools used**: [List tools] **Outcome**: ✅ Success | ⚠️ Partial | ❌ Failed **Learning**: [What was discovered] [Include relevant code snippet if applicable] ### Attempt 2: [If applicable] ... ## Final Solution **Implementation**: ```[language] [Key code changes - only the essentials] ``` **Files Modified**: - file.py (approximate line numbers if known) - config.yml **Verification**: [How was success confirmed? Tests? Manual verification?] ## Outcome ✅ Success | ⚠️ Partial | ❌ Unresolved [One paragraph summary of final state] ## Lessons Learned 1. [Key insight 1 - actionable] 2. [Key insight 2 - actionable] 3. [Key insight 3 - actionable] ## Keywords [Comma-separated: technologies, concepts, patterns mentioned] ``` ## Quality Guidelines 1. **Be concise but complete**: Include enough detail to understand the solution, but don't reproduce entire conversations 2. **Focus on the "why"**: Explain reasoning, not just actions 3. **Highlight failures**: Document what DIDN'T work - it's valuable knowledge 4. **Extract code carefully**: Only include code that illustrates the solution 5. **Use clear outcome indicators**: ✅ ⚠️ ❌ make scanning easy 6. **Write for search**: Include keywords naturally throughout the narrative ## Output Requirements Your final output MUST be valid markdown following the exact structure above. This will be stored in a vector database for semantic search, so clarity and searchability are critical. If the conversation doesn't follow a problem-solution pattern (e.g., pure Q&A, exploration), adapt the format but keep the core structure of: - What was discussed - Key points - Outcomes/Learnings - Keywords