Agent skill

Document Gen Unicode Safe

by HKUDS in HKUDS/OpenSpace

Unicode-safe fallback workflow for multi-format document generation with character sanitization

MITAuto-check passedDocuments & Office

Install Document Gen Unicode Safe

skills CLI
$ npx skills add HKUDS/OpenSpace --skill document-gen-unicode-safe -a claude-code

Project install by default; add -g for ~/.claude/skills/.

GitHub CLI
$ gh skill install HKUDS/OpenSpace document-gen-unicode-safe --agent claude-code

Project scope by default; add --scope user for a personal install. Needs GitHub CLI 2.90.0 or later (public preview).

Manual copy
$ git clone --depth 1 https://github.com/HKUDS/OpenSpace.git skills-src && mkdir -p .claude/skills && cp -r skills-src/benchmarks/gdpval/skills/document-gen-fallback-enhanced-enhanced-c5d426 .claude/skills/document-gen-unicode-safe && rm -rf skills-src

Use ~/.claude/skills/ instead of .claude/skills for a personal install. The folder must contain SKILL.md.

Claude Code skills documentation · loads skills from .claude/skills/

Facts

Skill name
document-gen-unicode-safe
GitHub stars
7.7k
Token cost
~3k tokens
SKILL.md length
832 words
Files
2
Skills in repo
199
Repo updated
First seen
Licence
MIT

At a glance

