Initial commit

This commit is contained in:
Zhongwei Li
2025-11-29 17:55:08 +08:00
commit 30e333bf4e
9 changed files with 1435 additions and 0 deletions

View File

@@ -0,0 +1,364 @@
---
description: Extract themes and insights from interview transcripts with intelligent agent scaling
argument-hint: [output-name] [transcripts-directory] [--context-file]
---
# Analyze Interview Transcripts
Analyze all interview transcripts in a directory, extract themes, rank insights, and generate a comprehensive report.
## Step 1: Discover and Validate Transcripts
**Scan the transcripts directory ($2):**
- Find all text files (.txt, .md, .doc, .docx)
- Count total transcripts
- Calculate total file size and estimated token count
- Identify any context files (ICP, research goals, methodology docs)
**Look for context file ($3):**
- If --context-file argument provided, read that file
- If not provided, look for common files in directory:
- `icp.md` or `ideal-customer-profile.md`
- `research-goals.md` or `objectives.md`
- `methodology.md`
- `customer-profile.md` or `persona.md`
**Report to user:**
```markdown
## 📁 Transcripts Discovered
**Directory:** $2
**Transcripts found:** [number] files
**Total size:** [size in MB]
**Estimated tokens:** ~[number]k tokens
**Files:**
- [filename 1] ([size])
- [filename 2] ([size])
- [etc.]
**Context documents found:**
- [ICP/research goals/methodology if found, or "None"]
Would you like to proceed with analysis?
```
**Wait for user confirmation.**
---
## Step 2: Determine Agent Scaling Strategy
Based on workload, intelligently determine how many parallel agents to use:
**Agent Scaling Logic:**
```
If 1-3 transcripts:
→ Use 1 agent (sequential analysis is fine)
If 4-8 transcripts:
→ Use 3 parallel agents
→ Divide transcripts evenly (e.g., Agent 1: transcripts 1-3, Agent 2: 4-6, Agent 3: 7-8)
If 9-15 transcripts:
→ Use 5 parallel agents
→ Divide transcripts evenly
If 16+ transcripts:
→ Use 8 parallel agents (optimal for most systems)
→ Divide transcripts evenly
ALSO consider total token count:
If total tokens > 150k:
→ Increase agent count by 1-2
→ Example: 6 transcripts but 200k tokens → use 5 agents instead of 3
If total tokens < 30k:
→ Decrease agent count
→ Example: 10 short transcripts with 25k tokens → use 3 agents instead of 5
```
**Present strategy to user:**
```markdown
## 🤖 Agent Strategy
Based on [number] transcripts totaling ~[number]k tokens, I recommend using **[number] parallel agents** for efficient analysis.
**How it works:**
- Each agent will analyze [number] transcripts
- Agents work simultaneously (faster than sequential)
- All findings will be synthesized into final report
**Agent assignments:**
- Agent 1: [transcript names]
- Agent 2: [transcript names]
- [etc.]
**Estimated time:** [minutes] minutes
Would you like to:
1. ✅ Proceed with this strategy
2. 🔄 Adjust agent count (tell me your preference)
3. ❌ Cancel
```
**Wait for user approval or adjustment.**
---
## Step 3: Launch Theme Extraction Agents
For each agent, use the Task tool with the **theme-extractor** agent:
**Provide each agent with:**
- Its assigned transcripts (full text)
- Context file contents (if available)
- Instructions to identify 3-5 major themes
- Request supporting quotes for each theme
**Track progress:**
```markdown
## 🔍 Extracting Themes
- ✅ Agent 1: Complete (found 4 themes)
- ✅ Agent 2: Complete (found 5 themes)
- 🔄 Agent 3: In progress
- ⏳ Agent 4: Pending
- ⏳ Agent 5: Pending
```
**Once all agents complete, collect results:**
- All themes from all agents
- Supporting quotes
- Frequency counts (how many transcripts mentioned each theme)
---
## Step 4: Synthesize and Rank Themes
Use the **insight-ranker** agent to:
**Consolidate themes:**
- Merge duplicate/similar themes across agents
- Example: "Pricing concerns" + "Cost barriers" → "Pricing and cost concerns"
**Rank themes by:**
1. **Frequency** - How many transcripts mentioned it
2. **Relevance** - Alignment with ICP/research goals (if context provided)
3. **Impact** - Magnitude of the insight (pain point severity, opportunity size)
**Present ranked themes to user:**
```markdown
## 🎯 Top Themes Identified
### Theme 1: [Theme Name]
**Mentioned in:** [X] of [Y] transcripts ([percentage]%)
**Relevance:** [High/Medium/Low based on ICP]
**Key insight:** [One sentence summary]
**Representative quote:**
> "[Quote from transcript]"
> — Participant [number/name]
---
### Theme 2: [Theme Name]
[Same format...]
---
[Continue for top 5-7 themes]
---
**Would you like me to:**
1. ✅ Proceed with final report generation
2. 🔎 Deep dive into specific themes (tell me which ones)
3. 🔄 Re-rank themes with different criteria
```
**Wait for user feedback.**
---
## Step 5: Generate Comprehensive Report
Create a structured markdown report with:
### Report Structure
```markdown
# Interview Analysis Report: [Output Name]
**Analysis date:** [Date]
**Transcripts analyzed:** [Number]
**Context:** [ICP/research goals summary if available]
---
## Executive Summary
[2-3 paragraph overview of most important findings]
---
## Methodology
**Transcripts:**
- [List of transcripts with dates if available]
**Analysis approach:**
- [Number] parallel agents
- Theme extraction and consolidation
- Ranking by frequency and relevance
**Context documents:**
- [List context files if used]
---
## Key Themes
### 1. [Theme Name] ([frequency]% of interviews)
**Summary:** [Detailed explanation of this theme]
**Why it matters:** [Relevance to ICP/business goals]
**Supporting quotes:**
1. "[Quote]" — Participant [ID]
2. "[Quote]" — Participant [ID]
3. "[Quote]" — Participant [ID]
**Recommendations:**
- [Actionable insight 1]
- [Actionable insight 2]
---
[Repeat for each major theme]
---
## Cross-Cutting Insights
[Patterns that span multiple themes]
---
## Recommendations
1. **[Priority]** [Recommendation based on findings]
2. **[Priority]** [Recommendation based on findings]
[etc.]
---
## Appendix: All Themes
[Comprehensive list of all themes found, including lower-frequency ones]
---
**Analysis performed by:** Interview Transcript Analyzer plugin for Claude Code
**Generated:** [Timestamp]
```
**Save report to:** `analysis/$1-analysis.md`
---
## Step 6: Deliver Results
**Report to user:**
```markdown
## ✅ Analysis Complete!
**Report location:** analysis/$1-analysis.md
**Transcripts analyzed:** [number]
**Themes identified:** [number] major themes, [number] total
**Top insights:** [number]
**Report sections:**
- Executive Summary
- Methodology
- [Number] Key Themes (with quotes and recommendations)
- Cross-cutting insights
- Actionable recommendations
**Next steps:**
1. Review the full report
2. Use `/extract-quotes [theme]` to find more quotes on specific themes
3. Use `/rank-insights` to re-rank with different criteria
```
---
## Error Handling
**If no transcripts found:**
```
❌ No transcripts found in directory: $2
Please ensure:
- Directory path is correct
- Transcripts are in supported formats (.txt, .md, .doc, .docx)
- Files are readable
Expected structure:
interviews/
├── interview-1.txt
├── interview-2.txt
└── context/
└── icp.md
```
**If context file specified but not found:**
```
⚠️ Warning: Context file not found: $3
Would you like to:
1. Proceed without context (insights won't be ranked by ICP relevance)
2. Specify a different context file
3. Cancel and add context file first
```
**If agent fails during analysis:**
- Save partial results from completed agents
- Report which agent failed and why
- Offer to retry with fewer agents or different allocation
---
## Usage Examples
```bash
# Basic analysis
/analyze-interviews customer-feedback ./interviews/
# With ICP context for relevance ranking
/analyze-interviews product-research ./research/transcripts/ --context-file ./research/icp.md
# Large-scale analysis (automatically uses more agents)
/analyze-interviews enterprise-study ./enterprise-interviews/
```
---
## Tips for Best Results
**Organize transcripts clearly:**
- Use descriptive filenames (`interview-customer-name.txt`)
- Include dates if relevant (`2024-01-15-interview-acme-corp.txt`)
- Keep transcripts in dedicated directory
**Provide context:**
- ICP document helps rank insights by relevance
- Research goals ensure findings align with objectives
- Methodology doc helps interpret findings appropriately
**For large datasets:**
- The plugin will automatically scale agents (no manual config needed)
- More transcripts = more agents = faster analysis
- Expected speed: ~15-20 transcripts in 15-20 minutes with 8 agents

