reportlab-styles
Qué hace
Esta skill explica cómo usar los estilos de párrafo ya definidos en la biblioteca ReportLab para PDF. Está pensada para quienes crean documentos PDF con Python y se topan con errores de estilo.
Cuándo usarla
- ✓Cuando un script de ReportLab lanza un KeyError con el nombre de un estilo de párrafo.
- ✓Cuando quieres dar formato a títulos y texto principal sin crear nombres de estilo a mano.
- ✓Cuando creas un informe en PDF y quieres el aspecto estándar de los estilos de ejemplo.
Link de la skill
https://github.com/HKUDS/AgentPilot/blob/main/openspace/benchmarks/gdpval/skills/reportlab-styles/SKILL.mdCópialo y pégalo en tu IA (Claude, ChatGPT o Cursor) pidiéndole que siga las instrucciones.
Cómo usar
La forma más fácil: copia el mensaje y pégalo en tu IA. Ella lee la skill y sigue las instrucciones.
Mensaje listo para pegar
Para Claude Code, Codex o Cursor: ejecútalo en la carpeta del proyecto y la skill queda instalada.
Descarga el SKILL.md y ponlo en la carpeta de skills de tu agente.
Ejemplo de qué pedirle a la IA
“Mi script de ReportLab se rompe con un KeyError en el estilo. Arréglalo usando los estilos integrados.”
5 skills nuevas por semana. 1 minuto de lectura.
Cómo funciona
El agente obtiene la hoja de estilos de ejemplo de ReportLab y usa los nombres de estilo existentes, como Title, Heading1 y Normal. Evita crear un estilo nuevo con un nombre que ya existe en la hoja.
Contenido técnico (SKILL.md original)
Texto original del autor, en inglés, directo de 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
Preguntas frecuentes
¿Qué estilos vienen integrados?
La skill enumera Normal, Title, Heading1 a Heading6, Bullet, Definition, Italic y Code.
¿Qué causa el KeyError?
La skill indica que el error se produce al redefinir un nombre de estilo existente, así que la solución es usar el nombre integrado.
¿Necesito un estilo nuevo para mi diseño?
La skill sugiere usar primero los estilos existentes y añadir estilos nuevos solo con nombres únicos.
Detalles
Descripción original del autor
Use reportlab's pre-defined styles from getSampleStyleSheet() correctly
repo: HKUDS/AgentPilot
Popularidad
- Estrellas en GitHub
- 7,8 mil
- Posición en el ranking
- #12970
- Licencia
- MIT
- Actualizada
- 1/11/2026
Comentarios
- …
Más skills de este repositorio
agentpilot
7,8 milAyuda a tu agente a mejorar un proyecto paso a paso, preparando una tarea y ejecutando el bucle de AgentPilot que propone, prueba y puntúa cambios.
openspace
7,8 milAyuda a tu agente a configurar OpenSpace, una herramienta que guarda y recupera skills de agentes, y a conectarla a tu app de IA mediante MCP.
rsi-arena
7,8 milAyuda a tu agente a configurar y ejecutar pruebas de referencia de IA conocidas, como AIME y Terminal-Bench, para comparar distintos métodos de mejora.
experiment-guide
7,8 milAyuda a tu agente a planificar experimentos pequeños, leer sus resultados y anotar conclusiones mientras investiga cómo mejorar un programa.
Skills parecidas
feishu-doc
394 milAyuda a tu agente a leer, crear y editar documentos en la nube de Feishu, incluidos texto, imágenes y tablas, usando la herramienta de documentos.
feishu-drive
394 milPermite que tu agente explore, organice y comente archivos de una carpeta de la nube de Feishu que se haya compartido con el bot.
feishu-perm
394 milAyuda a tu agente a revisar y cambiar quién puede acceder a un archivo de Feishu, eligiendo el permiso más pequeño que cumpla tu petición.