Elegant reports

From malue-ai/dazee-small · View interactive version

Elegant reports is an AI agent skill from the GitHub repository malue-ai/dazee-small. Generate beautifully designed PDF reports with Nordic-style typography, charts, tables, and multi-page layouts using reportlab or fpdf2.

How to use this skill

Skill file

精美报告生成

生成设计感强的专业 PDF 报告,支持图表、表格、多页排版,Nordic 简约风格。

使用场景

依赖安装

首次使用时自动安装:

pip install fpdf2 matplotlib

执行方式

通过 Python 脚本使用 fpdf2 生成 PDF,matplotlib 生成图表。

设计风格:Nordic 简约

报告结构模板

from fpdf import FPDF

class ElegantReport(FPDF):
    """Nordic-style PDF report generator."""

    def header(self):
        self.set_font('Helvetica', 'B', 10)
        self.set_text_color(44, 62, 80)
        self.cell(0, 10, self.title, align='R')
        self.ln(15)

    def footer(self):
        self.set_y(-15)
        self.set_font('Helvetica', '', 8)
        self.set_text_color(149, 165, 166)
        self.cell(0, 10, f'Page {self.page_no()}/{{nb}}', align='C')

    def chapter_title(self, title: str):
        self.set_font('Helvetica', 'B', 18)
        self.set_text_color(44, 62, 80)
        self.cell(0, 15, title)
        self.ln(20)

    def body_text(self, text: str):
        self.set_font('Helvetica', '', 11)
        self.set_text_color(52, 73, 94)
        self.multi_cell(0, 7, text)
        self.ln(5)

支持的内容元素

  1. 封面页:标题、副标题、日期、作者
  2. 目录:自动生成章节目录
  3. 正文:标题层级、段落、列表
  4. 表格:带交替行背景色的数据表
  5. 图表:matplotlib 生成的统计图
  6. 页眉页脚:标题 + 页码

图表生成

import matplotlib.pyplot as plt
import matplotlib
matplotlib.use('Agg')

def create_chart(data: dict, output_path: str):
    """Generate chart image for embedding in PDF."""
    fig, ax = plt.subplots(figsize=(8, 4))
    # Nordic color palette
    colors = ['#2C3E50', '#E74C3C', '#F39C12', '#27AE60', '#3498DB']
    ax.bar(data.keys(), data.values(), color=colors[:len(data)])
    ax.spines['top'].set_visible(False)
    ax.spines['right'].set_visible(False)
    plt.tight_layout()
    plt.savefig(output_path, dpi=150, bbox_inches='tight')
    plt.close()

输出规范

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.