Check messy rows and double counts before totals (grain_report.py): row meaning, cancellations, negative quantities, missing IDs, duplicates. Not for Tableau exports; use tableau.
Ships in data-analytics. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them; scripts run unread.
Use before counting, summing, averaging, joining, plotting or modeling any table, especially when orders span multiple rows or transactions contain cancellations, negative quantities, missing IDs, zero or negative prices, or duplicates.
data via gateway first, then measure grainCall PanCode's read-only data capability through gateway(op="call", capability="data", args={op: "inspect"|"stats"|"select", path: "<file>", ...}) without Python on CSV, TSV, xlsx (sheet as table) and Parquet. args={op: "stats", path: "<file>"} profiles every column; args={op: "stats", path: "<file>", where: {...}, aggregates: ["count"]} counts each messy class ({"InvoiceNo": {"starts_with": "C"}}, {"Quantity": {"lt": 0}}, {"UnitPrice": {"lte": 0}}, {"CustomerID": {"is_null": true}}; is_null matches empty cells only, and NA markers show as the column's sentinels). args={op: "stats", path: "<file>", aggregates: ["count", "count_distinct:Order ID"]} gives lines versus orders, and adding group_by: ["Order ID"] lists the orders with the most lines first. A figure is exact only with complete: true; args={op: "select", path: "<file>", where: {...}} shows sample rows, never counts.
When you need exact duplicate rows, fixed-within-key level mapping, join fan-out (--rows-were), or a Data board fact in PANCODE_BOARD_FACTS, run the bundled report relative to <base_dir>:
uv run python <base_dir>/scripts/grain_report.py data/transactions.csv
uv run python <base_dir>/scripts/grain_report.py out/joined.csv --key "Order ID" --rows-were 1000
Columns fixed within an identifier belong to that coarser entity and must not be summed across finer rows.
Transactional tables often mix sales with cancellations, adjustments and incomplete rows. Whenever inspection or grain_report.py flags any of these five classes, apply decide, state, count before quoting a total:
| Messy class | What to check | Decision to make |
|---|---|---|
| Cancellations or returns | Prefixed invoice numbers (such as C...), return flags or credit memos | Report gross sales (excluding cancellations/returns) or net sales (keeping them), and check if cancellations pair with earlier sales |
| Negative quantities | Whether every negative quantity has a cancellation flag or unflagged negatives (stock write-offs) also exist | Keep in net totals, exclude, or split into an adjustments bucket; never drop silently |
| Missing customer keys | Guest checkouts, unlinked POS rows or adjustments with null customer IDs | Keep valid sales in store-wide totals; exclude null keys only from customer-level metrics (distinct customers, cohorts, RFM) |
| Zero or negative prices | Free samples, promos or accounting adjustments (such as bad-debt entries) | Inspect descriptions; exclude accounting adjustments from product revenue unless computing accounting net |
| Duplicate lines | Exact copies of all columns vs legitimate repeat scans on one invoice | Confirm export repeats before calling drop_duplicates() |
len(df) (BI COUNT). Never label line counts as order or customer counts when an ID repeats.df["Order ID"].nunique() (BI COUNTD). Per-order averages need two steps (df.groupby("Order ID")["Sales"].sum().mean()), not df["Sales"].mean().nunique().sum(numerator) / sum(denominator) at the group level, never the mean of row ratios.resample("W") vs BI locale weeks).validate= ("many_to_one", "one_to_one", "one_to_many"), print len() before and after, and inspect unmatched keys. Count matched coarse keys with nunique() or aggregate before joining.When two tools disagree, audit grain and messy-row scope first; use tableau to match a Tableau export.
What SKILL.md sets; muted values are Claude Code's defaults
/data-analytics:grain-checkfrom data-analytics
npx claudepluginhub panstudio/pancode --plugin data-analytics9 skills in this plugin
/analysis-projectStart a pinned uv analysis project or check one is ready (check_workspace.py), then lay out its notebook and prompt appendix. Read-only check; syncs only with the user's go. Not for the analysis itself; use pandas-descriptive./chartsMake and check bar, line, histogram or scatter charts (plotly_chart.py, matplotlib): backing table printed, sorted, labelled, bars from zero. Not for dashboards; use streamlit-app./customer-analyticsCohort retention, top-customer share and RFM (cohort_table.py, pareto_rfm.py) for repeat and best customers, counting customers and orders, not lines. Not for k-means clusters; use modelling.Other plugins' skills for the same job