Unicode-safe fallback workflow for multi-format document generation with character sanitization

  • Works in 4 steps: Create Source Content with write_file → Sanitize Unicode Characters (Pre-PDF… → Convert to Target Formats with run_shell → …
  • Documents & Office work in your project
  • SKILL.md covers When to Use, Core Technique, Why This Adaptive Approach? and ⚠️ Unicode & LaTeX…, plus 8 more sections
  • Calls pandoc, apt-get and brew

What it does

Document Gen Unicode Safe is an agent skill from HKUDS/OpenSpace. Unicode-safe fallback workflow for multi-format document generation with character sanitization

Its SKILL.md is about 3k tokens, which your agent loads only when the skill is triggered. The skill folder holds 1 other file.

It sits in Documents & Office. It works with LaTeX. The repository describes itself as: "OpenSpace: The Skill Management Layer for AI Agents" -- https://open-space.cloud/. The licence is MIT.

When your agent uses it

  • Documents & Office work in your project

Example prompts

  • “/document-gen-unicode-safe”

Workflow steps

4 steps, taken from the step headings in SKILL.md.

  1. Create Source Content with write_file
  2. Sanitize Unicode Characters (Pre-PDF Conversion)
  3. Convert to Target Formats with run_shell
  4. Verify Outputs

What it can do on your machine

Read from SKILL.md and the folder at commit 3827781. It shows what the files ask for, not the result of running them.

  • Tool permissions

    Pre-approves nothing: there is no allowed-tools line, so your agent's usual permission prompts apply.

    From allowed-tools in the SKILL.md frontmatter.

  • Runs code

    Shell commands in SKILL.md call:

    • pandoc
    • apt-get
    • brew

    From the folder's file list and the shell code blocks in SKILL.md.

  • Network

    No URLs in SKILL.md.

    From URLs in SKILL.md, links to its own repository left out.

  • Credentials

    Names no API keys, tokens, secrets or passwords.

    From names ending in _API_KEY, _TOKEN, _SECRET, _KEY or _PASSWORD in SKILL.md.

Context cost

Document Gen Unicode Safe loads about 3k tokens when it runs. Until then it costs about 30 tokens; SKILL.md has 832 words of instructions outside code blocks.

Always · name and description, kept in context so the agent knows when to use it
~30
When it runs · the whole SKILL.md, loaded when a task matches
~3k

Estimates: characters ÷ 4, the usual rule of thumb; real counts depend on the model's tokenizer. Scripts and assets cost tokens only if the agent reads them.

Safety

Auto-check passed

The automated check found no risky patterns in SKILL.md.

Automated static check — not a guarantee. Review scripts before installing. It scans the text of SKILL.md for risky patterns (piping downloads into a shell, reading credential files, hidden Unicode, destructive commands); files beside SKILL.md are not scanned.

SKILL.md

The full file from HKUDS/OpenSpace at commit 3827781, republished under its MIT licence (© HKUDS). 832 words, ~2,964 tokens.

Download SKILL.mdSave it as .claude/skills/document-gen-unicode-safe/SKILL.md (or your agent's skills folder). This skill also uses 1 other file; get the full folder from GitHub.
name
document-gen-unicode-safe
description
Unicode-safe fallback workflow for multi-format document generation with character sanitization

Document Generation Fallback Workflow (Unicode-Safe)

When to Use

First, assess whether to delegate to shell_agent or use manual workflow:

✅ Use shell_agent Directly When:
  • Document is straightforward (no special Unicode characters, symbols, or non-ASCII text)
  • Single format output needed (e.g., just .docx)
  • Content is primarily ASCII text with standard punctuation
  • No complex formatting requirements (tables, equations, custom templates)
  • You want quick iteration and shell_agent has succeeded on similar tasks before
⚠️ Use Manual Workflow When:
  • shell_agent returns unknown or unclear errors
  • Document contains special characters, symbols, or non-ASCII text (see Unicode table below)
  • Generating multiple formats simultaneously (e.g., .docx, .pdf, .html)
  • PDF generation fails due to LaTeX encoding issues
  • You need fine-grained control over each conversion step
  • Previous shell_agent attempts failed on similar content
📋 Decision Checklist
markdown
1. Does the document contain: em-dashes (—), curly quotes (" "), arrows (→), 
   checkmarks (✓), or other special symbols? → Use Manual Workflow

2. Is non-ASCII text present (é, ñ, ü, 中文,العربية)? → Use Manual Workflow with sanitization

3. Did shell_agent already fail on this or similar content? → Use Manual Workflow

4. Need multiple output formats with guaranteed success? → Use Manual Workflow

5. Simple ASCII document, single format, first attempt? → Try shell_agent First

Core Technique

Quick Path (for straightforward documents): Delegate directly to shell_agent with clear instructions:

shell_agent
task: Create a Word document from markdown content. Write the markdown to 
      /tmp/document.md, then convert to .docx using pandoc, and verify the output exists.

Manual Path (for complex/Unicode-heavy documents): Split the workflow into discrete, observable steps:

  1. Content creation → Use write_file to create source document (Markdown)
  2. Unicode sanitization → Preprocess markdown to replace problematic characters before PDF conversion
  3. Format conversion → Use run_shell with pandoc for each target format
  4. Verification → Check output files exist and are valid

Why This Adaptive Approach?

ScenarioRecommended ApproachRationale
Simple ASCII doc, single formatshell_agentFaster, less manual overhead
Unicode symbols presentManual workflowPrevents LaTeX encoding failures
Previous shell_agent failureManual workflowAvoids repeat failures
Multiple formats neededManual workflowGranular control per format
Time-sensitive, low-riskshell_agent firstTry fast path, fallback if needed
  1. Content creation → Use write_file to create source document (Markdown)
  2. Unicode sanitization → Preprocess markdown to replace problematic characters before PDF conversion
  3. Format conversion → Use run_shell with pandoc for each target format
  4. Verification → Check output files exist and are valid

⚠️ Unicode & LaTeX Compatibility Warning

Critical: PDF generation via pandoc typically uses LaTeX (pdflatex or xelatex), which has limited Unicode support. Common problematic characters include:

CharacterIssueSafe Replacement
— (em dash)May not render-- or -
– (en dash)May not render-
" " (curly quotes)Encoding errors" " (straight quotes)
' ' (curly apostrophe)Encoding errors' (straight apostrophe)
… (ellipsis)May not render...
→ ← ↑ ↓ (arrows)LaTeX incompatibility-> <- ^ v
✓ ✗ (checkmarks)May not render[x] [ ]
★ ● (symbols)May not render* -
© ® ™May require packages(c) (r) (tm)
Non-ASCII letters (é, ñ, ü)Font-dependentUse xeLaTeX or replace

Step-by-Step Workflow

Step 1: Create Source Content with write_file

Write your document content as Markdown to a temporary source file. This gives you full visibility into the content being generated.

write_file
path: /tmp/document_source.md
content: |
  # Document Title
  
  ## Section 1
  Content here...
  
  ## Section 2
  More content...
Step 2: Sanitize Unicode Characters (Pre-PDF Conversion)

Before PDF conversion, create a sanitized version of your markdown with LaTeX-safe characters:

write_file
path: /tmp/document_source_sanitized.md
content: |
  # Document Title
  
  ## Section 1
  Content here... (with all special chars replaced per table above)

Alternative: Use a shell script to sanitize:

run_shell
command: sed -e 's/—/--/g' -e 's/–/-/g' -e 's/"([^"]*)"/"\1"/g' -e 's/'([^']*)/'\1'/g' /tmp/document_source.md > /tmp/document_source_sanitized.md

Note: Keep the original unsanitized file for DOCX/HTML conversion (these formats handle Unicode better).

Step 3: Convert to Target Formats with run_shell

Use run_shell with explicit pandoc commands for each format. Use sanitized source for PDF, original for other formats.

run_shell
command: pandoc /tmp/document_source.md -o output.docx
run_shell
command: pandoc /tmp/document_source_sanitized.md -o output.pdf
run_shell
command: pandoc /tmp/document_source.md -o output.html
Step 4: Verify Outputs

Check that files were created successfully:

run_shell
command: ls -lh output.docx output.pdf output.html

Complete Example

Quick Path Example (Simple Document)
markdown
# Generate Simple Meeting Notes

## Delegate to shell_agent
shell_agent
task: |
  Create meeting notes document:
  1. Write to /tmp/meeting_notes.md with content:
     "# Team Meeting Notes
     
     ## Date: 2024-01-15
     ## Attendees: Alice, Bob, Carol
     
     ## Action Items
     - Alice: Complete report by Friday
     - Bob: Schedule follow-up meeting
     
     ## Next Meeting: 2024-01-22"
  2. Convert to Word: pandoc /tmp/meeting_notes.md -o meeting_notes.docx
  3. Verify: ls -lh meeting_notes.docx
Manual Path Example (Unicode-Heavy Document)
markdown
# Generate Negotiation Strategy Document

## Step 1: Write Markdown source
write_file
path: /tmp/negotiation_strategy.md
content: |
  # Negotiation Strategy
  
  ## Executive Summary
  [Content with original unicode...]
  
  ## Resolution Path
  [Content...]
  
  ## BATNA Analysis
  [Content...]

## Step 2: Create sanitized version for PDF
write_file
path: /tmp/negotiation_strategy_sanitized.md
content: |
  # Negotiation Strategy
  
  ## Executive Summary
  [Content with unicode replaced: em-dash -> --, curly quotes -> straight, etc.]
  
  ## Resolution Path
  [Content...]
  
  ## BATNA Analysis
  [Content...]

## Step 3: Convert to DOCX (from original)
run_shell
command: pandoc /tmp/negotiation_strategy.md -o negotiation_strategy.docx

## Step 4: Convert to PDF (from sanitized)
run_shell
command: pandoc /tmp/negotiation_strategy_sanitized.md -o negotiation_strategy.pdf

## Step 5: Convert to HTML (from original)
run_shell
command: pandoc /tmp/negotiation_strategy.md -o negotiation_strategy.html

## Step 6: Verify
run_shell
command: ls -lh negotiation_strategy.*
Show full SKILL.md (341 more words)Show less

Advantages Over shell_agent

Aspectshell_agentManual Workflow
Error visibilityOpaque, may retry silentlyEach step shows explicit output
RecoveryAutomatic but may loopManual intervention at specific step
DebuggingHard to isolate failure pointClear which step failed
Unicode controlAgent may not handle encodingYou control character sanitization
ControlAgent decides approachYou control each conversion

Common pandoc Commands

bash
# Markdown to Word
pandoc input.md -o output.docx

# Markdown to PDF (requires LaTeX or wkhtmltopdf)
pandoc input.md -o output.pdf

# Markdown to PDF with Unicode-safe engine (better Unicode support)
pandoc input.md -o output.pdf --pdf-engine=xelatex

# Markdown to HTML
pandoc input.md -o output.html

# With custom template
pandoc input.md --template=template.html -o output.html

# With metadata
pandoc input.md -o output.pdf --metadata title="Document Title"

Troubleshooting

  • PDF generation fails with encoding error:

    • Use the sanitized markdown file (Step 2)
    • Or try --pdf-engine=xelatex for better Unicode support
    • Or use --pdf-engine=wkhtmltopdf as alternative
  • PDF generation fails: LaTeX not found:

    • Install LaTeX: apt-get install texlive-latex-recommended texlive-fonts-recommended
    • Or use --pdf-engine=wkhtmltopdf instead
  • DOCX formatting issues: Add --reference-doc=template.docx for custom styles

  • Unicode/encoding errors in any format:

    • Add -f markdown+utf8 to pandoc command
    • Ensure source file is UTF-8 encoded: file -i source.md
  • Special characters not rendering in PDF:

    • Use the character replacement table above
    • Create sanitized version before PDF conversion
  • Missing pandoc: Install via apt-get install pandoc or brew install pandoc

Unicode Sanitization Script (Optional)

For repeated use, create a reusable sanitization script:

bash
#!/bin/bash
# sanitize_for_pdf.sh - Replace problematic unicode chars for LaTeX/PDF
if [ -z "$1" ]; then
  echo "Usage: $0 <input.md> [output.md]"
  exit 1
fi
INPUT="$1"
OUTPUT="${2:-${1%.md}_sanitized.md}"

sed -e 's/—/--/g' \
    -e 's/–/-/g' \
    -e 's/"([^"]*)"/"\1"/g' \
    -e 's/'([^']*)/'\1'/g' \
    -e 's/…/.../g' \
    -e 's/→/->/g' \
    -e 's/←/<-/g' \
    -e 's/✓/[x]/g' \
    -e 's/✗/[ ]/g' \
    -e 's/©/(c)/g' \
    -e 's/®/(r)/g' \
    -e 's/™/(tm)/g' \
    "$INPUT" > "$OUTPUT"

echo "Sanitized: $INPUT -> $OUTPUT"

Save as sanitize_for_pdf.sh, make executable with chmod +x sanitize_for_pdf.sh, then use:

run_shell
command: ./sanitize_for_pdf.sh /tmp/document_source.md /tmp/document_source_sanitized.md

When to Return to shell_agent

After successful shell_agent completion: Continue using shell_agent for similar straightforward documents.

After shell_agent failure on Unicode content: Switch to manual workflow for that document and similar future documents. Document the failure pattern.

After successful manual workflow: You now have a proven approach. For future similar documents:

  • If content is similar (same Unicode patterns): Use manual workflow directly
  • If content is simpler: Try shell_agent first, keep manual workflow as backup
  • Build a library of sanitized templates for repeated use
  • document-gen-fallback: Original fallback workflow without Unicode guidance
  • Use this skill as your primary document generation skill—it adapts to document complexity
  • Fall back to document-gen-unicode-safe (parent) if you need the original prescriptive manual-only approach name: document-gen-adaptive-workflow description: Adaptive document generation with smart fallback to manual Unicode-safe workflow
Quick Path: Delegate to shell_agent

For straightforward documents without Unicode concerns:

shell_agent
task: |
  1. Write markdown content to /tmp/report.md using write_file
  2. Convert to Word format: pandoc /tmp/report.md -o report.docx
  3. Convert to PDF: pandoc /tmp/report.md -o report.pdf --pdf-engine=xelatex
  4. Verify both files exist with: ls -lh report.docx report.pdf
  5. Report the file sizes and confirm successful generation

If shell_agent succeeds: Task complete.

If shell_agent fails: Switch to Manual Path below.

Manual Path: Step-by-Step Workflow

© HKUDS, MIT. Rendered from Markdown: HTML in the file is shown as text, images as links, and headings moved down two levels. Raw file

Files

SKILL.md and 1 other file in benchmarks/gdpval/skills/document-gen-fallback-enhanced-enhanced-c5d426 of HKUDS/OpenSpace.

  • SKILL.md
  • .skill_id

Open the folder on GitHubat commit 3827781

Compare with similar skills

Document Gen Unicode Safe next to the 5 skills that share the most tags, products or categories with it. Stars are the repository's; “used in” counts other GitHub owners with a copy.

Document Gen Unicode Safe compared with similar skills
SkillStarsUsed inTokensAuto-checkLicenceRepo updated
Document Gen Unicode Safe this skillHKUDS/OpenSpace7.7k—~3kAutomated safety check: PassMIT
Harness Book Best Practicewquguru/harness-books3.2k—~4.1kAutomated safety check: PassNone
Research Writingalfonso0512/research-writing-skill4861 repos~818Automated safety check: PassMIT
Paper WritingMLNLP-World/Paper-Writing-Tips4.7k—~630Automated safety check: PassNone
Evomath TaoEvoScientist/EvoSkills4742 repos~3.8kAutomated safety check: PassApache-2.0
PaperjurySpark-To-Paper-Skills/paperjury1.2k—~5.3kAutomated safety check: PassMIT

Similar skills

  • Harness Book Best Practice

    wquguru/harness-books

    Best practices for working on the Harness books repo. An agent skill from wquguru/harness-books.

    3.2k GitHub stars~4.1k tokensUpdated 5 mo ago
    Documents & OfficeAuto-check passed
  • Research Writing

    alfonso0512/research-writing-skill

    科研论文写作助手,提供 30 个 Prompt 模板覆盖论文写作全流程. An agent skill from alfonso0512/research-writing-skill.

    486 GitHub starsUsed in 1 repo~818 tokens
    Documents & OfficeAuto-check passed
  • Paper Writing

    MLNLP-World/Paper-Writing-Tips

    学术论文写作检查与优化助手。基于 MLNLP-World 社区整理的论文写作技巧,帮助检查和优化学术论文。Use when: (1) 检查论文 LaTeX 格式和排版, (2) 优化公式符号使用, (3) 改进图表设计, (4) 润色英文学术表达, (5) 检查参考文献格式, (6) 投稿前终稿检查, (7) 用户询问论文写作技巧或规范。

    4.7k GitHub stars~630 tokensUpdated 11 days ago
    Documents & OfficeAuto-check passed
  • Evomath Tao

    EvoScientist/EvoSkills

    A skill your agent uses whenever the user submits a non-trivial mathematical claim that needs a rigorous proof or audit.

    474 GitHub starsUsed in 2 repos~3.8k tokens
    Documents & OfficeAuto-check passed
  • Paperjury

    Spark-To-Paper-Skills/paperjury

    Three modes for CS-conference papers (CVPR/ICCV/ECCV vision, ACL/EMNLP/NAACL NLP, ICLR/NeurIPS/ICML/AAAI ML).

    1.2k GitHub stars~5.3k tokensUpdated 1 mo ago
    Documents & OfficeAuto-check passed
  • Thesis Defense PPTX Builder

    zouchenzhen/thesis-defense-pptx-skill

    Builds an editable thesis defense PowerPoint from a thesis PDF or LaTeX project while preserving a supplied university or lab template, then runs a visual quality check.

    266 GitHub stars~2.4k tokensUpdated 4 mo ago
    Documents & OfficeAuto-check passed

More from HKUDS/OpenSpace

All 199 skills in this repo
  • Walks through producing a master audio track plus stems in Python, from checking a reference file and timing sections by BPM to effects, a zip archive and final verification.

    7.7k GitHub stars~2.9k tokensUpdated 1 mo ago
    Auto-check passed
  • Handle cascading data retrieval tool failures by falling back to embedded knowledge generation

    7.7k GitHub stars~765 tokensUpdated 1 mo ago
    Auto-check passed
  • Gives an agent a workaround when its code-execution sandbox keeps failing: save the Python script to a file and run it through the shell instead.

    7.7k GitHub stars~588 tokensUpdated 1 mo ago
    Auto-check passed
  • A recovery routine for agents whose sandboxed code runner keeps failing: save the Python script to disk, then run it through the shell and read the output.

    7.7k GitHub stars~652 tokensUpdated 1 mo ago
    Auto-check passed
  • Fallback ladder for failed sandboxed code runs, plus the habit of fixing the working directory first so generated files land in the right place.

    7.7k GitHub stars~1.1k tokensUpdated 1 mo ago
    Auto-check passed
  • Fallback workflow for executing Python code when executecodesandbox fails repeatedly

    7.7k GitHub stars~1.1k tokensUpdated 1 mo ago
    Auto-check passed

Works with

Questions about Document Gen Unicode Safe

What does Document Gen Unicode Safe do?

Unicode-safe fallback workflow for multi-format document generation with character sanitization. Document Gen Unicode Safe is an agent skill from HKUDS/OpenSpace.

When should I use Document Gen Unicode Safe?

Document Gen Unicode Safe fits situations like: documents & Office work in your project.

How do I install Document Gen Unicode Safe in Claude Code?

Run `npx skills add HKUDS/OpenSpace --skill document-gen-unicode-safe -a claude-code`. Or copy the skill folder (benchmarks/gdpval/skills/document-gen-fallback-enhanced-enhanced-c5d426 in HKUDS/OpenSpace) into .claude/skills/document-gen-unicode-safe in your project. Claude Code loads it when a task matches its description.

How do I install Document Gen Unicode Safe in Codex?

Run `npx skills add HKUDS/OpenSpace --skill document-gen-unicode-safe -a codex`. Or copy the skill folder (benchmarks/gdpval/skills/document-gen-fallback-enhanced-enhanced-c5d426 in HKUDS/OpenSpace) into .agents/skills/document-gen-unicode-safe in your project. Codex loads it when a task matches its description.

Can I use Document Gen Unicode Safe in Cursor, Gemini CLI or GitHub Copilot?

Cursor, Gemini CLI, GitHub Copilot and OpenCode also load SKILL.md folders. With the skills CLI, run `npx skills add HKUDS/OpenSpace --skill document-gen-unicode-safe -a cursor` (or -a gemini-cli, github-copilot or opencode for the others). To copy it by hand, put the folder in .cursor/skills/document-gen-unicode-safe, .gemini/skills/document-gen-unicode-safe, .github/skills/document-gen-unicode-safe and .opencode/skills/document-gen-unicode-safe in your project.

What does Document Gen Unicode Safe need to run?

Going by SKILL.md and its folder, Document Gen Unicode Safe needs the command-line tools its instructions call (pandoc, apt-get and brew).

Does Document Gen Unicode Safe access the network?

SKILL.md contains no URLs. Any network use would come from the scripts or tools the agent runs. This is read from the text; nothing was executed.

Is Document Gen Unicode Safe safe to install?

Our automated static check of SKILL.md found no risky patterns, such as piping downloads into a shell, reading credential files or hidden Unicode. It is not a guarantee. Review the folder before installing.

What licence does Document Gen Unicode Safe use?

Document Gen Unicode Safe is published under the MIT licence (the repository's licence). It allows redistribution, so the full SKILL.md is shown on this page.

How many tokens does Document Gen Unicode Safe use?

About 3k tokens (SKILL.md is roughly 12k characters). Agents keep only the skill's name and description in context until a task matches; then they load SKILL.md in full.

What are the alternatives to Document Gen Unicode Safe?

Skills that share tags, products or a category with Document Gen Unicode Safe: Harness Book Best Practice (wquguru/harness-books, 3.2k stars), Research Writing (alfonso0512/research-writing-skill, 486 stars), Paper Writing (MLNLP-World/Paper-Writing-Tips, 4.7k stars) and Evomath Tao (EvoScientist/EvoSkills, 474 stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.

Who maintains Document Gen Unicode Safe?

HKUDS (a GitHub organization) maintains it in HKUDS/OpenSpace, which has 7,743 GitHub stars. The repository holds 199 skills in this directory. The repository was last updated on August 12, 2026.

Source: HKUDS/OpenSpace on GitHub. Facts on this page come from the repository at the commit we read; the author's words are quoted as theirs.