[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M6KHZNN267AE269VETE15Q2V":3,"skill-same:01M6KHZNN267AE269VETE15Q2V":64},{"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":17,"publishedAt":32,"linkOnly":33,"markdownContent":34,"markdownBody":35,"frontMatter":36,"refName":37,"commitSha":38,"skillDirectory":39,"forksCount":13,"repositoryHtmlUrl":40,"repositoryHomepageUrl":6,"ownerHtmlUrl":41,"ownerBlogUrl":6,"ownerDescription":42,"updatedAt":43,"install":44,"resources":57},"01M6KHZNN267AE269VETE15Q2V","document-gen-unicode-safe",null,"Unicode-safe fallback workflow for multi-format document generation with character sanitization","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-c5d426\u002FSKILL.md",[],[18,19,20,21,22,23,24,25,26,27,28,29,30,31],"safe","document","Unicode","document gen unicode safe","workflow","format","fallback","character","generation","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\n---\n\n# Document Generation Fallback Workflow (Unicode-Safe)\n\n## When to Use\n\n**First**, assess whether to delegate to `shell_agent` or use manual workflow:\n\n### ✅ Use shell_agent Directly When:\n- Document is straightforward (no special Unicode characters, symbols, or non-ASCII text)\n- Single format output needed (e.g., just `.docx`)\n- Content is primarily ASCII text with standard punctuation\n- No complex formatting requirements (tables, equations, custom templates)\n- You want quick iteration and `shell_agent` has succeeded on similar tasks before\n\n### ⚠️ Use Manual Workflow When:\n- `shell_agent` returns unknown or unclear errors\n- **Document contains special characters, symbols, or non-ASCII text** (see Unicode table below)\n- Generating multiple formats simultaneously (e.g., `.docx`, `.pdf`, `.html`)\n- PDF generation fails due to LaTeX encoding issues\n- You need fine-grained control over each conversion step\n- Previous `shell_agent` attempts failed on similar content\n\n### ? Decision Checklist\n\n```markdown\n1. Does the document contain: em-dashes (—), curly quotes (\" \"), arrows (→), \n   checkmarks (✓), or other special symbols? → Use Manual Workflow\n\n2. Is non-ASCII text present (é, ñ, ü, 中文，العربية)? → Use Manual Workflow with sanitization\n\n3. Did shell_agent already fail on this or similar content? → Use Manual Workflow\n\n4. Need multiple output formats with guaranteed success? → Use Manual Workflow\n\n5. Simple ASCII document, single format, first attempt? → Try shell_agent First\n```\n\n## Core Technique\n\n**Quick Path** (for straightforward documents): Delegate directly to `shell_agent` with clear instructions:\n\n```\nshell_agent\ntask: Create a Word document from markdown content. Write the markdown to \n      \u002Ftmp\u002Fdocument.md, then convert to .docx using pandoc, and verify the output exists.\n```\n\n**Manual Path** (for complex\u002FUnicode-heavy documents): 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** → Use `run_shell` with `pandoc` for each target format\n4. **Verification** → Check output files exist and are valid\n\n## Why This Adaptive Approach?\n\n| Scenario | Recommended Approach | Rationale |\n|----------|---------------------|-----------|\n| Simple ASCII doc, single format | shell_agent | Faster, less manual overhead |\n| Unicode symbols present | Manual workflow | Prevents LaTeX encoding failures |\n| Previous shell_agent failure | Manual workflow | Avoids repeat failures |\n| Multiple formats needed | Manual workflow | Granular control per format |\n| Time-sensitive, low-risk | shell_agent first | Try fast path, fallback if needed |\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** → Use `run_shell` with `pandoc` for each target format\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```\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### 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### Quick Path Example (Simple Document)\n\n```markdown\n# Generate Simple Meeting Notes\n\n## Delegate to shell_agent\nshell_agent\ntask: |\n  Create meeting notes document:\n  1. Write to \u002Ftmp\u002Fmeeting_notes.md with content:\n     \"# Team Meeting Notes\n     \n     ## Date: 2024-01-15\n     ## Attendees: Alice, Bob, Carol\n     \n     ## Action Items\n     - Alice: Complete report by Friday\n     - Bob: Schedule follow-up meeting\n     \n     ## Next Meeting: 2024-01-22\"\n  2. Convert to Word: pandoc \u002Ftmp\u002Fmeeting_notes.md -o meeting_notes.docx\n  3. Verify: ls -lh meeting_notes.docx\n```\n\n### Manual Path Example (Unicode-Heavy Document)\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 PDF (from sanitized)\nrun_shell\ncommand: pandoc \u002Ftmp\u002Fnegotiation_strategy_sanitized.md -o negotiation_strategy.pdf\n\n## Step 5: Convert to HTML (from original)\nrun_shell\ncommand: pandoc \u002Ftmp\u002Fnegotiation_strategy.md -o negotiation_strategy.html\n\n## Step 6: 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\n## Common pandoc Commands\n\n```bash\n# Markdown to Word\npandoc input.md -o output.docx\n\n# Markdown to PDF (requires LaTeX or wkhtmltopdf)\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 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  - Or try `--pdf-engine=xelatex` for better Unicode support\n  - Or use `--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  - Or use `--pdf-engine=wkhtmltopdf` instead\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\n- **Missing pandoc**: Install via `apt-get install pandoc` or `brew install pandoc`\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\n**After successful shell_agent completion**: Continue using shell_agent for similar straightforward documents.\n\n**After shell_agent failure on Unicode content**: Switch to manual workflow for that document and similar future documents. Document the failure pattern.\n\n**After successful manual workflow**: You now have a proven approach. For future similar documents:\n- If content is similar (same Unicode patterns): Use manual workflow directly\n- If content is simpler: Try shell_agent first, keep manual workflow as backup\n- Build a library of sanitized templates for repeated use\n\n## Related Skills\n\n- `document-gen-fallback`: Original fallback workflow without Unicode guidance\n- Use this skill as your **primary** document generation skill—it adapts to document complexity\n- Fall back to `document-gen-unicode-safe` (parent) if you need the original prescriptive manual-only approach\nname: document-gen-adaptive-workflow\ndescription: Adaptive document generation with smart fallback to manual Unicode-safe workflow\n### Quick Path: Delegate to shell_agent\n\nFor straightforward documents without Unicode concerns:\n\n```\nshell_agent\ntask: |\n  1. Write markdown content to \u002Ftmp\u002Freport.md using write_file\n  2. Convert to Word format: pandoc \u002Ftmp\u002Freport.md -o report.docx\n  3. Convert to PDF: pandoc \u002Ftmp\u002Freport.md -o report.pdf --pdf-engine=xelatex\n  4. Verify both files exist with: ls -lh report.docx report.pdf\n  5. Report the file sizes and confirm successful generation\n```\n\n**If shell_agent succeeds**: Task complete.\n\n**If shell_agent fails**: Switch to Manual Path below.\n\n### Manual Path: Step-by-Step Workflow\n","# Document Generation Fallback Workflow (Unicode-Safe)\n\n## When to Use\n\n**First**, assess whether to delegate to `shell_agent` or use manual workflow:\n\n### ✅ Use shell_agent Directly When:\n- Document is straightforward (no special Unicode characters, symbols, or non-ASCII text)\n- Single format output needed (e.g., just `.docx`)\n- Content is primarily ASCII text with standard punctuation\n- No complex formatting requirements (tables, equations, custom templates)\n- You want quick iteration and `shell_agent` has succeeded on similar tasks before\n\n### ⚠️ Use Manual Workflow When:\n- `shell_agent` returns unknown or unclear errors\n- **Document contains special characters, symbols, or non-ASCII text** (see Unicode table below)\n- Generating multiple formats simultaneously (e.g., `.docx`, `.pdf`, `.html`)\n- PDF generation fails due to LaTeX encoding issues\n- You need fine-grained control over each conversion step\n- Previous `shell_agent` attempts failed on similar content\n\n### ? Decision Checklist\n\n```markdown\n1. Does the document contain: em-dashes (—), curly quotes (\" \"), arrows (→), \n   checkmarks (✓), or other special symbols? → Use Manual Workflow\n\n2. Is non-ASCII text present (é, ñ, ü, 中文，العربية)? → Use Manual Workflow with sanitization\n\n3. Did shell_agent already fail on this or similar content? → Use Manual Workflow\n\n4. Need multiple output formats with guaranteed success? → Use Manual Workflow\n\n5. Simple ASCII document, single format, first attempt? → Try shell_agent First\n```\n\n## Core Technique\n\n**Quick Path** (for straightforward documents): Delegate directly to `shell_agent` with clear instructions:\n\n```\nshell_agent\ntask: Create a Word document from markdown content. Write the markdown to \n      \u002Ftmp\u002Fdocument.md, then convert to .docx using pandoc, and verify the output exists.\n```\n\n**Manual Path** (for complex\u002FUnicode-heavy documents): 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** → Use `run_shell` with `pandoc` for each target format\n4. **Verification** → Check output files exist and are valid\n\n## Why This Adaptive Approach?\n\n| Scenario | Recommended Approach | Rationale |\n|----------|---------------------|-----------|\n| Simple ASCII doc, single format | shell_agent | Faster, less manual overhead |\n| Unicode symbols present | Manual workflow | Prevents LaTeX encoding failures |\n| Previous shell_agent failure | Manual workflow | Avoids repeat failures |\n| Multiple formats needed | Manual workflow | Granular control per format |\n| Time-sensitive, low-risk | shell_agent first | Try fast path, fallback if needed |\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** → Use `run_shell` with `pandoc` for each target format\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```\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### 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### Quick Path Example (Simple Document)\n\n```markdown\n# Generate Simple Meeting Notes\n\n## Delegate to shell_agent\nshell_agent\ntask: |\n  Create meeting notes document:\n  1. Write to \u002Ftmp\u002Fmeeting_notes.md with content:\n     \"# Team Meeting Notes\n     \n     ## Date: 2024-01-15\n     ## Attendees: Alice, Bob, Carol\n     \n     ## Action Items\n     - Alice: Complete report by Friday\n     - Bob: Schedule follow-up meeting\n     \n     ## Next Meeting: 2024-01-22\"\n  2. Convert to Word: pandoc \u002Ftmp\u002Fmeeting_notes.md -o meeting_notes.docx\n  3. Verify: ls -lh meeting_notes.docx\n```\n\n### Manual Path Example (Unicode-Heavy Document)\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 PDF (from sanitized)\nrun_shell\ncommand: pandoc \u002Ftmp\u002Fnegotiation_strategy_sanitized.md -o negotiation_strategy.pdf\n\n## Step 5: Convert to HTML (from original)\nrun_shell\ncommand: pandoc \u002Ftmp\u002Fnegotiation_strategy.md -o negotiation_strategy.html\n\n## Step 6: 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\n## Common pandoc Commands\n\n```bash\n# Markdown to Word\npandoc input.md -o output.docx\n\n# Markdown to PDF (requires LaTeX or wkhtmltopdf)\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 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  - Or try `--pdf-engine=xelatex` for better Unicode support\n  - Or use `--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  - Or use `--pdf-engine=wkhtmltopdf` instead\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\n- **Missing pandoc**: Install via `apt-get install pandoc` or `brew install pandoc`\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\n**After successful shell_agent completion**: Continue using shell_agent for similar straightforward documents.\n\n**After shell_agent failure on Unicode content**: Switch to manual workflow for that document and similar future documents. Document the failure pattern.\n\n**After successful manual workflow**: You now have a proven approach. For future similar documents:\n- If content is similar (same Unicode patterns): Use manual workflow directly\n- If content is simpler: Try shell_agent first, keep manual workflow as backup\n- Build a library of sanitized templates for repeated use\n\n## Related Skills\n\n- `document-gen-fallback`: Original fallback workflow without Unicode guidance\n- Use this skill as your **primary** document generation skill—it adapts to document complexity\n- Fall back to `document-gen-unicode-safe` (parent) if you need the original prescriptive manual-only approach\nname: document-gen-adaptive-workflow\ndescription: Adaptive document generation with smart fallback to manual Unicode-safe workflow\n### Quick Path: Delegate to shell_agent\n\nFor straightforward documents without Unicode concerns:\n\n```\nshell_agent\ntask: |\n  1. Write markdown content to \u002Ftmp\u002Freport.md using write_file\n  2. Convert to Word format: pandoc \u002Ftmp\u002Freport.md -o report.docx\n  3. Convert to PDF: pandoc \u002Ftmp\u002Freport.md -o report.pdf --pdf-engine=xelatex\n  4. Verify both files exist with: ls -lh report.docx report.pdf\n  5. Report the file sizes and confirm successful generation\n```\n\n**If shell_agent succeeds**: Task complete.\n\n**If shell_agent fails**: Switch to Manual Path below.\n\n### Manual Path: Step-by-Step Workflow\n",{"name":5,"description":7},"main","ff671ef61ed6587c49bd54c81cdc751c0b99e363","gdpval_bench\u002Fskills\u002Fdocument-gen-fallback-enhanced-enhanced-c5d426","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":45,"prompt":55,"zipAvailable":56},[46,49,52],{"tool":47,"command":48},"npx","npx skills add AG064\u002FOpenSpace --skill document-gen-unicode-safe",{"tool":50,"command":51},"bunx","bunx skills add AG064\u002FOpenSpace --skill document-gen-unicode-safe",{"tool":53,"command":54},"pnpm","pnpm dlx skills add AG064\u002FOpenSpace --skill document-gen-unicode-safe","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002FAG064\u002FOpenSpace\u002Fblob\u002Fmain\u002Fgdpval_bench\u002Fskills\u002Fdocument-gen-fallback-enhanced-enhanced-c5d426\u002FSKILL.md",true,[58],{"path":59,"resourceType":60,"resourceTypeDesc":61,"sizeBytes":62,"sourceHtmlUrl":63},".skill_id","OTHER","其他",60,"https:\u002F\u002Fgithub.com\u002FAG064\u002FOpenSpace\u002Fblob\u002Fmain\u002Fgdpval_bench\u002Fskills\u002Fdocument-gen-fallback-enhanced-enhanced-c5d426\u002F.skill_id",[65,88,104,113,138,154],{"skillNo":66,"name":67,"nameZh":6,"description":68,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":9,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":69,"categories":70,"keywords":71,"publishedAt":32},"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",[],[72,73,74,75,76,77,31,78,79,80,81,82,83,84,85,86,87],"write special chars ts check","check","write","filters","Existing","type-checking","errors","script","output","type","files","only","template","file","python","typescript",{"skillNo":89,"name":90,"nameZh":6,"description":91,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":9,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":92,"categories":93,"keywords":94,"publishedAt":32},"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",[],[95,96,74,84,97,98,85,86,99,100,101,102,103,31,79,29],"readback","write special chars readback","cleanup","read","scripts","verification","via","post","helper",{"skillNo":105,"name":106,"nameZh":6,"description":107,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":9,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":108,"categories":109,"keywords":110,"publishedAt":32},"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",[],[74,111,86,31,101,84,112,85,79],"write special chars heredoc","shell",{"skillNo":114,"name":115,"nameZh":6,"description":116,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":9,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":117,"categories":118,"keywords":119,"publishedAt":32},"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",[],[120,121,122,123,87,124,125,126,127,128,31,129,130,131,132,133,134,135,136,137],"reference","worldmonitor","worldmonitor reference","dashboard","css","architecture","extracting","hierarchy","source","layer","panel","patterns","edge functions","integrations","open","api","data","scheduler",{"skillNo":139,"name":140,"nameZh":6,"description":141,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":9,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":142,"categories":143,"keywords":144,"publishedAt":32},"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",[],[145,146,147,148,31,149,29,150,151,152,153],"virtual list","list","virtual","chunk","dom","rendering","recycling","implement","performance",{"skillNo":155,"name":156,"nameZh":6,"description":157,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":9,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":158,"categories":159,"keywords":160,"publishedAt":32},"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",[],[161,162,163,164,165,166,85,167,168,169],"directory","verify","structure","verify directory structure","access","first","issues","diagnose","file access"]