[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M6XBHFFMR75VH98KFB29319D":3,"skill-same:01M6XBHFFMR75VH98KFB29319D":73},{"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":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":6,"updatedAt":52,"install":53,"resources":66},"01M6XBHFFMR75VH98KFB29319D","document-gen-unicode-safe",null,"Unicode-safe fallback workflow for multi-format document generation with character sanitization and explicit error capture","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\u002Fdocument-gen-fallback-enhanced\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],"safe","document","Unicode","document gen unicode safe","workflow","format","capture","fallback","character","generation","error","multi","document generation","with","sanitization","for","2026-11-10 10:12:30",false,"---\nname: document-gen-unicode-safe\ndescription: Unicode-safe fallback workflow for multi-format document generation with character sanitization and explicit error capture\n---\n\n# Document Generation Fallback Workflow (Unicode-Safe)\n\n## When to Use\n\nUse this skill when `shell_agent` returns unknown or unclear errors on complex document generation tasks, especially when:\n- Generating documents in multiple formats (e.g., `.docx`, `.pdf`, `.html`)\n- The error message doesn't provide clear debugging information\n- You need to handle special characters, symbols, or non-ASCII text safely\n- PDF generation fails due to LaTeX encoding issues\n\n## Core Technique\n\nInstead of delegating the entire document generation to `shell_agent`, manually split the workflow into discrete, observable steps:\n1. **Content creation** → Use `write_file` to create source document (Markdown)\n2. **Unicode sanitization** → Preprocess markdown to replace problematic characters before PDF conversion\n3. **Format conversion with stderr capture** → Use `run_shell` with `pandoc` for each target format, capturing full stderr output\n4. **Verification** → Check output files exist and are valid\n\n## ⚠️ Unicode & LaTeX Compatibility Warning\n\n**Critical**: 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## Step-by-Step Workflow\n\n### Step 1: Create Source Content with write_file\n\nWrite your document content as Markdown to a temporary source file. This gives you full visibility into the content being generated.\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 2: Sanitize Unicode Characters (Pre-PDF Conversion)\n\n**Before PDF conversion**, create a sanitized version of your markdown with LaTeX-safe characters:\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**Alternative**: Use a shell script to sanitize:\n\n```\nrun_shell\ncommand: sed -e 's\u002F—\u002F--\u002Fg' -e 's\u002F–\u002F-\u002Fg' -e 's\u002F\"([^\"]*)\"\u002F\"\\1\"\u002Fg' -e 's\u002F'([^']*)\u002F'\\1'\u002Fg' \u002Ftmp\u002Fdocument_source.md > \u002Ftmp\u002Fdocument_source_sanitized.md\n```\n\n**Note**: Keep the original unsanitized file for DOCX\u002FHTML conversion (these formats handle Unicode better).\n\n### Step 3: Convert to Target Formats with run_shell\n\nUse `run_shell` with explicit `pandoc` commands for each format. Use sanitized source for PDF, original for other formats.\n\n**Critical**: Always capture stderr output (`2>&1`) to diagnose failures before retrying with alternative engines.\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 3a: PDF Conversion - Try xelatex First (Best Unicode Support)\n\n**Use xelatex as the first engine** - it has better Unicode support and is commonly available in containerized environments:\n\n```\nrun_shell\ncommand: pandoc \u002Ftmp\u002Fdocument_source_sanitized.md --pdf-engine=xelatex -o output.pdf 2>&1\n```\n\n### Step 3b: If xelatex Fails - Capture Full Error and Retry with wkhtmltopdf\n\n**Before retrying**, examine the full stderr output from Step 3a to understand the failure cause (missing engine, font issues, etc.). Then try wkhtmltopdf as fallback:\n\n```\nrun_shell\ncommand: pandoc \u002Ftmp\u002Fdocument_source_sanitized.md --pdf-engine=wkhtmltopdf -o output.pdf 2>&1\n```\n\n### Step 4: Verify Outputs\n\nCheck that files were created successfully:\n\n```\nrun_shell\ncommand: ls -lh output.docx output.pdf output.html\n```\n\n## Complete Example\n\n```markdown\n# Generate Negotiation Strategy Document\n\n## Step 1: Write Markdown source\nwrite_file\npath: \u002Ftmp\u002Fnegotiation_strategy.md\ncontent: |\n  # Negotiation Strategy\n  \n  ## Executive Summary\n  [Content with original unicode...]\n  \n  ## Resolution Path\n  [Content...]\n  \n  ## BATNA Analysis\n  [Content...]\n\n## Step 2: Create sanitized version for PDF\nwrite_file\npath: \u002Ftmp\u002Fnegotiation_strategy_sanitized.md\ncontent: |\n  # Negotiation Strategy\n  \n  ## Executive Summary\n  [Content with unicode replaced: em-dash -> --, curly quotes -> straight, etc.]\n  \n  ## Resolution Path\n  [Content...]\n  \n  ## BATNA Analysis\n  [Content...]\n\n## Step 3: Convert to DOCX (from original)\nrun_shell\ncommand: pandoc \u002Ftmp\u002Fnegotiation_strategy.md -o negotiation_strategy.docx\n\n## Step 4: Convert to HTML (from original)\nrun_shell\ncommand: pandoc \u002Ftmp\u002Fnegotiation_strategy.md -o negotiation_strategy.html\n\n## Step 5: Convert to PDF (try xelatex first, capture stderr)\nrun_shell\ncommand: pandoc \u002Ftmp\u002Fnegotiation_strategy_sanitized.md --pdf-engine=xelatex -o negotiation_strategy.pdf 2>&1\n\n## Step 6: If xelatex fails, retry with wkhtmltopdf (after examining error)\nrun_shell\ncommand: pandoc \u002Ftmp\u002Fnegotiation_strategy_sanitized.md --pdf-engine=wkhtmltopdf -o negotiation_strategy.pdf 2>&1\n\n## Step 7: Verify\nrun_shell\ncommand: ls -lh negotiation_strategy.*\n```\n\n## Advantages Over shell_agent\n\n| Aspect | shell_agent | Manual Workflow |\n|--------|-------------|-----------------|\n| Error visibility | Opaque, may retry silently | Each step shows explicit output |\n| Recovery | Automatic but may loop | Manual intervention at specific step |\n| Debugging | Hard to isolate failure point | Clear which step failed |\n| Unicode control | Agent may not handle encoding | You control character sanitization |\n| Control | Agent decides approach | You control each conversion |\n| **Stderr capture** | Often lost in retries | Explicit `2>&1` capture at each step |\n\n## Common pandoc Commands\n\n```bash\n# Markdown to Word\npandoc input.md -o output.docx\n\n# Markdown to PDF with xelatex (better Unicode support - TRY FIRST)\npandoc input.md -o output.pdf --pdf-engine=xelatex\n\n# Markdown to PDF with wkhtmltopdf (fallback if xelatex unavailable)\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## Troubleshooting\n\n- **PDF generation fails with encoding error**: \n  - Use the sanitized markdown file (Step 2)\n  - **Try xelatex first** (better Unicode support, more common in containers): `--pdf-engine=xelatex`\n  - **Capture full stderr** with `2>&1` and examine the error before retrying\n  - **Then retry with wkhtmltopdf** as fallback: `--pdf-engine=wkhtmltopdf`\n\n- **PDF generation fails: LaTeX not found**: \n  - Install LaTeX: `apt-get install texlive-latex-recommended texlive-fonts-recommended`\n  - **Preferred**: Use `--pdf-engine=xelatex` (often pre-installed in containers)\n  - **Fallback**: Use `--pdf-engine=wkhtmltopdf` if xelatex unavailable\n\n- **xelatex not found**: Install with `apt-get install texlive-xetex` or use wkhtmltopdf fallback\n\n- **wkhtmltopdf not found**: Install with `apt-get install wkhtmltopdf`\n\n- **DOCX formatting issues**: Add `--reference-doc=template.docx` for custom styles\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  - Use the character replacement table above\n  - Create sanitized version before PDF conversion\n  - Use xelatex engine for better Unicode font support\n\n- **Missing pandoc**: Install via `apt-get install pandoc` or `brew install pandoc`\n\n- **Engine failures not diagnosed**: Always append `2>&1` to capture stderr, examine output before retrying with different engine\n\n## Unicode Sanitization Script (Optional)\n\nFor repeated use, 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## 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, consider always using the manual workflow with sanitization.\n\n## Related Skills\n\n- `document-gen-fallback`: Original fallback workflow without Unicode guidance\n- Use this skill when your documents contain special characters, symbols, or non-ASCII text that may cause LaTeX\u002FPDF conversion issues\nReturn to `shell_agent` in these scenarios:\n\n1. **Environment diagnostics fail** - If pandoc or PDF engines are unavailable and installation isn't possible\n2. **Multiple tools returning 'unknown error'** - Suggests broader environment issue; shell_agent may have different access\n3. **After successful manual completion** - For similar future tasks, try shell_agent first with this workflow as fallback\n4. **Simple documents** - For straightforward documents without complex Unicode, shell_agent is often sufficient\n5. **Time-sensitive tasks** - When you need quick results and can accept some formatting uncertainty\n\n**For documents with heavy Unicode content**, consider always using the manual workflow with sanitization, but only after confirming the toolchain is available.\n","# Document Generation Fallback Workflow (Unicode-Safe)\n\n## When to Use\n\nUse this skill when `shell_agent` returns unknown or unclear errors on complex document generation tasks, especially when:\n- Generating documents in multiple formats (e.g., `.docx`, `.pdf`, `.html`)\n- The error message doesn't provide clear debugging information\n- You need to handle special characters, symbols, or non-ASCII text safely\n- PDF generation fails due to LaTeX encoding issues\n\n## Core Technique\n\nInstead of delegating the entire document generation to `shell_agent`, manually split the workflow into discrete, observable steps:\n1. **Content creation** → Use `write_file` to create source document (Markdown)\n2. **Unicode sanitization** → Preprocess markdown to replace problematic characters before PDF conversion\n3. **Format conversion with stderr capture** → Use `run_shell` with `pandoc` for each target format, capturing full stderr output\n4. **Verification** → Check output files exist and are valid\n\n## ⚠️ Unicode & LaTeX Compatibility Warning\n\n**Critical**: 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## Step-by-Step Workflow\n\n### Step 1: Create Source Content with write_file\n\nWrite your document content as Markdown to a temporary source file. This gives you full visibility into the content being generated.\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 2: Sanitize Unicode Characters (Pre-PDF Conversion)\n\n**Before PDF conversion**, create a sanitized version of your markdown with LaTeX-safe characters:\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**Alternative**: Use a shell script to sanitize:\n\n```\nrun_shell\ncommand: sed -e 's\u002F—\u002F--\u002Fg' -e 's\u002F–\u002F-\u002Fg' -e 's\u002F\"([^\"]*)\"\u002F\"\\1\"\u002Fg' -e 's\u002F'([^']*)\u002F'\\1'\u002Fg' \u002Ftmp\u002Fdocument_source.md > \u002Ftmp\u002Fdocument_source_sanitized.md\n```\n\n**Note**: Keep the original unsanitized file for DOCX\u002FHTML conversion (these formats handle Unicode better).\n\n### Step 3: Convert to Target Formats with run_shell\n\nUse `run_shell` with explicit `pandoc` commands for each format. Use sanitized source for PDF, original for other formats.\n\n**Critical**: Always capture stderr output (`2>&1`) to diagnose failures before retrying with alternative engines.\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 3a: PDF Conversion - Try xelatex First (Best Unicode Support)\n\n**Use xelatex as the first engine** - it has better Unicode support and is commonly available in containerized environments:\n\n```\nrun_shell\ncommand: pandoc \u002Ftmp\u002Fdocument_source_sanitized.md --pdf-engine=xelatex -o output.pdf 2>&1\n```\n\n### Step 3b: If xelatex Fails - Capture Full Error and Retry with wkhtmltopdf\n\n**Before retrying**, examine the full stderr output from Step 3a to understand the failure cause (missing engine, font issues, etc.). Then try wkhtmltopdf as fallback:\n\n```\nrun_shell\ncommand: pandoc \u002Ftmp\u002Fdocument_source_sanitized.md --pdf-engine=wkhtmltopdf -o output.pdf 2>&1\n```\n\n### Step 4: Verify Outputs\n\nCheck that files were created successfully:\n\n```\nrun_shell\ncommand: ls -lh output.docx output.pdf output.html\n```\n\n## Complete Example\n\n```markdown\n# Generate Negotiation Strategy Document\n\n## Step 1: Write Markdown source\nwrite_file\npath: \u002Ftmp\u002Fnegotiation_strategy.md\ncontent: |\n  # Negotiation Strategy\n  \n  ## Executive Summary\n  [Content with original unicode...]\n  \n  ## Resolution Path\n  [Content...]\n  \n  ## BATNA Analysis\n  [Content...]\n\n## Step 2: Create sanitized version for PDF\nwrite_file\npath: \u002Ftmp\u002Fnegotiation_strategy_sanitized.md\ncontent: |\n  # Negotiation Strategy\n  \n  ## Executive Summary\n  [Content with unicode replaced: em-dash -> --, curly quotes -> straight, etc.]\n  \n  ## Resolution Path\n  [Content...]\n  \n  ## BATNA Analysis\n  [Content...]\n\n## Step 3: Convert to DOCX (from original)\nrun_shell\ncommand: pandoc \u002Ftmp\u002Fnegotiation_strategy.md -o negotiation_strategy.docx\n\n## Step 4: Convert to HTML (from original)\nrun_shell\ncommand: pandoc \u002Ftmp\u002Fnegotiation_strategy.md -o negotiation_strategy.html\n\n## Step 5: Convert to PDF (try xelatex first, capture stderr)\nrun_shell\ncommand: pandoc \u002Ftmp\u002Fnegotiation_strategy_sanitized.md --pdf-engine=xelatex -o negotiation_strategy.pdf 2>&1\n\n## Step 6: If xelatex fails, retry with wkhtmltopdf (after examining error)\nrun_shell\ncommand: pandoc \u002Ftmp\u002Fnegotiation_strategy_sanitized.md --pdf-engine=wkhtmltopdf -o negotiation_strategy.pdf 2>&1\n\n## Step 7: Verify\nrun_shell\ncommand: ls -lh negotiation_strategy.*\n```\n\n## Advantages Over shell_agent\n\n| Aspect | shell_agent | Manual Workflow |\n|--------|-------------|-----------------|\n| Error visibility | Opaque, may retry silently | Each step shows explicit output |\n| Recovery | Automatic but may loop | Manual intervention at specific step |\n| Debugging | Hard to isolate failure point | Clear which step failed |\n| Unicode control | Agent may not handle encoding | You control character sanitization |\n| Control | Agent decides approach | You control each conversion |\n| **Stderr capture** | Often lost in retries | Explicit `2>&1` capture at each step |\n\n## Common pandoc Commands\n\n```bash\n# Markdown to Word\npandoc input.md -o output.docx\n\n# Markdown to PDF with xelatex (better Unicode support - TRY FIRST)\npandoc input.md -o output.pdf --pdf-engine=xelatex\n\n# Markdown to PDF with wkhtmltopdf (fallback if xelatex unavailable)\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## Troubleshooting\n\n- **PDF generation fails with encoding error**: \n  - Use the sanitized markdown file (Step 2)\n  - **Try xelatex first** (better Unicode support, more common in containers): `--pdf-engine=xelatex`\n  - **Capture full stderr** with `2>&1` and examine the error before retrying\n  - **Then retry with wkhtmltopdf** as fallback: `--pdf-engine=wkhtmltopdf`\n\n- **PDF generation fails: LaTeX not found**: \n  - Install LaTeX: `apt-get install texlive-latex-recommended texlive-fonts-recommended`\n  - **Preferred**: Use `--pdf-engine=xelatex` (often pre-installed in containers)\n  - **Fallback**: Use `--pdf-engine=wkhtmltopdf` if xelatex unavailable\n\n- **xelatex not found**: Install with `apt-get install texlive-xetex` or use wkhtmltopdf fallback\n\n- **wkhtmltopdf not found**: Install with `apt-get install wkhtmltopdf`\n\n- **DOCX formatting issues**: Add `--reference-doc=template.docx` for custom styles\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  - Use the character replacement table above\n  - Create sanitized version before PDF conversion\n  - Use xelatex engine for better Unicode font support\n\n- **Missing pandoc**: Install via `apt-get install pandoc` or `brew install pandoc`\n\n- **Engine failures not diagnosed**: Always append `2>&1` to capture stderr, examine output before retrying with different engine\n\n## Unicode Sanitization Script (Optional)\n\nFor repeated use, 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## 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, consider always using the manual workflow with sanitization.\n\n## Related Skills\n\n- `document-gen-fallback`: Original fallback workflow without Unicode guidance\n- Use this skill when your documents contain special characters, symbols, or non-ASCII text that may cause LaTeX\u002FPDF conversion issues\nReturn to `shell_agent` in these scenarios:\n\n1. **Environment diagnostics fail** - If pandoc or PDF engines are unavailable and installation isn't possible\n2. **Multiple tools returning 'unknown error'** - Suggests broader environment issue; shell_agent may have different access\n3. **After successful manual completion** - For similar future tasks, try shell_agent first with this workflow as fallback\n4. **Simple documents** - For straightforward documents without complex Unicode, shell_agent is often sufficient\n5. **Time-sensitive tasks** - When you need quick results and can accept some formatting uncertainty\n\n**For documents with heavy Unicode content**, consider always using the manual workflow with sanitization, but only after confirming the toolchain is available.\n",{"name":5,"description":7},"main","0650921d63895de3997bc81f1ff1d0ac67032072","gdpval_bench\u002Fskills\u002Fdocument-gen-fallback-enhanced","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":54,"prompt":64,"zipAvailable":65},[55,58,61],{"tool":56,"command":57},"npx","npx skills add UF-gzj\u002Fopenspace-claude-evolution --skill document-gen-unicode-safe",{"tool":59,"command":60},"bunx","bunx skills add UF-gzj\u002Fopenspace-claude-evolution --skill document-gen-unicode-safe",{"tool":62,"command":63},"pnpm","pnpm dlx skills add UF-gzj\u002Fopenspace-claude-evolution --skill document-gen-unicode-safe","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002FUF-gzj\u002Fopenspace-claude-evolution\u002Fblob\u002Fmain\u002Fgdpval_bench\u002Fskills\u002Fdocument-gen-fallback-enhanced\u002FSKILL.md",true,[67],{"path":68,"resourceType":69,"resourceTypeDesc":70,"sizeBytes":71,"sourceHtmlUrl":72},".skill_id","OTHER","其他",44,"https:\u002F\u002Fgithub.com\u002FUF-gzj\u002Fopenspace-claude-evolution\u002Fblob\u002Fmain\u002Fgdpval_bench\u002Fskills\u002Fdocument-gen-fallback-enhanced\u002F.skill_id",[74,98,114,123,153,169],{"skillNo":75,"name":76,"nameZh":6,"description":77,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":78,"categories":79,"keywords":80,"publishedAt":42},"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",[],[81,82,83,84,85,86,87,88,41,89,90,91,92,93,94,95,96,97],"check","write","write special chars ts check","typescript","filters","characters","Existing","type-checking","errors","script","output","type","files","only","template","file","python",{"skillNo":99,"name":100,"nameZh":6,"description":101,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":102,"categories":103,"keywords":104,"publishedAt":42},"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",[],[105,106,82,96,107,97,108,109,110,111,112,95,113,39,86,41,90],"readback","write special chars readback","helper","post","via","scripts","cleanup","read","verification",{"skillNo":115,"name":116,"nameZh":6,"description":117,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":118,"categories":119,"keywords":120,"publishedAt":42},"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",[],[121,82,86,122,90,109,95,96,97,41],"write special chars heredoc","shell",{"skillNo":124,"name":125,"nameZh":6,"description":126,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":127,"categories":128,"keywords":134,"publishedAt":42},"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",[129],{"categoryNo":130,"categoryName":131,"taxonomyType":132,"taxonomyTypeDesc":133},"01JBSEEDCAT000000000000033","数据分析师","PROFESSION","适用职业",[135,136,137,138,139,84,140,141,142,143,144,41,145,146,147,148,149,150,151,152],"reference","worldmonitor","worldmonitor reference","architecture","dashboard","css","scheduler","layer","hierarchy","source","extracting","panel","patterns","edge functions","integrations","open","api","data",{"skillNo":154,"name":155,"nameZh":6,"description":156,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":157,"categories":158,"keywords":159,"publishedAt":42},"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",[],[160,161,162,163,41,164,39,165,166,167,168],"virtual list","list","virtual","chunk","dom","rendering","recycling","implement","performance",{"skillNo":170,"name":171,"nameZh":6,"description":172,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":173,"categories":174,"keywords":175,"publishedAt":42},"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",[],[176,177,178,179,180,181,96,182,183,184],"directory","verify directory structure","structure","verify","access","first","issues","diagnose","file access"]