168
commands/extract-quotes.md Normal file
View File

@@ -0,0 +1,168 @@
---
description: Find representative quotes on specific topics from interview transcripts
argument-hint: [topic] [transcripts-directory] [--max-quotes]
---
# Extract Quotes by Topic
Find the most representative and compelling quotes about a specific topic from interview transcripts.
## Step 1: Scan Transcripts
**Search directory $2 for transcripts:**
- Identify all transcript files
- Count total transcripts available
**Report to user:**
```markdown
## 📁 Transcripts Found
**Directory:** $2
**Transcripts:** [number] files
**Topic to search:** "$1"
Proceeding to extract relevant quotes...
```
---
## Step 2: Extract Relevant Quotes
Use the **quote-selector** agent to:
**For each transcript:**
1. Search for mentions of topic "$1" (and related terms)
2. Extract full quote with context
3. Rate quote quality (clarity, insight value, brevity)
4. Include speaker/participant attribution if available
**Quote selection criteria:**
- **Relevant** - Directly addresses the topic
- **Insightful** - Reveals something meaningful
- **Clear** - Standalone understandable
- **Concise** - Not overly long (prefer 1-3 sentences)
- **Authentic** - Conversational tone preserved
---
## Step 3: Rank and Present Quotes
**Default: Show top 10 quotes**
**If --max-quotes specified: Show that many**
**Present to user:**
```markdown
## 💬 Quotes About: "$1"
Found [total number] relevant quotes across [number] transcripts.
Showing top [$3 or 10] by quality score.
---
### Quote 1 (Score: [X]/10)
> "[Full quote text]"
**Source:** [Transcript name / Participant ID]
**Context:** [Brief context if helpful - when/why this was said]
---
### Quote 2 (Score: [X]/10)
[Same format...]
---
## Quote Categories
**By theme:**
- [Sub-theme 1]: [count] quotes
- [Sub-theme 2]: [count] quotes
**By sentiment:**
- Positive: [count]
- Negative/Pain point: [count]
- Neutral: [count]
---
## Usage Tips
**To find more quotes:**
```bash
/extract-quotes "[topic]" [directory] --max-quotes 20
```
**To search related terms:**
```bash
/extract-quotes "pricing or cost or budget" [directory]
```
```
---
## Step 4: Optional - Export Quotes
**Ask user:**
```
Would you like to:
1. Save these quotes to a file (quotes/$1-quotes.md)
2. Copy to clipboard for pasting elsewhere
3. Just view them here
```
**If user chooses save:**
- Create `quotes/` directory if needed
- Save as `quotes/$1-quotes.md` with all quotes in markdown format
---
## Error Handling
**If topic not found in any transcript:**
```
⚠️ No quotes found for topic: "$1"
Suggestions:
- Try broader search terms
- Check transcript file names to ensure they're included
- Try related terms: /extract-quotes "[alternative terms]"
```
**If no transcripts in directory:**
```
❌ No transcripts found in: $2
Please ensure:
- Directory path is correct
- Transcripts are in .txt or .md format
```
---
## Usage Examples
```bash
# Find quotes about pricing
/extract-quotes pricing ./interviews/
# Find more quotes with custom limit
/extract-quotes "product feedback" ./interviews/ --max-quotes 20
# Search multiple related terms
/extract-quotes "onboarding or getting started" ./customer-calls/
```
---
## Tips
**Effective search terms:**
- Single concepts: `pricing`, `features`, `support`
- Multi-word phrases: `"user experience"`, `"biggest challenge"`
- Related terms with OR: `"price or cost or budget"`
**Quote quality:**
- Scores 8-10: Exceptional quotes (use in presentations)
- Scores 6-7: Good quotes (use in reports)
- Scores 4-5: Useful context (reference material)

