libreoffice-writer
Use when creating, editing, formatting, exporting, or extracting LibreOffice Writer (.odt) documents via UNO, including session-based edits, structured text targets, tables, images, lists, patch workflows, and snapshots.
下記のコマンドをコピーしてターミナル(Mac/Linux)または PowerShell(Windows)に貼り付けてください。 ダウンロード → 解凍 → 配置まで全自動。
mkdir -p ~/.claude/skills && cd ~/.claude/skills && curl -L -o libreoffice-writer.zip https://jpskill.com/download/18634.zip && unzip -o libreoffice-writer.zip && rm libreoffice-writer.zip
$d = "$env:USERPROFILE\.claude\skills"; ni -Force -ItemType Directory $d | Out-Null; iwr https://jpskill.com/download/18634.zip -OutFile "$d\libreoffice-writer.zip"; Expand-Archive "$d\libreoffice-writer.zip" -DestinationPath $d -Force; ri "$d\libreoffice-writer.zip"
完了後、Claude Code を再起動 → 普通に「動画プロンプト作って」のように話しかけるだけで自動発動します。
💾 手動でダウンロードしたい(コマンドが難しい人向け)
- 1. 下の青いボタンを押して
libreoffice-writer.zipをダウンロード - 2. ZIPファイルをダブルクリックで解凍 →
libreoffice-writerフォルダができる - 3. そのフォルダを
C:\Users\あなたの名前\.claude\skills\(Win)または~/.claude/skills/(Mac)へ移動 - 4. Claude Code を再起動
⚠️ ダウンロード・利用は自己責任でお願いします。当サイトは内容・動作・安全性について責任を負いません。
🎯 このSkillでできること
下記の説明文を読むと、このSkillがあなたに何をしてくれるかが分かります。Claudeにこの分野の依頼をすると、自動で発動します。
📦 インストール方法 (3ステップ)
- 1. 上の「ダウンロード」ボタンを押して .skill ファイルを取得
- 2. ファイル名の拡張子を .skill から .zip に変えて展開(macは自動展開可)
- 3. 展開してできたフォルダを、ホームフォルダの
.claude/skills/に置く- · macOS / Linux:
~/.claude/skills/ - · Windows:
%USERPROFILE%\.claude\skills\
- · macOS / Linux:
Claude Code を再起動すれば完了。「このSkillを使って…」と話しかけなくても、関連する依頼で自動的に呼び出されます。
詳しい使い方ガイドを見る →- 最終更新
- 2026-05-18
- 取得日時
- 2026-05-18
- 同梱ファイル
- 14
📖 Skill本文(日本語訳)
※ 原文(英語/中国語)を Gemini で日本語化したものです。Claude 自身は原文を読みます。誤訳がある場合は原文をご確認ください。
LibreOffice Writer
UNO を利用した Writer ドキュメントの作業には、バンドルされている writer モジュールを使用します。
すべてのパスは絶対パスでなければなりません。バンドルされているモジュールは、このスキルのディレクトリの scripts/ の下に存在するため、PYTHONPATH=<skill_base_dir>/scripts を設定してください。
セットアップまたは実行時の問題が発生した場合は、references/troubleshooting.md を確認してください。
API Surface
# Non-session utilities
create_document(path)
export_document(path, output_path, format) # formats: "pdf", "docx"
snapshot_page(doc_path, output_path, page=1, dpi=150)
# Session (primary editing API)
open_writer_session(path) -> WriterSession
WriterSession methods:
read_text(target: WriterTarget | None = None) -> str
insert_text(text, target: WriterTarget | None = None)
replace_text(target: WriterTarget, new_text)
delete_text(target: WriterTarget)
format_text(target: WriterTarget, formatting: TextFormatting)
insert_table(rows, cols, data=None, name=None, target: WriterTarget | None = None)
update_table(target: WriterTarget, data)
delete_table(target: WriterTarget)
insert_image(image_path, width=None, height=None, name=None, target: WriterTarget | None = None)
update_image(target: WriterTarget, image_path=None, width=None, height=None)
delete_image(target: WriterTarget)
insert_list(items: list[ListItem], ordered: bool, target: WriterTarget | None = None)
replace_list(target: WriterTarget, items: list[ListItem], ordered: bool | None = None)
delete_list(target: WriterTarget)
patch(patch_text, mode="atomic") -> PatchApplyResult
export(output_path, format)
reset()
close(save=True)
# Standalone patch utility
patch(path, patch_text, mode="atomic") -> PatchApplyResult
構造化されたターゲット: WriterTarget
from writer import WriterTarget
WriterTarget(
kind="text" | "insertion" | "table" | "image" | "list",
text=None,
after=None,
before=None,
occurrence=None,
name=None,
index=None,
)
ターゲットの種類
| Kind | Supported fields | Use |
|---|---|---|
text |
text, after, before, occurrence |
一致したテキストの読み取り、置換、削除、または書式設定 |
insertion |
text, after, before, occurrence |
解決された境界または一致したスパンの後への挿入 |
table |
name or index |
テーブルの更新/削除 |
image |
name or index |
画像の更新/削除 |
list |
text, after, before, occurrence |
1つの論理リストブロックの置換/削除 |
解決ルール
- ドキュメント全体を読み取るか、挿入されたコンテンツを末尾に追加するには、
targetを省略します。 - 検索ウィンドウを制限するには、
afterおよびbeforeを使用します。 - テキストが繰り返し出現することが予想される場合は
occurrenceを使用します。それ以外の場合、一致は一意である必要があります。 text、after、およびbeforeアンカーには、完全な文または特徴的な段落サイズのフレーズを優先します。単語1つのアンカーは、現実的な文章の編集には脆弱すぎることがよくあります。- テーブル/イメージのターゲットには、
nameを優先します。順序が安定している場合にのみindexを使用します。 - インラインテキストの後に挿入する場合、Writer は一致したスパンの後の境界に挿入します。段落区切りは、挿入されたテキストまたはセッションヘルパーからのものでなければなりません。
書式設定ペイロード
from writer import TextFormatting
TextFormatting(
bold=None,
italic=None,
underline=None,
font_name=None,
font_size=None,
color=None, # named color or integer
align=None, # "left" | "center" | "right" | "justify"
line_spacing=None,
spacing_before=None,
spacing_after=None,
)
注:
- 文字と段落の書式設定は、1回の呼び出しで組み合わせることができます。
alignなどの段落プロパティは、一致したスパンだけでなく、一致を含む段落全体に適用されます。- 少なくとも1つの書式設定フィールドを設定する必要があります。
リスト項目
from writer import ListItem
ListItem(text="Confirm scope", level=0)
levelはゼロベースのネストです。- ネストはレベルをスキップできません。
ordered=Trueは番号付けスタイルを使用します。ordered=Falseは箇条書きを使用します。
Patch DSL
順序付けられた操作を適用するには、patch() または session.patch() を使用します。
[operation]
type = format_text
target.kind = text
target.text = Quarterly revenue grew 18%.
target.after = Financial Summary
target.before = Action Items
format.bold = true
format.align = center
[operation]
type = insert_list
target.kind = insertion
target.after = Action Items
list.ordered = false
items <<JSON
[
{"text": "Confirm scope", "level": 0},
{"text": "Review output", "level": 0},
{"text": "Update packaging", "level": 1}
]
JSON
サポートされている操作タイプ
insert_textreplace_textdelete_textformat_textinsert_tableupdate_tabledelete_tableinsert_imageupdate_imagedelete_imageinsert_listreplace_listdelete_list
Patch 値のルール
- ターゲット定義には
target.*フィールドを使用します。 - 書式設定ペイロードには
format.*フィールドを使用します。 - リスト操作には
list.orderedと JSONitemsを使用します。 itemsおよびdataは有効な JSON である必要があります。- 複数行のテキストまたは JSON には、
<<TAG ... TAGでヒアドキュメントブロックがサポートされています。
モード
atomicは最初の失敗で停止し、セッションをリセットし、何も保持しません。best_effortは成功した以前の操作を保持し、失敗を記録します。
PatchApplyResult フィールド:
modeoverall_status="ok" | "partial" | "failed"operations=PatchOperationResultのリストdocument_persisted
スタンドアロンの patch(path, ...) の場合、document_persisted は変更がディスクに保存されたことを意味します。session.patch(...) の場合、これはパッチが現在のオープンセッション状態で成功した変更を生成したことを意味します。
例: セッションでレポートを編集する
from pathlib import Path
from writer import ListItem, TextFormatting, WriterTarget, open_writer_session
from writer.core import create_document
output = str(Path("test-output/report.odt").resolve())
create_document(output)
with open_writer_session(output) as session:
session.insert_text(
"Executive Summary\n\n"
"Financial Summary\n\n"
"Quarterly revenue grew 18%.\n\n"
"
(原文がここで切り詰められています) 📜 原文 SKILL.md(Claudeが読む英語/中国語)を展開
LibreOffice Writer
Use the bundled writer modules for UNO-backed Writer document work.
All paths must be absolute. Bundled modules live under scripts/ in this
skill directory, so set PYTHONPATH=<skill_base_dir>/scripts.
If setup or runtime issues appear, check references/troubleshooting.md.
API Surface
# Non-session utilities
create_document(path)
export_document(path, output_path, format) # formats: "pdf", "docx"
snapshot_page(doc_path, output_path, page=1, dpi=150)
# Session (primary editing API)
open_writer_session(path) -> WriterSession
WriterSession methods:
read_text(target: WriterTarget | None = None) -> str
insert_text(text, target: WriterTarget | None = None)
replace_text(target: WriterTarget, new_text)
delete_text(target: WriterTarget)
format_text(target: WriterTarget, formatting: TextFormatting)
insert_table(rows, cols, data=None, name=None, target: WriterTarget | None = None)
update_table(target: WriterTarget, data)
delete_table(target: WriterTarget)
insert_image(image_path, width=None, height=None, name=None, target: WriterTarget | None = None)
update_image(target: WriterTarget, image_path=None, width=None, height=None)
delete_image(target: WriterTarget)
insert_list(items: list[ListItem], ordered: bool, target: WriterTarget | None = None)
replace_list(target: WriterTarget, items: list[ListItem], ordered: bool | None = None)
delete_list(target: WriterTarget)
patch(patch_text, mode="atomic") -> PatchApplyResult
export(output_path, format)
reset()
close(save=True)
# Standalone patch utility
patch(path, patch_text, mode="atomic") -> PatchApplyResult
Structured Targets: WriterTarget
from writer import WriterTarget
WriterTarget(
kind="text" | "insertion" | "table" | "image" | "list",
text=None,
after=None,
before=None,
occurrence=None,
name=None,
index=None,
)
Target kinds
| Kind | Supported fields | Use |
|---|---|---|
text |
text, after, before, occurrence |
Read, replace, delete, or format matched text |
insertion |
text, after, before, occurrence |
Insert at a resolved boundary or after a matched span |
table |
name or index |
Update/delete a table |
image |
name or index |
Update/delete an image |
list |
text, after, before, occurrence |
Replace/delete one logical list block |
Resolution rules
- Omit
targetto read the full document or append inserted content at the end. - Use
afterandbeforeto constrain a search window. - Use
occurrencewhen repeated text is expected; otherwise matching must be unique. - Prefer full sentences or distinctive paragraph-sized phrases for
text,after, andbeforeanchors; single-word anchors are often too brittle for realistic prose edits. - For table/image targets, prefer
name; useindexonly when order is stable. - For insertion after inline text, Writer inserts at the boundary after the matched span; paragraph breaks must come from the inserted text or the session helper.
Formatting Payload
from writer import TextFormatting
TextFormatting(
bold=None,
italic=None,
underline=None,
font_name=None,
font_size=None,
color=None, # named color or integer
align=None, # "left" | "center" | "right" | "justify"
line_spacing=None,
spacing_before=None,
spacing_after=None,
)
Notes:
- Character and paragraph formatting can be combined in one call.
- Paragraph properties such as
alignapply to the full paragraph containing the match, not just the exact matched span. - At least one formatting field must be set.
List Items
from writer import ListItem
ListItem(text="Confirm scope", level=0)
levelis zero-based nesting.- Nesting cannot skip levels.
ordered=Trueuses a numbering style;ordered=Falseuses bullets.
Patch DSL
Use patch() or session.patch() to apply ordered operations.
[operation]
type = format_text
target.kind = text
target.text = Quarterly revenue grew 18%.
target.after = Financial Summary
target.before = Action Items
format.bold = true
format.align = center
[operation]
type = insert_list
target.kind = insertion
target.after = Action Items
list.ordered = false
items <<JSON
[
{"text": "Confirm scope", "level": 0},
{"text": "Review output", "level": 0},
{"text": "Update packaging", "level": 1}
]
JSON
Supported operation types
insert_textreplace_textdelete_textformat_textinsert_tableupdate_tabledelete_tableinsert_imageupdate_imagedelete_imageinsert_listreplace_listdelete_list
Patch value rules
- Use
target.*fields for target definition. - Use
format.*fields for formatting payloads. - Use
list.orderedplus JSONitemsfor list operations. itemsanddatamust be valid JSON.- Heredoc blocks are supported with
<<TAG ... TAGfor multiline text or JSON.
Modes
atomicstops on first failure, resets the session, and persists nothing.best_effortkeeps successful earlier operations and records failures.
PatchApplyResult fields:
modeoverall_status="ok" | "partial" | "failed"operations= list ofPatchOperationResultdocument_persisted
For standalone patch(path, ...), document_persisted means the changes were
saved to disk. For session.patch(...), it means the patch produced successful
mutations in the current open session state.
Example: Edit a Report in Session
from pathlib import Path
from writer import ListItem, TextFormatting, WriterTarget, open_writer_session
from writer.core import create_document
output = str(Path("test-output/report.odt").resolve())
create_document(output)
with open_writer_session(output) as session:
session.insert_text(
"Executive Summary\n\n"
"Financial Summary\n\n"
"Quarterly revenue grew 18%.\n\n"
"Action Items"
)
session.format_text(
WriterTarget(
kind="text",
text="Quarterly revenue grew 18%.",
after="Financial Summary",
before="Action Items",
),
TextFormatting(bold=True, align="center"),
)
session.insert_list(
[
ListItem(text="Confirm scope", level=0),
ListItem(text="Review output", level=0),
ListItem(text="Update packaging", level=1),
],
ordered=False,
target=WriterTarget(kind="insertion", after="Action Items"),
)
Example: Patch an Existing Document
from writer import patch
result = patch(
"/abs/path/report.odt",
"""
[operation]
type = replace_text
target.kind = text
target.text = Draft
new_text = Final
[operation]
type = update_table
target.kind = table
target.name = Summary
data = [["Metric", "Value"], ["Revenue", "$2M"]]
[operation]
type = replace_list
target.kind = list
target.text = Confirm scope
items = [{"text": "Approve release", "level": 0}, {"text": "Notify team", "level": 1}]
list.ordered = true
""",
mode="best_effort",
)
print(result.overall_status)
Snapshots
from pathlib import Path
from writer import snapshot_page
result = snapshot_page(doc_path, "/tmp/page1.png", page=1, dpi=150)
print(result.file_path, result.width, result.height)
Path(result.file_path).unlink(missing_ok=True)
Use snapshots to verify layout after formatting, list edits, image placement, or table changes.
Common Mistakes
- Passing a relative path; UNO-facing Writer APIs expect absolute file paths.
- Omitting
occurrencefor repeated text and then getting an ambiguity error. - Using anchors that are too short or too common; prefer full-sentence or paragraph-level anchor text plus
after/beforebounds when possible. - Expecting
alignto apply only to a phrase; Writer applies paragraph alignment to the containing paragraph. - Supplying malformed JSON in
itemsordatapatch fields. - Calling
session.export()or other methods aftersession.close().
同梱ファイル
※ ZIPに含まれるファイル一覧。`SKILL.md` 本体に加え、参考資料・サンプル・スクリプトが入っている場合があります。
- 📄 SKILL.md (8,376 bytes)
- 📎 references/troubleshooting.md (1,562 bytes)
- 📎 scripts/colors.py (4,591 bytes)
- 📎 scripts/exceptions.py (247 bytes)
- 📎 scripts/session.py (961 bytes)
- 📎 scripts/uno_bridge.py (5,635 bytes)
- 📎 scripts/writer/__init__.py (580 bytes)
- 📎 scripts/writer/core.py (1,658 bytes)
- 📎 scripts/writer/exceptions.py (1,928 bytes)
- 📎 scripts/writer/metadata.py (2,904 bytes)
- 📎 scripts/writer/patch.py (15,362 bytes)
- 📎 scripts/writer/session.py (17,294 bytes)
- 📎 scripts/writer/snapshot.py (4,312 bytes)
- 📎 scripts/writer/targets.py (15,176 bytes)