[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M6XBFVCD15JT54J8HF43CP9M":3,"skill-same:01M6XBFVCD15JT54J8HF43CP9M":76},{"skillNo":4,"name":5,"nameZh":6,"description":7,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":15,"categories":16,"keywords":25,"publishedAt":45,"linkOnly":46,"markdownContent":47,"markdownBody":48,"frontMatter":49,"refName":50,"commitSha":51,"skillDirectory":52,"forksCount":13,"repositoryHtmlUrl":53,"repositoryHomepageUrl":6,"ownerHtmlUrl":54,"ownerBlogUrl":6,"ownerDescription":6,"updatedAt":55,"install":56,"resources":69},"01M6XBFVCD15JT54J8HF43CP9M","direct-reportlab-pdf-generation",null,"Generate complex multi-page PDFs by running reportlab Python code directly via run_shell when shell_agent fails on document creation","UF-gzj\u002Fopenspace-claude-evolution","UF-gzj","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F272393507?v=4","01M6XBCZB755P01VVYGQWPYZY3","01M6XBCZFJA5AREA17WGETA3FW",0,"MIT","https:\u002F\u002Fgithub.com\u002FUF-gzj\u002Fopenspace-claude-evolution\u002Fblob\u002Fmain\u002Fgdpval_bench\u002Fskills\u002Fdirect-reportlab-pdf-generation\u002FSKILL.md",[17,22],{"categoryNo":18,"categoryName":19,"taxonomyType":20,"taxonomyTypeDesc":21},"01JBSEEDCAT000000000000002","文档处理","SCENARIO","使用场景",{"categoryNo":23,"categoryName":24,"taxonomyType":20,"taxonomyTypeDesc":21},"01JBSEEDCAT000000000000023","Skill与智能体开发",[26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44],"PDF","direct reportlab pdf generation","direct","pdf generation","generation","running","when","multi-page","python code","multi","via","creation","document","page","shell","code","run","generate","python","2026-11-10 10:12:30",false,"---\nname: direct-reportlab-pdf-generation\ndescription: Generate complex multi-page PDFs by running reportlab Python code directly via run_shell when shell_agent fails on document creation\n---\n\n# Direct ReportLab PDF Generation via run_shell\n\n## When to Use This Skill\n\nUse this pattern when:\n- You need to create a complex, multi-page PDF document with structured content\n- Delegating PDF generation to `shell_agent` fails or produces unreliable results\n- You need fine-grained control over PDF layout, styling, and pagination\n\n## Core Technique\n\nInstead of asking `shell_agent` to handle PDF creation, write inline Python code using the `reportlab` library and execute it directly via `run_shell`. This gives you deterministic control over the document structure.\n\n## Step-by-Step Instructions\n\n### Step 1: Prepare Your PDF Content\n\nOrganize your content into logical sections that will become pages or page groups:\n- Title page\n- Table of contents (optional)\n- Main content sections\n- Appendices or references\n\n### Step 2: Write the ReportLab Python Script\n\nCreate a Python script that uses these key reportlab components:\n\n```python\nfrom reportlab.lib import colors\nfrom reportlab.lib.pagesizes import letter\nfrom reportlab.lib.styles import getSampleStyleSheet, ParagraphStyle\nfrom reportlab.lib.units import inch\nfrom reportlab.platypus import SimpleDocTemplate, Paragraph, Spacer, Table, TableStyle, PageBreak, Image\nfrom reportlab.lib.enums import TA_CENTER, TA_LEFT, TA_JUSTIFY\n\ndef create_pdf(filename, content_data):\n    doc = SimpleDocTemplate(filename, pagesize=letter,\n                           rightMargin=72, leftMargin=72,\n                           topMargin=72, bottomMargin=72)\n    \n    story = []\n    styles = getSampleStyleSheet()\n    \n    # Custom styles\n    title_style = ParagraphStyle(\n        'CustomTitle',\n        parent=styles['Heading1'],\n        fontSize=24,\n        textColor=colors.HexColor('#1a1a1a'),\n        spaceAfter=30,\n        alignment=TA_CENTER\n    )\n    \n    heading_style = ParagraphStyle(\n        'CustomHeading',\n        parent=styles['Heading2'],\n        fontSize=16,\n        textColor=colors.HexColor('#2c3e50'),\n        spaceBefore=20,\n        spaceAfter=12\n    )\n    \n    body_style = ParagraphStyle(\n        'CustomBody',\n        parent=styles['Normal'],\n        fontSize=11,\n        leading=16,\n        alignment=TA_JUSTIFY\n    )\n    \n    # Build document content\n    for section in content_data:\n        if section['type'] == 'title':\n            story.append(Paragraph(section['text'], title_style))\n        elif section['type'] == 'heading':\n            story.append(Paragraph(section['text'], heading_style))\n        elif section['type'] == 'paragraph':\n            story.append(Paragraph(section['text'], body_style))\n            story.append(Spacer(1, 12))\n        elif section['type'] == 'table':\n            table = Table(section['data'], colWidths=section.get('col_widths'))\n            table.setStyle(TableStyle([\n                ('BACKGROUND', (0, 0), (-1, 0), colors.grey),\n                ('TEXTCOLOR', (0, 0), (-1, 0), colors.whitesmoke),\n                ('ALIGN', (0, 0), (-1, -1), 'CENTER'),\n                ('FONTNAME', (0, 0), (-1, 0), 'Helvetica-Bold'),\n                ('FONTSIZE', (0, 0), (-1, 0), 12),\n                ('BOTTOMPADDING', (0, 0), (-1, 0), 12),\n                ('BACKGROUND', (0, 1), (-1, -1), colors.beige),\n                ('GRID', (0, 0), (-1, -1), 1, colors.black),\n            ]))\n            story.append(table)\n            story.append(Spacer(1, 20))\n        elif section['type'] == 'pagebreak':\n            story.append(PageBreak())\n    \n    doc.build(story)\n```\n\n### Step 3: Execute via run_shell\n\nRun the Python script directly using `run_shell`:\n\n```bash\npython3 \u003C\u003C 'EOF'\n# Your complete reportlab script here\nfrom reportlab.lib import colors\nfrom reportlab.lib.pagesizes import letter\nfrom reportlab.lib.styles import getSampleStyleSheet, ParagraphStyle\nfrom reportlab.platypus import SimpleDocTemplate, Paragraph, Spacer, Table, TableStyle, PageBreak\n\n# ... rest of your script\nEOF\n```\n\nOr save to a file and execute:\n\n```bash\ncat > generate_pdf.py \u003C\u003C 'SCRIPT'\n# Your complete script\nSCRIPT\n\npython3 generate_pdf.py\n```\n\n### Step 4: Handle Complex Content\n\nFor lengthy documents, structure content as a data structure:\n\n```python\ndocument_sections = [\n    {'type': 'title', 'text': 'Document Title'},\n    {'type': 'pagebreak'},\n    {'type': 'heading', 'text': 'Section 1'},\n    {'type': 'paragraph', 'text': 'Content here...'},\n    {'type': 'heading', 'text': 'Section 2'},\n    {'type': 'table', 'data': [['Header1', 'Header2'], ['Row1-Col1', 'Row1-Col2']]},\n    {'type': 'pagebreak'},\n    # Continue for all sections\n]\n```\n\n### Step 5: Verify Output\n\nCheck that the PDF was created successfully:\n\n```bash\nls -la your_document.pdf\n# Optionally check page count\npdfinfo your_document.pdf 2>\u002Fdev\u002Fnull || echo \"PDF created, pdfinfo not available\"\n```\n\n## Common Patterns\n\n### Multi-Section Documents\nUse `PageBreak()` between major sections to ensure clean pagination.\n\n### Tables with Data\nStructure tabular data as nested lists:\n```python\ntable_data = [\n    ['Column 1', 'Column 2', 'Column 3'],\n    ['Value 1', 'Value 2', 'Value 3'],\n    ['Value 4', 'Value 5', 'Value 6'],\n]\n```\n\n### Styled Text\nCreate custom `ParagraphStyle` objects for consistent formatting across sections.\n\n### Long Paragraphs\nReportLab automatically handles text wrapping. For very long content, consider breaking into multiple paragraphs.\n\n## Troubleshooting\n\n| Issue | Solution |\n|-------|----------|\n| Import errors | Ensure reportlab is installed: `pip install reportlab` |\n| Layout issues | Adjust margins in `SimpleDocTemplate` constructor |\n| Text overflow | Use `Spacer` elements to add vertical space |\n| Table width problems | Set explicit `colWidths` parameter |\n| Page breaks in wrong places | Insert `PageBreak()` explicitly before new sections |\n\n## Advantages Over shell_agent\n\n- **Deterministic**: Code executes exactly as written\n- **Debuggable**: Errors are immediate and clear\n- **Controllable**: Full access to reportlab's API\n- **Reliable**: No intermediate agent interpretation layer\n- **Efficient**: Single execution, no retry loops","# Direct ReportLab PDF Generation via run_shell\n\n## When to Use This Skill\n\nUse this pattern when:\n- You need to create a complex, multi-page PDF document with structured content\n- Delegating PDF generation to `shell_agent` fails or produces unreliable results\n- You need fine-grained control over PDF layout, styling, and pagination\n\n## Core Technique\n\nInstead of asking `shell_agent` to handle PDF creation, write inline Python code using the `reportlab` library and execute it directly via `run_shell`. This gives you deterministic control over the document structure.\n\n## Step-by-Step Instructions\n\n### Step 1: Prepare Your PDF Content\n\nOrganize your content into logical sections that will become pages or page groups:\n- Title page\n- Table of contents (optional)\n- Main content sections\n- Appendices or references\n\n### Step 2: Write the ReportLab Python Script\n\nCreate a Python script that uses these key reportlab components:\n\n```python\nfrom reportlab.lib import colors\nfrom reportlab.lib.pagesizes import letter\nfrom reportlab.lib.styles import getSampleStyleSheet, ParagraphStyle\nfrom reportlab.lib.units import inch\nfrom reportlab.platypus import SimpleDocTemplate, Paragraph, Spacer, Table, TableStyle, PageBreak, Image\nfrom reportlab.lib.enums import TA_CENTER, TA_LEFT, TA_JUSTIFY\n\ndef create_pdf(filename, content_data):\n    doc = SimpleDocTemplate(filename, pagesize=letter,\n                           rightMargin=72, leftMargin=72,\n                           topMargin=72, bottomMargin=72)\n    \n    story = []\n    styles = getSampleStyleSheet()\n    \n    # Custom styles\n    title_style = ParagraphStyle(\n        'CustomTitle',\n        parent=styles['Heading1'],\n        fontSize=24,\n        textColor=colors.HexColor('#1a1a1a'),\n        spaceAfter=30,\n        alignment=TA_CENTER\n    )\n    \n    heading_style = ParagraphStyle(\n        'CustomHeading',\n        parent=styles['Heading2'],\n        fontSize=16,\n        textColor=colors.HexColor('#2c3e50'),\n        spaceBefore=20,\n        spaceAfter=12\n    )\n    \n    body_style = ParagraphStyle(\n        'CustomBody',\n        parent=styles['Normal'],\n        fontSize=11,\n        leading=16,\n        alignment=TA_JUSTIFY\n    )\n    \n    # Build document content\n    for section in content_data:\n        if section['type'] == 'title':\n            story.append(Paragraph(section['text'], title_style))\n        elif section['type'] == 'heading':\n            story.append(Paragraph(section['text'], heading_style))\n        elif section['type'] == 'paragraph':\n            story.append(Paragraph(section['text'], body_style))\n            story.append(Spacer(1, 12))\n        elif section['type'] == 'table':\n            table = Table(section['data'], colWidths=section.get('col_widths'))\n            table.setStyle(TableStyle([\n                ('BACKGROUND', (0, 0), (-1, 0), colors.grey),\n                ('TEXTCOLOR', (0, 0), (-1, 0), colors.whitesmoke),\n                ('ALIGN', (0, 0), (-1, -1), 'CENTER'),\n                ('FONTNAME', (0, 0), (-1, 0), 'Helvetica-Bold'),\n                ('FONTSIZE', (0, 0), (-1, 0), 12),\n                ('BOTTOMPADDING', (0, 0), (-1, 0), 12),\n                ('BACKGROUND', (0, 1), (-1, -1), colors.beige),\n                ('GRID', (0, 0), (-1, -1), 1, colors.black),\n            ]))\n            story.append(table)\n            story.append(Spacer(1, 20))\n        elif section['type'] == 'pagebreak':\n            story.append(PageBreak())\n    \n    doc.build(story)\n```\n\n### Step 3: Execute via run_shell\n\nRun the Python script directly using `run_shell`:\n\n```bash\npython3 \u003C\u003C 'EOF'\n# Your complete reportlab script here\nfrom reportlab.lib import colors\nfrom reportlab.lib.pagesizes import letter\nfrom reportlab.lib.styles import getSampleStyleSheet, ParagraphStyle\nfrom reportlab.platypus import SimpleDocTemplate, Paragraph, Spacer, Table, TableStyle, PageBreak\n\n# ... rest of your script\nEOF\n```\n\nOr save to a file and execute:\n\n```bash\ncat > generate_pdf.py \u003C\u003C 'SCRIPT'\n# Your complete script\nSCRIPT\n\npython3 generate_pdf.py\n```\n\n### Step 4: Handle Complex Content\n\nFor lengthy documents, structure content as a data structure:\n\n```python\ndocument_sections = [\n    {'type': 'title', 'text': 'Document Title'},\n    {'type': 'pagebreak'},\n    {'type': 'heading', 'text': 'Section 1'},\n    {'type': 'paragraph', 'text': 'Content here...'},\n    {'type': 'heading', 'text': 'Section 2'},\n    {'type': 'table', 'data': [['Header1', 'Header2'], ['Row1-Col1', 'Row1-Col2']]},\n    {'type': 'pagebreak'},\n    # Continue for all sections\n]\n```\n\n### Step 5: Verify Output\n\nCheck that the PDF was created successfully:\n\n```bash\nls -la your_document.pdf\n# Optionally check page count\npdfinfo your_document.pdf 2>\u002Fdev\u002Fnull || echo \"PDF created, pdfinfo not available\"\n```\n\n## Common Patterns\n\n### Multi-Section Documents\nUse `PageBreak()` between major sections to ensure clean pagination.\n\n### Tables with Data\nStructure tabular data as nested lists:\n```python\ntable_data = [\n    ['Column 1', 'Column 2', 'Column 3'],\n    ['Value 1', 'Value 2', 'Value 3'],\n    ['Value 4', 'Value 5', 'Value 6'],\n]\n```\n\n### Styled Text\nCreate custom `ParagraphStyle` objects for consistent formatting across sections.\n\n### Long Paragraphs\nReportLab automatically handles text wrapping. For very long content, consider breaking into multiple paragraphs.\n\n## Troubleshooting\n\n| Issue | Solution |\n|-------|----------|\n| Import errors | Ensure reportlab is installed: `pip install reportlab` |\n| Layout issues | Adjust margins in `SimpleDocTemplate` constructor |\n| Text overflow | Use `Spacer` elements to add vertical space |\n| Table width problems | Set explicit `colWidths` parameter |\n| Page breaks in wrong places | Insert `PageBreak()` explicitly before new sections |\n\n## Advantages Over shell_agent\n\n- **Deterministic**: Code executes exactly as written\n- **Debuggable**: Errors are immediate and clear\n- **Controllable**: Full access to reportlab's API\n- **Reliable**: No intermediate agent interpretation layer\n- **Efficient**: Single execution, no retry loops",{"name":5,"description":7},"main","0650921d63895de3997bc81f1ff1d0ac67032072","gdpval_bench\u002Fskills\u002Fdirect-reportlab-pdf-generation","https:\u002F\u002Fgithub.com\u002FUF-gzj\u002Fopenspace-claude-evolution","https:\u002F\u002Fgithub.com\u002FUF-gzj","2026-04-16 09:31:03",{"source":8,"skillName":5,"commands":57,"prompt":67,"zipAvailable":68},[58,61,64],{"tool":59,"command":60},"npx","npx skills add UF-gzj\u002Fopenspace-claude-evolution --skill direct-reportlab-pdf-generation",{"tool":62,"command":63},"bunx","bunx skills add UF-gzj\u002Fopenspace-claude-evolution --skill direct-reportlab-pdf-generation",{"tool":65,"command":66},"pnpm","pnpm dlx skills add UF-gzj\u002Fopenspace-claude-evolution --skill direct-reportlab-pdf-generation","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002FUF-gzj\u002Fopenspace-claude-evolution\u002Fblob\u002Fmain\u002Fgdpval_bench\u002Fskills\u002Fdirect-reportlab-pdf-generation\u002FSKILL.md",true,[70],{"path":71,"resourceType":72,"resourceTypeDesc":73,"sizeBytes":74,"sourceHtmlUrl":75},".skill_id","OTHER","其他",45,"https:\u002F\u002Fgithub.com\u002FUF-gzj\u002Fopenspace-claude-evolution\u002Fblob\u002Fmain\u002Fgdpval_bench\u002Fskills\u002Fdirect-reportlab-pdf-generation\u002F.skill_id",[77,101,117,125,155,171],{"skillNo":78,"name":79,"nameZh":6,"description":80,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":81,"categories":82,"keywords":83,"publishedAt":45},"01M6XCCXD3NCM2YKR3WNGBASPC","write-special-chars-ts-check","Workaround for write_file failures caused by special characters (apostrophes, backticks, template literals) using a Python heredoc script, plus a reliable TypeScript type-checking step that filters output to only the newly-written files to avoid being misled by pre-existing errors.","https:\u002F\u002Fgithub.com\u002FUF-gzj\u002Fopenspace-claude-evolution\u002Fblob\u002Fmain\u002Fshowcase\u002Fskills\u002Fwrite-special-chars-ts-check\u002FSKILL.md",[],[84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,44],"check","write","write special chars ts check","typescript","filters","characters","Existing","type-checking","for","errors","script","output","type","files","only","template","file",{"skillNo":102,"name":103,"nameZh":6,"description":104,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":105,"categories":106,"keywords":107,"publishedAt":45},"01M6XCCT7E3J922Q345PBGSHPN","write-special-chars-readback","Workaround for write_file failures caused by special characters (apostrophes, backticks, template literals) using a Python heredoc script, with mandatory post-write verification via read_file and cleanup of \u002Ftmp helper scripts.","https:\u002F\u002Fgithub.com\u002FUF-gzj\u002Fopenspace-claude-evolution\u002Fblob\u002Fmain\u002Fshowcase\u002Fskills\u002Fwrite-special-chars-readback\u002FSKILL.md",[],[108,109,85,100,110,44,111,36,112,113,114,99,115,116,89,92,94],"readback","write special chars readback","helper","post","scripts","cleanup","read","verification","with",{"skillNo":118,"name":119,"nameZh":6,"description":120,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":121,"categories":122,"keywords":123,"publishedAt":45},"01M6XCCMQX1R8B6FECWB3P63T7","write-special-chars-heredoc","Workaround for write_file failures caused by special characters (apostrophes, backticks, template literals) by using a Python heredoc script executed via shell.","https:\u002F\u002Fgithub.com\u002FUF-gzj\u002Fopenspace-claude-evolution\u002Fblob\u002Fmain\u002Fshowcase\u002Fskills\u002Fwrite-special-chars-heredoc\u002FSKILL.md",[],[124,85,89,40,94,36,99,100,44,92],"write special chars heredoc",{"skillNo":126,"name":127,"nameZh":6,"description":128,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":129,"categories":130,"keywords":136,"publishedAt":45},"01M6XCCG41M994JJEX6VN52PEP","worldmonitor-reference","Curated architecture index of the WorldMonitor open-source dashboard. Reference for extracting patterns — vanilla TypeScript, Panel class hierarchy, service layer, CSS grid, API edge functions, refresh scheduler, and 60+ data source integrations.","https:\u002F\u002Fgithub.com\u002FUF-gzj\u002Fopenspace-claude-evolution\u002Fblob\u002Fmain\u002Fshowcase\u002Fskills\u002Fworldmonitor-reference\u002FSKILL.md",[131],{"categoryNo":132,"categoryName":133,"taxonomyType":134,"taxonomyTypeDesc":135},"01JBSEEDCAT000000000000033","数据分析师","PROFESSION","适用职业",[137,138,139,140,141,87,142,143,144,145,146,92,147,148,149,150,151,152,153,154],"reference","worldmonitor","worldmonitor reference","architecture","dashboard","css","scheduler","layer","hierarchy","source","extracting","panel","patterns","edge functions","integrations","open","api","data",{"skillNo":156,"name":157,"nameZh":6,"description":158,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":159,"categories":160,"keywords":161,"publishedAt":45},"01M6XCCCHWNKG2W4VH9E6A10HF","virtual-list","Implement efficient virtual scrolling for rendering large lists with DOM recycling, chunk-based rendering, and performance optimizations","https:\u002F\u002Fgithub.com\u002FUF-gzj\u002Fopenspace-claude-evolution\u002Fblob\u002Fmain\u002Fshowcase\u002Fskills\u002Fvirtual-list\u002FSKILL.md",[],[162,163,164,165,92,166,116,167,168,169,170],"virtual list","list","virtual","chunk","dom","rendering","recycling","implement","performance",{"skillNo":172,"name":173,"nameZh":6,"description":174,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":175,"categories":176,"keywords":177,"publishedAt":45},"01M6XCC7X8PKMR2DEW91XGHYSV","verify-directory-structure","Diagnose and resolve file access issues by first verifying the directory structure.","https:\u002F\u002Fgithub.com\u002FUF-gzj\u002Fopenspace-claude-evolution\u002Fblob\u002Fmain\u002Fshowcase\u002Fskills\u002Fverify-directory-structure\u002FSKILL.md",[],[178,179,180,181,182,183,100,184,185,186],"directory","verify directory structure","structure","verify","access","first","issues","diagnose","file access"]