[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M6KHZDX3W2Y84QGAGGTRGD16":3,"skill-same:01M6KHZDX3W2Y84QGAGGTRGD16":74},{"skillNo":4,"name":5,"nameZh":6,"description":7,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":9,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":15,"categories":16,"keywords":28,"publishedAt":42,"linkOnly":43,"markdownContent":44,"markdownBody":45,"frontMatter":46,"refName":47,"commitSha":48,"skillDirectory":49,"forksCount":13,"repositoryHtmlUrl":50,"repositoryHomepageUrl":6,"ownerHtmlUrl":51,"ownerBlogUrl":6,"ownerDescription":52,"updatedAt":53,"install":54,"resources":67},"01M6KHZDX3W2Y84QGAGGTRGD16","document-gen-dual-backend",null,"Document generation with direct pandoc\u002FReportLab execution (lightweight default) and optional shell_agent fallback for complex scenarios","AG064\u002FOpenSpace","AG064","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F184930299?v=4","01M6KHVFG7TB73NHX3RDYSTMH2","01M6KHVFMM7XA2PZA9Z83PHS3V",0,"MIT","https:\u002F\u002Fgithub.com\u002FAG064\u002FOpenSpace\u002Fblob\u002Fmain\u002Fgdpval_bench\u002Fskills\u002Fdocument-gen-fallback-enhanced-enhanced-9f3b1f\u002FSKILL.md",[17,22,25],{"categoryNo":18,"categoryName":19,"taxonomyType":20,"taxonomyTypeDesc":21},"01JBSEEDCAT000000000000002","文档处理","SCENARIO","使用场景",{"categoryNo":23,"categoryName":24,"taxonomyType":20,"taxonomyTypeDesc":21},"01JBSEEDCAT000000000000010","后端与接口",{"categoryNo":26,"categoryName":27,"taxonomyType":20,"taxonomyTypeDesc":21},"01JBSEEDCAT000000000000023","Skill与智能体开发",[29,30,31,32,33,34,35,36,37,38,39,40,41],"backend","document","document gen dual backend","execution","shell","direct","fallback","default","generation","pandoc","document generation","with","for","2026-11-10 10:12:30",false,"---\nname: document-gen-dual-backend\ndescription: Document generation with direct pandoc\u002FReportLab execution (lightweight default) and optional shell_agent fallback for complex scenarios\n---\n\n# Document Generation: Dual-Backend Workflow (Unicode-Safe)\n\n## When to Use\n\n**Default Approach: Lightweight Direct Execution (Recommended for 90% of tasks)**\n\nFor most document generation tasks, use direct `write_file` + `run_shell` **without** `shell_agent`:\n- Generating documents in standard formats (`.docx`, `.pdf`, `.html`) from Markdown\n- Content is straightforward with minimal special characters\n- You already know the pandoc\u002FReportLab commands needed\n- Quick single-format or multi-format output is needed\n\n**Fallback Approach: shell_agent Delegation (For Complex Scenarios Only)**\n\nUse `shell_agent` delegation only when:\n- Automated fallback handling between backends requires complex logic\n- Dynamic content generation needs programmatic decision-making\n- You need to capture and analyze error messages for intelligent retry logic\n\n### When shell_agent May Be Useful (Optional)\n\nOnly consider `shell_agent` delegation for:\n- Complex error recovery requiring automated backend switching\n- Dynamic workflows with conditional branching based on generation results\n\n## Core Technique\n\n**For simple tasks (default):** Use direct `write_file` + `run_shell` with pandoc or ReportLab (no shell_agent needed)\n\n**For complex tasks requiring fallback logic:** Split the workflow into discrete, observable steps with **two PDF generation paths**:\n\n**Path A (Pandoc)**: Best for Markdown-to-PDF conversion with rich text formatting\n**Path B (ReportLab)**: Best for programmatic PDF generation without LaTeX dependencies\n\nWorkflow steps:\n1. **Content creation** → Use `write_file` to create source document (Markdown)\n2. **Choose PDF backend** → Decide between pandoc (rich formatting) or ReportLab (programmatic control)\n3. **Unicode handling** → Apply sanitization for pandoc; ReportLab handles Unicode natively\n4. **Format conversion** → Use `run_shell` with appropriate commands for each format\n5. **Verification** → Check output files exist and are valid\n\n## ⚠️ Backend Selection Guide\n\n| Requirement | Recommended Backend | Rationale |\n|-------------|---------------------|-----------|\n| Markdown source with headers, lists, tables | **Pandoc** | Native Markdown parsing |\n| Heavy Unicode\u002Fspecial characters | **ReportLab** | Native UTF-8 support, no sanitization needed |\n| LaTeX not available | **ReportLab** | Pure Python, no external dependencies |\n| Precise layout control (positions, graphics) | **ReportLab** | Programmatic canvas control |\n| Quick DOCX + PDF + HTML batch | **Pandoc** | Single tool, multiple outputs |\n| Tables with complex formatting | **Pandoc** | Better table rendering |\n| Dynamic\u002Fcharts\u002Fgraphs in PDF | **ReportLab** | Drawing operations support |\n\n## Unicode & LaTeX Compatibility Warning\n\n**Critical for Pandoc Path**: PDF generation via pandoc typically uses LaTeX (`pdflatex` or `xelatex`), which has limited Unicode support. Common problematic characters include:\n\n| Character | Issue | Safe Replacement |\n|-----------|-------|------------------|\n| `—` (em dash) | May not render | `--` or `-` |\n| `–` (en dash) | May not render | `-` |\n| `\" \"` (curly quotes) | Encoding errors | `\" \"` (straight quotes) |\n| `' '` (curly apostrophe) | Encoding errors | `'` (straight apostrophe) |\n| `…` (ellipsis) | May not render | `...` |\n| `→` `←` `↑` `↓` (arrows) | LaTeX incompatibility | `->` `\u003C-` `^` `v` |\n| `✓` `✗` (checkmarks) | May not render | `[x]` `[ ]` |\n| `★` `●` (symbols) | May not render | `*` `-` |\n| `©` `®` `™` | May require packages | `(c)` `(r)` `(tm)` |\n| Non-ASCII letters (é, ñ, ü) | Font-dependent | Use xeLaTeX or replace |\n\n**ReportLab Path**: Handles Unicode natively. Pass content as UTF-8 strings; no character sanitization required.\n\n## Step-by-Step Workflow\n\n### Quick Start: Lightweight Direct Execution (Default for Most Tasks)\n\n**This is the recommended approach for most document generation tasks. No shell_agent delegation needed:**\n\n```\n# Step 1: Write Markdown content\nwrite_file\npath: \u002Ftmp\u002Fdoc.md\ncontent: |\n  # My Document\n  \n  Simple content here.\n\n# Step 2: Convert with pandoc (direct)\nrun_shell\ncommand: pandoc \u002Ftmp\u002Fdoc.md -o output.docx\n\n# Step 3: Verify\nrun_shell\ncommand: ls -lh output.docx\n```\n\n**For PDF with potential Unicode issues:**\n\n```\n# Create sanitized version if needed\nwrite_file\npath: \u002Ftmp\u002Fdoc_sanitized.md\ncontent: |\n  # My Document\n  Content with safe ASCII characters only.\n\nrun_shell\ncommand: pandoc \u002Ftmp\u002Fdoc_sanitized.md -o output.pdf\n```\n\n**For Unicode-heavy content (use ReportLab directly):**\n\n```\nwrite_file\npath: \u002Ftmp\u002Fgen.py\ncontent: |\n  from reportlab.platypus import SimpleDocTemplate, Paragraph\n  from reportlab.lib.styles import getSampleStyleSheet\n  doc = SimpleDocTemplate(\"output.pdf\")\n  styles = getSampleStyleSheet()\n  story = [Paragraph(\"Unicode: é ñ ü 日本語\", styles[\"Normal\"])]\n  doc.build(story)\n\nrun_shell\ncommand: python \u002Ftmp\u002Fgen.py\n```\n\n---\n\n### Full Workflow: Dual-Backend with Fallback (For Complex Cases)\n\n### Step 1: Create Source Content with write_file\n\nWrite your document content as Markdown to a temporary source file:\n\n```\nwrite_file\npath: \u002Ftmp\u002Fdocument_source.md\ncontent: |\n  # Document Title\n  \n  ## Section 1\n  Content here...\n  \n  ## Section 2\n  More content...\n```\n\n### Step 2A: Pandoc Path - Sanitize Unicode (Pre-PDF Conversion)\n\n**Before PDF conversion with pandoc**, create a sanitized version:\n\n```\nwrite_file\npath: \u002Ftmp\u002Fdocument_source_sanitized.md\ncontent: |\n  # Document Title\n  \n  ## Section 1\n  Content here... (with all special chars replaced per table above)\n```\n\n### Step 2B: ReportLab Path - Create Python Script\n\nFor ReportLab, create a Python script that generates PDF directly:\n\n```\nwrite_file\npath: \u002Ftmp\u002Fgenerate_pdf.py\ncontent: |\n  from reportlab.lib.pagesizes import letter\n  from reportlab.platypus import SimpleDocTemplate, Paragraph, Spacer, Table, TableStyle\n  from reportlab.lib.styles import getSampleStyleSheet, ParagraphStyle\n  from reportlab.lib import colors\n  from reportlab.pdfbase import pdfmetrics\n  from reportlab.pdfbase.ttfonts import TTFont\n  \n  # Create PDF\n  doc = SimpleDocTemplate(\"output.pdf\", pagesize=letter)\n  styles = getSampleStyleSheet()\n  story = []\n  \n  # Add content\n  story.append(Paragraph(\"Document Title\", styles[\"Heading1\"]))\n  story.append(Spacer(1, 12))\n  story.append(Paragraph(\"Section 1 content with Unicode: é ñ ü → ✓ …\", styles[\"Normal\"]))\n  \n  # Build PDF\n  doc.build(story)\n```\n\n### Step 3: Convert to Target Formats\n\n#### Option A: Pandoc Conversion (Use sanitized source for PDF)\n\n```\nrun_shell\ncommand: pandoc \u002Ftmp\u002Fdocument_source.md -o output.docx\n```\n\n```\nrun_shell\ncommand: pandoc \u002Ftmp\u002Fdocument_source_sanitized.md -o output.pdf\n```\n\n```\nrun_shell\ncommand: pandoc \u002Ftmp\u002Fdocument_source.md -o output.html\n```\n\n#### Option B: ReportLab Conversion (Direct PDF generation)\n\n```\nrun_shell\ncommand: python \u002Ftmp\u002Fgenerate_pdf.py\n```\n\nThen use pandoc for other formats from original source:\n\n```\nrun_shell\ncommand: pandoc \u002Ftmp\u002Fdocument_source.md -o output.docx\n```\n\n```\nrun_shell\ncommand: pandoc \u002Ftmp\u002Fdocument_source.md -o output.html\n```\n\n### Step 4: Verify Outputs\n\n```\nrun_shell\ncommand: ls -lh output.docx output.pdf output.html\n```\n\n## Complete Examples\n\n### Example 1: Pandoc-First Approach\n\n```markdown\n# Generate Report with Pandoc\n\n## Step 1: Write Markdown source\nwrite_file\npath: \u002Ftmp\u002Freport.md\ncontent: |\n  # Quarterly Report\n  \n  ## Executive Summary\n  Performance improved by 15% this quarter...\n  \n  ## Key Metrics\n  - Revenue: $1.2M\n  - Growth: +15%\n  - Customers: 500+\n\n## Step 2: Create sanitized version for PDF\nwrite_file\npath: \u002Ftmp\u002Freport_sanitized.md\ncontent: |\n  # Quarterly Report\n  \n  ## Executive Summary\n  Performance improved by 15% this quarter...\n  \n  ## Key Metrics\n  - Revenue: $1.2M\n  - Growth: +15%\n  - Customers: 500+\n\n## Step 3: Convert to DOCX (from original)\nrun_shell\ncommand: pandoc \u002Ftmp\u002Freport.md -o quarterly_report.docx\n\n## Step 4: Convert to PDF (from sanitized)\nrun_shell\ncommand: pandoc \u002Ftmp\u002Freport_sanitized.md -o quarterly_report.pdf\n\n## Step 5: Convert to HTML (from original)\nrun_shell\ncommand: pandoc \u002Ftmp\u002Freport.md -o quarterly_report.html\n\n## Step 6: Verify\nrun_shell\ncommand: ls -lh quarterly_report.*\n```\n\n### Example 2: ReportLab-First Approach (Heavy Unicode)\n\n```markdown\n# Generate Unicode-Heavy Document with ReportLab\n\n## Step 1: Write Markdown source (for DOCX\u002FHTML)\nwrite_file\npath: \u002Ftmp\u002Fintl_report.md\ncontent: |\n  # International Market Analysis\n  \n  ## Région EMEA\n  Performance in Europe: ↑ 12%\n  Markets: Deutschland, França, España\n  \n  ## Région APAC\n  Growth: ✓ Exceeded targets\n  Key: 日本，中国，한국\n\n## Step 2: Create ReportLab Python script for PDF\nwrite_file\npath: \u002Ftmp\u002Fgenerate_intl_pdf.py\ncontent: |\n  from reportlab.lib.pagesizes import letter\n  from reportlab.platypus import SimpleDocTemplate, Paragraph, Spacer, Table, TableStyle\n  from reportlab.lib.styles import getSampleStyleSheet\n  from reportlab.lib import colors\n  \n  doc = SimpleDocTemplate(\"intl_analysis.pdf\", pagesize=letter)\n  styles = getSampleStyleSheet()\n  story = []\n  \n  # Title - Unicode handled natively\n  story.append(Paragraph(\"International Market Analysis\", styles[\"Heading1\"]))\n  story.append(Spacer(1, 12))\n  \n  # EMEA Section\n  story.append(Paragraph(\"Région EMEA\", styles[\"Heading2\"]))\n  story.append(Paragraph(\"Performance in Europe: ↑ 12%\", styles[\"Normal\"]))\n  story.append(Paragraph(\"Markets: Deutschland, França, España\", styles[\"Normal\"]))\n  story.append(Spacer(1, 12))\n  \n  # APAC Section\n  story.append(Paragraph(\"Région APAC\", styles[\"Heading2\"]))\n  story.append(Paragraph(\"Growth: ✓ Exceeded targets\", styles[\"Normal\"]))\n  story.append(Paragraph(\"Key: 日本，中国，한국\", styles[\"Normal\"]))\n  \n  doc.build(story)\n\n## Step 3: Generate PDF with ReportLab\nrun_shell\ncommand: python \u002Ftmp\u002Fgenerate_intl_pdf.py\n\n## Step 4: Generate DOCX with pandoc\nrun_shell\ncommand: pandoc \u002Ftmp\u002Fintl_report.md -o intl_analysis.docx\n\n## Step 5: Generate HTML with pandoc\nrun_shell\ncommand: pandoc \u002Ftmp\u002Fintl_report.md -o intl_analysis.html\n\n## Step 6: Verify\nrun_shell\ncommand: ls -lh intl_analysis.*\n```\n\n### Example 3: Hybrid Approach with Fallback\n\n```markdown\n# Generate with Pandoc, Fallback to ReportLab\n\n## Step 1: Create source document\nwrite_file\npath: \u002Ftmp\u002Fanalysis.md\ncontent: |\n  # Analysis Document\n  [Content...]\n\n## Step 2: Try pandoc first\nrun_shell\ncommand: pandoc \u002Ftmp\u002Fanalysis.md -o analysis.pdf\n\n## Step 3: If pandoc fails, use ReportLab fallback\n[If Step 2 returns error...]\nwrite_file\npath: \u002Ftmp\u002Ffallback_pdf.py\ncontent: |\n  from reportlab.lib.pagesizes import letter\n  from reportlab.platypus import SimpleDocTemplate, Paragraph, Spacer\n  from reportlab.lib.styles import getSampleStyleSheet\n  from reportlab.pdfbase import pdfmetrics\n  from reportlab.pdfbase.ttfonts import TTFont\n  \n  # Register Unicode font if needed\n  # pdfmetrics.registerFont(TTFont('UnicodeFont', '\u002Fpath\u002Fto\u002Ffont.ttf'))\n  \n  doc = SimpleDocTemplate(\"analysis.pdf\", pagesize=letter)\n  styles = getSampleStyleSheet()\n  story = []\n  story.append(Paragraph(\"Analysis Document\", styles[\"Heading1\"]))\n  story.append(Spacer(1, 12))\n  story.append(Paragraph(\"[Content from analysis.md parsed here]\", styles[\"Normal\"]))\n  doc.build(story)\n\nrun_shell\ncommand: python \u002Ftmp\u002Ffallback_pdf.py\n```\n\n## Common pandoc Commands\n\n```bash\n# Markdown to Word\npandoc input.md -o output.docx\n\n# Markdown to PDF (requires LaTeX)\npandoc input.md -o output.pdf\n\n# Markdown to PDF with Unicode-safe engine (better Unicode support)\npandoc input.md -o output.pdf --pdf-engine=xelatex\n\n# Markdown to PDF with wkhtmltopdf (alternative, no LaTeX)\npandoc input.md -o output.pdf --pdf-engine=wkhtmltopdf\n\n# Markdown to HTML\npandoc input.md -o output.html\n\n# With custom template\npandoc input.md --template=template.html -o output.html\n\n# With metadata\npandoc input.md -o output.pdf --metadata title=\"Document Title\"\n```\n\n## Common ReportLab Patterns\n\n```python\n# Basic PDF creation\nfrom reportlab.lib.pagesizes import letter\nfrom reportlab.platypus import SimpleDocTemplate, Paragraph, Spacer\nfrom reportlab.lib.styles import getSampleStyleSheet\n\ndoc = SimpleDocTemplate(\"output.pdf\", pagesize=letter)\nstyles = getSampleStyleSheet()\nstory = []\nstory.append(Paragraph(\"Title\", styles[\"Heading1\"]))\nstory.append(Spacer(1, 12))\nstory.append(Paragraph(\"Content\", styles[\"Normal\"]))\ndoc.build(story)\n\n# With tables\nfrom reportlab.platypus import Table, TableStyle\nfrom reportlab.lib import colors\n\ndata = [['Header1', 'Header2'], ['Row1-Col1', 'Row1-Col2']]\ntable = Table(data)\ntable.setStyle(TableStyle([\n    ('BACKGROUND', (0, 0), (-1, 0), colors.grey),\n    ('TEXTCOLOR', (0, 0), (-1, 0), colors.whitesmoke),\n    ('GRID', (0, 0), (-1, -1), 0.5, colors.black),\n]))\nstory.append(table)\n\n# With custom fonts for Unicode\nfrom reportlab.pdfbase import pdfmetrics\nfrom reportlab.pdfbase.ttfonts import TTFont\n\npdfmetrics.registerFont(TTFont('NotoSans', 'NotoSans-Regular.ttf'))\ncustom_style = ParagraphStyle('Custom', fontName='NotoSans', fontSize=12)\nstory.append(Paragraph(\"Unicode: 日本語 العربية\", custom_style))\n```\n\n## Troubleshooting\n\n### Pandoc Issues\n\n- **PDF generation fails with encoding error**: \n  - Use the sanitized markdown file\n  - Try `--pdf-engine=xelatex` for better Unicode support\n  - Try `--pdf-engine=wkhtmltopdf` as alternative\n\n- **PDF generation fails: LaTeX not found**: \n  - Install LaTeX: `apt-get install texlive-latex-recommended texlive-fonts-recommended`\n  - **Switch to ReportLab backend** (no LaTeX needed)\n\n- **DOCX formatting issues**: Add `--reference-doc=template.docx` for custom styles\n\n- **Missing pandoc**: Install via `apt-get install pandoc` or `brew install pandoc`\n\n### ReportLab Issues\n\n- **Missing reportlab**: Install via `pip install reportlab`\n\n- **Unicode characters not rendering**: \n  - ReportLab handles UTF-8 natively - ensure Python script uses UTF-8\n  - For CJK\u002FArabic\u002Fetc., register a Unicode-capable font:\n    ```python\n    from reportlab.pdfbase import pdfmetrics\n    from reportlab.pdfbase.ttfonts import TTFont\n    pdfmetrics.registerFont(TTFont('NotoSans', 'NotoSans-Regular.ttf'))\n    ```\n\n- **Complex layouts needed**: Use `reportlab.lib.canvas` for direct drawing operations\n\n- **Tables breaking across pages**: Use `reportlab.platypus.LongTable` instead of `Table`\n\n### General Issues\n\n- **Unicode\u002Fencoding errors in any format**: \n  - Add `-f markdown+utf8` to pandoc command\n  - Ensure source file is UTF-8 encoded: `file -i source.md`\n\n- **Special characters not rendering in PDF**: \n  - For pandoc: Use character replacement table or ReportLab\n  - For ReportLab: Register appropriate Unicode fonts\n\n## Installation Commands\n\n```bash\n# Install pandoc\napt-get install pandoc  # Debian\u002FUbuntu\nbrew install pandoc     # macOS\n\n# Install LaTeX (for pdflatex)\napt-get install texlive-latex-recommended texlive-fonts-recommended\n\n# Install wkhtmltopdf (alternative PDF engine)\napt-get install wkhtmltopdf\n\n# Install ReportLab\npip install reportlab\n\n# Install fonts for Unicode support\napt-get install fonts-noto-core  # Comprehensive Unicode font\n```\n\n## Unicode Sanitization Script (For Pandoc Path)\n\nFor repeated use with pandoc, create a reusable sanitization script:\n\n```bash\n#!\u002Fbin\u002Fbash\n# sanitize_for_pdf.sh - Replace problematic unicode chars for LaTeX\u002FPDF\nif [ -z \"$1\" ]; then\n  echo \"Usage: $0 \u003Cinput.md> [output.md]\"\n  exit 1\nfi\nINPUT=\"$1\"\nOUTPUT=\"${2:-${1%.md}_sanitized.md}\"\n\nsed -e 's\u002F—\u002F--\u002Fg' \\\n    -e 's\u002F–\u002F-\u002Fg' \\\n    -e 's\u002F\"([^\"]*)\"\u002F\"\\1\"\u002Fg' \\\n    -e \"s\u002F'([^']*)'\u002F\\1'\u002Fg\" \\\n    -e 's\u002F…\u002F...\u002Fg' \\\n    -e 's\u002F→\u002F->\u002Fg' \\\n    -e 's\u002F←\u002F\u003C-\u002Fg' \\\n    -e 's\u002F✓\u002F[x]\u002Fg' \\\n    -e 's\u002F✗\u002F[ ]\u002Fg' \\\n    -e 's\u002F©\u002F(c)\u002Fg' \\\n    -e 's\u002F®\u002F(r)\u002Fg' \\\n    -e 's\u002F™\u002F(tm)\u002Fg' \\\n    \"$INPUT\" > \"$OUTPUT\"\n\necho \"Sanitized: $INPUT -> $OUTPUT\"\n```\n\nSave as `sanitize_for_pdf.sh`, make executable with `chmod +x sanitize_for_pdf.sh`, then use:\n\n```\nrun_shell\ncommand: .\u002Fsanitize_for_pdf.sh \u002Ftmp\u002Fdocument_source.md \u002Ftmp\u002Fdocument_source_sanitized.md\n```\n\n## Decision Flowchart\n\n```\nNeed PDF generation?\n    │\n    ├─ Heavy Unicode\u002Fsymbols? ──YES──> Use ReportLab\n    │         │\n    │         NO\n    │         │\n    ├─ LaTeX available? ──NO──> Use ReportLab\n    │         │\n    │         YES\n    │         │\n    ├─ Need Markdown formatting? ──YES──> Use Pandoc (with sanitization)\n    │         │\n    │         NO\n    │         │\n    └─ Need programmatic layout? ──YES──> Use ReportLab\n```\n\n## When to Return to shell_agent\n\nAfter successfully completing the manual workflow once, you can attempt `shell_agent` again for similar tasks, now with a known-working fallback if errors recur. For documents with heavy Unicode content or when LaTeX is unavailable, prefer the ReportLab path.\n\n## Related Skills\n\n- `document-gen-unicode-safe`: Parent skill with pandoc-only approach\n- `document-gen-fallback`: Original fallback workflow without Unicode guidance\n- Use this skill when you need flexible PDF generation with multiple backend options\n### Example 0: Lightweight Single-Format Generation\n\n```markdown\n# Quick DOCX Generation (No shell_agent needed)\n\n## Step 1: Write content\nwrite_file\npath: \u002Ftmp\u002Fbrief.md\ncontent: |\n  # Meeting Notes\n  \n  ## Attendees\n  - Alice\n  - Bob\n  \n  ## Decisions\n  Project approved.\n\n## Step 2: Convert directly\nrun_shell\ncommand: pandoc \u002Ftmp\u002Fbrief.md -o meeting_notes.docx\n\n## Step 3: Verify\nrun_shell\ncommand: ls -lh meeting_notes.docx\n```\n\n---\n\n### Example 1: Pandoc-First Approach (Multi-Format with Sanitization)\n\n### Example 2: ReportLab-First Approach (Heavy Unicode — Direct Execution)\n\n## Mode Selection Quick Reference\n\n| Scenario | Recommended Mode | Why |\n|----------|------------------|-----|\n| Simple Markdown → DOCX | **Lightweight** | Direct pandoc call is fastest |\n| Single PDF from ASCII content | **Lightweight** | No sanitization needed |\n| Multi-format batch (DOCX + PDF + HTML) | **Full Workflow** | Coordinated conversion with error handling |\n| Content with Unicode\u002Fsymbols | **Lightweight + ReportLab** | Direct Python script avoids LaTeX issues |\n| Uncertain about LaTeX availability | **Full Workflow** | Built-in fallback detection |\n| Need programmatic layout control | **Full Workflow** | ReportLab integration with fallback logic |\n| Production pipeline with error recovery | **Full Workflow** | Automated retry and backend switching |\n\n---\n\n## Troubleshooting\n\n- **Missing reportlab**: Install\n### ReportLab Issues\n\n- **Missing reportlab**: Install via `pip install reportlab`\n","# Document Generation: Dual-Backend Workflow (Unicode-Safe)\n\n## When to Use\n\n**Default Approach: Lightweight Direct Execution (Recommended for 90% of tasks)**\n\nFor most document generation tasks, use direct `write_file` + `run_shell` **without** `shell_agent`:\n- Generating documents in standard formats (`.docx`, `.pdf`, `.html`) from Markdown\n- Content is straightforward with minimal special characters\n- You already know the pandoc\u002FReportLab commands needed\n- Quick single-format or multi-format output is needed\n\n**Fallback Approach: shell_agent Delegation (For Complex Scenarios Only)**\n\nUse `shell_agent` delegation only when:\n- Automated fallback handling between backends requires complex logic\n- Dynamic content generation needs programmatic decision-making\n- You need to capture and analyze error messages for intelligent retry logic\n\n### When shell_agent May Be Useful (Optional)\n\nOnly consider `shell_agent` delegation for:\n- Complex error recovery requiring automated backend switching\n- Dynamic workflows with conditional branching based on generation results\n\n## Core Technique\n\n**For simple tasks (default):** Use direct `write_file` + `run_shell` with pandoc or ReportLab (no shell_agent needed)\n\n**For complex tasks requiring fallback logic:** Split the workflow into discrete, observable steps with **two PDF generation paths**:\n\n**Path A (Pandoc)**: Best for Markdown-to-PDF conversion with rich text formatting\n**Path B (ReportLab)**: Best for programmatic PDF generation without LaTeX dependencies\n\nWorkflow steps:\n1. **Content creation** → Use `write_file` to create source document (Markdown)\n2. **Choose PDF backend** → Decide between pandoc (rich formatting) or ReportLab (programmatic control)\n3. **Unicode handling** → Apply sanitization for pandoc; ReportLab handles Unicode natively\n4. **Format conversion** → Use `run_shell` with appropriate commands for each format\n5. **Verification** → Check output files exist and are valid\n\n## ⚠️ Backend Selection Guide\n\n| Requirement | Recommended Backend | Rationale |\n|-------------|---------------------|-----------|\n| Markdown source with headers, lists, tables | **Pandoc** | Native Markdown parsing |\n| Heavy Unicode\u002Fspecial characters | **ReportLab** | Native UTF-8 support, no sanitization needed |\n| LaTeX not available | **ReportLab** | Pure Python, no external dependencies |\n| Precise layout control (positions, graphics) | **ReportLab** | Programmatic canvas control |\n| Quick DOCX + PDF + HTML batch | **Pandoc** | Single tool, multiple outputs |\n| Tables with complex formatting | **Pandoc** | Better table rendering |\n| Dynamic\u002Fcharts\u002Fgraphs in PDF | **ReportLab** | Drawing operations support |\n\n## Unicode & LaTeX Compatibility Warning\n\n**Critical for Pandoc Path**: PDF generation via pandoc typically uses LaTeX (`pdflatex` or `xelatex`), which has limited Unicode support. Common problematic characters include:\n\n| Character | Issue | Safe Replacement |\n|-----------|-------|------------------|\n| `—` (em dash) | May not render | `--` or `-` |\n| `–` (en dash) | May not render | `-` |\n| `\" \"` (curly quotes) | Encoding errors | `\" \"` (straight quotes) |\n| `' '` (curly apostrophe) | Encoding errors | `'` (straight apostrophe) |\n| `…` (ellipsis) | May not render | `...` |\n| `→` `←` `↑` `↓` (arrows) | LaTeX incompatibility | `->` `\u003C-` `^` `v` |\n| `✓` `✗` (checkmarks) | May not render | `[x]` `[ ]` |\n| `★` `●` (symbols) | May not render | `*` `-` |\n| `©` `®` `™` | May require packages | `(c)` `(r)` `(tm)` |\n| Non-ASCII letters (é, ñ, ü) | Font-dependent | Use xeLaTeX or replace |\n\n**ReportLab Path**: Handles Unicode natively. Pass content as UTF-8 strings; no character sanitization required.\n\n## Step-by-Step Workflow\n\n### Quick Start: Lightweight Direct Execution (Default for Most Tasks)\n\n**This is the recommended approach for most document generation tasks. No shell_agent delegation needed:**\n\n```\n# Step 1: Write Markdown content\nwrite_file\npath: \u002Ftmp\u002Fdoc.md\ncontent: |\n  # My Document\n  \n  Simple content here.\n\n# Step 2: Convert with pandoc (direct)\nrun_shell\ncommand: pandoc \u002Ftmp\u002Fdoc.md -o output.docx\n\n# Step 3: Verify\nrun_shell\ncommand: ls -lh output.docx\n```\n\n**For PDF with potential Unicode issues:**\n\n```\n# Create sanitized version if needed\nwrite_file\npath: \u002Ftmp\u002Fdoc_sanitized.md\ncontent: |\n  # My Document\n  Content with safe ASCII characters only.\n\nrun_shell\ncommand: pandoc \u002Ftmp\u002Fdoc_sanitized.md -o output.pdf\n```\n\n**For Unicode-heavy content (use ReportLab directly):**\n\n```\nwrite_file\npath: \u002Ftmp\u002Fgen.py\ncontent: |\n  from reportlab.platypus import SimpleDocTemplate, Paragraph\n  from reportlab.lib.styles import getSampleStyleSheet\n  doc = SimpleDocTemplate(\"output.pdf\")\n  styles = getSampleStyleSheet()\n  story = [Paragraph(\"Unicode: é ñ ü 日本語\", styles[\"Normal\"])]\n  doc.build(story)\n\nrun_shell\ncommand: python \u002Ftmp\u002Fgen.py\n```\n\n---\n\n### Full Workflow: Dual-Backend with Fallback (For Complex Cases)\n\n### Step 1: Create Source Content with write_file\n\nWrite your document content as Markdown to a temporary source file:\n\n```\nwrite_file\npath: \u002Ftmp\u002Fdocument_source.md\ncontent: |\n  # Document Title\n  \n  ## Section 1\n  Content here...\n  \n  ## Section 2\n  More content...\n```\n\n### Step 2A: Pandoc Path - Sanitize Unicode (Pre-PDF Conversion)\n\n**Before PDF conversion with pandoc**, create a sanitized version:\n\n```\nwrite_file\npath: \u002Ftmp\u002Fdocument_source_sanitized.md\ncontent: |\n  # Document Title\n  \n  ## Section 1\n  Content here... (with all special chars replaced per table above)\n```\n\n### Step 2B: ReportLab Path - Create Python Script\n\nFor ReportLab, create a Python script that generates PDF directly:\n\n```\nwrite_file\npath: \u002Ftmp\u002Fgenerate_pdf.py\ncontent: |\n  from reportlab.lib.pagesizes import letter\n  from reportlab.platypus import SimpleDocTemplate, Paragraph, Spacer, Table, TableStyle\n  from reportlab.lib.styles import getSampleStyleSheet, ParagraphStyle\n  from reportlab.lib import colors\n  from reportlab.pdfbase import pdfmetrics\n  from reportlab.pdfbase.ttfonts import TTFont\n  \n  # Create PDF\n  doc = SimpleDocTemplate(\"output.pdf\", pagesize=letter)\n  styles = getSampleStyleSheet()\n  story = []\n  \n  # Add content\n  story.append(Paragraph(\"Document Title\", styles[\"Heading1\"]))\n  story.append(Spacer(1, 12))\n  story.append(Paragraph(\"Section 1 content with Unicode: é ñ ü → ✓ …\", styles[\"Normal\"]))\n  \n  # Build PDF\n  doc.build(story)\n```\n\n### Step 3: Convert to Target Formats\n\n#### Option A: Pandoc Conversion (Use sanitized source for PDF)\n\n```\nrun_shell\ncommand: pandoc \u002Ftmp\u002Fdocument_source.md -o output.docx\n```\n\n```\nrun_shell\ncommand: pandoc \u002Ftmp\u002Fdocument_source_sanitized.md -o output.pdf\n```\n\n```\nrun_shell\ncommand: pandoc \u002Ftmp\u002Fdocument_source.md -o output.html\n```\n\n#### Option B: ReportLab Conversion (Direct PDF generation)\n\n```\nrun_shell\ncommand: python \u002Ftmp\u002Fgenerate_pdf.py\n```\n\nThen use pandoc for other formats from original source:\n\n```\nrun_shell\ncommand: pandoc \u002Ftmp\u002Fdocument_source.md -o output.docx\n```\n\n```\nrun_shell\ncommand: pandoc \u002Ftmp\u002Fdocument_source.md -o output.html\n```\n\n### Step 4: Verify Outputs\n\n```\nrun_shell\ncommand: ls -lh output.docx output.pdf output.html\n```\n\n## Complete Examples\n\n### Example 1: Pandoc-First Approach\n\n```markdown\n# Generate Report with Pandoc\n\n## Step 1: Write Markdown source\nwrite_file\npath: \u002Ftmp\u002Freport.md\ncontent: |\n  # Quarterly Report\n  \n  ## Executive Summary\n  Performance improved by 15% this quarter...\n  \n  ## Key Metrics\n  - Revenue: $1.2M\n  - Growth: +15%\n  - Customers: 500+\n\n## Step 2: Create sanitized version for PDF\nwrite_file\npath: \u002Ftmp\u002Freport_sanitized.md\ncontent: |\n  # Quarterly Report\n  \n  ## Executive Summary\n  Performance improved by 15% this quarter...\n  \n  ## Key Metrics\n  - Revenue: $1.2M\n  - Growth: +15%\n  - Customers: 500+\n\n## Step 3: Convert to DOCX (from original)\nrun_shell\ncommand: pandoc \u002Ftmp\u002Freport.md -o quarterly_report.docx\n\n## Step 4: Convert to PDF (from sanitized)\nrun_shell\ncommand: pandoc \u002Ftmp\u002Freport_sanitized.md -o quarterly_report.pdf\n\n## Step 5: Convert to HTML (from original)\nrun_shell\ncommand: pandoc \u002Ftmp\u002Freport.md -o quarterly_report.html\n\n## Step 6: Verify\nrun_shell\ncommand: ls -lh quarterly_report.*\n```\n\n### Example 2: ReportLab-First Approach (Heavy Unicode)\n\n```markdown\n# Generate Unicode-Heavy Document with ReportLab\n\n## Step 1: Write Markdown source (for DOCX\u002FHTML)\nwrite_file\npath: \u002Ftmp\u002Fintl_report.md\ncontent: |\n  # International Market Analysis\n  \n  ## Région EMEA\n  Performance in Europe: ↑ 12%\n  Markets: Deutschland, França, España\n  \n  ## Région APAC\n  Growth: ✓ Exceeded targets\n  Key: 日本，中国，한국\n\n## Step 2: Create ReportLab Python script for PDF\nwrite_file\npath: \u002Ftmp\u002Fgenerate_intl_pdf.py\ncontent: |\n  from reportlab.lib.pagesizes import letter\n  from reportlab.platypus import SimpleDocTemplate, Paragraph, Spacer, Table, TableStyle\n  from reportlab.lib.styles import getSampleStyleSheet\n  from reportlab.lib import colors\n  \n  doc = SimpleDocTemplate(\"intl_analysis.pdf\", pagesize=letter)\n  styles = getSampleStyleSheet()\n  story = []\n  \n  # Title - Unicode handled natively\n  story.append(Paragraph(\"International Market Analysis\", styles[\"Heading1\"]))\n  story.append(Spacer(1, 12))\n  \n  # EMEA Section\n  story.append(Paragraph(\"Région EMEA\", styles[\"Heading2\"]))\n  story.append(Paragraph(\"Performance in Europe: ↑ 12%\", styles[\"Normal\"]))\n  story.append(Paragraph(\"Markets: Deutschland, França, España\", styles[\"Normal\"]))\n  story.append(Spacer(1, 12))\n  \n  # APAC Section\n  story.append(Paragraph(\"Région APAC\", styles[\"Heading2\"]))\n  story.append(Paragraph(\"Growth: ✓ Exceeded targets\", styles[\"Normal\"]))\n  story.append(Paragraph(\"Key: 日本，中国，한국\", styles[\"Normal\"]))\n  \n  doc.build(story)\n\n## Step 3: Generate PDF with ReportLab\nrun_shell\ncommand: python \u002Ftmp\u002Fgenerate_intl_pdf.py\n\n## Step 4: Generate DOCX with pandoc\nrun_shell\ncommand: pandoc \u002Ftmp\u002Fintl_report.md -o intl_analysis.docx\n\n## Step 5: Generate HTML with pandoc\nrun_shell\ncommand: pandoc \u002Ftmp\u002Fintl_report.md -o intl_analysis.html\n\n## Step 6: Verify\nrun_shell\ncommand: ls -lh intl_analysis.*\n```\n\n### Example 3: Hybrid Approach with Fallback\n\n```markdown\n# Generate with Pandoc, Fallback to ReportLab\n\n## Step 1: Create source document\nwrite_file\npath: \u002Ftmp\u002Fanalysis.md\ncontent: |\n  # Analysis Document\n  [Content...]\n\n## Step 2: Try pandoc first\nrun_shell\ncommand: pandoc \u002Ftmp\u002Fanalysis.md -o analysis.pdf\n\n## Step 3: If pandoc fails, use ReportLab fallback\n[If Step 2 returns error...]\nwrite_file\npath: \u002Ftmp\u002Ffallback_pdf.py\ncontent: |\n  from reportlab.lib.pagesizes import letter\n  from reportlab.platypus import SimpleDocTemplate, Paragraph, Spacer\n  from reportlab.lib.styles import getSampleStyleSheet\n  from reportlab.pdfbase import pdfmetrics\n  from reportlab.pdfbase.ttfonts import TTFont\n  \n  # Register Unicode font if needed\n  # pdfmetrics.registerFont(TTFont('UnicodeFont', '\u002Fpath\u002Fto\u002Ffont.ttf'))\n  \n  doc = SimpleDocTemplate(\"analysis.pdf\", pagesize=letter)\n  styles = getSampleStyleSheet()\n  story = []\n  story.append(Paragraph(\"Analysis Document\", styles[\"Heading1\"]))\n  story.append(Spacer(1, 12))\n  story.append(Paragraph(\"[Content from analysis.md parsed here]\", styles[\"Normal\"]))\n  doc.build(story)\n\nrun_shell\ncommand: python \u002Ftmp\u002Ffallback_pdf.py\n```\n\n## Common pandoc Commands\n\n```bash\n# Markdown to Word\npandoc input.md -o output.docx\n\n# Markdown to PDF (requires LaTeX)\npandoc input.md -o output.pdf\n\n# Markdown to PDF with Unicode-safe engine (better Unicode support)\npandoc input.md -o output.pdf --pdf-engine=xelatex\n\n# Markdown to PDF with wkhtmltopdf (alternative, no LaTeX)\npandoc input.md -o output.pdf --pdf-engine=wkhtmltopdf\n\n# Markdown to HTML\npandoc input.md -o output.html\n\n# With custom template\npandoc input.md --template=template.html -o output.html\n\n# With metadata\npandoc input.md -o output.pdf --metadata title=\"Document Title\"\n```\n\n## Common ReportLab Patterns\n\n```python\n# Basic PDF creation\nfrom reportlab.lib.pagesizes import letter\nfrom reportlab.platypus import SimpleDocTemplate, Paragraph, Spacer\nfrom reportlab.lib.styles import getSampleStyleSheet\n\ndoc = SimpleDocTemplate(\"output.pdf\", pagesize=letter)\nstyles = getSampleStyleSheet()\nstory = []\nstory.append(Paragraph(\"Title\", styles[\"Heading1\"]))\nstory.append(Spacer(1, 12))\nstory.append(Paragraph(\"Content\", styles[\"Normal\"]))\ndoc.build(story)\n\n# With tables\nfrom reportlab.platypus import Table, TableStyle\nfrom reportlab.lib import colors\n\ndata = [['Header1', 'Header2'], ['Row1-Col1', 'Row1-Col2']]\ntable = Table(data)\ntable.setStyle(TableStyle([\n    ('BACKGROUND', (0, 0), (-1, 0), colors.grey),\n    ('TEXTCOLOR', (0, 0), (-1, 0), colors.whitesmoke),\n    ('GRID', (0, 0), (-1, -1), 0.5, colors.black),\n]))\nstory.append(table)\n\n# With custom fonts for Unicode\nfrom reportlab.pdfbase import pdfmetrics\nfrom reportlab.pdfbase.ttfonts import TTFont\n\npdfmetrics.registerFont(TTFont('NotoSans', 'NotoSans-Regular.ttf'))\ncustom_style = ParagraphStyle('Custom', fontName='NotoSans', fontSize=12)\nstory.append(Paragraph(\"Unicode: 日本語 العربية\", custom_style))\n```\n\n## Troubleshooting\n\n### Pandoc Issues\n\n- **PDF generation fails with encoding error**: \n  - Use the sanitized markdown file\n  - Try `--pdf-engine=xelatex` for better Unicode support\n  - Try `--pdf-engine=wkhtmltopdf` as alternative\n\n- **PDF generation fails: LaTeX not found**: \n  - Install LaTeX: `apt-get install texlive-latex-recommended texlive-fonts-recommended`\n  - **Switch to ReportLab backend** (no LaTeX needed)\n\n- **DOCX formatting issues**: Add `--reference-doc=template.docx` for custom styles\n\n- **Missing pandoc**: Install via `apt-get install pandoc` or `brew install pandoc`\n\n### ReportLab Issues\n\n- **Missing reportlab**: Install via `pip install reportlab`\n\n- **Unicode characters not rendering**: \n  - ReportLab handles UTF-8 natively - ensure Python script uses UTF-8\n  - For CJK\u002FArabic\u002Fetc., register a Unicode-capable font:\n    ```python\n    from reportlab.pdfbase import pdfmetrics\n    from reportlab.pdfbase.ttfonts import TTFont\n    pdfmetrics.registerFont(TTFont('NotoSans', 'NotoSans-Regular.ttf'))\n    ```\n\n- **Complex layouts needed**: Use `reportlab.lib.canvas` for direct drawing operations\n\n- **Tables breaking across pages**: Use `reportlab.platypus.LongTable` instead of `Table`\n\n### General Issues\n\n- **Unicode\u002Fencoding errors in any format**: \n  - Add `-f markdown+utf8` to pandoc command\n  - Ensure source file is UTF-8 encoded: `file -i source.md`\n\n- **Special characters not rendering in PDF**: \n  - For pandoc: Use character replacement table or ReportLab\n  - For ReportLab: Register appropriate Unicode fonts\n\n## Installation Commands\n\n```bash\n# Install pandoc\napt-get install pandoc  # Debian\u002FUbuntu\nbrew install pandoc     # macOS\n\n# Install LaTeX (for pdflatex)\napt-get install texlive-latex-recommended texlive-fonts-recommended\n\n# Install wkhtmltopdf (alternative PDF engine)\napt-get install wkhtmltopdf\n\n# Install ReportLab\npip install reportlab\n\n# Install fonts for Unicode support\napt-get install fonts-noto-core  # Comprehensive Unicode font\n```\n\n## Unicode Sanitization Script (For Pandoc Path)\n\nFor repeated use with pandoc, create a reusable sanitization script:\n\n```bash\n#!\u002Fbin\u002Fbash\n# sanitize_for_pdf.sh - Replace problematic unicode chars for LaTeX\u002FPDF\nif [ -z \"$1\" ]; then\n  echo \"Usage: $0 \u003Cinput.md> [output.md]\"\n  exit 1\nfi\nINPUT=\"$1\"\nOUTPUT=\"${2:-${1%.md}_sanitized.md}\"\n\nsed -e 's\u002F—\u002F--\u002Fg' \\\n    -e 's\u002F–\u002F-\u002Fg' \\\n    -e 's\u002F\"([^\"]*)\"\u002F\"\\1\"\u002Fg' \\\n    -e \"s\u002F'([^']*)'\u002F\\1'\u002Fg\" \\\n    -e 's\u002F…\u002F...\u002Fg' \\\n    -e 's\u002F→\u002F->\u002Fg' \\\n    -e 's\u002F←\u002F\u003C-\u002Fg' \\\n    -e 's\u002F✓\u002F[x]\u002Fg' \\\n    -e 's\u002F✗\u002F[ ]\u002Fg' \\\n    -e 's\u002F©\u002F(c)\u002Fg' \\\n    -e 's\u002F®\u002F(r)\u002Fg' \\\n    -e 's\u002F™\u002F(tm)\u002Fg' \\\n    \"$INPUT\" > \"$OUTPUT\"\n\necho \"Sanitized: $INPUT -> $OUTPUT\"\n```\n\nSave as `sanitize_for_pdf.sh`, make executable with `chmod +x sanitize_for_pdf.sh`, then use:\n\n```\nrun_shell\ncommand: .\u002Fsanitize_for_pdf.sh \u002Ftmp\u002Fdocument_source.md \u002Ftmp\u002Fdocument_source_sanitized.md\n```\n\n## Decision Flowchart\n\n```\nNeed PDF generation?\n    │\n    ├─ Heavy Unicode\u002Fsymbols? ──YES──> Use ReportLab\n    │         │\n    │         NO\n    │         │\n    ├─ LaTeX available? ──NO──> Use ReportLab\n    │         │\n    │         YES\n    │         │\n    ├─ Need Markdown formatting? ──YES──> Use Pandoc (with sanitization)\n    │         │\n    │         NO\n    │         │\n    └─ Need programmatic layout? ──YES──> Use ReportLab\n```\n\n## When to Return to shell_agent\n\nAfter successfully completing the manual workflow once, you can attempt `shell_agent` again for similar tasks, now with a known-working fallback if errors recur. For documents with heavy Unicode content or when LaTeX is unavailable, prefer the ReportLab path.\n\n## Related Skills\n\n- `document-gen-unicode-safe`: Parent skill with pandoc-only approach\n- `document-gen-fallback`: Original fallback workflow without Unicode guidance\n- Use this skill when you need flexible PDF generation with multiple backend options\n### Example 0: Lightweight Single-Format Generation\n\n```markdown\n# Quick DOCX Generation (No shell_agent needed)\n\n## Step 1: Write content\nwrite_file\npath: \u002Ftmp\u002Fbrief.md\ncontent: |\n  # Meeting Notes\n  \n  ## Attendees\n  - Alice\n  - Bob\n  \n  ## Decisions\n  Project approved.\n\n## Step 2: Convert directly\nrun_shell\ncommand: pandoc \u002Ftmp\u002Fbrief.md -o meeting_notes.docx\n\n## Step 3: Verify\nrun_shell\ncommand: ls -lh meeting_notes.docx\n```\n\n---\n\n### Example 1: Pandoc-First Approach (Multi-Format with Sanitization)\n\n### Example 2: ReportLab-First Approach (Heavy Unicode — Direct Execution)\n\n## Mode Selection Quick Reference\n\n| Scenario | Recommended Mode | Why |\n|----------|------------------|-----|\n| Simple Markdown → DOCX | **Lightweight** | Direct pandoc call is fastest |\n| Single PDF from ASCII content | **Lightweight** | No sanitization needed |\n| Multi-format batch (DOCX + PDF + HTML) | **Full Workflow** | Coordinated conversion with error handling |\n| Content with Unicode\u002Fsymbols | **Lightweight + ReportLab** | Direct Python script avoids LaTeX issues |\n| Uncertain about LaTeX availability | **Full Workflow** | Built-in fallback detection |\n| Need programmatic layout control | **Full Workflow** | ReportLab integration with fallback logic |\n| Production pipeline with error recovery | **Full Workflow** | Automated retry and backend switching |\n\n---\n\n## Troubleshooting\n\n- **Missing reportlab**: Install\n### ReportLab Issues\n\n- **Missing reportlab**: Install via `pip install reportlab`\n",{"name":5,"description":7},"main","ff671ef61ed6587c49bd54c81cdc751c0b99e363","gdpval_bench\u002Fskills\u002Fdocument-gen-fallback-enhanced-enhanced-9f3b1f","https:\u002F\u002Fgithub.com\u002FAG064\u002FOpenSpace","https:\u002F\u002Fgithub.com\u002FAG064","AG064, E.Mi.\r\n\r\nA person who thinks all the time, yet all they have to think about is nothing. I want to improve the world and work on open source projects","2026-10-08 06:53:48",{"source":8,"skillName":5,"commands":55,"prompt":65,"zipAvailable":66},[56,59,62],{"tool":57,"command":58},"npx","npx skills add AG064\u002FOpenSpace --skill document-gen-dual-backend",{"tool":60,"command":61},"bunx","bunx skills add AG064\u002FOpenSpace --skill document-gen-dual-backend",{"tool":63,"command":64},"pnpm","pnpm dlx skills add AG064\u002FOpenSpace --skill document-gen-dual-backend","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002FAG064\u002FOpenSpace\u002Fblob\u002Fmain\u002Fgdpval_bench\u002Fskills\u002Fdocument-gen-fallback-enhanced-enhanced-9f3b1f\u002FSKILL.md",true,[68],{"path":69,"resourceType":70,"resourceTypeDesc":71,"sizeBytes":72,"sourceHtmlUrl":73},".skill_id","OTHER","其他",60,"https:\u002F\u002Fgithub.com\u002FAG064\u002FOpenSpace\u002Fblob\u002Fmain\u002Fgdpval_bench\u002Fskills\u002Fdocument-gen-fallback-enhanced-enhanced-9f3b1f\u002F.skill_id",[75,98,114,122,152,168],{"skillNo":76,"name":77,"nameZh":6,"description":78,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":9,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":79,"categories":80,"keywords":81,"publishedAt":42},"01M6KKMPWA0B5SCCH766F8M5EA","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\u002FAG064\u002FOpenSpace\u002Fblob\u002Fmain\u002Fshowcase\u002Fskills\u002Fwrite-special-chars-ts-check\u002FSKILL.md",[],[82,83,84,85,86,87,41,88,89,90,91,92,93,94,95,96,97],"write special chars ts check","check","write","filters","Existing","type-checking","errors","script","output","type","files","only","template","file","python","typescript",{"skillNo":99,"name":100,"nameZh":6,"description":101,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":9,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":102,"categories":103,"keywords":104,"publishedAt":42},"01M6KKMJXVBNVEY3TRK055F4A7","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\u002FAG064\u002FOpenSpace\u002Fblob\u002Fmain\u002Fshowcase\u002Fskills\u002Fwrite-special-chars-readback\u002FSKILL.md",[],[105,106,84,94,107,108,95,96,109,110,111,112,113,41,89,40],"readback","write special chars readback","cleanup","read","scripts","verification","via","post","helper",{"skillNo":115,"name":116,"nameZh":6,"description":117,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":9,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":118,"categories":119,"keywords":120,"publishedAt":42},"01M6KKMEGX9M9NC105J0W3Q5B9","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\u002FAG064\u002FOpenSpace\u002Fblob\u002Fmain\u002Fshowcase\u002Fskills\u002Fwrite-special-chars-heredoc\u002FSKILL.md",[],[84,121,96,41,111,94,33,95,89],"write special chars heredoc",{"skillNo":123,"name":124,"nameZh":6,"description":125,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":9,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":126,"categories":127,"keywords":133,"publishedAt":42},"01M6KKM8EJ2AATVHZBNB916WT0","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\u002FAG064\u002FOpenSpace\u002Fblob\u002Fmain\u002Fshowcase\u002Fskills\u002Fworldmonitor-reference\u002FSKILL.md",[128],{"categoryNo":129,"categoryName":130,"taxonomyType":131,"taxonomyTypeDesc":132},"01JBSEEDCAT000000000000033","数据分析师","PROFESSION","适用职业",[134,135,136,137,97,138,139,140,141,142,41,143,144,145,146,147,148,149,150,151],"reference","worldmonitor","worldmonitor reference","dashboard","css","architecture","extracting","hierarchy","source","layer","panel","patterns","edge functions","integrations","open","api","data","scheduler",{"skillNo":153,"name":154,"nameZh":6,"description":155,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":9,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":156,"categories":157,"keywords":158,"publishedAt":42},"01M6KKM39PHYK627F19GE2B9XN","virtual-list","Implement efficient virtual scrolling for rendering large lists with DOM recycling, chunk-based rendering, and performance optimizations","https:\u002F\u002Fgithub.com\u002FAG064\u002FOpenSpace\u002Fblob\u002Fmain\u002Fshowcase\u002Fskills\u002Fvirtual-list\u002FSKILL.md",[],[159,160,161,162,41,163,40,164,165,166,167],"virtual list","list","virtual","chunk","dom","rendering","recycling","implement","performance",{"skillNo":169,"name":170,"nameZh":6,"description":171,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":9,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":172,"categories":173,"keywords":174,"publishedAt":42},"01M6KKKY7T2P61Y0JH54CDEJKQ","verify-directory-structure","Diagnose and resolve file access issues by first verifying the directory structure.","https:\u002F\u002Fgithub.com\u002FAG064\u002FOpenSpace\u002Fblob\u002Fmain\u002Fshowcase\u002Fskills\u002Fverify-directory-structure\u002FSKILL.md",[],[175,176,177,178,179,180,95,181,182,183],"directory","verify","structure","verify directory structure","access","first","issues","diagnose","file access"]