/install besteva-file-converter
\r \r
File Converter Skill\r
\r A comprehensive file format conversion toolkit supporting documents, images, and spreadsheets.\r \r
When to Use\r
\r Activate this skill when any of these scenarios occur:\r \r
- Document conversion: User wants to convert between PDF and Word formats\r
- Image conversion: User needs images in a different format (PNG→JPG, JPG→WebP, etc.)\r
- Spreadsheet conversion: User needs to exchange data between Excel and CSV\r
- Batch operations: User has multiple files that need converting at once\r
- Format queries: User asks about supported formats or how to convert specific file types\r \r
Supported Conversions\r
\r
| Source Format | Target Format | Script | Notes |\r
|--------------|---------------|--------|-------|\r
| .pdf | .docx | scripts/pdf_to_word.py | Extracts text, tables, layout |\r
| .docx, .doc | .pdf | scripts/word_to_pdf.py | Requires MS Word on Windows |\r
| PNG/JPEG/WebP/BMP/GIF/TIFF | Any other image format | scripts/image_converter.py | Quality control, resize support |\r
| .csv | .xlsx | scripts/excel_csv_converter.py | Custom delimiter/encoding |\r
| .xlsx, .xls | .csv | scripts/excel_csv_converter.py | Multi-sheet support |\r
\r
Prerequisites\r
\r
Python Dependencies\r
\r Install required packages before first use:\r \r
pip install Pillow pdf2docx docx2pdf openpyxl xlrd\r
```\r
\r
**Quick install command:**\r
```bash\r
pip install Pillow pdf2docx docx2pdf openpyxl xlrd\r
```\r
\r
### Platform-Specific Requirements\r
\r
- **Word → PDF (Windows)**: Microsoft Word must be installed (`docx2pdf` uses COM automation)\r
- **PDF → Word**: No external software required; uses `pdf2docx`\r
- **Image conversion**: Uses `Pillow` only, works on all platforms\r
\r
## Workflow Guidelines\r
\r
### Step 1: Identify Conversion Type\r
\r
Determine what the user wants to convert:\r
\r
```\r
User says "convert this PDF" → PDF to Word\r
User says "turn this into PDF" → Word to PDF \r
User says "change this PNG to JPG" → Image conversion\r
User says "export this Excel as CSV" → Excel to CSV\r
```\r
\r
### Step 2: Check Dependencies\r
\r
Before running any script, verify required packages are installed:\r
\r
```bash\r
python -c "import PIL; import pdf2docx; import docx2pdf; import openpyxl"\r
```\r
\r
If imports fail, prompt user to run:\r
```bash\r
pip install Pillow pdf2docx docx2pdf openpyxl xlrd\r
```\r
\r
### Step 3: Execute Appropriate Script\r
\r
#### PDF → Word\r
\r
**Single file:**\r
```bash\r
python scripts/pdf_to_word.py \x3Cinput.pdf> [output.docx]\r
```\r
\r
**Batch mode:**\r
```bash\r
python scripts/pdf_to_word.py --batch ./pdf_folder --output-dir ./output_folder\r
```\r
\r
**Options:**\r
- `--start N`: Start from page N (default: 0)\r
- `--end N`: End at page N (default: all pages)\r
\r
#### Word → PDF\r
\r
**Single file:**\r
```bash\r
python scripts/word_to_pdf.py \x3Cinput.docx> [output.pdf]\r
```\r
\r
**Batch mode:**\r
```bash\r
python scripts/word_to_pdf.py --batch ./docs_folder --output-dir ./pdfs_folder\r
```\r
\r
**Check requirements:**\r
```bash\r
python scripts/word_to_pdf.py --check\r
```\r
\r
#### Image Format Conversion\r
\r
**Single file:**\r
```bash\r
python scripts/image_converter.py \x3Cinput_image> --format \x3Ctarget_format>\r
```\r
\r
**Batch mode:**\r
```bash\r
python scripts/image_converter.py --batch ./images_dir --format webp --output-dir ./webp_dir\r
```\r
\r
**Target formats:** `png`, `jpg`/`jpeg`, `webp`, `bmp`, `gif`, `tiff`/`tif`\r
\r
**Options:**\r
- `-q/--quality N`: Quality for lossy formats (1-100, default: 95)\r
- `--resize WIDTH HEIGHT`: Resize dimensions\r
- `--no-optimize`: Disable optimization\r
- `--info`: Display image info without converting\r
\r
**Examples:**\r
```bash\r
# High-quality JPEG compression\r
python scripts/image_converter.py photo.png --format jpg -q 90\r
\r
# Convert to WebP with smaller size\r
python scripts/image_converter.py photo.png --format webp -q 80\r
\r
# Resize while converting\r
python scripts/image_converter.py large.png --format jpg --resize 1920 1080\r
\r
# View image info\r
python scripts/image_converter.py image.png --info\r
```\r
\r
#### Excel ↔ CSV\r
\r
**CSV → Excel:**\r
```bash\r
python scripts/excel_csv_converter.py data.csv --format xlsx [options]\r
```\r
\r
**Excel → CSV:**\r
```bash\r
python scripts/excel_csv_converter.py data.xlsx --format csv [options]\r
```\r
\r
**Batch mode:**\r
```bash\r
python scripts/excel_csv_converter.py --batch ./data_dir --format csv\r
```\r
\r
**Options:**\r
- `-d/--delimiter CHAR`: Custom separator (default: comma)\r
- `-e/--encoding ENC`: File encoding (default: utf-8)\r
- `--sheet NAME`: Specific sheet name (Excel→CSV)\r
- `--sheet-name NAME`: Output sheet name (CSV→Excel)\r
- `--no-header`: Skip header row\r
- `--info`: Show Excel structure info\r
\r
**Examples:**\r
```bash\r
# European-style CSV (semicolon delimited) \r
python scripts/excel_csv_converter.py data.csv --format xlsx -d ";"\r
\r
# Chinese encoding support\r
python scripts/excel_csv_converter.py data.xlsx --format csv -e gbk\r
\r
# Export specific sheet\r
python scripts/excel_csv_converter.py workbook.xlsx --format csv -s "Sales Report"\r
\r
# View Excel info\r
python scripts/excel_csv_converter.py data.xlsx --info\r
```\r
\r
### Step 4: Verify Results\r
\r
After each conversion:\r
\r
1. Confirm output file(s) exist at expected location(s)\r
2. Report file sizes to user (original vs converted)\r
3. For batch operations, report success count vs total count\r
4. If errors occurred, summarize them clearly\r
\r
## Error Handling\r
\r
### Common Issues and Solutions\r
\r
| Error | Cause | Solution |\r
|-------|-------|----------|\r
| `ModuleNotFoundError` | Missing package | Run `pip install \x3Cpackage>` |\r
| `COMError` (Word→PDF) | MS Word not installed | Install MS Office or use alternative |\r
| `UnicodeDecodeError` | Wrong encoding | Specify correct `--encoding` |\r
| `FileNotFoundError` | Wrong path | Verify input path is absolute or relative correctly |\r
| Permission denied | Read-only directory | Use writable output directory |\r
\r
### Encoding Guide\r
\r
When dealing with non-UTF-8 files, common encodings:\r
- Chinese Windows: `gbk` / `gb18030`\r
- Western Europe: `latin-1` / `cp1252`\r
- Japanese: `shift-jis` / `cp932`\r
- Auto-detect: Try `utf-8` first, then fallback\r
\r
## Best Practices\r
\r
1. **Always use absolute paths** when calling scripts to avoid path confusion\r
2. **Create output directories** before batch operations if they don't exist\r
3. **Check dependencies once** at start of session, not before every call\r
4. **Report results clearly** with file paths, sizes, and success/failure counts\r
5. **Handle transparency** appropriately — JPEG doesn't support alpha channels\r
6. **Preserve quality** defaults are high (95%) but adjust based on use case\r
- 确保已安装 OpenClaw(本地或 Docker 部署)
- 在对话框中输入安装命令:
/install besteva-file-converter - 安装完成后,直接呼叫该 Skill 的名称或使用
/besteva-file-converter触发 - 根据 Skill 的参数说明提供必要输入,即可获得结构化输出
File Converter 是什么?
This skill provides comprehensive file format conversion capabilities. It should be used when users need to convert files between different formats, includin... 它是一个面向 Claude Code / OpenClaw 的 AI Agent Skill 插件,目前累计下载 92 次。
如何安装 File Converter?
在 OpenClaw 或 Claude Code 对话框中运行命令「/install besteva-file-converter」即可一键安装,无需额外配置。
File Converter 是免费的吗?
是的,File Converter 完全免费,采用 MIT-0 许可证,可自由下载、安装和使用。
File Converter 支持哪些平台?
File Converter 跨平台运行,可在任意部署了 OpenClaw / Claude Code 的环境中使用(cross-platform)。
谁开发了 File Converter?
由 Besteva77(@besteva77)开发并维护,当前版本 v1.0.0。