$120 tested Claude codes · real before/after data · Full tier $15 one-timebuy --sheet=15 →
$Free 40-page Claude guide — setup, 120 prompt codes, MCP servers, AI agents. download --free →
clskills.sh — terminal v2.4 — 2,347 skills indexed● online
[CL]Skills_
Data & Analyticsintermediate

Report Generator

Share

Generate reports from data

Works with OpenClaude

You are a data engineer who needs to generate professional reports from structured data using Python. The user wants to create automated reports with formatting, charts, and export capabilities.

What to check first

  • Verify you have pandas, matplotlib, and reportlab installed: pip list | grep -E "pandas|matplotlib|reportlab"
  • Confirm your data source is accessible (CSV file, database connection, or API endpoint)
  • Check that your output directory exists or can be created with os.makedirs()

Steps

  1. Import required libraries: pandas for data manipulation, matplotlib for charts, and reportlab for PDF generation
  2. Load your data using pd.read_csv(), pd.read_sql(), or your data source method
  3. Clean and aggregate data using groupby(), agg(), and sort_values() methods to prepare metrics
  4. Generate visualizations with plt.figure() and save as PNG using plt.savefig() with dpi=300 for report quality
  5. Create a PDF document using SimpleDocTemplate() from reportlab and define page size with letter
  6. Build report content with Paragraph, Table, PageBreak, and Image elements, appending to a story list
  7. Apply styling with ParagraphStyle to set fonts, sizes, and alignment for headers, body text, and tables
  8. Render the final PDF by calling pdf.build(story) with your assembled content

Code

import pandas as pd
import matplotlib.pyplot as plt
from reportlab.lib.pagesizes import letter, A4
from reportlab.lib.styles import getSampleStyleSheet, ParagraphStyle
from reportlab.lib.units import inch
from reportlab.platypus import SimpleDocTemplate, Paragraph, Table, TableStyle, PageBreak, Image, Spacer
from reportlab.lib import colors
from datetime import datetime
import os

class ReportGenerator:
    def __init__(self, output_path="report.pdf", page_size=letter):
        self.output_path = output_path
        self.page_size = page_size
        self.story = []
        self.styles = getSampleStyleSheet()
        self._setup_custom_styles()
    
    def _setup_custom_styles(self):
        """Define custom paragraph styles"""
        self.styles.add(ParagraphStyle(
            name='CustomTitle',
            parent=self.styles['Heading1'],
            fontSize=24,
            textColor=colors.HexColor('#1f4788'),
            spaceAfter=30,
            alignment=1
        ))
        self.styles.add(ParagraphStyle(
            name='CustomHeading',
            parent=self.styles['Heading2'],
            fontSize=14,
            textColor=colors.HexColor('#2e5c8a'),
            spaceAfter=12,
            spaceBefore=12
        ))

Note: this example was truncated in the source. See the GitHub repo for the latest full version.

Common Pitfalls

  • Treating this skill as a one-shot solution — most workflows need iteration and verification
  • Skipping the verification steps — you don't know it worked until you measure
  • Applying this skill without understanding the underlying problem — read the related docs first

When NOT to Use This Skill

  • When a simpler manual approach would take less than 10 minutes
  • On critical production systems without testing in staging first
  • When you don't have permission or authorization to make these changes

How to Verify It Worked

  • Run the verification steps documented above
  • Compare the output against your expected baseline
  • Check logs for any warnings or errors — silent failures are the worst kind

Production Considerations

  • Test in staging before deploying to production
  • Have a rollback plan — every change should be reversible
  • Monitor the affected systems for at least 24 hours after the change

Quick Info

Difficultyintermediate
Version1.0.0
AuthorClaude Skills Hub
datareportsgeneration

Install command:

curl -o ~/.claude/skills/report-generator.md https://claude-skills-hub.vercel.app/skills/data/report-generator.md

Related Data & Analytics Skills

Other Claude Code skills in the same category — free to download.

Want a Data & Analytics skill personalized to YOUR project?

This is a generic skill that works for everyone. Our AI can generate one tailored to your exact tech stack, naming conventions, folder structure, and coding patterns — with 3x more detail.