Bỏ qua để đến nội dung

Sinh báo cáo

Thời gian học: ~30 phút

Yêu cầu trước: Module 13.1 (Phân tích dữ liệu)

Kết quả: Sau module này, bạn sẽ biết generate complete report từ data, dùng template cho consistent reporting, và export various format.


Analysis xong, cần share kết quả. Boss muốn PDF report. Client muốn executive summary. Team muốn detailed finding.

Copy paste response của Claude vào Word? Tedious và error-prone. Manual format chart? Phí thời gian. Claude Code có thể generate complete, formatted report — từ raw data đến polished deliverable. Một prompt: “Generate monthly sales report.”


[Data] → [Analysis] → [Narrative] → [Format] → [Export]
↓ ↓ ↓ ↓ ↓
CSV/DB Insight Write-up Markdown PDF/HTML
ComponentMục đíchClaude làm gì
Title/HeaderIdentify reportGenerate với date, author
Executive SummaryKey takeawaySynthesize finding
MethodologyCách làmDocument approach
FindingsChi tiếtData + narrative
VisualizationChart, tableGenerate và embed
RecommendationBước tiếpBusiness insight
AppendixSupportingRaw table, code
  • Markdown: Universal, dễ version control
  • HTML: Rich formatting, interactive chart
  • PDF: Professional, printable (qua pandoc)
  • DOCX: Cho Word user (qua pandoc)
# [Report Title]
**Date**: [Date] | **Author**: [Author]
## Executive Summary
[3-5 bullet key finding]
## Methodology
[Cách analysis được thực hiện]
## Key Findings
### Finding 1: [Title]
[Narrative + visualization]
## Recommendations
[Actionable next step]
## Appendix
[Supporting data]

Scenario: Generate monthly sales report từ sales.csv.

Bạn: Generate monthly sales report tháng 12/2023 từ sales.csv.
Include:
- Executive summary (3 điểm chính)
- Revenue analysis by region và category
- Top performing product
- 2 visualization
- Recommendation
Format: Markdown. Audience: executive team.
Save to reports/thang-12-2023-sales.md
Claude: [Analyze data, generate report]
Đã tạo: reports/thang-12-2023-sales.md
# Báo cáo Bán hàng Tháng 12/2023
**Ngày tạo**: 05/01/2024 | **Nguồn**: sales.csv (3,245 giao dịch)
## Executive Summary
- **Revenue kỷ lục**: Tháng 12 đạt 890 triệu, cao hơn 40% so với trung bình
- **Electronics thống trị**: Category chiếm 52% monthly revenue
- **Regional shift**: Khu vực Tây tăng 25% MoM, hiện là #2 market
## Revenue Analysis
### By Region
| Region | Revenue | MoM Change |
|--------|---------|------------|
| Bắc | 320 tr | +15% |
| Tây | 280 tr | +25% |
| Nam | 180 tr | +10% |
| Đông | 110 tr | +5% |
![Regional Revenue](charts/regional_revenue_dec.png)
## Recommendations
1. **Chuẩn bị tồn kho**: Tăng inventory Electronics cho Q1
2. **Focus Tây**: Allocate thêm marketing budget
3. **Product Bundling**: Laptop + Headphones bundle opportunity
Terminal window
$ pandoc reports/thang-12-2023-sales.md -o reports/thang-12-2023-sales.pdf
Bạn: Executive summary quá dài. Làm concise hơn —
mỗi điểm tối đa một dòng.
Claude: [Revise executive summary cho ngắn gọn hơn]

Mục tiêu: Generate report đơn giản từ data.

Hướng dẫn:

  1. Dùng bất kỳ CSV dataset
  2. Yêu cầu Claude generate report: summary, 3 finding, 1 chart
  3. Save dạng Markdown
  4. Review structure
💡 Hint

Specify audience và format rõ ràng: “Format as Markdown. Audience: executive.”

✅ Solution
Prompt: "Generate summary report từ data.csv.
Include: executive summary (3 bullet), 3 key finding với một chart,
recommendation. Format: Markdown. Audience: executive.
Save to: reports/summary.md"

Mục tiêu: Dùng template consistent cho nhiều report.

Hướng dẫn:

  1. Thêm report template vào CLAUDE.md
  2. Yêu cầu Claude generate report theo template
  3. Generate cùng loại report cho data khác
  4. So sánh consistency
💡 Hint

Thêm vào CLAUDE.md: “Standard report include: summary, methodology, findings, recommendations, appendix.”

✅ Solution

CLAUDE.md addition:

## Report Template
Tất cả report phải include:
1. Executive Summary (3-5 bullet)
2. Methodology (1 paragraph)
3. Key Findings (với visualization)
4. Recommendations (numbered list)
5. Appendix (raw data reference)

Prompt: “Generate report từ [data] theo standard template của chúng ta.”

Mục tiêu: Export report sang nhiều format.

Hướng dẫn:

  1. Generate report dạng Markdown
  2. Convert sang HTML với pandoc
  3. Convert sang PDF với pandoc
  4. So sánh readability
💡 Hint

Dùng pandoc: pandoc input.md -o output.pdfpandoc input.md -o output.html

✅ Solution
Terminal window
# Generate Markdown trước (qua Claude)
# Sau đó convert:
pandoc report.md -o report.html
pandoc report.md -o report.pdf
pandoc report.md -o report.docx

"Generate [type] report từ [data].
Include: [component]
Format: [Markdown/HTML]
Audience: [technical/executive]
Save to: [path]"
  • Executive Summary
  • Methodology
  • Key Findings (với visual)
  • Recommendations
  • Appendix
Terminal window
# Markdown sang PDF
pandoc report.md -o report.pdf
# Markdown sang HTML
pandoc report.md -o report.html
# Markdown sang DOCX
pandoc report.md -o report.docx
AudienceFocus
ExecutiveHigh-level, business impact
TechnicalChi tiết methodology, code
GeneralPlain language, nhiều context

❌ Sai✅ Đúng
Không rõ audienceSpecify “audience: executive” hoặc “technical”
Thiếu structureDùng template hoặc specify component
Chart không saveYêu cầu Claude save chart ra file, rồi embed
Summary quá chi tiết”Executive summary: 3 bullet, mỗi bullet một dòng”
Không specify format”Format as Markdown” hoặc “Generate HTML”
Một prompt khổng lồIterate: generate, review, refine
Quên appendixInclude raw data cho reference

Scenario: Công ty logistics Việt Nam cần weekly performance report cho 12 regional manager. Manual process: analyst tốn 2 ngày/tuần tạo 12 report.

Claude Code Solution:

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

Implementation:

Terminal window
for region in bac nam dong tay; do
claude -p "Generate weekly report cho $region từ data/${region}.csv
theo standard template. Save to reports/${region}-tuan-42.md"
pandoc reports/${region}-tuan-42.md -o reports/${region}-tuan-42.pdf
done

Kết quả:

  • 2 ngày manual → 30 phút automated
  • Format nhất quán across 12 vùng
  • Manager nhận report Monday 8am thay vì Wednesday
  • Analyst giờ làm strategic work thay vì copy-paste

Quote: “Report generation là task analyst ghét nhất. Giờ Claude làm, cô ấy focus vào insight quan trọng.”


Tiếp theo: Module 13.3: Phân tích Log & Lỗi