xiaohongshu
xiaohongshu
document-converter
Convert between Markdown, DOCX, and PDF formats bidirectionally. Handles text extraction from PDF/DOCX, markdown to document conversion. Use when converting document formats or extracting structured content from Word or PDF files.
Full skill instructions
Convert documents bidirectionally between Markdown, DOCX, and PDF formats. This skill automatically detects optimal conversion tools, handles batch processing, and ensures quality output with appropriate fallback mechanisms.
The skill supports two conversion modes:
Default Mode (API): When GEMINI_API_KEY is set, PDF-to-Markdown conversions use Google Gemini API for significantly improved quality (+20-30% fidelity). Other conversions use local tools.
Offline Mode: Use --no-api flag or set CONVERT_DOCS_OFFLINE=true to disable all API calls. All conversions use local tools only.
TO Markdown (text extraction from documents):
FROM Markdown (document generation):
Direct Conversion:
The skill uses intelligent tool selection based on format and quality metrics:
Gemini Mode (when GEMINI_API_KEY is set):
Offline Mode (--no-api or no API key):
# Source conversion core library
source /home/benjamin/.config/.claude/lib/convert/convert-core.sh
# Detect available tools
detect_tools
# Convert DOCX/PDF to Markdown
main_conversion /path/to/documents /path/to/output
# Convert Markdown to DOCX
main_conversion /path/to/markdown /path/to/output
The conversion core automatically processes all files in the input directory:
The conversion script emits PROGRESS markers:
[PROGRESS] Converting: file1.docx → file1.md
[PROGRESS] Converting: file2.pdf → file2.md (2/10)
[SUCCESS] Converted file1.docx → file1.md
[FAILED] file3.pdf: Conversion timeout after 300s
command -v markitdown)command -v pandoc)python3 -c "import pymupdf4llm")Tool not available:
Error: No conversion tool available for DOCX→Markdown
Required: markitdown or pandoc
→ Install required tools
Conversion timeout:
[FAILED] large_document.pdf: Conversion timeout after 300s
→ Increase TIMEOUT_PDF_TO_MD or use simpler PDF
Validation failure:
[WARNING] output.md: No headings found (possible conversion issue)
→ Check source document structure
Environment variables to tune conversion behavior:
# Timeout multipliers (seconds)
TIMEOUT_MULTIPLIER=1.5 # Increase all timeouts by 50%
# Disk usage limits
MAX_DISK_USAGE_GB=10 # Abort if output exceeds 10GB
MIN_FREE_SPACE_MB=500 # Require 500MB free space
# Concurrency
MAX_CONCURRENT_CONVERSIONS=4 # Parallel conversion limit
When working within agent contexts, the skill automatically triggers when Claude detects conversion needs:
User: "Extract text from these PDF reports"
→ Skill auto-invokes: document-converter
→ Converts PDFs to Markdown
→ Returns structured text
The /convert-docs command delegates to this skill when available:
/convert-docs ./documents ./output
→ Checks skill availability
→ Delegates to document-converter skill
→ Falls back to script mode if skill unavailable
Skills can compose with document-converter:
# research-specialist skill
dependencies:
- document-converter # Auto-loads for PDF analysis
The skill relies on conversion scripts in the project:
.claude/lib/convert/convert-core.sh.claude/lib/convert/convert-docx.sh.claude/lib/convert/convert-pdf.sh.claude/lib/convert/convert-gemini.sh.claude/lib/convert/convert_gemini.py.claude/lib/convert/convert-markdown.shScripts are symlinked in the skill's scripts/ directory for easy access.
Test the skill with sample conversions:
# Test DOCX→Markdown
/convert-docs ./test/sample.docx ./output
# Test PDF→Markdown
/convert-docs ./test/report.pdf ./output
# Test Markdown→DOCX
/convert-docs ./test/document.md ./output
# Batch test
/convert-docs ./test/documents ./output
Verify:
If the skill doesn't auto-invoke when expected:
.claude/skills/ directory (project-level)MarkItDown (recommended):
pip install markitdown
PyMuPDF4LLM (optional):
pip install pymupdf4llm
pdf2docx (optional, for PDF to DOCX):
pip install pdf2docx
google-genai (optional, for Gemini API):
pip install google-genai
# Set API key (free tier available at https://aistudio.google.com/)
export GEMINI_API_KEY="your-api-key"
Pandoc (required):
# Ubuntu/Debian
apt install pandoc
# macOS
brew install pandoc
Typst (optional, for MD→PDF):
# Ubuntu/Debian
wget https://github.com/typst/typst/releases/latest/download/typst-x86_64-unknown-linux-musl.tar.xz
tar -xf typst-*.tar.xz && sudo mv typst-*/typst /usr/local/bin/
# macOS
brew install typst
If conversions are slow:
xiaohongshu
technical spec
product ux expert
database patterns
Conduct multi-agent task orchestration and workflow coordination.
Initialize project with Conductor artifacts (product definition,
Expert in web animations, transitions, and motion design using Framer Motion and CSS
Creates Mermaid and ASCII diagrams for flowcharts, architecture, ERDs, state machines, mindmaps, and more. Use when user mentions diagram, flowchart, mermaid, ASCII diagram, text diagram, terminal diagram, visualize, C4, mindmap, architecture diagram, sequence diagram, ERD, or needs visual docume...
PostgreSQL bindings for H3 hexagonal grid system. Use when working with H3 cells in Postgres, including spatial indexing, geometry/geography integration, and raster analysis.
Context-Driven Development skill for projects using Conductor. Use this skill when you detect a `conductor/` directory in the project, when working on tasks defined in a `plan.md` file, or when the user asks about tracks, specs, or plans. Automatically applies TDD workflow, tracks task completion...
Display project status, active tracks, and next actions
Official Stakpak application containerization standard operating procedure, a step-by-step guidline to properly dockerize applications. This is a rule book curated by the Stakpak Team.
Generate, edit, and beat-sync AI video with leading models in one workspace.
The world's fastest calendar for remote work
Transform Your Design with AI Designer by ImgCreator.ai
Revolutionizing Video Production with AI-Powered Creativity
Extend an image past the frame and let AI fill the new aspect ratio.
Discover your celebrity doppelgänger with StarByFace!
ChainClarity explains 700+ crypto whitepapers in plain English, with layered summaries, comparisons, research tools, alerts, and a $4.99 Pro plan.
Opus.ai: Revolutionize Your Web Experience