libreoffice-writer
Automate LibreOffice Writer Documents
Manually editing documents is time-consuming and error-prone. This skill automates LibreOffice Writer operations through UNO integration, enabling programmatic document creation, editing, formatting, and export.
Download the skill ZIP
Upload in Claude
Go to Settings → Capabilities → Skills → Upload skill
Toggle on and start using
Test it
Using "libreoffice-writer". Create a new document with a title and export to PDF
Expected outcome:
- Document created successfully: /path/to/report.odt
- Exported to PDF: /path/to/report.pdf
Using "libreoffice-writer". Find and format text in existing document
Expected outcome:
- Opened document: /path/to/draft.odt
- Formatted text range: bold, center-aligned
- Changes saved and document closed
Using "libreoffice-writer". Apply patch with multiple operations
Expected outcome:
- Patch parsed: 3 operations
- Operation 1 (replace_text): success
- Operation 2 (format_text): success
- Operation 3 (insert_table): success
- Overall status: ok
- Document persisted: true
Security Audit
Low RiskStatic analysis flagged 175 patterns but evaluation confirms these are false positives. The skill legitimately uses subprocess to launch LibreOffice with hardcoded arguments, tempfile for secure temp directories, and importlib for module detection. All external command usage has no user input injection vectors. Risk is low due to filesystem and external command dependencies requiring LibreOffice installation.
Low Risk Issues (3)
Risk Factors
⚙️ External commands (1)
📁 Filesystem access (2)
🔑 Env variables (1)
⚡ Contains scripts (2)
Quality Score
What You Can Build
Automated Report Generation
Generate standardized reports by creating documents, inserting formatted text and tables, then exporting to PDF for distribution.
Document Template Processing
Load template documents, replace placeholder text with dynamic content, update tables with new data, and export customized versions.
Batch Document Operations
Apply consistent formatting changes across multiple documents using patch workflows with atomic rollback on failures.
Try These Prompts
Create a new LibreOffice Writer document at /path/to/report.odt. Insert a title "Monthly Report", add a section heading "Summary", then insert a paragraph describing this month's achievements. Export the final document to PDF.
Open /path/to/draft.odt and find the sentence "Quarterly revenue grew significantly" that appears after "Financial Overview" and before "Next Steps". Make it bold and centered. Then insert a bulleted list after "Action Items" with three tasks: Review budget, Schedule meeting, Send updates.
Open the document at /path/to/data-report.odt. Insert a table with 4 rows and 3 columns named "Sales Data". Populate it with headers [Region, Q1, Q2] and data rows for North, South, East regions. Later update the Q2 values when new numbers arrive.
Apply this patch to /path/to/manuscript.odt in atomic mode: First, replace all instances of "Draft" with "Final". Second, format the chapter titles bold with 14pt font. Third, insert a table of contents. If any operation fails, rollback all changes and report the error.
Best Practices
- Always use absolute file paths when working with UNO-based Writer APIs
- Anchor text targets with full sentences or paragraph-level phrases, not single words
- Use after and before bounds to constrain searches when text may appear multiple times
- Wrap session operations in try/finally or context managers to ensure proper cleanup
- Test patch workflows in best_effort mode before switching to atomic for production
Avoid
- Using relative paths - UNO requires absolute file paths for all document operations
- Omitting occurrence parameter when the same text appears multiple times in a document
- Calling session methods after session.close() has been invoked
- Supplying malformed JSON in patch items or data fields
- Expecting paragraph alignment to apply only to matched text instead of the full paragraph