[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M7BVH5PEHDD0WJGYY8AVJPRN":3,"skill-same:01M7BVH5PEHDD0WJGYY8AVJPRN":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":18,"publishedAt":19,"linkOnly":20,"markdownContent":21,"markdownBody":22,"frontMatter":23,"refName":49,"commitSha":50,"skillDirectory":51,"forksCount":52,"repositoryHtmlUrl":53,"repositoryHomepageUrl":6,"ownerHtmlUrl":54,"ownerBlogUrl":6,"ownerDescription":55,"updatedAt":56,"install":57,"resources":70},"01M7BVH5PEHDD0WJGYY8AVJPRN","batch-convert",null,"Batch convert documents between multiple formats using a unified pipeline","om-scogo\u002Fskillsh-scraper","om-scogo","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F160466840?v=4","01M79AWB6DFVCQ7RK70CS34B96","Om Achrekar","01M79AWB6ZM9SKR8KDH1WSSM22",0,"MIT","https:\u002F\u002Fgithub.com\u002Fom-scogo\u002Fskillsh-scraper\u002Fblob\u002Fmain\u002Fdata\u002Fskills\u002Fclaude-office-skills-skills\u002Fbatch-convert\u002Fbatch-convert\u002FSKILL.md",[],[],"2026-11-15 14:19:17",false,"---\n# ═══════════════════════════════════════════════════════════════════════════════\n# CLAUDE OFFICE SKILL - Enhanced Metadata v2.0\n# ═══════════════════════════════════════════════════════════════════════════════\n\n# Basic Information\nname: batch-convert\ndescription: \"Batch convert documents between multiple formats using a unified pipeline\"\nversion: \"1.0\"\nauthor: claude-office-skills\nlicense: MIT\n\n# Categorization\ncategory: conversion\ntags:\n  - batch\n  - conversion\n  - bulk\n  - automation\ndepartment: All\n\n# AI Model Compatibility\nmodels:\n  recommended:\n    - claude-sonnet-4\n    - claude-opus-4\n  compatible:\n    - claude-3-5-sonnet\n    - gpt-4\n    - gpt-4o\n\n# MCP Tools Integration\nmcp:\n  server: office-mcp\n  tools:\n    - batch_convert\n\n# Skill Capabilities\ncapabilities:\n  - bulk_conversion\n  - automation\n\n# Language Support\nlanguages:\n  - en\n  - zh\n---\n\n# Batch Convert Skill\n\n## Overview\n\nThis skill enables batch conversion of documents between multiple formats using a unified pipeline. Convert hundreds of files at once with consistent settings, automatic format detection, and parallel processing for maximum efficiency.\n\n## How to Use\n\n1. Specify the source folder or files\n2. Choose target format(s)\n3. Optionally configure conversion options\n4. I'll process all files with progress tracking\n\n**Example prompts:**\n- \"Convert all PDFs in this folder to Word documents\"\n- \"Batch convert these markdown files to PDF and HTML\"\n- \"Process all Office files and convert to Markdown\"\n- \"Convert this folder of images to a single PDF\"\n\n## Domain Knowledge\n\n### Supported Format Matrix\n\n| From | To: DOCX | To: PDF | To: MD | To: HTML | To: PPTX |\n|------|----------|---------|--------|----------|----------|\n| DOCX | - | ✅ | ✅ | ✅ | - |\n| PDF | ✅ | - | ✅ | ✅ | - |\n| MD | ✅ | ✅ | - | ✅ | ✅ |\n| HTML | ✅ | ✅ | ✅ | - | - |\n| XLSX | - | ✅ | ✅ | ✅ | - |\n| PPTX | - | ✅ | ✅ | ✅ | - |\n\n### Core Pipeline\n\n```python\nfrom pathlib import Path\nfrom concurrent.futures import ThreadPoolExecutor, as_completed\nimport subprocess\nimport os\n\nclass DocumentConverter:\n    \"\"\"Unified document conversion pipeline.\"\"\"\n    \n    def __init__(self, max_workers=4):\n        self.max_workers = max_workers\n        self.converters = {\n            ('md', 'docx'): self._md_to_docx,\n            ('md', 'pdf'): self._md_to_pdf,\n            ('md', 'html'): self._md_to_html,\n            ('md', 'pptx'): self._md_to_pptx,\n            ('docx', 'pdf'): self._docx_to_pdf,\n            ('docx', 'md'): self._docx_to_md,\n            ('pdf', 'docx'): self._pdf_to_docx,\n            ('pdf', 'md'): self._pdf_to_md,\n            ('xlsx', 'pdf'): self._xlsx_to_pdf,\n            ('xlsx', 'md'): self._xlsx_to_md,\n            ('pptx', 'pdf'): self._pptx_to_pdf,\n            ('pptx', 'md'): self._pptx_to_md,\n            ('html', 'md'): self._html_to_md,\n            ('html', 'pdf'): self._html_to_pdf,\n        }\n    \n    def convert(self, input_path, output_format, output_dir=None):\n        \"\"\"Convert single file to target format.\"\"\"\n        input_path = Path(input_path)\n        input_format = input_path.suffix[1:].lower()\n        \n        if output_dir:\n            output_path = Path(output_dir) \u002F f\"{input_path.stem}.{output_format}\"\n        else:\n            output_path = input_path.with_suffix(f\".{output_format}\")\n        \n        converter_key = (input_format, output_format)\n        if converter_key not in self.converters:\n            raise ValueError(f\"Conversion not supported: {input_format} -> {output_format}\")\n        \n        converter = self.converters[converter_key]\n        return converter(input_path, output_path)\n    \n    def batch_convert(self, input_dir, output_format, output_dir=None, \n                      file_pattern=\"*\", recursive=False):\n        \"\"\"Batch convert all matching files.\"\"\"\n        input_path = Path(input_dir)\n        output_path = Path(output_dir) if output_dir else input_path \u002F \"converted\"\n        output_path.mkdir(exist_ok=True)\n        \n        # Find files\n        if recursive:\n            files = list(input_path.rglob(file_pattern))\n        else:\n            files = list(input_path.glob(file_pattern))\n        \n        # Filter to supported formats\n        supported_ext = ['.md', '.docx', '.pdf', '.xlsx', '.pptx', '.html']\n        files = [f for f in files if f.suffix.lower() in supported_ext]\n        \n        results = []\n        \n        with ThreadPoolExecutor(max_workers=self.max_workers) as executor:\n            future_to_file = {\n                executor.submit(self.convert, f, output_format, output_path): f\n                for f in files\n            }\n            \n            for future in as_completed(future_to_file):\n                file = future_to_file[future]\n                try:\n                    result = future.result()\n                    results.append({'file': str(file), 'status': 'success', 'output': str(result)})\n                except Exception as e:\n                    results.append({'file': str(file), 'status': 'error', 'error': str(e)})\n        \n        return results\n```\n\n### Converter Implementations\n\n```python\n# Markdown conversions (using Pandoc)\ndef _md_to_docx(self, input_path, output_path):\n    subprocess.run(['pandoc', str(input_path), '-o', str(output_path)], check=True)\n    return output_path\n\ndef _md_to_pdf(self, input_path, output_path):\n    subprocess.run(['pandoc', str(input_path), '-o', str(output_path)], check=True)\n    return output_path\n\ndef _md_to_html(self, input_path, output_path):\n    subprocess.run(['pandoc', str(input_path), '-s', '-o', str(output_path)], check=True)\n    return output_path\n\ndef _md_to_pptx(self, input_path, output_path):\n    subprocess.run(['marp', str(input_path), '-o', str(output_path)], check=True)\n    return output_path\n\n# Office to Markdown (using markitdown)\ndef _docx_to_md(self, input_path, output_path):\n    from markitdown import MarkItDown\n    md = MarkItDown()\n    result = md.convert(str(input_path))\n    with open(output_path, 'w') as f:\n        f.write(result.text_content)\n    return output_path\n\ndef _xlsx_to_md(self, input_path, output_path):\n    from markitdown import MarkItDown\n    md = MarkItDown()\n    result = md.convert(str(input_path))\n    with open(output_path, 'w') as f:\n        f.write(result.text_content)\n    return output_path\n\ndef _pptx_to_md(self, input_path, output_path):\n    from markitdown import MarkItDown\n    md = MarkItDown()\n    result = md.convert(str(input_path))\n    with open(output_path, 'w') as f:\n        f.write(result.text_content)\n    return output_path\n\n# PDF conversions\ndef _pdf_to_docx(self, input_path, output_path):\n    from pdf2docx import Converter\n    cv = Converter(str(input_path))\n    cv.convert(str(output_path))\n    cv.close()\n    return output_path\n\ndef _pdf_to_md(self, input_path, output_path):\n    from markitdown import MarkItDown\n    md = MarkItDown()\n    result = md.convert(str(input_path))\n    with open(output_path, 'w') as f:\n        f.write(result.text_content)\n    return output_path\n\n# Office to PDF (using LibreOffice)\ndef _docx_to_pdf(self, input_path, output_path):\n    subprocess.run([\n        'soffice', '--headless', '--convert-to', 'pdf',\n        '--outdir', str(output_path.parent), str(input_path)\n    ], check=True)\n    return output_path\n\ndef _xlsx_to_pdf(self, input_path, output_path):\n    subprocess.run([\n        'soffice', '--headless', '--convert-to', 'pdf',\n        '--outdir', str(output_path.parent), str(input_path)\n    ], check=True)\n    return output_path\n\ndef _pptx_to_pdf(self, input_path, output_path):\n    subprocess.run([\n        'soffice', '--headless', '--convert-to', 'pdf',\n        '--outdir', str(output_path.parent), str(input_path)\n    ], check=True)\n    return output_path\n```\n\n### Progress Tracking\n\n```python\nfrom tqdm import tqdm\n\ndef batch_convert_with_progress(converter, input_dir, output_format, output_dir=None):\n    \"\"\"Batch convert with progress bar.\"\"\"\n    input_path = Path(input_dir)\n    files = list(input_path.glob('*'))\n    \n    results = []\n    for file in tqdm(files, desc=f\"Converting to {output_format}\"):\n        try:\n            result = converter.convert(file, output_format, output_dir)\n            results.append({'file': str(file), 'status': 'success'})\n        except Exception as e:\n            results.append({'file': str(file), 'status': 'error', 'error': str(e)})\n    \n    return results\n```\n\n## Best Practices\n\n1. **Test Sample First**: Convert a few files before batch processing\n2. **Check Disk Space**: Ensure sufficient space for output\n3. **Use Parallel Processing**: Speed up with multiple workers\n4. **Handle Errors Gracefully**: Log failures, continue processing\n5. **Verify Output**: Spot-check converted files\n\n## Common Patterns\n\n### Format Detection Pipeline\n```python\ndef detect_and_convert(file_path, target_format):\n    \"\"\"Automatically detect format and convert.\"\"\"\n    import mimetypes\n    \n    mime_type, _ = mimetypes.guess_type(str(file_path))\n    \n    format_map = {\n        'application\u002Fpdf': 'pdf',\n        'application\u002Fvnd.openxmlformats-officedocument.wordprocessingml.document': 'docx',\n        'application\u002Fvnd.openxmlformats-officedocument.spreadsheetml.sheet': 'xlsx',\n        'application\u002Fvnd.openxmlformats-officedocument.presentationml.presentation': 'pptx',\n        'text\u002Fmarkdown': 'md',\n        'text\u002Fhtml': 'html',\n    }\n    \n    source_format = format_map.get(mime_type, Path(file_path).suffix[1:])\n    \n    converter = DocumentConverter()\n    return converter.convert(file_path, target_format)\n```\n\n### Multi-Format Output\n```python\ndef convert_to_multiple_formats(input_file, output_formats, output_dir):\n    \"\"\"Convert one file to multiple formats.\"\"\"\n    converter = DocumentConverter()\n    results = {}\n    \n    for fmt in output_formats:\n        try:\n            output = converter.convert(input_file, fmt, output_dir)\n            results[fmt] = {'status': 'success', 'path': str(output)}\n        except Exception as e:\n            results[fmt] = {'status': 'error', 'error': str(e)}\n    \n    return results\n\n# Convert README to multiple formats\nresults = convert_to_multiple_formats(\n    'README.md',\n    ['docx', 'pdf', 'html'],\n    '.\u002Fexports'\n)\n```\n\n## Examples\n\n### Example 1: Documentation Export\n```python\nfrom pathlib import Path\nimport json\n\ndef export_documentation(docs_dir, export_dir):\n    \"\"\"Export all documentation to multiple formats.\"\"\"\n    \n    converter = DocumentConverter(max_workers=8)\n    docs_path = Path(docs_dir)\n    export_path = Path(export_dir)\n    \n    # Create format directories\n    for fmt in ['pdf', 'docx', 'html']:\n        (export_path \u002F fmt).mkdir(parents=True, exist_ok=True)\n    \n    all_results = {}\n    \n    # Find all markdown files\n    md_files = list(docs_path.rglob('*.md'))\n    \n    for md_file in md_files:\n        file_results = {}\n        \n        for fmt in ['pdf', 'docx', 'html']:\n            output_dir = export_path \u002F fmt\n            try:\n                output = converter.convert(md_file, fmt, output_dir)\n                file_results[fmt] = 'success'\n            except Exception as e:\n                file_results[fmt] = f'error: {e}'\n        \n        all_results[str(md_file)] = file_results\n        print(f\"Processed: {md_file.name}\")\n    \n    # Save report\n    with open(export_path \u002F 'export_report.json', 'w') as f:\n        json.dump(all_results, f, indent=2)\n    \n    return all_results\n\nresults = export_documentation('.\u002Fdocs', '.\u002Fexports')\n```\n\n### Example 2: Legacy Document Migration\n```python\ndef migrate_legacy_docs(source_dir, target_dir):\n    \"\"\"Migrate legacy documents to modern formats.\"\"\"\n    \n    converter = DocumentConverter(max_workers=4)\n    \n    # Migration rules\n    migrations = [\n        ('*.doc', 'docx'),   # Old Word to new\n        ('*.xls', 'xlsx'),   # Old Excel to new\n        ('*.ppt', 'pptx'),   # Old PowerPoint to new\n        ('*.rtf', 'docx'),   # RTF to Word\n    ]\n    \n    source_path = Path(source_dir)\n    target_path = Path(target_dir)\n    target_path.mkdir(exist_ok=True)\n    \n    total_migrated = 0\n    errors = []\n    \n    for pattern, target_format in migrations:\n        files = list(source_path.glob(pattern))\n        \n        for file in files:\n            try:\n                # Use LibreOffice for legacy formats\n                subprocess.run([\n                    'soffice', '--headless',\n                    '--convert-to', target_format,\n                    '--outdir', str(target_path),\n                    str(file)\n                ], check=True)\n                \n                total_migrated += 1\n                print(f\"Migrated: {file.name}\")\n                \n            except Exception as e:\n                errors.append({'file': str(file), 'error': str(e)})\n    \n    print(f\"\\nMigration complete: {total_migrated} files\")\n    print(f\"Errors: {len(errors)}\")\n    \n    return {'migrated': total_migrated, 'errors': errors}\n```\n\n### Example 3: Report Generation Pipeline\n```python\ndef generate_reports_pipeline(data_files, template_dir, output_dir):\n    \"\"\"Generate reports from data files using templates.\"\"\"\n    \n    from datetime import datetime\n    \n    converter = DocumentConverter()\n    output_path = Path(output_dir)\n    output_path.mkdir(exist_ok=True)\n    \n    timestamp = datetime.now().strftime('%Y%m%d_%H%M%S')\n    \n    reports = []\n    \n    for data_file in data_files:\n        # Load data\n        data_path = Path(data_file)\n        \n        # Generate markdown report\n        md_content = f\"\"\"---\ntitle: Report - {data_path.stem}\ndate: {datetime.now().strftime('%Y-%m-%d')}\n---\n\n# {data_path.stem} Report\n\nGenerated: {datetime.now().strftime('%Y-%m-%d %H:%M:%S')}\n\n## Data Summary\n\n\"\"\"\n        \n        # Add data content (simplified)\n        if data_path.suffix == '.xlsx':\n            from markitdown import MarkItDown\n            md = MarkItDown()\n            result = md.convert(str(data_path))\n            md_content += result.text_content\n        \n        # Save markdown\n        md_file = output_path \u002F f\"{data_path.stem}_{timestamp}.md\"\n        with open(md_file, 'w') as f:\n            f.write(md_content)\n        \n        # Convert to PDF and DOCX\n        for fmt in ['pdf', 'docx']:\n            try:\n                output = converter.convert(md_file, fmt, output_path)\n                reports.append({'source': str(data_file), 'output': str(output), 'format': fmt})\n            except Exception as e:\n                print(f\"Error converting {data_file} to {fmt}: {e}\")\n    \n    return reports\n```\n\n## Limitations\n\n- Some format combinations not supported\n- Complex formatting may be lost in conversion\n- Large files may require more time\n- Some conversions need external tools (LibreOffice, Pandoc)\n- Quality varies by source document complexity\n\n## Installation\n\n```bash\n# Core dependencies\npip install pdf2docx markitdown python-docx openpyxl\n\n# Pandoc (for MD conversions)\nbrew install pandoc  # macOS\napt install pandoc   # Ubuntu\n\n# Marp (for PPTX)\nnpm install -g @marp-team\u002Fmarp-cli\n\n# LibreOffice (for Office formats)\nbrew install libreoffice  # macOS\napt install libreoffice   # Ubuntu\n```\n\n## Resources\n\n- [Pandoc Documentation](https:\u002F\u002Fpandoc.org\u002FMANUAL.html)\n- [markitdown GitHub](https:\u002F\u002Fgithub.com\u002Fmicrosoft\u002Fmarkitdown)\n- [pdf2docx Documentation](https:\u002F\u002Fpdf2docx.readthedocs.io\u002F)\n- [LibreOffice CLI](https:\u002F\u002Fhelp.libreoffice.org\u002Flatest\u002Fen-US\u002Ftext\u002Fshared\u002Fguide\u002Fstart_parameters.html)\n","# Batch Convert Skill\n\n## Overview\n\nThis skill enables batch conversion of documents between multiple formats using a unified pipeline. Convert hundreds of files at once with consistent settings, automatic format detection, and parallel processing for maximum efficiency.\n\n## How to Use\n\n1. Specify the source folder or files\n2. Choose target format(s)\n3. Optionally configure conversion options\n4. I'll process all files with progress tracking\n\n**Example prompts:**\n- \"Convert all PDFs in this folder to Word documents\"\n- \"Batch convert these markdown files to PDF and HTML\"\n- \"Process all Office files and convert to Markdown\"\n- \"Convert this folder of images to a single PDF\"\n\n## Domain Knowledge\n\n### Supported Format Matrix\n\n| From | To: DOCX | To: PDF | To: MD | To: HTML | To: PPTX |\n|------|----------|---------|--------|----------|----------|\n| DOCX | - | ✅ | ✅ | ✅ | - |\n| PDF | ✅ | - | ✅ | ✅ | - |\n| MD | ✅ | ✅ | - | ✅ | ✅ |\n| HTML | ✅ | ✅ | ✅ | - | - |\n| XLSX | - | ✅ | ✅ | ✅ | - |\n| PPTX | - | ✅ | ✅ | ✅ | - |\n\n### Core Pipeline\n\n```python\nfrom pathlib import Path\nfrom concurrent.futures import ThreadPoolExecutor, as_completed\nimport subprocess\nimport os\n\nclass DocumentConverter:\n    \"\"\"Unified document conversion pipeline.\"\"\"\n    \n    def __init__(self, max_workers=4):\n        self.max_workers = max_workers\n        self.converters = {\n            ('md', 'docx'): self._md_to_docx,\n            ('md', 'pdf'): self._md_to_pdf,\n            ('md', 'html'): self._md_to_html,\n            ('md', 'pptx'): self._md_to_pptx,\n            ('docx', 'pdf'): self._docx_to_pdf,\n            ('docx', 'md'): self._docx_to_md,\n            ('pdf', 'docx'): self._pdf_to_docx,\n            ('pdf', 'md'): self._pdf_to_md,\n            ('xlsx', 'pdf'): self._xlsx_to_pdf,\n            ('xlsx', 'md'): self._xlsx_to_md,\n            ('pptx', 'pdf'): self._pptx_to_pdf,\n            ('pptx', 'md'): self._pptx_to_md,\n            ('html', 'md'): self._html_to_md,\n            ('html', 'pdf'): self._html_to_pdf,\n        }\n    \n    def convert(self, input_path, output_format, output_dir=None):\n        \"\"\"Convert single file to target format.\"\"\"\n        input_path = Path(input_path)\n        input_format = input_path.suffix[1:].lower()\n        \n        if output_dir:\n            output_path = Path(output_dir) \u002F f\"{input_path.stem}.{output_format}\"\n        else:\n            output_path = input_path.with_suffix(f\".{output_format}\")\n        \n        converter_key = (input_format, output_format)\n        if converter_key not in self.converters:\n            raise ValueError(f\"Conversion not supported: {input_format} -> {output_format}\")\n        \n        converter = self.converters[converter_key]\n        return converter(input_path, output_path)\n    \n    def batch_convert(self, input_dir, output_format, output_dir=None, \n                      file_pattern=\"*\", recursive=False):\n        \"\"\"Batch convert all matching files.\"\"\"\n        input_path = Path(input_dir)\n        output_path = Path(output_dir) if output_dir else input_path \u002F \"converted\"\n        output_path.mkdir(exist_ok=True)\n        \n        # Find files\n        if recursive:\n            files = list(input_path.rglob(file_pattern))\n        else:\n            files = list(input_path.glob(file_pattern))\n        \n        # Filter to supported formats\n        supported_ext = ['.md', '.docx', '.pdf', '.xlsx', '.pptx', '.html']\n        files = [f for f in files if f.suffix.lower() in supported_ext]\n        \n        results = []\n        \n        with ThreadPoolExecutor(max_workers=self.max_workers) as executor:\n            future_to_file = {\n                executor.submit(self.convert, f, output_format, output_path): f\n                for f in files\n            }\n            \n            for future in as_completed(future_to_file):\n                file = future_to_file[future]\n                try:\n                    result = future.result()\n                    results.append({'file': str(file), 'status': 'success', 'output': str(result)})\n                except Exception as e:\n                    results.append({'file': str(file), 'status': 'error', 'error': str(e)})\n        \n        return results\n```\n\n### Converter Implementations\n\n```python\n# Markdown conversions (using Pandoc)\ndef _md_to_docx(self, input_path, output_path):\n    subprocess.run(['pandoc', str(input_path), '-o', str(output_path)], check=True)\n    return output_path\n\ndef _md_to_pdf(self, input_path, output_path):\n    subprocess.run(['pandoc', str(input_path), '-o', str(output_path)], check=True)\n    return output_path\n\ndef _md_to_html(self, input_path, output_path):\n    subprocess.run(['pandoc', str(input_path), '-s', '-o', str(output_path)], check=True)\n    return output_path\n\ndef _md_to_pptx(self, input_path, output_path):\n    subprocess.run(['marp', str(input_path), '-o', str(output_path)], check=True)\n    return output_path\n\n# Office to Markdown (using markitdown)\ndef _docx_to_md(self, input_path, output_path):\n    from markitdown import MarkItDown\n    md = MarkItDown()\n    result = md.convert(str(input_path))\n    with open(output_path, 'w') as f:\n        f.write(result.text_content)\n    return output_path\n\ndef _xlsx_to_md(self, input_path, output_path):\n    from markitdown import MarkItDown\n    md = MarkItDown()\n    result = md.convert(str(input_path))\n    with open(output_path, 'w') as f:\n        f.write(result.text_content)\n    return output_path\n\ndef _pptx_to_md(self, input_path, output_path):\n    from markitdown import MarkItDown\n    md = MarkItDown()\n    result = md.convert(str(input_path))\n    with open(output_path, 'w') as f:\n        f.write(result.text_content)\n    return output_path\n\n# PDF conversions\ndef _pdf_to_docx(self, input_path, output_path):\n    from pdf2docx import Converter\n    cv = Converter(str(input_path))\n    cv.convert(str(output_path))\n    cv.close()\n    return output_path\n\ndef _pdf_to_md(self, input_path, output_path):\n    from markitdown import MarkItDown\n    md = MarkItDown()\n    result = md.convert(str(input_path))\n    with open(output_path, 'w') as f:\n        f.write(result.text_content)\n    return output_path\n\n# Office to PDF (using LibreOffice)\ndef _docx_to_pdf(self, input_path, output_path):\n    subprocess.run([\n        'soffice', '--headless', '--convert-to', 'pdf',\n        '--outdir', str(output_path.parent), str(input_path)\n    ], check=True)\n    return output_path\n\ndef _xlsx_to_pdf(self, input_path, output_path):\n    subprocess.run([\n        'soffice', '--headless', '--convert-to', 'pdf',\n        '--outdir', str(output_path.parent), str(input_path)\n    ], check=True)\n    return output_path\n\ndef _pptx_to_pdf(self, input_path, output_path):\n    subprocess.run([\n        'soffice', '--headless', '--convert-to', 'pdf',\n        '--outdir', str(output_path.parent), str(input_path)\n    ], check=True)\n    return output_path\n```\n\n### Progress Tracking\n\n```python\nfrom tqdm import tqdm\n\ndef batch_convert_with_progress(converter, input_dir, output_format, output_dir=None):\n    \"\"\"Batch convert with progress bar.\"\"\"\n    input_path = Path(input_dir)\n    files = list(input_path.glob('*'))\n    \n    results = []\n    for file in tqdm(files, desc=f\"Converting to {output_format}\"):\n        try:\n            result = converter.convert(file, output_format, output_dir)\n            results.append({'file': str(file), 'status': 'success'})\n        except Exception as e:\n            results.append({'file': str(file), 'status': 'error', 'error': str(e)})\n    \n    return results\n```\n\n## Best Practices\n\n1. **Test Sample First**: Convert a few files before batch processing\n2. **Check Disk Space**: Ensure sufficient space for output\n3. **Use Parallel Processing**: Speed up with multiple workers\n4. **Handle Errors Gracefully**: Log failures, continue processing\n5. **Verify Output**: Spot-check converted files\n\n## Common Patterns\n\n### Format Detection Pipeline\n```python\ndef detect_and_convert(file_path, target_format):\n    \"\"\"Automatically detect format and convert.\"\"\"\n    import mimetypes\n    \n    mime_type, _ = mimetypes.guess_type(str(file_path))\n    \n    format_map = {\n        'application\u002Fpdf': 'pdf',\n        'application\u002Fvnd.openxmlformats-officedocument.wordprocessingml.document': 'docx',\n        'application\u002Fvnd.openxmlformats-officedocument.spreadsheetml.sheet': 'xlsx',\n        'application\u002Fvnd.openxmlformats-officedocument.presentationml.presentation': 'pptx',\n        'text\u002Fmarkdown': 'md',\n        'text\u002Fhtml': 'html',\n    }\n    \n    source_format = format_map.get(mime_type, Path(file_path).suffix[1:])\n    \n    converter = DocumentConverter()\n    return converter.convert(file_path, target_format)\n```\n\n### Multi-Format Output\n```python\ndef convert_to_multiple_formats(input_file, output_formats, output_dir):\n    \"\"\"Convert one file to multiple formats.\"\"\"\n    converter = DocumentConverter()\n    results = {}\n    \n    for fmt in output_formats:\n        try:\n            output = converter.convert(input_file, fmt, output_dir)\n            results[fmt] = {'status': 'success', 'path': str(output)}\n        except Exception as e:\n            results[fmt] = {'status': 'error', 'error': str(e)}\n    \n    return results\n\n# Convert README to multiple formats\nresults = convert_to_multiple_formats(\n    'README.md',\n    ['docx', 'pdf', 'html'],\n    '.\u002Fexports'\n)\n```\n\n## Examples\n\n### Example 1: Documentation Export\n```python\nfrom pathlib import Path\nimport json\n\ndef export_documentation(docs_dir, export_dir):\n    \"\"\"Export all documentation to multiple formats.\"\"\"\n    \n    converter = DocumentConverter(max_workers=8)\n    docs_path = Path(docs_dir)\n    export_path = Path(export_dir)\n    \n    # Create format directories\n    for fmt in ['pdf', 'docx', 'html']:\n        (export_path \u002F fmt).mkdir(parents=True, exist_ok=True)\n    \n    all_results = {}\n    \n    # Find all markdown files\n    md_files = list(docs_path.rglob('*.md'))\n    \n    for md_file in md_files:\n        file_results = {}\n        \n        for fmt in ['pdf', 'docx', 'html']:\n            output_dir = export_path \u002F fmt\n            try:\n                output = converter.convert(md_file, fmt, output_dir)\n                file_results[fmt] = 'success'\n            except Exception as e:\n                file_results[fmt] = f'error: {e}'\n        \n        all_results[str(md_file)] = file_results\n        print(f\"Processed: {md_file.name}\")\n    \n    # Save report\n    with open(export_path \u002F 'export_report.json', 'w') as f:\n        json.dump(all_results, f, indent=2)\n    \n    return all_results\n\nresults = export_documentation('.\u002Fdocs', '.\u002Fexports')\n```\n\n### Example 2: Legacy Document Migration\n```python\ndef migrate_legacy_docs(source_dir, target_dir):\n    \"\"\"Migrate legacy documents to modern formats.\"\"\"\n    \n    converter = DocumentConverter(max_workers=4)\n    \n    # Migration rules\n    migrations = [\n        ('*.doc', 'docx'),   # Old Word to new\n        ('*.xls', 'xlsx'),   # Old Excel to new\n        ('*.ppt', 'pptx'),   # Old PowerPoint to new\n        ('*.rtf', 'docx'),   # RTF to Word\n    ]\n    \n    source_path = Path(source_dir)\n    target_path = Path(target_dir)\n    target_path.mkdir(exist_ok=True)\n    \n    total_migrated = 0\n    errors = []\n    \n    for pattern, target_format in migrations:\n        files = list(source_path.glob(pattern))\n        \n        for file in files:\n            try:\n                # Use LibreOffice for legacy formats\n                subprocess.run([\n                    'soffice', '--headless',\n                    '--convert-to', target_format,\n                    '--outdir', str(target_path),\n                    str(file)\n                ], check=True)\n                \n                total_migrated += 1\n                print(f\"Migrated: {file.name}\")\n                \n            except Exception as e:\n                errors.append({'file': str(file), 'error': str(e)})\n    \n    print(f\"\\nMigration complete: {total_migrated} files\")\n    print(f\"Errors: {len(errors)}\")\n    \n    return {'migrated': total_migrated, 'errors': errors}\n```\n\n### Example 3: Report Generation Pipeline\n```python\ndef generate_reports_pipeline(data_files, template_dir, output_dir):\n    \"\"\"Generate reports from data files using templates.\"\"\"\n    \n    from datetime import datetime\n    \n    converter = DocumentConverter()\n    output_path = Path(output_dir)\n    output_path.mkdir(exist_ok=True)\n    \n    timestamp = datetime.now().strftime('%Y%m%d_%H%M%S')\n    \n    reports = []\n    \n    for data_file in data_files:\n        # Load data\n        data_path = Path(data_file)\n        \n        # Generate markdown report\n        md_content = f\"\"\"---\ntitle: Report - {data_path.stem}\ndate: {datetime.now().strftime('%Y-%m-%d')}\n---\n\n# {data_path.stem} Report\n\nGenerated: {datetime.now().strftime('%Y-%m-%d %H:%M:%S')}\n\n## Data Summary\n\n\"\"\"\n        \n        # Add data content (simplified)\n        if data_path.suffix == '.xlsx':\n            from markitdown import MarkItDown\n            md = MarkItDown()\n            result = md.convert(str(data_path))\n            md_content += result.text_content\n        \n        # Save markdown\n        md_file = output_path \u002F f\"{data_path.stem}_{timestamp}.md\"\n        with open(md_file, 'w') as f:\n            f.write(md_content)\n        \n        # Convert to PDF and DOCX\n        for fmt in ['pdf', 'docx']:\n            try:\n                output = converter.convert(md_file, fmt, output_path)\n                reports.append({'source': str(data_file), 'output': str(output), 'format': fmt})\n            except Exception as e:\n                print(f\"Error converting {data_file} to {fmt}: {e}\")\n    \n    return reports\n```\n\n## Limitations\n\n- Some format combinations not supported\n- Complex formatting may be lost in conversion\n- Large files may require more time\n- Some conversions need external tools (LibreOffice, Pandoc)\n- Quality varies by source document complexity\n\n## Installation\n\n```bash\n# Core dependencies\npip install pdf2docx markitdown python-docx openpyxl\n\n# Pandoc (for MD conversions)\nbrew install pandoc  # macOS\napt install pandoc   # Ubuntu\n\n# Marp (for PPTX)\nnpm install -g @marp-team\u002Fmarp-cli\n\n# LibreOffice (for Office formats)\nbrew install libreoffice  # macOS\napt install libreoffice   # Ubuntu\n```\n\n## Resources\n\n- [Pandoc Documentation](https:\u002F\u002Fpandoc.org\u002FMANUAL.html)\n- [markitdown GitHub](https:\u002F\u002Fgithub.com\u002Fmicrosoft\u002Fmarkitdown)\n- [pdf2docx Documentation](https:\u002F\u002Fpdf2docx.readthedocs.io\u002F)\n- [LibreOffice CLI](https:\u002F\u002Fhelp.libreoffice.org\u002Flatest\u002Fen-US\u002Ftext\u002Fshared\u002Fguide\u002Fstart_parameters.html)\n",{"mcp":24,"name":5,"tags":28,"author":33,"models":34,"license":15,"version":42,"category":30,"languages":43,"department":46,"description":7,"capabilities":47},{"tools":25,"server":27},[26],"batch_convert","office-mcp",[29,30,31,32],"batch","conversion","bulk","automation","claude-office-skills",{"compatible":35,"recommended":39},[36,37,38],"claude-3-5-sonnet","gpt-4","gpt-4o",[40,41],"claude-sonnet-4","claude-opus-4","1.0",[44,45],"en","zh","All",[48,32],"bulk_conversion","main","8859218955d9504cd18b59e7892100718039d3b4","data\u002Fskills\u002Fclaude-office-skills-skills\u002Fbatch-convert\u002Fbatch-convert",1,"https:\u002F\u002Fgithub.com\u002Fom-scogo\u002Fskillsh-scraper","https:\u002F\u002Fgithub.com\u002Fom-scogo","SDE-1 @ Scogo ","2026-07-18 12:22:46",{"source":8,"skillName":5,"commands":58,"prompt":68,"zipAvailable":69},[59,62,65],{"tool":60,"command":61},"npx","npx skills add om-scogo\u002Fskillsh-scraper --skill batch-convert",{"tool":63,"command":64},"bunx","bunx skills add om-scogo\u002Fskillsh-scraper --skill batch-convert",{"tool":66,"command":67},"pnpm","pnpm dlx skills add om-scogo\u002Fskillsh-scraper --skill batch-convert","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002Fom-scogo\u002Fskillsh-scraper\u002Fblob\u002Fmain\u002Fdata\u002Fskills\u002Fclaude-office-skills-skills\u002Fbatch-convert\u002Fbatch-convert\u002FSKILL.md",true,[],[72,79,84,91,96,103],{"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":19},"01M7D6MC9FAAEV4CMNYX8W7JTG","arxiv-search","Search arXiv physics, math, and computer science preprints using natural language queries. Powered by Valyu semantic search.","https:\u002F\u002Fgithub.com\u002Fom-scogo\u002Fskillsh-scraper\u002Fblob\u002Fmain\u002Fdata\u002Fskills\u002Fyorkeccak-scientific-skills\u002Farxiv-search\u002Fskills\u002Farxiv-search\u002FSKILL.md",[],[],{"skillNo":80,"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":81,"categories":82,"keywords":83,"publishedAt":19},"01M7D6M85CKKN87TA98VCQV4H7","https:\u002F\u002Fgithub.com\u002Fom-scogo\u002Fskillsh-scraper\u002Fblob\u002Fmain\u002Fdata\u002Fskills\u002Fyorkeccak-scientific-skills\u002Farxiv-search\u002FSkill.md",[],[],{"skillNo":85,"name":86,"nameZh":6,"description":87,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":88,"categories":89,"keywords":90,"publishedAt":19},"01M7D4ZTCS4DR3CE4JY06X84T2","working-with-legacy-code","Safely change and test untested codebases using Feathers' \"Working Effectively with Legacy Code\". Use when the user mentions \"legacy code\", \"no tests\", \"untested codebase\", \"how do I test this\", \"seams\", \"characterization tests\", \"golden master\", \"sprout method\", \"afraid to change this code\", \"monster method\", \"dependency breaking\", or \"inherited a messy codebase\". Also trigger when changing code without tests safely, getting a class under test when constructors, statics, or singletons block it, adding features to tangled modules, or planning incremental test coverage for an old codebase. Covers the legacy-code change algorithm, seams, characterization tests, sprout\u002Fwrap, and dependency-breaking techniques. For refactoring code that already has tests, see refactoring-patterns. For day-to-day code quality, see clean-code.","https:\u002F\u002Fgithub.com\u002Fom-scogo\u002Fskillsh-scraper\u002Fblob\u002Fmain\u002Fdata\u002Fskills\u002Fwondelai-skills\u002Fworking-with-legacy-code\u002Fworking-with-legacy-code\u002FSKILL.md",[],[],{"skillNo":92,"name":86,"nameZh":6,"description":87,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":93,"categories":94,"keywords":95,"publishedAt":19},"01M7D4ZHZKJD2RSNGAF63V14P4","https:\u002F\u002Fgithub.com\u002Fom-scogo\u002Fskillsh-scraper\u002Fblob\u002Fmain\u002Fdata\u002Fskills\u002Fwondelai-skills\u002Fworking-with-legacy-code\u002FSkill.md",[],[],{"skillNo":97,"name":98,"nameZh":6,"description":99,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":100,"categories":101,"keywords":102,"publishedAt":19},"01M7D4ZB4CJBFW5JE67CPH2QRV","web-typography","Select, pair, and implement typefaces for web projects. Use when the user mentions \"font pairing\", \"which typeface\", \"line height\", \"responsive typography\", \"web font loading\", \"type hierarchy\", \"variable fonts\", \"FOUT\u002FFOIT\", \"typographic scale\", or \"the text is hard to read\". Also trigger when choosing between system fonts and web fonts, optimizing font-loading performance, or designing readable long-form content. Covers readability evaluation, CSS implementation, and performance optimization. For overall UI design systems, see refactoring-ui. For dramatic typographic experiences, see top-design.","https:\u002F\u002Fgithub.com\u002Fom-scogo\u002Fskillsh-scraper\u002Fblob\u002Fmain\u002Fdata\u002Fskills\u002Fwondelai-skills\u002Fweb-typography\u002Fweb-typography\u002FSKILL.md",[],[],{"skillNo":104,"name":98,"nameZh":6,"description":99,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":105,"categories":106,"keywords":107,"publishedAt":19},"01M7D4Z4MVYVY3NMJ18BNV6WNA","https:\u002F\u002Fgithub.com\u002Fom-scogo\u002Fskillsh-scraper\u002Fblob\u002Fmain\u002Fdata\u002Fskills\u002Fwondelai-skills\u002Fweb-typography\u002FSkill.md",[],[]]