Skip to content

Report Generation

Estimated time: ~30 minutes

Prerequisite: Module 13.1 (Data Analysis)

Outcome: After this module, you will know how to generate complete reports from data, use templates for consistent reporting, and export to various formats.


You’ve done great analysis with Claude Code. Now you need to share it. The boss wants a PDF report. The client wants an executive summary. The team wants detailed findings.

Copying and pasting Claude’s responses into Word? Tedious and error-prone. Manually formatting charts? Time waster. Claude Code can generate complete, formatted reports — from raw data to polished deliverable. One prompt: “Generate a monthly sales report.”


[Data] → [Analysis] → [Narrative] → [Format] → [Export]
↓ ↓ ↓ ↓ ↓
CSV/DB Insights Write-up Markdown PDF/HTML
ComponentPurposeClaude’s Role
Title/HeaderIdentify reportGenerate with date, author
Executive SummaryKey takeawaysSynthesize findings
MethodologyHow analysis was doneDocument approach
FindingsDetailed resultsData + narrative
VisualizationsCharts, tablesGenerate and embed
RecommendationsNext stepsBusiness insights
AppendixSupporting dataRaw tables, code
  • Markdown: Universal, version control friendly
  • HTML: Rich formatting, interactive charts
  • PDF: Professional, printable (via pandoc)
  • DOCX: For Word users (via pandoc)
# [Report Title]
**Date**: [Date] | **Author**: [Author]
## Executive Summary
[3-5 bullet key findings]
## Methodology
[How analysis was performed]
## Key Findings
### Finding 1: [Title]
[Narrative + visualization]
## Recommendations
[Actionable next steps]
## Appendix
[Supporting data]

Scenario: Generate monthly sales report from sales.csv.

You: Generate a monthly sales report for December 2023 from sales.csv.
Include:
- Executive summary (3 key points)
- Revenue analysis by region and category
- Top performing products
- 2 visualizations
- Recommendations
Format as Markdown. Audience: executive team.
Save to reports/december-2023-sales.md
Claude: [Analyzes data, generates report]
Created: reports/december-2023-sales.md
# Monthly Sales Report: December 2023
**Generated**: 2024-01-05 | **Data Source**: sales.csv (3,245 transactions)
## Executive Summary
- **Record Revenue**: December achieved $890K, 40% above monthly average
- **Electronics Dominance**: Category drove 52% of monthly revenue
- **Regional Shift**: West region grew 25% MoM, now #2 market
## Revenue Analysis
### By Region
| Region | Revenue | MoM Change |
|--------|---------|------------|
| North | $320K | +15% |
| West | $280K | +25% |
| South | $180K | +10% |
| East | $110K | +5% |
![Regional Revenue](charts/regional_revenue_dec.png)
## Recommendations
1. **Stock Preparation**: Increase Electronics inventory for Q1
2. **West Region Focus**: Allocate more marketing budget
3. **Product Bundling**: Laptop + Headphones bundle opportunity
Terminal window
$ pandoc reports/december-2023-sales.md -o reports/december-2023-sales.pdf
You: The executive summary is too long. Make it more concise —
each point should be one line max.
Claude: [Revises executive summary to be more concise]

Goal: Generate a simple report from data.

Instructions:

  1. Use any CSV dataset
  2. Ask Claude to generate report with: summary, 3 findings, 1 chart
  3. Save as Markdown
  4. Review the structure
💡 Hint

Specify audience and format explicitly: “Format as Markdown. Audience: executive.”

✅ Solution
Prompt: "Generate a summary report from data.csv.
Include: executive summary (3 bullets), 3 key findings with one chart,
recommendations. Format: Markdown. Audience: executive.
Save to: reports/summary.md"

Goal: Use consistent templates across reports.

Instructions:

  1. Add a report template to CLAUDE.md
  2. Ask Claude to generate report following template
  3. Generate same report type for different data
  4. Compare consistency
💡 Hint

Add template to CLAUDE.md: “Standard reports include: summary, methodology, findings, recommendations, appendix.”

✅ Solution

CLAUDE.md addition:

## Report Template
All reports must include:
1. Executive Summary (3-5 bullets)
2. Methodology (1 paragraph)
3. Key Findings (with visualizations)
4. Recommendations (numbered list)
5. Appendix (raw data reference)

Prompt: “Generate a report from [data] using our standard template.”

Goal: Export report to multiple formats.

Instructions:

  1. Generate report in Markdown
  2. Convert to HTML using pandoc
  3. Convert to PDF using pandoc
  4. Compare readability
💡 Hint

Use pandoc: pandoc input.md -o output.pdf and pandoc input.md -o output.html

✅ Solution
Terminal window
# Generate Markdown first (via Claude)
# Then convert:
pandoc report.md -o report.html
pandoc report.md -o report.pdf
pandoc report.md -o report.docx

"Generate a [type] report from [data].
Include: [components]
Format: [Markdown/HTML]
Audience: [technical/executive]
Save to: [path]"
  • Executive Summary
  • Methodology
  • Key Findings (with visuals)
  • Recommendations
  • Appendix
Terminal window
# Markdown to PDF
pandoc report.md -o report.pdf
# Markdown to HTML
pandoc report.md -o report.html
# Markdown to DOCX
pandoc report.md -o report.docx
AudienceFocus
ExecutiveHigh-level, business impact
TechnicalDetailed methodology, code
GeneralPlain language, more context

❌ Mistake✅ Correct Approach
No clear audienceSpecify “audience: executive” or “technical”
Missing structureUse template or specify components
Charts not savedAsk Claude to save charts to files, then embed
Too much detail in summary”Executive summary: 3 bullets, one line each”
No export format specified”Format as Markdown” or “Generate HTML”
One giant promptIterate: generate, review, refine
Forgetting appendixInclude raw data for reference

Scenario: Vietnamese logistics company needed weekly performance reports for 12 regional managers. Manual process: analyst spent 2 days per week creating 12 reports.

Claude Code Solution:

CLAUDE.md template defined standard report structure: KPI summary, delivery performance, cost analysis, issues & recommendations.

Implementation:

Terminal window
for region in north south east west; do
claude -p "Generate weekly report for $region from data/${region}.csv
using our standard template. Save to reports/${region}-week-42.md"
pandoc reports/${region}-week-42.md -o reports/${region}-week-42.pdf
done

Results:

  • 2 days manual → 30 minutes automated
  • Consistent format across all 12 regions
  • Managers get reports Monday 8am instead of Wednesday
  • Analyst now does strategic work instead of copy-paste

Quote: “Report generation was our analyst’s least favorite task. Now Claude does it while she focuses on insights that matter.”


Next: Module 13.3: Log & Error Analysis