252
commands/rank-insights.md Normal file
View File

@@ -0,0 +1,252 @@
---
description: Re-rank insights from previous analysis with different criteria
argument-hint: [analysis-file] [--criteria]
---
# Re-Rank Insights
Re-rank insights from a previous analysis using different criteria (frequency, impact, relevance, or custom).
## Step 1: Load Previous Analysis
**Read the analysis file ($1):**
- Parse all themes/insights from the file
- Extract frequency data
- Note any existing rankings
**Report to user:**
```markdown
## 📊 Analysis Loaded
**File:** $1
**Themes found:** [number]
**Current ranking:** [Current criteria if specified]
**Available themes:**
1. [Theme name] - Currently ranked #1
2. [Theme name] - Currently ranked #2
[etc.]
How would you like to re-rank these insights?
```
---
## Step 2: Select Ranking Criteria
**Present options to user:**
```markdown
## 🎯 Ranking Criteria Options
Choose how to rank insights:
1. **Frequency** - Most mentioned themes first
- Best for: Understanding what came up most often
- Data available: ✅
2. **Impact** - Highest impact/severity first
- Best for: Prioritizing what to act on
- Requires: Manual input or impact assessment
3. **Relevance to ICP** - Best fit with ideal customer profile
- Best for: Focusing on target audience needs
- Requires: ICP document for comparison
4. **Business Value** - Revenue/strategic opportunity size
- Best for: ROI-focused prioritization
- Requires: Business context assessment
5. **Ease of Implementation** - Quick wins first
- Best for: Tactical planning
- Requires: Feasibility assessment
6. **Custom** - Provide your own criteria
- Example: "Rank by technical complexity" or "Rank by customer segment"
Which criteria would you like to use? [1-6 or describe custom]
```
**Wait for user selection.**
---
## Step 3: Apply Ranking Criteria
Based on user's choice:
### If Frequency (Option 1):
- Simply re-sort themes by mention count
- No additional analysis needed
### If Impact (Option 2):
Use the **insight-ranker** agent to:
- Review each theme
- Assess potential impact (pain point severity, opportunity size)
- Rank accordingly
### If Relevance to ICP (Option 3):
**Ask for ICP document:**
```
Please provide path to your ICP document, or I'll look for:
- icp.md
- ideal-customer-profile.md
- customer-profile.md
in the analysis directory
```
Then use **insight-ranker** agent to:
- Read ICP document
- Score each theme by alignment with ICP characteristics
- Rank by relevance score
### If Business Value (Option 4):
**Prompt user for context:**
```
To rank by business value, I need to understand:
1. Revenue impact indicators (which themes suggest upsell/retention opportunities?)
2. Strategic priorities (which align with company goals?)
Please provide:
- Business goals document, OR
- Quick description of strategic priorities
Or I can make best-effort assessment based on theme content.
```
### If Custom (Option 6):
**Ask user to clarify:**
```
Please describe your custom ranking criteria:
Example: "Rank by technical complexity, easiest first"
Example: "Rank by enterprise vs SMB relevance"
Example: "Rank by urgency based on competitive pressure"
```
Then use **insight-ranker** agent with custom instructions.
---
## Step 4: Present Re-Ranked Results
```markdown
## ✅ Insights Re-Ranked: [Criteria]
### New Ranking:
#### #1: [Theme Name]
**Previous rank:** #[old position]
**Score:** [Score based on criteria] / 10
**Why this ranking:** [Brief explanation of why it ranks here]
**Key insight:** [One sentence summary]
---
#### #2: [Theme Name]
[Same format...]
---
[Continue for all themes]
---
## Ranking Changes
**Moved up:**
- [Theme]: #[old] → #[new] (↑[change])
**Moved down:**
- [Theme]: #[old] → #[new] (↓[change])
**Stayed same:**
- [Theme]: #[position]
---
## Next Steps
Would you like to:
1. Save this new ranking to file (updates original or creates new)
2. Compare rankings side-by-side (original vs new)
3. Try different criteria
4. Export top 3 insights as summary
```
---
## Step 5: Save or Export (Optional)
**If user chooses to save:**
```markdown
Options:
1. ✅ Update original file ($1) with new ranking
2. 📄 Save as new file (analysis/$1-reranked-[criteria].md)
3. 📋 Just show me the ranking (don't save)
Which would you prefer?
```
---
## Error Handling
**If analysis file doesn't exist:**
```
❌ Analysis file not found: $1
Available analysis files in current directory:
- [file1]
- [file2]
Usage: /rank-insights [analysis-file] [--criteria]
```
**If insufficient data for chosen criteria:**
```
⚠️ Not enough data to rank by "[criteria]"
This ranking method requires:
- [What's needed]
Would you like to:
1. Choose different criteria
2. Provide required context
3. Cancel
```
---
## Usage Examples
```bash
# Rank by frequency (simplest)
/rank-insights analysis/customer-research-analysis.md --criteria frequency
# Rank by ICP relevance
/rank-insights analysis/interviews-analysis.md --criteria relevance
# Custom ranking
/rank-insights analysis/feedback-analysis.md --criteria "urgency based on churn risk"
```
---
## Tips for Effective Ranking
**Frequency ranking:**
- Good for: Identifying consensus themes
- Watch out for: Silent but critical minority opinions
**Impact ranking:**
- Good for: Prioritizing action items
- Consider: Both pain severity and opportunity size
**Relevance ranking:**
- Good for: Focusing on target audience
- Requires: Well-defined ICP
**Custom ranking:**
- Most flexible
- Best when you have specific strategic context
- Examples: "competitive urgency", "implementation cost", "customer segment"