pdf-checklist-generator
它能做什么
这项技能是在沙盒中用 Python 制作专业 PDF 文档的可复用模式。适合需要结构化评估、清单或报告并以 PDF 形式交付的人。
适用场景
- ✓当我需要带表格、章节和评分的结构化 PDF 时。
- ✓当我希望在编写任何代码之前先规划文档结构时。
- ✓当工作流程需要一个可下载的成果文件时。
技能链接
https://github.com/HKUDS/AgentPilot/blob/main/openspace/benchmarks/gdpval/skills/pdf-checklist-generator/SKILL.md复制后粘贴给你的 AI(Claude、ChatGPT 或 Cursor),让它按照说明操作。
使用方法
最简单的方法:复制下面的消息,粘贴给你的 AI。它会读取这个技能并按说明操作。
可直接粘贴的消息
适用于 Claude Code、Codex 或 Cursor:在项目文件夹中运行,即可安装该技能。
下载 SKILL.md,放进智能体的技能文件夹。
可以这样问 AI
“请帮我制作一份供应商评审的 PDF 评分表,包含评分标准,并为每个类别设置一个章节。”
每周 5 个新技能,1 分钟读完。
工作原理
AI 先规划标题、章节、表格列和评分标准,然后编写 reportlab 或 fpdf2 代码,在沙盒中生成文档。
技术内容(原始 SKILL.md)
作者在 GitHub 上的英文原文。
PDF Checklist/Report Generator
This skill provides a reusable pattern for creating professional PDF documents (checklists, reports, scorecards) using Python libraries within execute_code_sandbox.
When to Use This Skill
- Need to generate structured PDF documents programmatically
- Creating checklists with scoring criteria
- Building reports with tables, sections, and formatted content
- Producing downloadable artifacts for workflow tasks
Library Selection
Choose the appropriate library based on your needs:
| Library | Best For | Installation |
|---|---|---|
| reportlab | Complex layouts, tables, precise control | pip install reportlab |
| fpdf2 | Simple documents, easy API | pip install fpdf2 |
| matplotlib | Charts/graphs in PDFs | pip install matplotlib |
Step-by-Step Procedure
Step 1: Plan Document Structure
Define the sections, tables, and scoring criteria before coding:
- Document title and metadata
- Section headers
- Table columns and rows
- Scoring rubric (if applicable)
Step 2: Write Python Code in execute_code_sandbox
Use execute_code_sandbox with the appropriate library. Here are templates:
Template A: Using reportlab (recommended for tables)
from reportlab.lib import colors
from reportlab.lib.pagesizes import letter
from reportlab.platypus import SimpleDocTemplate, Table, TableStyle, Paragraph, Spacer
from reportlab.lib.styles import getSampleStyleSheet, ParagraphStyle
from reportlab.lib.units import inch
# Create PDF
doc = SimpleDocTemplate("checklist.pdf", pagesize=letter)
elements = []
styles = getSampleStyleSheet()
# Title
title_style = ParagraphStyle('CustomTitle', parent=styles['Heading1'], alignment=1)
elements.append(Paragraph("Compliance Checklist", title_style))
elements.append(Spacer(1, 0.25*inch))
# Create table data
data = [
['Criteria', 'Status', 'Score', 'Notes'],
['Security Review', 'Pass', '10', 'All checks passed'],
['Code Quality', 'Pass', '8', 'Minor improvements'],
['Documentation', 'Pending', '5', 'Needs updates'],
]
# Create and style table
table = Table(data, colWidths=[3*inch, 1*inch, 1*inch, 2*inch])
table.setStyle(TableStyle([
('BACKGROUND', (0, 0), (-1, 0), colors.grey),
('TEXTCOLOR', (0, 0), (-1, 0), colors.whitesmoke),
('ALIGN', (0, 0), (-1, -1), 'CENTER'),
('GRID', (0, 0), (-1, -1), 1, colors.black),
('BACKGROUND', (0, 1), (-1, -1), colors.beige),
]))
elements.append(table)
# Build PDF
doc.build(elements)
print("PDF created: checklist.pdf")
print(f"ARTIFACT_PATH:/workspace/checklist.pdf")
Template B: Using fpdf2 (simpler API)
from fpdf import FPDF
pdf = FPDF()
pdf.add_page()
pdf.set_font("Arial", "B", 16)
pdf.cell(0, 10, "Project Report", ln=True, align='C')
pdf.set_font("Arial", size=12)
pdf.ln(10)
# Add sections
sections = [
("Executive Summary", "Project completed successfully."),
("Key Findings", "All milestones achieved on time."),
("Recommendations", "Continue current practices."),
]
for title, content in sections:
pdf.set_font("Arial", "B", 14)
pdf.cell(0, 10, title, ln=True)
pdf.set_font("Arial", size=12)
pdf.multi_cell(0, 8, content)
pdf.ln(5)
pdf.output("report.pdf")
print("PDF created: report.pdf")
print(f"ARTIFACT_PATH:/workspace/report.pdf")
Template C: Checklist with Scoring
from reportlab.lib.pagesizes import letter
from reportlab.platypus import SimpleDocTemplate, Table, TableStyle, Paragraph, Spacer
from reportlab.lib.styles import getSampleStyleSheet
from reportlab.lib import colors
doc = SimpleDocTemplate("scorecard.pdf", pagesize=letter)
elements = []
styles = getSampleStyleSheet()
# Title
elements.append(Paragraph("Evaluation Scorecard", styles['Heading1']))
elements.append(Spacer(1, 0.25*inch))
# Scoring criteria table
criteria = [
['Category', 'Weight', 'Score (0-10)', 'Weighted'],
['Functionality', '30%', '9', '2.7'],
['Performance', '25%', '8', '2.0'],
['Security', '25%', '10', '2.5'],
['Documentation', '20%', '7', '1.4'],
['TOTAL', '100%', '-', '8.6/10'],
]
table = Table(criteria, colWidths=[2.5*inch, 1*inch, 1.5*inch, 1.5*inch])
table.setStyle(TableStyle([
('BACKGROUND', (0, 0), (-1, 0), colors.darkblue),
('TEXTCOLOR', (0, 0), (-1, 0), colors.whitesmoke),
('ALIGN', (0, 0), (-1, -1), 'CENTER'),
('GRID', (0, 0), (-1, -1), 1, colors.black),
('FONTNAME', (0, -1), (-1, -1), 'Helvetica-Bold'),
常见问题
为什么要先规划结构?
先确定章节、表格和评分标准,代码会更简单,结果也更一致。
提到了哪些库?
指南提到了 reportlab、fpdf2 和 matplotlib,各自适用于不同需求。
需要特别安装吗?
指南给出了所选库的 pip 安装命令。
详情
作者的原始描述
Generate structured PDF checklists and reports with tables, sections, and scoring criteria using Python libraries
repo: HKUDS/AgentPilot
热度
- GitHub 星标
- 7.8k
- 排名
- #12909
- 许可证
- MIT
- 更新时间
- 2026/11/1
评论
- …
同一仓库的更多技能
agentpilot
7.8k帮你的智能体准备任务并运行 AgentPilot 循环,逐步改进项目:循环会提出修改、测试修改并为其打分。
openspace
7.8k帮你的智能体设置 OpenSpace,这是一个用于存储和获取智能体技能的工具,并通过 MCP 将其连接到你的 AI 应用。
rsi-arena
7.8k帮你的智能体设置并运行标准 AI 基准测试,例如 AIME 和 Terminal-Bench,用来比较不同的改进方法。
experiment-guide
7.8k帮你的智能体规划小型实验、阅读实验结果并记录发现,同时研究如何改进一个程序。