[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M6HXH2P5FXPKWXSND91SW6JS":3,"skill-same:01M6HXH2P5FXPKWXSND91SW6JS":71},{"skillNo":4,"name":5,"nameZh":6,"description":7,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":16,"categories":17,"keywords":23,"publishedAt":38,"linkOnly":39,"markdownContent":40,"markdownBody":41,"frontMatter":42,"refName":43,"commitSha":44,"skillDirectory":45,"forksCount":46,"repositoryHtmlUrl":47,"repositoryHomepageUrl":6,"ownerHtmlUrl":48,"ownerBlogUrl":49,"ownerDescription":6,"updatedAt":50,"install":51,"resources":64},"01M6HXH2P5FXPKWXSND91SW6JS","resilient-document-pipeline",null,"Unified document generation with tool failure detection, domain knowledge fallback, progressive conversion, and Unicode safety","HKUDS\u002FAgentPilot","HKUDS","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F118165258?v=4","01M6HW8VRNZP64G0P4MVJW2KKQ","✨Data Intelligence Lab@HKU✨","01M6HW8VWZVHBRHYH3T330PFWV",7993,"MIT","https:\u002F\u002Fgithub.com\u002FHKUDS\u002FAgentPilot\u002Fblob\u002Fmain\u002Fopenspace\u002Flegacy\u002Fv1\u002Fgdpval_bench\u002Fskills\u002Fdocument-gen-fallback-enhanced-merged\u002FSKILL.md",[18],{"categoryNo":19,"categoryName":20,"taxonomyType":21,"taxonomyTypeDesc":22},"01JBSEEDCAT000000000000002","文档处理","SCENARIO","使用场景",[24,25,26,27,28,29,30,31,32,33,34,35,36,37],"pipeline","document","resilient document pipeline","detection","Safety","knowledge","tool","conversion","fallback","domain","generation","Unicode","document generation","with","2026-11-10 10:12:30",false,"---\nname: resilient-document-pipeline\ndescription: Unified document generation with tool failure detection, domain knowledge fallback, progressive conversion, and Unicode safety\n---\n\n# Resilient Document Generation Pipeline\n\n## When to Use This Skill\n\nUse this workflow when generating documents in **challenging environments** where:\n\n- **Tool failures are likely or have occurred**: `read_file`, `search_web`, `read_webpage`, or `execute_code_sandbox` return errors\n- **Multiple formats are needed**: Generate `.docx`, `.pdf`, `.html` from the same source\n- **Unicode\u002Fspecial characters are present**: Documents contain em dashes, curly quotes, arrows, symbols, or non-ASCII text\n- **Primary conversion methods may fail**: LaTeX\u002Fpandoc may not be available or misconfigured\n\nThis skill combines **early failure detection**, **domain-knowledge content creation**, **progressive conversion fallbacks**, and **Unicode safety** into a single resilient workflow.\n\n## Core Workflow Overview\n\n```\n┌─────────────────────────────────────────────────────────────────┐\n│  1. DETECT tool failures (2+ indicators → pivot immediately)   │\n└────────────────┬────────────────────────────────────────────────┘\n                 │\n┌────────────────▼────────────────────────────────────────────────┐\n│  2. CREATE content with write_file using embedded domain       │\n│     knowledge (professionally structured markdown)              │\n└────────────────┬────────────────────────────────────────────────┘\n                 │\n┌────────────────▼────────────────────────────────────────────────┐\n│  3. SANITIZE unicode (create LaTeX-safe version for PDF)       │\n└────────────────┬────────────────────────────────────────────────┘\n                 │\n┌────────────────▼────────────────────────────────────────────────┐\n│  4. CONVERT with progressive fallbacks:                        │\n│     pandoc → reportlab → fpdf2 → wkhtmltopdf                   │\n└────────────────┬────────────────────────────────────────────────┘\n                 │\n┌────────────────▼────────────────────────────────────────────────┐\n│  5. VERIFY outputs exist and are valid                          │\n└─────────────────────────────────────────────────────────────────┘\n```\n\n## Step-by-Step Workflow\n\n### Step 1: Detect Tool Failure Pattern\n\n**Before attempting document generation**, check for failure indicators:\n\n```\nTOOL_FAILURE_INDICATORS = [\n    \"read_file returns binary\u002Fimage data instead of text\",\n    \"search_web returns unknown error or empty results\",\n    \"read_webpage returns unknown error on multiple URLs\",\n    \"execute_code_sandbox fails unexpectedly\",\n    \"pandoc command fails with 'unknown error'\",\n    \"Multiple consecutive tool failures on data retrieval\"\n]\n```\n\n**Decision point**: If **2+ indicators** are present within the first 2-3 iterations:\n\n1. **Stop** attempting to fix the failing tools\n2. **Acknowledge** the limitation briefly in your output\n3. **Commit** to generating the document with available knowledge\n4. **Proceed** to Step 2 immediately\n\n### Step 2: Create Content with write_file\n\nWrite your document as **professionally structured Markdown** using embedded domain knowledge:\n\n```\nwrite_file\npath: \u002Ftmp\u002Fdocument_source.md\ncontent: |\n  # [Document Title]\n  \n  ## Executive Summary\n  [Brief overview of key content - use domain knowledge]\n  \n  ## Background\n  [Context and scope - leverage embedded expertise]\n  \n  ## Main Content\n  [Organized sections with headers, lists, tables]\n  \n  ## Limitations & Notes\n  [Transparent about data source limitations if relevant]\n  \n  ## Recommendations\u002FNext Steps\n  [Actionable guidance based on available information]\n```\n\n**Best practices for content:**\n- Use **general domain knowledge** appropriately when external data is unavailable\n- **Clearly distinguish** between verified facts and general guidance\n- Include **actionable frameworks** rather than specific unverified data\n- Add **placeholder notes** where specific data would enhance the document:\n\n```markdown\n> **Note**: Specific [metric\u002Fdata point] would typically be sourced from \n> [expected source]. The guidance below reflects established best practices.\n```\n\n### Step 3: Sanitize Unicode Characters (Pre-PDF Conversion)\n\n**Critical**: PDF generation via pandoc typically uses LaTeX, which has limited Unicode support. Create a sanitized version:\n\n#### Option A: Manual write_file (Recommended for control)\n\n```\nwrite_file\npath: \u002Ftmp\u002Fdocument_source_sanitized.md\ncontent: |\n  [Same content as Step 2, but with these replacements:]\n```\n\n**Character replacement table:**\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 keep for non-PDF formats |\n\n#### Option B: Shell script sanitization\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\" -e 's\u002F…\u002F...\u002Fg' -e 's\u002F→\u002F->\u002Fg' -e 's\u002F←\u002F\u003C-\u002Fg' -e 's\u002F©\u002F(c)\u002Fg' -e 's\u002F®\u002F(r)\u002Fg' -e 's\u002F™\u002F(tm)\u002Fg' \u002Ftmp\u002Fdocument_source.md > \u002Ftmp\u002Fdocument_source_sanitized.md\n```\n\n**Important**: Keep the original unsanitized file for DOCX\u002FHTML conversion (these formats handle Unicode better).\n\n### Step 4: Convert to Target Formats with Progressive Fallbacks\n\nUse `run_shell` with **progressive fallback** strategy. Try each method; if it fails, move to the next.\n\n#### For DOCX (from original markdown):\n\n```\nrun_shell\ncommand: pandoc \u002Ftmp\u002Fdocument_source.md -o output.docx\n```\n\n**Fallback if pandoc fails:**\n```\nexecute_code_sandbox\ncode: |\n  from docx import Document\n  # Parse markdown and create DOCX with python-docx\n  # (Implementation depends on complexity needs)\n```\n\n#### For PDF (from sanitized markdown):\n\n**Attempt 1 - pandoc with default engine:**\n```\nrun_shell\ncommand: pandoc \u002Ftmp\u002Fdocument_source_sanitized.md -o output.pdf\n```\n\n**Attempt 2 - pandoc with xeLaTeX (better Unicode):**\n```\nrun_shell\ncommand: pandoc \u002Ftmp\u002Fdocument_source_sanitized.md -o output.pdf --pdf-engine=xelatex\n```\n\n**Attempt 3 - pandoc with wkhtmltopdf:**\n```\nrun_shell\ncommand: pandoc \u002Ftmp\u002Fdocument_source_sanitized.md -o output.pdf --pdf-engine=wkhtmltopdf\n```\n\n**Attempt 4 - Python fpdf2 (most reliable fallback):**\n```\nexecute_code_sandbox\ncode: |\n  from fpdf import FPDF\n  import re\n  \n  # Read sanitized markdown\n  with open('\u002Ftmp\u002Fdocument_source_sanitized.md', 'r') as f:\n      content = f.read()\n  \n  # Simple markdown-to-PDF conversion\n  pdf = FPDF()\n  pdf.add_page()\n  pdf.set_font('Arial', '', 12)\n  \n  # Process content (strip markdown, handle basic formatting)\n  lines = content.split('\\n')\n  for line in lines:\n      # Remove markdown syntax\n      clean = re.sub(r'[#*_`]', '', line)\n      if clean.strip():\n          pdf.cell(0, 10, clean, ln=True)\n  \n  pdf.output('output.pdf')\n  print('PDF created successfully')\n```\n\n**Attempt 5 - Python reportlab (alternative):**\n```\nexecute_code_sandbox\ncode: |\n  from reportlab.lib.pagesizes import letter\n  from reportlab.platypus import SimpleDocTemplate, Paragraph, Spacer\n  from reportlab.lib.styles import getSampleStyleSheet\n  import re\n  \n  doc = SimpleDocTemplate('output.pdf', pagesize=letter)\n  styles = getSampleStyleSheet()\n  story = []\n  \n  with open('\u002Ftmp\u002Fdocument_source_sanitized.md', 'r') as f:\n      content = f.read()\n  \n  lines = content.split('\\n')\n  for line in lines:\n      clean = re.sub(r'[#*_`]', '', line)\n      if clean.strip():\n          story.append(Paragraph(clean, styles['Normal']))\n          story.append(Spacer(1, 6))\n  \n  doc.build(story)\n  print('PDF created with reportlab')\n```\n\n#### For HTML (from original markdown):\n\n```\nrun_shell\ncommand: pandoc \u002Ftmp\u002Fdocument_source.md -o output.html\n```\n\n**Fallback if pandoc fails:**\n```\nexecute_code_sandbox\ncode: |\n  import markdown\n  with open('\u002Ftmp\u002Fdocument_source.md', 'r') as f:\n      md_content = f.read()\n  html_content = markdown.markdown(md_content)\n  with open('output.html', 'w') as f:\n      f.write(f'\u003C!DOCTYPE html>\u003Chtml>\u003Cbody>{html_content}\u003C\u002Fbody>\u003C\u002Fhtml>')\n```\n\n### Step 5: Verify Outputs\n\nCheck that files were created successfully and have reasonable sizes:\n\n```\nrun_shell\ncommand: ls -lh output.* 2>\u002Fdev\u002Fnull || echo \"Some outputs missing\"\n```\n\n```\nrun_shell\ncommand: file output.pdf output.docx output.html 2>\u002Fdev\u002Fnull\n```\n\n**Validation criteria:**\n- [ ] File exists\n- [ ] File size > 0 bytes\n- [ ] File command recognizes the format correctly\n- [ ] (Optional) Open\u002Fpreview the file to confirm content renders\n\n## Complete Example\n\n```markdown\n# Generate Project Status Report\n\n## Step 1: Detect failures (if applicable)\nTool check: read_webpage failed 3x, search_web failed 2x → PIVOT to fallback workflow\n\n## Step 2: Write Markdown source\nwrite_file\npath: \u002Ftmp\u002Fproject_status.md\ncontent: |\n  # Project Status Report\n  \n  ## Executive Summary\n  This report summarizes project progress using established methodologies.\n  \n  ## Current Status\n  - Phase 1: Complete\n  - Phase 2: In Progress (75%)\n  - Phase 3: Not Started\n  \n  ## Risks & Mitigation\n  Standard risk framework applied...\n  \n  ## Recommendations\n  1. Continue current trajectory\n  2. Schedule stakeholder review\n\n> **Note**: Specific metrics from project management tool were unavailable; guidance reflects standard practices.\n\n## Step 3: Sanitize for PDF\nwrite_file\npath: \u002Ftmp\u002Fproject_status_sanitized.md\ncontent: |\n  [Same content with any special chars replaced per table above]\n\n## Step 4: Convert (try each, proceed on failure)\nrun_shell\ncommand: pandoc \u002Ftmp\u002Fproject_status.md -o project_status.docx\n\nrun_shell\ncommand: pandoc \u002Ftmp\u002Fproject_status_sanitized.md -o project_status.pdf\n\nrun_shell\ncommand: pandoc \u002Ftmp\u002Fproject_status.md -o project_status.html\n\n## Step 5: Verify\nrun_shell\ncommand: ls -lh project_status.*\n```\n\n## Decision Tree for Conversion Failures\n\n```\npandoc PDF fails?\n  ├─→ Try --pdf-engine=xelatex\n  │   └─→ Fails?\n  │       ├─→ Try --pdf-engine=wkhtmltopdf\n  │       │   └─→ Fails?\n  │       │       └─→ Use Python fpdf2 (most reliable)\n  │       └─→ Success → Done\n  └─→ Success → Done\n```\n\n## Troubleshooting\n\n| Issue | Solution |\n|-------|----------|\n| PDF generation fails with encoding error | Use sanitized markdown; try `--pdf-engine=xelatex` |\n| Pandoc not found | Install via `apt-get install pandoc` or use Python fallbacks |\n| LaTeX not found | Use `--pdf-engine=wkhtmltopdf` or Python fpdf2 |\n| DOCX formatting issues | Add `--reference-doc=template.docx` for custom styles |\n| Unicode in any format | Use `-f markdown+utf8`; ensure UTF-8 encoding with `file -i source.md` |\n| All pandoc commands fail | Fall back to Python libraries (fpdf2, reportlab, python-docx, markdown) |\n| Python libraries missing | Install via `pip install fpdf2 reportlab python-docx markdown` |\n\n## Advantages Over Standard Approaches\n\n| Aspect | Standard Approach | Resilient Pipeline |\n|--------|------------------|-------------------|\n| Tool failure response | Retry same approach | Detect pattern, pivot immediately |\n| Content source | External data only | Embedded domain knowledge when needed |\n| Conversion robustness | Single method | Progressive fallbacks (5+ options) |\n| Unicode handling | May cause failures | Proactive sanitization |\n| Verification | Optional | Built-in validation step |\n| Transparency | May hide limitations | Explicit about constraints |\n\n## Best Practices\n\n| Do | Don't |\n|----|-------|\n| Pivot after 2+ tool failures | Retry failing tools 5+ times |\n| Sanitize before PDF conversion | Send raw Unicode to LaTeX |\n| Try multiple conversion methods | Give up after first failure |\n| Be transparent about limitations | Claim unverified facts as certain |\n| Verify all outputs | Assume files were created |\n| Use progressive fallbacks | Hard-code single approach |\n\n## When to Return to Standard Methods\n\nAfter successfully completing the resilient pipeline:\n\n1. **For similar future tasks**: You can attempt standard `shell_agent` delegation first\n2. **Keep this skill ready**: Use immediately if tool failures recur\n3. **For Unicode-heavy documents**: Consider always using this workflow with sanitization\n4. **For critical deliverables**: This workflow provides maximum reliability\n\n## Related Skills\n\n- `document-gen-fallback-enhanced`: Original Unicode-safe fallback (parent)\n- `write-file-fallback-report`: Domain-knowledge report generation (parent)\n- Use this unified skill when you need **all capabilities combined** in one workflow\n*** End Files\n*** Add File: sanitize_for_pdf.sh\n#!\u002Fbin\u002Fbash\n# sanitize_for_pdf.sh - Replace problematic unicode chars for LaTeX\u002FPDF\n# Usage: .\u002Fsanitize_for_pdf.sh \u003Cinput.md> [output.md]\n\nif [ -z \"$1\" ]; then\n  echo \"Usage: $0 \u003Cinput.md> [output.md]\"\n  exit 1\nfi\n\nINPUT=\"$1\"\nOUTPUT=\"${2:-${1%.md}_sanitized.md}\"\n\n# Check input file exists\nif [ ! -f \"$INPUT\" ]; then\n  echo \"Error: Input file not found: $INPUT\"\n  exit 1\nfi\n\n# Apply sanitization replacements\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^^\u002Fg' \\\n    -e 's\u002F↓\u002Fvv\u002Fg' \\\n    -e 's\u002F✓\u002F[x]\u002Fg' \\\n    -e 's\u002F✗\u002F[ ]\u002Fg' \\\n    -e 's\u002F★\u002F*\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\"\necho \"Verify with: diff $INPUT $OUTPUT\"\n*** Add File: convert_with_fallbacks.sh\n#!\u002Fbin\u002Fbash\n# convert_with_fallbacks.sh - Progressive fallback document conversion\n# Usage: .\u002Fconvert_with_fallbacks.sh \u003Cinput.md> \u003Coutput_format>\n# Formats: pdf, docx, html\n\nif [ -z \"$1\" ] || [ -z \"$2\" ]; then\n  echo \"Usage: $0 \u003Cinput.md> \u003Cpdf|docx|html>\"\n  exit 1\nfi\n\nINPUT=\"$1\"\nFORMAT=\"$2\"\nBASENAME=\"${INPUT%.*}\"\nOUTPUT=\"${BASENAME}.${FORMAT}\"\n\necho \"Converting $INPUT to $FORMAT...\"\n\nif [ \"$FORMAT\" = \"pdf\" ]; then\n  echo \"Attempt 1: pandoc default\"\n  if pandoc \"$INPUT\" -o \"$OUTPUT\" 2>\u002Fdev\u002Fnull; then\n    echo \"Success with pandoc default\"\n    exit 0\n  fi\n  \n  echo \"Attempt 2: pandoc with xeLaTeX\"\n  if pandoc \"$INPUT\" -o \"$OUTPUT\" --pdf-engine=xelatex 2>\u002Fdev\u002Fnull; then\n    echo \"Success with xeLaTeX\"\n    exit 0\n  fi\n  \n  echo \"Attempt 3: pandoc with wkhtmltopdf\"\n  if pandoc \"$INPUT\" -o \"$OUTPUT\" --pdf-engine=wkhtmltopdf 2>\u002Fdev\u002Fnull; then\n    echo \"Success with wkhtmltopdf\"\n    exit 0\n  fi\n  \n  echo \"Attempt 4: Python fpdf2\"\n  if python3 -c \"\nfrom fpdf import FPDF\nimport re\npdf = FPDF()\npdf.add_page()\npdf.set_font('Arial', '', 12)\nwith open('$INPUT', 'r') as f:\n    for line in f:\n        clean = re.sub(r'[#*_\\`]', '', line)\n        if clean.strip():\n            pdf.cell(0, 10, clean.strip(), ln=True)\npdf.output('$OUTPUT')\n\" 2>\u002Fdev\u002Fnull; then\n    echo \"Success with fpdf2\"\n    exit 0\n  fi\n  \n  echo \"All PDF conversion methods failed\"\n  exit 1\n\nelif [ \"$FORMAT\" = \"docx\" ]; then\n  echo \"Attempt 1: pandoc\"\n  if pandoc \"$INPUT\" -o \"$OUTPUT\" 2>\u002Fdev\u002Fnull; then\n    echo \"Success with pandoc\"\n    exit 0\n  fi\n  \n  echo \"Pandoc failed for DOCX - consider Python fallback (python-docx)\"\n  exit 1\n\nelif [ \"$FORMAT\" = \"html\" ]; then\n  echo \"Attempt 1: pandoc\"\n  if pandoc \"$INPUT\" -o \"$OUTPUT\" 2>\u002Fdev\u002Fnull; then\n    echo \"Success with pandoc\"\n    exit 0\n  fi\n  \n  echo \"Attempt 2: Python markdown\"\n  if python3 -c \"\nimport markdown\nwith open('$INPUT', 'r') as f:\n    content = f.read()\nhtml = markdown.markdown(content)\nwith open('$OUTPUT', 'w') as f:\n    f.write(f'\u003C!DOCTYPE html>\u003Chtml>\u003Cbody>{html}\u003C\u002Fbody>\u003C\u002Fhtml>')\n\" 2>\u002Fdev\u002Fnull; then\n    echo \"Success with markdown library\"\n    exit 0\n  fi\n  \n  echo \"All HTML conversion methods failed\"\n  exit 1\n\nelse\n  echo \"Unknown format: $FORMAT (use pdf, docx, or html)\"\n  exit 1\nfi\n","# Resilient Document Generation Pipeline\n\n## When to Use This Skill\n\nUse this workflow when generating documents in **challenging environments** where:\n\n- **Tool failures are likely or have occurred**: `read_file`, `search_web`, `read_webpage`, or `execute_code_sandbox` return errors\n- **Multiple formats are needed**: Generate `.docx`, `.pdf`, `.html` from the same source\n- **Unicode\u002Fspecial characters are present**: Documents contain em dashes, curly quotes, arrows, symbols, or non-ASCII text\n- **Primary conversion methods may fail**: LaTeX\u002Fpandoc may not be available or misconfigured\n\nThis skill combines **early failure detection**, **domain-knowledge content creation**, **progressive conversion fallbacks**, and **Unicode safety** into a single resilient workflow.\n\n## Core Workflow Overview\n\n```\n┌─────────────────────────────────────────────────────────────────┐\n│  1. DETECT tool failures (2+ indicators → pivot immediately)   │\n└────────────────┬────────────────────────────────────────────────┘\n                 │\n┌────────────────▼────────────────────────────────────────────────┐\n│  2. CREATE content with write_file using embedded domain       │\n│     knowledge (professionally structured markdown)              │\n└────────────────┬────────────────────────────────────────────────┘\n                 │\n┌────────────────▼────────────────────────────────────────────────┐\n│  3. SANITIZE unicode (create LaTeX-safe version for PDF)       │\n└────────────────┬────────────────────────────────────────────────┘\n                 │\n┌────────────────▼────────────────────────────────────────────────┐\n│  4. CONVERT with progressive fallbacks:                        │\n│     pandoc → reportlab → fpdf2 → wkhtmltopdf                   │\n└────────────────┬────────────────────────────────────────────────┘\n                 │\n┌────────────────▼────────────────────────────────────────────────┐\n│  5. VERIFY outputs exist and are valid                          │\n└─────────────────────────────────────────────────────────────────┘\n```\n\n## Step-by-Step Workflow\n\n### Step 1: Detect Tool Failure Pattern\n\n**Before attempting document generation**, check for failure indicators:\n\n```\nTOOL_FAILURE_INDICATORS = [\n    \"read_file returns binary\u002Fimage data instead of text\",\n    \"search_web returns unknown error or empty results\",\n    \"read_webpage returns unknown error on multiple URLs\",\n    \"execute_code_sandbox fails unexpectedly\",\n    \"pandoc command fails with 'unknown error'\",\n    \"Multiple consecutive tool failures on data retrieval\"\n]\n```\n\n**Decision point**: If **2+ indicators** are present within the first 2-3 iterations:\n\n1. **Stop** attempting to fix the failing tools\n2. **Acknowledge** the limitation briefly in your output\n3. **Commit** to generating the document with available knowledge\n4. **Proceed** to Step 2 immediately\n\n### Step 2: Create Content with write_file\n\nWrite your document as **professionally structured Markdown** using embedded domain knowledge:\n\n```\nwrite_file\npath: \u002Ftmp\u002Fdocument_source.md\ncontent: |\n  # [Document Title]\n  \n  ## Executive Summary\n  [Brief overview of key content - use domain knowledge]\n  \n  ## Background\n  [Context and scope - leverage embedded expertise]\n  \n  ## Main Content\n  [Organized sections with headers, lists, tables]\n  \n  ## Limitations & Notes\n  [Transparent about data source limitations if relevant]\n  \n  ## Recommendations\u002FNext Steps\n  [Actionable guidance based on available information]\n```\n\n**Best practices for content:**\n- Use **general domain knowledge** appropriately when external data is unavailable\n- **Clearly distinguish** between verified facts and general guidance\n- Include **actionable frameworks** rather than specific unverified data\n- Add **placeholder notes** where specific data would enhance the document:\n\n```markdown\n> **Note**: Specific [metric\u002Fdata point] would typically be sourced from \n> [expected source]. The guidance below reflects established best practices.\n```\n\n### Step 3: Sanitize Unicode Characters (Pre-PDF Conversion)\n\n**Critical**: PDF generation via pandoc typically uses LaTeX, which has limited Unicode support. Create a sanitized version:\n\n#### Option A: Manual write_file (Recommended for control)\n\n```\nwrite_file\npath: \u002Ftmp\u002Fdocument_source_sanitized.md\ncontent: |\n  [Same content as Step 2, but with these replacements:]\n```\n\n**Character replacement table:**\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 keep for non-PDF formats |\n\n#### Option B: Shell script sanitization\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\" -e 's\u002F…\u002F...\u002Fg' -e 's\u002F→\u002F->\u002Fg' -e 's\u002F←\u002F\u003C-\u002Fg' -e 's\u002F©\u002F(c)\u002Fg' -e 's\u002F®\u002F(r)\u002Fg' -e 's\u002F™\u002F(tm)\u002Fg' \u002Ftmp\u002Fdocument_source.md > \u002Ftmp\u002Fdocument_source_sanitized.md\n```\n\n**Important**: Keep the original unsanitized file for DOCX\u002FHTML conversion (these formats handle Unicode better).\n\n### Step 4: Convert to Target Formats with Progressive Fallbacks\n\nUse `run_shell` with **progressive fallback** strategy. Try each method; if it fails, move to the next.\n\n#### For DOCX (from original markdown):\n\n```\nrun_shell\ncommand: pandoc \u002Ftmp\u002Fdocument_source.md -o output.docx\n```\n\n**Fallback if pandoc fails:**\n```\nexecute_code_sandbox\ncode: |\n  from docx import Document\n  # Parse markdown and create DOCX with python-docx\n  # (Implementation depends on complexity needs)\n```\n\n#### For PDF (from sanitized markdown):\n\n**Attempt 1 - pandoc with default engine:**\n```\nrun_shell\ncommand: pandoc \u002Ftmp\u002Fdocument_source_sanitized.md -o output.pdf\n```\n\n**Attempt 2 - pandoc with xeLaTeX (better Unicode):**\n```\nrun_shell\ncommand: pandoc \u002Ftmp\u002Fdocument_source_sanitized.md -o output.pdf --pdf-engine=xelatex\n```\n\n**Attempt 3 - pandoc with wkhtmltopdf:**\n```\nrun_shell\ncommand: pandoc \u002Ftmp\u002Fdocument_source_sanitized.md -o output.pdf --pdf-engine=wkhtmltopdf\n```\n\n**Attempt 4 - Python fpdf2 (most reliable fallback):**\n```\nexecute_code_sandbox\ncode: |\n  from fpdf import FPDF\n  import re\n  \n  # Read sanitized markdown\n  with open('\u002Ftmp\u002Fdocument_source_sanitized.md', 'r') as f:\n      content = f.read()\n  \n  # Simple markdown-to-PDF conversion\n  pdf = FPDF()\n  pdf.add_page()\n  pdf.set_font('Arial', '', 12)\n  \n  # Process content (strip markdown, handle basic formatting)\n  lines = content.split('\\n')\n  for line in lines:\n      # Remove markdown syntax\n      clean = re.sub(r'[#*_`]', '', line)\n      if clean.strip():\n          pdf.cell(0, 10, clean, ln=True)\n  \n  pdf.output('output.pdf')\n  print('PDF created successfully')\n```\n\n**Attempt 5 - Python reportlab (alternative):**\n```\nexecute_code_sandbox\ncode: |\n  from reportlab.lib.pagesizes import letter\n  from reportlab.platypus import SimpleDocTemplate, Paragraph, Spacer\n  from reportlab.lib.styles import getSampleStyleSheet\n  import re\n  \n  doc = SimpleDocTemplate('output.pdf', pagesize=letter)\n  styles = getSampleStyleSheet()\n  story = []\n  \n  with open('\u002Ftmp\u002Fdocument_source_sanitized.md', 'r') as f:\n      content = f.read()\n  \n  lines = content.split('\\n')\n  for line in lines:\n      clean = re.sub(r'[#*_`]', '', line)\n      if clean.strip():\n          story.append(Paragraph(clean, styles['Normal']))\n          story.append(Spacer(1, 6))\n  \n  doc.build(story)\n  print('PDF created with reportlab')\n```\n\n#### For HTML (from original markdown):\n\n```\nrun_shell\ncommand: pandoc \u002Ftmp\u002Fdocument_source.md -o output.html\n```\n\n**Fallback if pandoc fails:**\n```\nexecute_code_sandbox\ncode: |\n  import markdown\n  with open('\u002Ftmp\u002Fdocument_source.md', 'r') as f:\n      md_content = f.read()\n  html_content = markdown.markdown(md_content)\n  with open('output.html', 'w') as f:\n      f.write(f'\u003C!DOCTYPE html>\u003Chtml>\u003Cbody>{html_content}\u003C\u002Fbody>\u003C\u002Fhtml>')\n```\n\n### Step 5: Verify Outputs\n\nCheck that files were created successfully and have reasonable sizes:\n\n```\nrun_shell\ncommand: ls -lh output.* 2>\u002Fdev\u002Fnull || echo \"Some outputs missing\"\n```\n\n```\nrun_shell\ncommand: file output.pdf output.docx output.html 2>\u002Fdev\u002Fnull\n```\n\n**Validation criteria:**\n- [ ] File exists\n- [ ] File size > 0 bytes\n- [ ] File command recognizes the format correctly\n- [ ] (Optional) Open\u002Fpreview the file to confirm content renders\n\n## Complete Example\n\n```markdown\n# Generate Project Status Report\n\n## Step 1: Detect failures (if applicable)\nTool check: read_webpage failed 3x, search_web failed 2x → PIVOT to fallback workflow\n\n## Step 2: Write Markdown source\nwrite_file\npath: \u002Ftmp\u002Fproject_status.md\ncontent: |\n  # Project Status Report\n  \n  ## Executive Summary\n  This report summarizes project progress using established methodologies.\n  \n  ## Current Status\n  - Phase 1: Complete\n  - Phase 2: In Progress (75%)\n  - Phase 3: Not Started\n  \n  ## Risks & Mitigation\n  Standard risk framework applied...\n  \n  ## Recommendations\n  1. Continue current trajectory\n  2. Schedule stakeholder review\n\n> **Note**: Specific metrics from project management tool were unavailable; guidance reflects standard practices.\n\n## Step 3: Sanitize for PDF\nwrite_file\npath: \u002Ftmp\u002Fproject_status_sanitized.md\ncontent: |\n  [Same content with any special chars replaced per table above]\n\n## Step 4: Convert (try each, proceed on failure)\nrun_shell\ncommand: pandoc \u002Ftmp\u002Fproject_status.md -o project_status.docx\n\nrun_shell\ncommand: pandoc \u002Ftmp\u002Fproject_status_sanitized.md -o project_status.pdf\n\nrun_shell\ncommand: pandoc \u002Ftmp\u002Fproject_status.md -o project_status.html\n\n## Step 5: Verify\nrun_shell\ncommand: ls -lh project_status.*\n```\n\n## Decision Tree for Conversion Failures\n\n```\npandoc PDF fails?\n  ├─→ Try --pdf-engine=xelatex\n  │   └─→ Fails?\n  │       ├─→ Try --pdf-engine=wkhtmltopdf\n  │       │   └─→ Fails?\n  │       │       └─→ Use Python fpdf2 (most reliable)\n  │       └─→ Success → Done\n  └─→ Success → Done\n```\n\n## Troubleshooting\n\n| Issue | Solution |\n|-------|----------|\n| PDF generation fails with encoding error | Use sanitized markdown; try `--pdf-engine=xelatex` |\n| Pandoc not found | Install via `apt-get install pandoc` or use Python fallbacks |\n| LaTeX not found | Use `--pdf-engine=wkhtmltopdf` or Python fpdf2 |\n| DOCX formatting issues | Add `--reference-doc=template.docx` for custom styles |\n| Unicode in any format | Use `-f markdown+utf8`; ensure UTF-8 encoding with `file -i source.md` |\n| All pandoc commands fail | Fall back to Python libraries (fpdf2, reportlab, python-docx, markdown) |\n| Python libraries missing | Install via `pip install fpdf2 reportlab python-docx markdown` |\n\n## Advantages Over Standard Approaches\n\n| Aspect | Standard Approach | Resilient Pipeline |\n|--------|------------------|-------------------|\n| Tool failure response | Retry same approach | Detect pattern, pivot immediately |\n| Content source | External data only | Embedded domain knowledge when needed |\n| Conversion robustness | Single method | Progressive fallbacks (5+ options) |\n| Unicode handling | May cause failures | Proactive sanitization |\n| Verification | Optional | Built-in validation step |\n| Transparency | May hide limitations | Explicit about constraints |\n\n## Best Practices\n\n| Do | Don't |\n|----|-------|\n| Pivot after 2+ tool failures | Retry failing tools 5+ times |\n| Sanitize before PDF conversion | Send raw Unicode to LaTeX |\n| Try multiple conversion methods | Give up after first failure |\n| Be transparent about limitations | Claim unverified facts as certain |\n| Verify all outputs | Assume files were created |\n| Use progressive fallbacks | Hard-code single approach |\n\n## When to Return to Standard Methods\n\nAfter successfully completing the resilient pipeline:\n\n1. **For similar future tasks**: You can attempt standard `shell_agent` delegation first\n2. **Keep this skill ready**: Use immediately if tool failures recur\n3. **For Unicode-heavy documents**: Consider always using this workflow with sanitization\n4. **For critical deliverables**: This workflow provides maximum reliability\n\n## Related Skills\n\n- `document-gen-fallback-enhanced`: Original Unicode-safe fallback (parent)\n- `write-file-fallback-report`: Domain-knowledge report generation (parent)\n- Use this unified skill when you need **all capabilities combined** in one workflow\n*** End Files\n*** Add File: sanitize_for_pdf.sh\n#!\u002Fbin\u002Fbash\n# sanitize_for_pdf.sh - Replace problematic unicode chars for LaTeX\u002FPDF\n# Usage: .\u002Fsanitize_for_pdf.sh \u003Cinput.md> [output.md]\n\nif [ -z \"$1\" ]; then\n  echo \"Usage: $0 \u003Cinput.md> [output.md]\"\n  exit 1\nfi\n\nINPUT=\"$1\"\nOUTPUT=\"${2:-${1%.md}_sanitized.md}\"\n\n# Check input file exists\nif [ ! -f \"$INPUT\" ]; then\n  echo \"Error: Input file not found: $INPUT\"\n  exit 1\nfi\n\n# Apply sanitization replacements\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^^\u002Fg' \\\n    -e 's\u002F↓\u002Fvv\u002Fg' \\\n    -e 's\u002F✓\u002F[x]\u002Fg' \\\n    -e 's\u002F✗\u002F[ ]\u002Fg' \\\n    -e 's\u002F★\u002F*\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\"\necho \"Verify with: diff $INPUT $OUTPUT\"\n*** Add File: convert_with_fallbacks.sh\n#!\u002Fbin\u002Fbash\n# convert_with_fallbacks.sh - Progressive fallback document conversion\n# Usage: .\u002Fconvert_with_fallbacks.sh \u003Cinput.md> \u003Coutput_format>\n# Formats: pdf, docx, html\n\nif [ -z \"$1\" ] || [ -z \"$2\" ]; then\n  echo \"Usage: $0 \u003Cinput.md> \u003Cpdf|docx|html>\"\n  exit 1\nfi\n\nINPUT=\"$1\"\nFORMAT=\"$2\"\nBASENAME=\"${INPUT%.*}\"\nOUTPUT=\"${BASENAME}.${FORMAT}\"\n\necho \"Converting $INPUT to $FORMAT...\"\n\nif [ \"$FORMAT\" = \"pdf\" ]; then\n  echo \"Attempt 1: pandoc default\"\n  if pandoc \"$INPUT\" -o \"$OUTPUT\" 2>\u002Fdev\u002Fnull; then\n    echo \"Success with pandoc default\"\n    exit 0\n  fi\n  \n  echo \"Attempt 2: pandoc with xeLaTeX\"\n  if pandoc \"$INPUT\" -o \"$OUTPUT\" --pdf-engine=xelatex 2>\u002Fdev\u002Fnull; then\n    echo \"Success with xeLaTeX\"\n    exit 0\n  fi\n  \n  echo \"Attempt 3: pandoc with wkhtmltopdf\"\n  if pandoc \"$INPUT\" -o \"$OUTPUT\" --pdf-engine=wkhtmltopdf 2>\u002Fdev\u002Fnull; then\n    echo \"Success with wkhtmltopdf\"\n    exit 0\n  fi\n  \n  echo \"Attempt 4: Python fpdf2\"\n  if python3 -c \"\nfrom fpdf import FPDF\nimport re\npdf = FPDF()\npdf.add_page()\npdf.set_font('Arial', '', 12)\nwith open('$INPUT', 'r') as f:\n    for line in f:\n        clean = re.sub(r'[#*_\\`]', '', line)\n        if clean.strip():\n            pdf.cell(0, 10, clean.strip(), ln=True)\npdf.output('$OUTPUT')\n\" 2>\u002Fdev\u002Fnull; then\n    echo \"Success with fpdf2\"\n    exit 0\n  fi\n  \n  echo \"All PDF conversion methods failed\"\n  exit 1\n\nelif [ \"$FORMAT\" = \"docx\" ]; then\n  echo \"Attempt 1: pandoc\"\n  if pandoc \"$INPUT\" -o \"$OUTPUT\" 2>\u002Fdev\u002Fnull; then\n    echo \"Success with pandoc\"\n    exit 0\n  fi\n  \n  echo \"Pandoc failed for DOCX - consider Python fallback (python-docx)\"\n  exit 1\n\nelif [ \"$FORMAT\" = \"html\" ]; then\n  echo \"Attempt 1: pandoc\"\n  if pandoc \"$INPUT\" -o \"$OUTPUT\" 2>\u002Fdev\u002Fnull; then\n    echo \"Success with pandoc\"\n    exit 0\n  fi\n  \n  echo \"Attempt 2: Python markdown\"\n  if python3 -c \"\nimport markdown\nwith open('$INPUT', 'r') as f:\n    content = f.read()\nhtml = markdown.markdown(content)\nwith open('$OUTPUT', 'w') as f:\n    f.write(f'\u003C!DOCTYPE html>\u003Chtml>\u003Cbody>{html}\u003C\u002Fbody>\u003C\u002Fhtml>')\n\" 2>\u002Fdev\u002Fnull; then\n    echo \"Success with markdown library\"\n    exit 0\n  fi\n  \n  echo \"All HTML conversion methods failed\"\n  exit 1\n\nelse\n  echo \"Unknown format: $FORMAT (use pdf, docx, or html)\"\n  exit 1\nfi\n",{"name":5,"description":7},"main","6b84b0689ca0d9e7b1e4061188ff6b60758e0f8a","openspace\u002Flegacy\u002Fv1\u002Fgdpval_bench\u002Fskills\u002Fdocument-gen-fallback-enhanced-merged",940,"https:\u002F\u002Fgithub.com\u002FHKUDS\u002FAgentPilot","https:\u002F\u002Fgithub.com\u002FHKUDS","https:\u002F\u002Fsites.google.com\u002Fview\u002Fchaoh","2026-11-06 23:04:01",{"source":8,"skillName":5,"commands":52,"prompt":62,"zipAvailable":63},[53,56,59],{"tool":54,"command":55},"npx","npx skills add HKUDS\u002FAgentPilot --skill resilient-document-pipeline",{"tool":57,"command":58},"bunx","bunx skills add HKUDS\u002FAgentPilot --skill resilient-document-pipeline",{"tool":60,"command":61},"pnpm","pnpm dlx skills add HKUDS\u002FAgentPilot --skill resilient-document-pipeline","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002FHKUDS\u002FAgentPilot\u002Fblob\u002Fmain\u002Fopenspace\u002Flegacy\u002Fv1\u002Fgdpval_bench\u002Fskills\u002Fdocument-gen-fallback-enhanced-merged\u002FSKILL.md",true,[65],{"path":66,"resourceType":67,"resourceTypeDesc":68,"sizeBytes":69,"sourceHtmlUrl":70},".skill_id","OTHER","其他",51,"https:\u002F\u002Fgithub.com\u002FHKUDS\u002FAgentPilot\u002Fblob\u002Fmain\u002Fopenspace\u002Flegacy\u002Fv1\u002Fgdpval_bench\u002Fskills\u002Fdocument-gen-fallback-enhanced-merged\u002F.skill_id",[72,91,110,133,156,179],{"skillNo":73,"name":74,"nameZh":6,"description":75,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":76,"categories":77,"keywords":78,"publishedAt":38},"01M6HYB297NDABRERJRVG0K8R0","agentpilot","Set up AgentPilot and use its single entry to prepare missing inputs and run configured RSI experiments. Use when the user requests AgentPilot installation or work with AgentPilot.","https:\u002F\u002Fgithub.com\u002FHKUDS\u002FAgentPilot\u002Fblob\u002Fmain\u002Fplugins\u002Fagentpilot\u002Fskills\u002Fagentpilot\u002FSKILL.md",[],[74,79,80,37,81,82,83,84,85,86,87,88,89,90],"prepare","requests","missing","installation","rsi","up","use","user","work","SET","run","experiments",{"skillNo":92,"name":93,"nameZh":6,"description":94,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":95,"categories":96,"keywords":97,"publishedAt":38},"01M6HYAYWXTTE1J7DJM0MFNQ4H","remember","Review auto-memory entries and propose promotions to OPENSPACE.md, OPENSPACE.local.md, or retained auto-memory topics; detect duplicates, stale facts, conflicts, and ambiguous entries before making changes.","https:\u002F\u002Fgithub.com\u002FHKUDS\u002FAgentPilot\u002Fblob\u002Fmain\u002Fopenspace\u002Fopenspace\u002Fskills\u002Fremember\u002FSKILL.md",[],[93,98,99,100,101,102,103,104,105,106,107,108,109],"memory","review","auto","openspace","changes","facts","detect","entries","local","conflicts","stale","duplicates",{"skillNo":111,"name":112,"nameZh":6,"description":113,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":114,"categories":115,"keywords":119,"publishedAt":38},"01M6HYAVMPM4SBDV60R2B5HPV8","skill-discovery","Search reusable OpenSpace skills locally, and browse cloud packages step by step when a cloud skill may help. Reusing proven skills saves tokens, improves reliability, and extends your capabilities beyond built-in tools.","https:\u002F\u002Fgithub.com\u002FHKUDS\u002FAgentPilot\u002Fblob\u002Fmain\u002Fopenspace\u002Fopenspace\u002Fhost_skills\u002Fskill-discovery\u002FSKILL.md",[116],{"categoryNo":117,"categoryName":118,"taxonomyType":21,"taxonomyTypeDesc":22},"01JBSEEDCAT000000000000023","Skill与智能体开发",[120,121,122,101,123,124,125,126,127,128,129,130,131,132],"skill discovery","discovery","reusable","step by step","tokens","packages","help","cloud","reliability","capabilities","browse","search","Tools",{"skillNo":134,"name":135,"nameZh":6,"description":136,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":137,"categories":138,"keywords":140,"publishedAt":38},"01M6HYAR811B3RB0M50RBEDGN6","delegate-task","Delegate tasks to OpenSpace — a full-stack autonomous worker for coding, DevOps, web research, and desktop automation, backed by an extensive MCP tool and skill library. Skills auto-improve through use, reducing token consumption over time. A cloud community lets agents share and collectively evolve reusable skills.","https:\u002F\u002Fgithub.com\u002FHKUDS\u002FAgentPilot\u002Fblob\u002Fmain\u002Fopenspace\u002Fopenspace\u002Fhost_skills\u002Fdelegate-task\u002FSKILL.md",[139],{"categoryNo":117,"categoryName":118,"taxonomyType":21,"taxonomyTypeDesc":22},[141,142,143,101,144,145,146,147,148,122,100,85,149,30,150,151,152,153,154,155],"delegate","task","delegate task","time","improve","desktop automation","worker","community","autonomous","stack","for","share","tasks","automation","MCP",{"skillNo":157,"name":158,"nameZh":6,"description":159,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":160,"categories":161,"keywords":162,"publishedAt":38},"01M6HYAM9FSGV6E52AYENDQXYH","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\u002FHKUDS\u002FAgentPilot\u002Fblob\u002Fmain\u002Fopenspace\u002Flegacy\u002Fv1\u002Fshowcase\u002Fskills\u002Fwrite-special-chars-ts-check\u002FSKILL.md",[],[163,164,165,166,167,168,169,170,171,172,173,174,175,176,151,177,178],"write special chars ts check","write","check","type","files","filters","only","template","file","python","typescript","output","Existing","type-checking","errors","script",{"skillNo":180,"name":181,"nameZh":6,"description":182,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":183,"categories":184,"keywords":185,"publishedAt":38},"01M6HYAH05HGV7SVWSVR8PJRQD","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\u002FHKUDS\u002FAgentPilot\u002Fblob\u002Fmain\u002Fopenspace\u002Flegacy\u002Fv1\u002Fshowcase\u002Fskills\u002Fwrite-special-chars-readback\u002FSKILL.md",[],[186,187,164,37,151,178,188,189,190,191,192,170,171,193,194,172],"write special chars readback","readback","helper","post","via","scripts","read","verification","cleanup"]