LibreOffice Skill: Headless Document Conversion and Batch Export in Agent

Introduction

When handling Office documents in automated pipelines or conversational Agents, the common practice is to write separate scripts, wrangle with unoconv, or use online APIs. When environments are inconsistent, format mapping and batch wildcards can easily lead to pitfalls. Here we introduce the LibreOffice Skill (@user_eba395de/libreoffice) on SkillHub: it encapsulates local LibreOffice headless capabilities and scripts into a universal SKILL.md, allowing Agents to execute the same set of steps for intents such as “convert to PDF,” “batch docx,” or “export HTML/EPUB.”

What is this

LibreOffice is a community Skill (Source: community) under the SkillHub category office-efficiency. The current version is 1.1.0, published by user_eba395de, with the page author listed as TanYiLuo. The Skill tags indicate requires_api_key=false, meaning it does not rely on external API Keys.

In one sentence: It provides headless command-line operations for the LibreOffice 24.2 office suite—document format conversion, batch processing, and export to PDF / HTML / EPUB, etc. It is suitable for mutual conversion and batch tasks between Word, Excel, PPT, and PDF. The SkillHub page description is consistent with the SKILL.md description inside the package.

Official entry points:

  • API Page: https://api.skillhub.cn/user_eba395de/libreoffice
  • Display Page: https://www.skillhub.cn/skills/user_eba395de/libreoffice

(Page statistics are based on SkillHub crawls: Rating 100000, Downloads 6024.)

Core Features

Verified via the SKILL.md inside the package, the Skill provides two layers of capability:

  1. Recommended Path: libreoffice_ops.py in the Skill directory, which encapsulates installation detection, path and format mapping, and supports five sub-commands: convert, batch, merge, extract-text, and info.
  2. Alternative Path: Directly calling soffice --headless --convert-to, providing common filter names (such as writer_pdf_Export for PDF, XHTML Writer File for HTML, EPUB for EPUB, etc.).

The available target formats declared by the script include: pdf, html, epub, docx, odt, xlsx, ods, pptx, png, jpg, txt, csv. Before execution, you should first check if LibreOffice is installed locally (soffice --version); if not installed, the Skill documentation provides installation examples for apt / yum / brew.

Agent-side trigger semantics (from the Skill source): When a user mentions “convert document,” “export PDF,” “batch format conversion,” “Word to Excel,” etc., first confirm the input path and target format, then execute the command and report the output path or file.

Installation and Activation

1. Install SkillHub CLI (if not already installed)

First, check if the CLI is present:

command -v skillhub && skillhub --version

If not installed, you can execute the full installation (CLI + default Skill) following the official SkillHub instructions:

curl -fsSL https://skillhub-1388575217.cos.ap-guangzhou.myqcloud.com/install/install.sh | bash

To install only the CLI:

curl -fsSL https://skillhub-1388575217.cos.ap-guangzhou.myqcloud.com/install/install.sh | bash -s -- --cli-only

See instructions at: https://skillhub.cn/install/skillhub.md

2. Install the LibreOffice Skill to the current Agent’s skills directory

When installing the skill, you must use --dir to point to the skills directory recognized by your current Agent; otherwise, it defaults to ./skills/, which the Agent may not be able to read. Path examples listed in the official documentation:

  • Cursor: ~/.cursor/skills/
  • Claude Code: ~/.claude/skills/
  • Codex: ~/.codex/skills/ or .agents/skills/ under the project

In Cursor, you can execute:

skillhub install @user_eba395de/libreoffice --dir ~/.cursor/skills/

The SkillHub page also supports instructing the AI to install the same coordinate via https://skillhub.cn/install/skillhub.md.

3. Local LibreOffice

The Skill relies on soffice being installed on the system. Detection example:

soffice --version 2>&1 | head -1

For Debian/Ubuntu, refer to the Skill documentation:

sudo apt install -y libreoffice-core libreoffice-writer libreoffice-calc libreoffice-impress

After installing or updating the Skill, restart or refresh the Agent according to your client’s requirements to load the new Skill.

Typical Usage

The following examples are from the SKILL.md within the Skill package. Replace <skill_dir> with the installed Skill directory (e.g., ~/.cursor/skills/@user_eba395de/libreoffice).

python3 <skill_dir>/libreoffice_ops.py convert report.docx pdf --outdir /tmp/output

Batch convert docx files in the current directory to pdf:

python3 <skill_dir>/libreoffice_ops.py batch "*.docx" pdf --outdir /tmp/output

Extract plain text from PDF or Office files:

python3 <skill_dir>/libreoffice_ops.py extract-text contract.pdf --outdir /tmp/output

View file information:

python3 <skill_dir>/libreoffice_ops.py info document.docx

Directly Calling soffice (Alternative)

Convert a single Word file to PDF:

soffice --headless --convert-to pdf /path/to/document.docx --outdir /tmp/output/

Export the same document to both PDF and HTML simultaneously:

soffice --headless \
  --convert-to pdf:"writer_pdf_Export" \
  --convert-to html:"XHTML Writer File:UTF8" \
  /path/to/document.docx \
  --outdir /tmp/output/

Use Cases and Notes

Who is it for

  • Teams or individuals who need to complete Office/PDF mutual conversion, batch export, and text extraction within Agent conversations or local automation, and prefer to unify through local LibreOffice without binding to commercial conversion APIs.
  • Users already using clients like Cursor, Claude Code, or Codex that support Skill directories, and are willing to use SkillHub to manage skill packages.

Limitations and Notes

  • The Skill does not include the LibreOffice suite itself; libreoffice_ops.py only calls the installed suite. Version upgrades require manual apt upgrade or brew upgrade --cask libreoffice.
  • Startup can be slow when converting large files in headless mode; --headless should be placed at the beginning; if --outdir is not specified, output goes to the current working directory.
  • Batch *.docx depends on shell wildcard expansion.
  • Java warnings like javaldx in documents can generally be ignored; for garbled text, try text filters with :UTF8; if conversion fails, it is recommended to open the source file in the GUI to check for corruption.

Conclusion

The LibreOffice Skill consolidates headless conversion commands, format tables, and the five operations of libreoffice_ops.py into a single Skill, making it suitable for handling document batch tasks within Agents. Installation and coordinates are subject to SkillHub: @user_eba395de/libreoffice, Display Page https://www.skillhub.cn/skills/user_eba395de/libreoffice , API Page https://api.skillhub.cn/user_eba395de/libreoffice .

羽毛球分组比赛记分
小程序二维码

欢迎使用《羽毛球分组比赛记分》微信小程序

Xiaoye