reportlab-styles
하는 일
이 스킬은 PDF를 만들 때 ReportLab 라이브러리의 기본 제공 단락 스타일을 쓰는 방법을 설명합니다. Python으로 PDF 문서를 만들다가 스타일 오류를 겪는 사람에게 맞습니다.
사용하는 경우
- ✓ReportLab 스크립트가 단락 스타일 이름에서 KeyError를 낼 때.
- ✓스타일 이름을 직접 만들지 않고 제목과 본문에 스타일을 적용하고 싶은 경우.
- ✓샘플 스타일의 기본 모양으로 PDF 보고서를 만들고 싶을 때.
스킬 링크
https://github.com/HKUDS/AgentPilot/blob/main/openspace/benchmarks/gdpval/skills/reportlab-styles/SKILL.md복사해서 AI(Claude, ChatGPT, Cursor)에 붙여넣고 지침을 따르도록 요청하세요.
사용 방법
가장 쉬운 방법입니다. 메시지를 복사해 AI에 붙여넣으세요. AI가 스킬을 읽고 지침을 따릅니다.
바로 붙여넣을 수 있는 메시지
Claude Code, Codex, Cursor용입니다. 프로젝트 폴더에서 실행하면 스킬이 설치됩니다.
SKILL.md를 다운로드해 에이전트의 스킬 폴더에 넣으세요.
AI에게 요청하는 예시
“제 ReportLab 스크립트가 스타일에서 KeyError로 멈춥니다. 내장 스타일을 써서 고쳐 주세요.”
매주 새 스킬 5개. 읽는 데 1분.
작동 방식
에이전트는 ReportLab의 샘플 스타일시트를 가져와 Title, Heading1, Normal 같은 기존 스타일 이름을 씁니다. 이미 있는 이름으로 새 스타일을 만들지 않습니다.
기술 내용 (원본 SKILL.md)
작성자의 영어 원문을 GitHub에서 그대로 가져왔습니다.
ReportLab Pre-Defined Styles Reference
Overview
ReportLab's reportlab.lib.styles.getSampleStyleSheet() provides a collection of pre-defined paragraph styles. Use these existing styles rather than redefining them to avoid KeyError exceptions.
Available Pre-Defined Styles
The standard stylesheet includes these commonly-used styles:
| Style Name | Purpose |
|---|---|
Normal |
Default body text |
Title |
Document title (large, bold) |
Heading1 |
Level 1 section heading |
Heading2 |
Level 2 section heading |
Heading3 |
Level 3 section heading |
Heading4 |
Level 4 section heading |
Heading5 |
Level 5 section heading |
Heading6 |
Level 6 section heading |
Bullet |
Bulleted list items |
Definition |
Definition list terms |
Italic |
Italicized text |
Code |
Monospace code text |
Correct Usage Pattern
from reportlab.lib.styles import getSampleStyleSheet
from reportlab.platypus import Paragraph
# Get the stylesheet
styles = getSampleStyleSheet()
# Use existing styles directly (CORRECT)
title = Paragraph("My Document Title", styles['Title'])
heading = Paragraph("Section Header", styles['Heading1'])
body = Paragraph("Regular text content", styles['Normal'])
Common Mistake to Avoid
# WRONG - Don't redefine existing style names
from reportlab.lib.styles import getSampleStyleSheet, ParagraphStyle
styles = getSampleStyleSheet()
# This will cause KeyError when you try to use 'Title' later
styles.add(ParagraphStyle(
name='Title', # Overwrites the pre-defined 'Title' style
fontSize=24,
# ... incomplete definition
))
# Later code expecting the full 'Title' style will fail
paragraph = Paragraph("Title Text", styles['Title']) # KeyError!
Best Practices
- Use existing styles as-is when they meet your needs
- Create new style names for custom styles (e.g.,
MyCustomTitle,CustomHeading) - Base custom styles on existing ones when you need modifications:
from reportlab.lib.styles import getSampleStyleSheet, ParagraphStyle
styles = getSampleStyleSheet()
# Create a NEW style with a unique name
custom_title = ParagraphStyle(
name='CustomTitle', # Unique name, doesn't conflict
parent=styles['Title'], # Base it on existing Title
fontSize=28,
spaceAfter=30
)
styles.add(custom_title)
# Now both styles are available
styles['Title'] # Original pre-defined style
styles['CustomTitle'] # Your custom variant
Quick Reference Checklist
- Import
getSampleStyleSheet()fromreportlab.lib.styles - Call
styles = getSampleStyleSheet()once at the start - Access styles via
styles['StyleName'](case-sensitive) - Do NOT add styles with names that already exist in the stylesheet
- Use unique names for any custom styles you create
- Common available styles:
Normal,Title,Heading1-6,Bullet,Code,Italic
자주 묻는 질문
어떤 스타일이 기본 제공되나요?
Normal, Title, Heading1부터 Heading6까지, Bullet, Definition, Italic, Code를 나열합니다.
KeyError는 무엇 때문에 생기나요?
스킬은 기존 스타일 이름을 다시 정의하는 것 때문에 생긴다고 설명하므로, 해결책은 내장 이름을 쓰는 것입니다.
디자인에 새 스타일이 필요하나요?
스킬은 먼저 기존 스타일을 쓰고, 새 스타일은 고유한 이름으로만 추가하라고 제안합니다.
상세 정보
작성자의 원본 설명
Use reportlab's pre-defined styles from getSampleStyleSheet() correctly
repo: HKUDS/AgentPilot
인기도
- GitHub 스타
- 7.8k
- 순위
- #12970
- 라이선스
- MIT
- 업데이트
- 2026. 11. 1.
댓글
- …
이 저장소의 다른 스킬
agentpilot
7.8k작업을 준비하고 AgentPilot 루프를 실행해 변경을 제안, 테스트, 점수화하면서 프로젝트를 단계적으로 개선하도록 돕습니다.
openspace
7.8k에이전트 스킬을 저장하고 가져오는 도구인 OpenSpace를 설정하고, MCP를 통해 AI 앱에 연결하도록 돕습니다.
rsi-arena
7.8kAIME나 Terminal-Bench 같은 표준 AI 벤치마크 테스트를 설정하고 실행해 서로 다른 개선 방법을 비교하도록 돕습니다.
experiment-guide
7.8k프로그램을 개선하는 방법을 조사하면서 작은 실험을 계획하고, 결과를 읽고, 발견 사항을 기록하도록 돕습니다.
비슷한 스킬
feishu-doc
394k에이전트가 문서 도구를 사용해 텍스트, 이미지, 표를 포함한 Feishu 클라우드 문서를 읽고, 만들고, 편집하도록 돕습니다.
feishu-drive
394k에이전트가 봇과 공유된 Feishu 클라우드 폴더의 파일을 찾아보고, 정리하고, 댓글을 달도록 돕습니다.
feishu-perm
394k에이전트가 요청을 충족하는 가장 작은 권한을 골라, Feishu 파일에 누가 접근할 수 있는지 확인하고 바꾸도록 돕습니다.