Get the FREE Ultimate OpenClaw Setup Guide →

Analyze Reviews

npx machina-cli add skill jackhendon/ecom-feedback-intelligence/analyze-reviews --openclaw
Files (1)
SKILL.md
4.5 KB

Skill: analyze-reviews

Full pipeline analysis of customer reviews. Parallel classification via subagents — fast and token-efficient.

Usage

/analyze-reviews
/analyze-reviews data/examples/trustpilot_sample.json

If no file path is given, default to the path in config/brand.yamlreview_sources.trustpilot.sample_file.


Steps

Step 1: Load configuration

Read config/brand.yaml. Extract:

  • brand.name
  • themes list (valid slugs)
  • sentiment.weights (negative, neutral, positive)
  • reporting.output_dir
  • memory.history_file
  • memory.max_snapshots

Step 2: Load reviews

Read the JSON file. Validate it has a reviews array. Report total count. If the file doesn't exist or has no reviews, stop and tell the user.

Step 3: Classify reviews — parallel subagents

First, calculate chunk size and agent count based on total reviews (N):

ReviewsChunk sizeAgents
1–20N (single agent)1
21–10020ceil(N/20)
101–30030ceil(N/30)
300+40ceil(N/40)

Split the reviews array into evenly-sized chunks. The last chunk may be smaller.

CRITICAL: Make all Agent tool calls in a single response to run them in parallel. Do not wait for one to finish before starting the next — issue all calls simultaneously. Each call: subagent_type=general-purpose, model=haiku, foreground.

Each subagent receives this exact prompt (substitute the actual reviews JSON and valid theme slugs):


Subagent prompt:

Classify each review below. Return ONLY a JSON array — no explanation, no markdown, no other text.

Valid theme slugs (use only these): packaging, personalisation, delivery, product_quality, website_ux, customer_service, pricing, gifting_experience

Sentiment weights for reference: negative=2.0, neutral=1.0, positive=0.5

For each review output one object:

{"id":"<id>","r":<rating>,"s":"<pos|neu|neg>","c":<confidence 0.0-1.0>,"t":["<primary_theme>","<optional_secondary>"],"date":"<YYYY-MM-DD>"}

Rules:

  • s: positive = net satisfied (rating 4-5, affirming language); negative = net dissatisfied (rating 1-2, or strong complaint); neutral = mixed/indeterminate
  • c: 0.9-1.0 unambiguous; 0.7-0.8 strong signal; 0.5-0.6 mixed; 0.3-0.4 conflicting rating vs language
  • t: 1-3 slugs only, primary theme first, must have explicit evidence in text
  • Do not infer themes beyond what is stated

Reviews to classify: [INSERT REVIEWS JSON ARRAY HERE]

Once all agents have returned, merge their JSON arrays into a single flat list.

Step 4: Score priority

For each classified review, calculate (deterministic — no LLM):

today = current date
days_old = (today - review date) in days
recency = 1.2 if days_old ≤ 7 else (1.0 if days_old ≤ 30 else 0.8)
weight = sentiment_weights[s]  # from brand.yaml
priority = max(0, (6 - r) × weight × c × recency)

Step 5: Aggregate

  • Sentiment distribution: count and % for pos/neu/neg
  • Theme frequency: for each slug, total mentions (primary + secondary)
  • High-priority issues: all reviews with priority ≥ 6.0, sorted descending
  • avg_priority_score: mean of all priority scores

Step 6: Generate PM insights

Using the aggregated data, produce:

Executive summary (2–3 sentences): net sentiment, dominant theme, most urgent signal.

Top 3 opportunities: distinct, evidence-backed, actionable. Format: [Theme] — [Observation with count] → [Action] (Effort: X, Impact: X)

Top 3 risks: patterns threatening churn or reputation. Include urgency (immediate/monitor/watch).

Recommended experiments: 2–3 with hypothesis and metric.

Apply standards from .claude/rules/analysis-standards.md.

Step 7: Update history

Read memory/history.json. Append snapshot:

{
  "period": "YYYY-WNN",
  "run_date": "YYYY-MM-DD",
  "review_count": N,
  "sentiment_distribution": {
    "positive": {"count": N, "pct": N.N},
    "neutral": {"count": N, "pct": N.N},
    "negative": {"count": N, "pct": N.N}
  },
  "theme_frequency": {"slug": N},
  "high_priority_issues": [{"id": "...", "rating": N, "priority": N.N, "primary_theme": "slug"}],
  "avg_priority_score": N.N
}

Keep only last max_snapshots entries. Write back to memory/history.json.

Step 8: Present results

Output the inline summary format from .claude/rules/report-format.md.

End with:

History updated: memory/history.json (N snapshots)
Run /generate-report to save full report.
Run /compare-periods to see trend analysis.

Source

git clone https://github.com/jackhendon/ecom-feedback-intelligence/blob/main/.claude/skills/analyze-reviews/SKILL.mdView on GitHub

Overview

Analyze customer reviews end-to-end with a fast, token-efficient pipeline. It loads brand config, validates the reviews file, then classifies each review into themes via parallel subagents using a haiku model, followed by priority scoring and PM-ready insights.

How This Skill Works

The skill loads config (brand name, themes, sentiment weights) and the reviews JSON, then splits reviews into chunks based on total N. It issues all subagent calls simultaneously in a single response, each receiving a fixed prompt to classify reviews into allowed themes with sentiment and confidence. After collecting results, it merges them, computes priority scores per the formula, and generates aggregated insights for executive review.

When to Use It

  • When you have a Trustpilot-style JSON file and need structured sentiment, themes, and priority signals
  • Before product changes, to surface top recurring issues and urgent actions
  • For executive PM insights and summaries from large volumes of feedback
  • To monitor sentiment trends over time by review date
  • When validating or reusing a sample review dataset and ensuring data quality (non-empty reviews, valid array)

Quick Start

  1. Step 1: Ensure your reviews JSON includes a top-level reviews array and that config/brand.yaml defines brand.name, themes, sentiment.weights, and output_dir
  2. Step 2: Run the skill via /analyze-reviews [optional_path_to_json] to trigger parallel subagent classification
  3. Step 3: Open the output directory to review merged results, priority scores, and the generated PM insights

Best Practices

  • Validate input file exists and contains a 'reviews' array before running
  • Use official theme slugs only: packaging, personalisation, delivery, product_quality, website_ux, customer_service, pricing, gifting_experience
  • Keep sentiment weights aligned with your brand; adjust config/brand.yaml as needed
  • Pay attention to chunk sizing guidance; last chunk may be smaller and all calls run in parallel
  • Review priority outputs with a quick sanity check to confirm alignment with business goals

Example Use Cases

  • An e-commerce retailer processes 450 reviews to surface a surge in packaging complaints and delivery delays, generating a prioritized action list for ops
  • A marketplace analyzes 120 recent reviews weekly to track sentiment shifts and detect emerging issues in gifting_experience and website_ux
  • A skincare brand uses the tool to link negative sentiment about product_quality with actionable improvement recommendations
  • A fashion store aggregates reviews to identify switching patterns between pricing and customer_service themes for price-positioning decisions
  • An executive team uses the generated PM insights to define Top 3 opportunities and Top 3 risks with counts and confidence

Frequently Asked Questions

Add this skill to your agents
Sponsor this space

Reach thousands of developers