Turn raw data into a report you can ship, with AI
Skills used in this guide (4)
每当表格文件是主要输入或输出时使用。即任何用户想:打开、读取、编辑或修复现有 .xlsx/.xlsm/.xltx/.csv/.tsv 文件(如添加列、计算公式、格式化、制图、清理脏数据);从零或其他数据源新建表格;或在表格格式间转换。尤其当用户按名称或路径提及表格文件时(哪怕随口说“我下载里的 xlsx”)并想对其操作或由其生成内容。也用于把混乱的表格数据(畸形行、错位表头、垃圾数据)清理重构为规范表格。交付物必须是表格文件。当主要交付物是 Word 文档、HTML 报告、独立 Python 脚本、数据库流水线或 Google Sheets API 集成时,即使涉及表格数据也不要触发。
npx skills add anthropics/skills -g用 pandas DataFrame 做数据分析、处理、转换。处理 pandas DataFrame、数据清洗、聚合、合并、时间序列分析时使用。多键 join、透视表、重采样、插值/前填处理 NaN、groupby 聚合、类型转换、大数据集性能优化时调用。
npx skills add Jeffallan/claude-skills -g用 openpyxl 无界面生成可审计的财务工作簿。
npx skills add NousResearch/hermes-agent -g对显式支持的科研文件做有界、局部的探索性分析。用于脱敏 CSV/TSV/JSON 画像;可选 NumPy、HDF5、FASTA/FASTQ 与基础图像元数据检查;缺失/泄漏审计;离群与变换敏感性;以及严谨的 EDA 报告骨架。其他领域格式仅参考,未知格式失败即止。"
npx skills add k-dense-ai/claude-scientific-skills -g
The most common analytics failure isn't "can't compute" — it's "computed fast but wrong": units not unified, nulls treated as 0,口径 drifting from last time. The point: define口径 first, let AI compute, then spot-check 3 rows by hand.
Who this is for / not for
For:
- CSV / Excel in hand, need aggregation, pivot, YoY/MoM
- You want "a table you can ship", not statistical modeling
- Willing to write the口径 before numbers come out
Not for:
- Serious inference, p-values, significance (that's analysis, not reporting)
- Data so dirty it has no field definitions (fix metadata first)
- Money/headcount decisions that can't be wrong (AI output needs double review)
Before you start
- Raw file: CSV or .xlsx, ideally a clean export copy.
- 口径 list: metrics, denominators, null handling, time range.
- Last report (if any): to align口径 so this matches last time.
Steps
1. Install the skill
xlsx reads/writes Excel. Copy its folder into your client's skills directory (same as any Agent Skill):
| Client | Directory |
|---|---|
| Claude Code | ~/.claude/skills/ |
| Codex | ~/.codex/skills/ |
| Cursor | ~/.cursor/skills/ |
| Trae | ~/.trae/skills/ |
| CodeBuddy | ~/.codebuddy/skills/ |
| Tongyi Lingma | ~/.lingma/skills/ |
2. Define口径, then compute
Putting口径 in the prompt beats "use your judgment":
From data.xlsx "orders" sheet, produce a weekly report:
- GMV = sum(paid_amount); buyers = distinct user_id
- week starts Monday, range 2026-01 to 2026-09 by order_time
- nulls: orders with null paid_amount excluded from GMV but counted separately as "unpaid"
- output result.xlsx with columns: week / GMV / buyers / WoW3. Large data → script
Hundreds of thousands of rows or complex transforms: use pandas-pro to write a pandas script — more stable than clicking pivot in a sheet:
Read raw.csv with pandas, group by (region, week), compute mean and quantiles,
fill nulls with group median, output grouped.csv with 5 sample rows.4. Spot-check 3 rows before shipping
The most suspicious part of AI numbers is口径. Manually verify 3 rows (e.g. add up one week's GMV) before sending.
Pitfalls
| Pit | Symptom | Fix |
|---|---|---|
| Units not unified | yuan / 10k yuan mixed, off by 10000x | Fix unit in prompt, label unit in output |
| Null as 0 | mean dragged down | Explicit null rule, count unpaid separately |
| 口径 drift | Mismatch with last time | Keep口径 list, reuse it |
| Dedup missed | buyers inflated | State which field to dedup on |
| Trust AI only | Key number wrong | Spot-check 3 rows before shipping |
FAQ
CSV only, no Excel?
Fine. xlsx handles CSV; for big data use pandas-pro directly.
Slightly off from my hand calc?
Usually口径 or null handling. Write your method into the prompt to align; if still off, check raw rows.
Charts directly?
Do numbers first; charts in Excel / BI are safest. AI SVG charts "look right but are wrong".
Financial sheets OK?
Yes, excel-author makes formula-driven auditable workbooks; money still needs double review.
Data need masking?
Tables with PII (phone, ID) — mask before external services; use local model internally.
Related guides
Continue across these scenes:
相关源码
- anthropics/skills · xlsx source
- Jeffallan/claude-skills · pandas-pro source
- Agent Skill open format spec
一句话结论
结论:数据分析先定口径再出数,AI 跑完你抽查 3 行,比「让 AI 看着办」稳十倍。
References
Related Scenes
Write SQL and analytics queries with AI
AI SQL's scare is "runs but wrong口径" — looks right, aggregation dimension wrong. The point: give schema and clear口径 (by day / by user, dedup?, exclude refunds), have it explain then write, not just "count sales".
Build dashboards and visualizations with AI
The pain of dashboards isn't "can't draw charts" — it's "metrics undefined, charts piled, nobody looks". The point: define the north-star metric and the question first, then let AI pick chart types and write queries, not pile fancy charts upfront.