npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

amazon-review-defect-parser

v0.1.0

Published

Parse 1-3 star Amazon reviews into structured defect categories (sizing, material, instructions, packaging) with an LLM, or run fully offline in mock mode. CLI + TypeScript library.

Readme

amazon-review-defect-parser

Parse raw 1-3 star Amazon customer reviews into structured, actionable defect data: root-cause categories, supporting quotes, and ready-to-use listing bullet rewrites.

{
  "totalReviewsAnalyzed": 10,
  "categories": [
    {
      "category": "Sizing/Fit",
      "count": 3,
      "percentage": 30,
      "customerQuotes": ["Runs way too small, ordered a large and it fit like a medium."]
    }
  ],
  "recommendedBulletRewrites": [
    "Includes a true-to-size fit chart — measure before you buy to skip returns."
  ]
}

Works two ways:

  • Mock mode (default, no API key needed) — a deterministic, keyword-based analyzer. Good for local dev, CI, and trying the tool out.
  • LLM mode (Anthropic or OpenAI) — real clustering, quote extraction, and bullet-rewrite generation, set an API key and it's used automatically.

Install

npm install -g amazon-review-defect-parser

Or use it without installing:

npx amazon-review-defect-parser examples/sample-reviews.json

CLI usage

# Mock mode — no API key required
review-defect-parser examples/sample-reviews.json

# LLM mode — auto-detects the provider from your env
export ANTHROPIC_API_KEY=sk-ant-...
review-defect-parser examples/sample-reviews.json

# Force a provider / model
review-defect-parser reviews.json --provider openai --model gpt-4o-mini

# Write to a file instead of stdout
review-defect-parser reviews.json --output report.json

Input can be:

  • A .json file: an array of strings, or an array of { id?, rating?, text } objects
  • A .txt file: one review per line

Library usage

import { analyzeReviews } from "amazon-review-defect-parser";

const report = await analyzeReviews([
  { text: "Runs way too small, had to return it." },
  { text: "Strap broke after two days, feels cheap." },
]);

console.log(report.categories);

Pick a provider explicitly:

import { analyzeReviews, AnthropicAnalyzer, MockAnalyzer } from "amazon-review-defect-parser";

const report = await analyzeReviews(reviews, { provider: "anthropic", model: "claude-opus-5" });

// or instantiate directly for more control
const analyzer = new AnthropicAnalyzer({ apiKey: "sk-ant-..." });
const report2 = await analyzer.analyze(reviews);

Categories

Every review is mapped to exactly one of:

  • Sizing/Fit
  • Material/Durability
  • Instructions/Setup
  • Packaging/Transit Damage
  • Other

Development

npm install
npm run dev -- examples/sample-reviews.json   # run the CLI from source
npm test                                      # run the mock-mode test suite
npm run build                                 # compile to dist/

Why this exists

This is a focused, single-purpose utility, not a monitoring platform: point it at a batch of reviews and get one report back. If you want this running continuously across your whole catalog — automatic ingestion, trend tracking over time, and alerts when a new defect pattern emerges — that's what ASIN Guard does.

License

MIT