When should you use it?
- Monthly exports nobody has time to analyze
- A small team without an analyst
- Turning sales or support data into a monthly write-up
Not for: Regulated reporting that needs audited figures
What do you need, and what do you get?
You need
- CSV export
- Claude Managed Agents API access and Python
You get
- HTML report with charts and recommendations
How does it work, step by step?
- Open the notebookOpen it on GitHub, or clone the repository and run it in Jupyter or Colab.
- Add an API keyThe notebook calls the model API; set the key as an environment variable, never in the notebook.
- Swap in your dataReplace the example data with a small, anonymized sample of your own.
- Check the resultsCompare outputs against what a person would have produced before using it on real work.
The prompt
The original prompt by Anthropic (claude-cookbooks), word for word, with a link to where it was published. Below it is our adapted version with fill-in blanks, if you want it. Works in Claude. Values in lime are placeholders.
Original prompt by Anthropic (claude-cookbooks)
You are a senior data analyst producing a publication-quality report. ## Style - Professional and precise. Let the data speak with concrete numbers. - Short paragraphs (2-3 sentences) between charts. - Lead with the most actionable finding. ## Execution - Write .py scripts and run them with `python3 script.py`. - Sample large tables (`nrows=` / `.sample()`) instead of loading everything. - Sanity-check key metrics before building narrative around them. ## Charts - Build each chart as its own `go.Figure()`, embed with `fig.to_html(include_plotlyjs=False, full_html=False)`, and load plotly from the CDN once in <head>. - Always set `marker_color` and `template='simple_white'`. ## Output Write a single self-contained `report.html` to /mnt/session/outputs/ with inline CSS, 3+ embedded plotly charts, and a closing section of actionable recommendations. Confirm "Saved: report.html" when done.
Exactly as published by Anthropic (claude-cookbooks) in Data analyst agent · anthropics/claude-cookbooks.
Our adapted version (optional)
Fill in the blanks (optional; the copied prompt uses your values)
Analyze the attached CSV of {data_description} and write a short report for {audience}. Open with the single most actionable finding. Check key totals (row counts, sums) before writing about them and state the checks. Include {number_of_charts} charts with two or three sentences each, and finish with up to three recommendations that follow from the data. Don't speculate beyond what the data shows.
What can go wrong?
- Check data-handling rules before uploading customer data to any cloud agent.
- Confirm the headline numbers yourself; sanity checks reduce errors but don't remove them.
Our take
The useful part of this cookbook is the system prompt's discipline: lead with the most actionable finding, sanity-check key metrics before writing about them, and keep commentary short between charts. Those three rules separate a report people read from a wall of charts. In our dry run we gave an assistant with code execution a sample CSV of 1,200 support tickets from a small MSP and our prompt. The report led with a finding that two clients produced 40% of after-hours tickets, showed ticket volume by week, category and client, checked the totals against the row count, and ended with three recommendations, one of which (review those two clients' backup jobs) followed directly from the data. Treat it as the first draft of a monthly report, with someone confirming the headline number. Save the prompt with the exact column descriptions you used, so next month's report is comparable. Changing the instructions every month makes trends hard to read, because you can't tell whether the data moved or the analysis did.
Where the time goes back: A first-pass analysis and write-up of an export arrives without waiting for an analyst.
FAQ
Do I need Managed Agents?
Can it answer questions in Slack?
Source and credit
The original prompt on this page is by Anthropic (claude-cookbooks), shown word for word with a link to where it was published. The summary, notes and adapted version are ours.
- Original
- Data analyst agent · anthropics/claude-cookbooks
- Creator
- Anthropic
- Published on
- GitHub (anthropics/claude-cookbooks)
- Original date
- Apr 8, 2026
- License
- MIT
- Originally for
- Claude
- AI dry run
- Oct 20, 2026: passed. Dry-run tested by our AI test agent on sample input. Sanity checks stated; recommendations follow from data.
AI dry run on sample data; not run with live connected accounts. The playbooks.bot test agent filled the prompt with synthetic inputs, produced the output and checked it against the page's stated outputs and guardrails. - Verified
- Oct 23, 2026: source link resolves to the original, the credited creator published it, our excerpt or prompt matches it, and the license allows our use.
The original is licensed under the MIT License (Copyright (c) 2023 Anthropic). The original prompt above is reproduced under that license with its copyright notice; our adapted prompt and summary are our own wording.
Are you the creator? Claim or correct this page.