Docxのロゴ

Docx

コミュニティ
ur-grue
docx

Use this skill whenever the user wants to create or edit .docx (Microsoft Word) files. This includes creating new Word documents from scratch, editing existing Word documents, extracting content from Word files, converting between formats, adding images or other content to Word files, or manipulating Word file structure. If the user mentions .docx, Word, DOCX, or wants to produce a Word document, use this skill.

概要

公開者ur-grue
リポジトリautopunk-media-skills
スキル名docx
スター
45
フォーク
3
同梱ファイル
指示のみ
ライセンスMIT
リンク
  • Markdown形式の指示

    モデルが必要に応じて読み込むSKILL.mdファイルです。関連するリクエストがあったときだけトークンを消費します。

  • どのLLMでも利用可能

    AIスキルはプロバイダー固有のコードではなく、通常のMarkdownなので、GPT、Claude、Gemini、Grok、ローカルモデルで利用できます。

  • 指示だけで完結

    モデルに必要なものはすべて指示に含まれているため、別途同期するファイルはありません。

  • オープンソース

    ur-grueがGitHubで公開しています。インストールする前にソースを確認してください。

インストール

AIスキルDocxをTypingMindにインストールすれば、どのLLMでも利用できます。SKILL.mdを読み取れる別のAIエージェントに追加することもできます。

1

TypingMindにインストール

TypingMindはGitHubフォルダから直接スキルをインストールします。SKILL.mdを読み取り、リソースファイルをまとめてローカルに保存します。

  1. アプリを開き、「プラグイン」→「スキル」に移動します。
  2. 「GitHubからインストール」を選択します。
  3. 以下のスキルフォルダのURLを貼り付けて確定します。
    https://github.com/ur-grue/autopunk-media-skills/tree/main/.claude/skills/docx
  4. スキルを利用したいチャットごとに、そのスキルを有効にしてください。
「プラグイン」→「スキル」→「スキルを追加」→「GitHubのURLから」を選択し、フォルダのURLを貼り付けて「続行」を押します。
2

別のAIエージェントにインストール

Agent Skills形式を読み取れるAIエージェントなら、このスキルを利用できます。フォルダをそのAIエージェントのスキルディレクトリにコピーしてください。

Claude Code — .claude/skills
git clone --depth 1 https://github.com/ur-grue/autopunk-media-skills.git /tmp/autopunk-media-skills
mkdir -p .claude/skills
cp -r /tmp/autopunk-media-skills/.claude/skills/docx .claude/skills/docx
コピー後、新しいスキルを読み込むためにClaude Codeを再起動してください。

TypingMindで使用

TypingMindのチャットでDocxを有効にするだけで、あとはモデルが対応します。名前と説明がシステムプロンプトに含まれ、関連するリクエストがあると、モデルが指示の全文を自動で読み込みます。手動で呼び出す必要はなく、実際に使用されるまでトークンを消費しません。

関連するリクエストがあると、モデルが自動的にDocxを読み込みます。

どのAIモデルでも利用可能

AIスキルはプロバイダー固有のコードではなく、通常のMarkdownで書かれた指示です。そのため、Docxは作成時に想定されたモデルに縛られません。TypingMindに一度インストールすれば、ご自身のAPIキーを使って、GPT-5、Claude、Gemini、Grok、DeepSeek、Mistral、Llama、またはご自身で実行するローカルモデルで利用できます。

  • 必要なときだけ読み込み

    システムプロンプトには名前と説明だけが含まれます。関連するリクエストが初めてあったときに指示を取得するため、未使用のスキルにはコストがかかりません。

  • チャットの途中でモデルを切り替え

    スキルはコードではなく指示なので、モデルを切り替えてもそのまま使えます。次のモデルも同じSKILL.mdを読み込みます。

スキルの指示

モデルが読み込むSKILL.mdの内容です。スキルはモデルが従う指示なので、インストールする前に確認してください。

DOCX Processing Guide

Overview

This guide covers creating, editing, and analyzing Word documents (.docx files). Use this skill when you need to programmatically create new Word documents, make targeted edits to existing files, or extract content.

Creating Documents

Use the docx JavaScript library for programmatic document creation. The library provides a powerful API for building Word documents with full formatting control.

Page Sizing

Always explicitly set page size — docx-js defaults to A4 (11,906 × 16,838 DXA), not US Letter. Specify dimensions using DXA units, where 1 inch = 1440 DXA.

For US Letter (8.5" × 11"):

  • Width: 12,240 DXA
  • Height: 15,840 DXA
  • With standard 1" margins: content area is 10,240 × 13,840 DXA

For landscape orientation, pass portrait dimensions with landscape: true — the library handles internal conversion:

javascript
const doc = new Document({
  sections: [{
    properties: {
      pageHeight: 15840,  // Portrait height
      pageWidth: 12240,   // Portrait width
      landscape: true,    // Library rotates internally
    }
  }]
});

Tables

Tables require dual width specifications. Always specify both columnWidths array AND individual cell width properties, with all values using WidthType.DXA (percentage widths break in Google Docs).

Table width must equal the sum of column widths:

javascript
const columnWidths = [3000, 4000, 3000];  // Total: 10000
const table = new Table({
  columnWidths: columnWidths,
  width: { size: 10000, type: WidthType.DXA },  // Match total
  rows: [
    new TableRow({
      cells: [
        new TableCell({
          children: [...],
          width: { size: 3000, type: WidthType.DXA }
        }),
        // ... more cells
      ]
    })
  ]
});

Use ShadingType.CLEAR for cell background colors to avoid rendering issues.

Bullets and Lists

Never insert bullet points using manual Unicode characters. Instead, use the numbering system with LevelFormat.BULLET:

javascript
new Paragraph({
  text: "Item 1",
  bullet: {
    level: 0
  }
})

Smart Typography

Maintain professional typography with smart quotes and apostrophes via XML entities in the underlying document:

  • “ — Left double quote (")
  • ” — Right double quote (")
  • ’ — Apostrophe/Right single quote (')

These are handled automatically when using standard string methods, but when editing raw XML, use these entities explicitly.

Editing Existing Documents

Use the three-step workflow: unpack → edit → pack.

Step 1: Unpack

Extract the .docx archive into editable XML:

bash
unzip -q input.docx -d unpacked/

Step 2: Edit

Edit files in unpacked/word/document.xml directly. Prefer the Edit tool for transparent string replacement rather than writing custom Python scripts.

When applying tracked changes (revision marks), copy the original run's formatting block (<w:rPr>) to the new run to maintain style consistency:

xml
<!-- Original run with formatting -->
<w:r>
  <w:rPr>
    <w:b/>
    <w:color w:val="FF0000"/>
  </w:rPr>
  <w:t>Original text</w:t>
</w:r>

<!-- New run with revision mark — copy the <w:rPr> block -->
<w:r>
  <w:ins w:id="0" w:author="Editor" w:date="2024-01-15T10:00:00Z"/>
  <w:rPr>
    <w:b/>
    <w:color w:val="FF0000"/>
  </w:rPr>
  <w:t>Edited text</w:t>
</w:r>

When deleting entire paragraphs, mark both the paragraph content AND the paragraph element itself as deleted to prevent empty rows from persisting after change acceptance:

xml
<!-- Mark paragraph deletion at both content and element level -->
<w:del w:id="0" w:author="Editor" w:date="2024-01-15T10:00:00Z">
  <w:p>
    <w:pPr>
      <w:pStyle w:val="Normal"/>
    </w:pPr>
    <w:r>
      <w:annotationStart w:id="0"/>
      <w:t>Deleted paragraph</w:t>
      <w:annotationEnd w:id="0"/>
    </w:r>
  </w:p>
</w:del>

Step 3: Pack

Repack the XML back into a .docx file with validation:

bash
cd unpacked/
zip -r -q ../output.docx word/ _rels/ '[Content_Types].xml' customXml/ 2>/dev/null
cd ..

If validation errors occur, the library has auto-repair capabilities — repack and try again.

Reading Documents

Extract Text

Use pandoc to extract plain text while preserving document structure:

bash
pandoc input.docx -t plain -o output.txt

Access Raw XML

For programmatic content analysis, access the document's underlying XML structure directly via the unpacking method above.

Important Constraints

Line breaks — Never use \n for line breaks within a paragraph. Instead, create separate Paragraph elements or use explicit line break elements.

Page breaks — PageBreak elements must nest within Paragraph containers; they cannot exist at document root level.

ImageRun — When adding images, always specify the explicit type parameter (e.g., type: "picture").

Heading styles — Heading elements require outlineLevel attributes for table-of-contents generation:

javascript
new Paragraph({
  text: "Section Title",
  style: "Heading1",
  outlineLevel: 0
})

Built-in style overrides — Override built-in Word styles using exact identifiers (e.g., "Heading1", "Normal"), not custom names.


See REFERENCE.md for advanced techniques, more examples, and JavaScript library details.

よくある質問

AIスキル「Docx」では何ができますか?

Use this skill whenever the user wants to create or edit .docx (Microsoft Word) files. This includes creating new Word documents from scratch, editing existing Word documents, extracting content from Word files, converting between formats, adding images or other content to Word files, or manipulating Word file structure. If the user mentions .docx, Word, DOCX, or wants to produce a Word document, use this skill.

TypingMindでDocxを使うメリットは何ですか?

一度インストールすれば、どのモデルでも使えるからです。Docxはプロバイダー固有のコードではなく、通常のMarkdownで記述されているため、同じスキルをGPT-5、Claude、Gemini、Grok、ローカルモデルで利用できます。チャットの途中でモデルを切り替えても、そのまま使い続けられます。TypingMindは自分のAPIキーで動作するため、シート単位のサブスクリプションではなく、プロバイダーに直接料金を支払います。スキルとチャットは自分のストレージに保持されます。

TypingMindにDocxをインストールするにはどうすればよいですか?

TypingMindで「プラグイン」→「スキル」→「GitHubからインストール」を開き、https://github.com/ur-grue/autopunk-media-skills/tree/main/.claude/skills/docxを貼り付けてください。TypingMindがSKILL.mdを読み込み、チャットごとに有効にできるスキルとしてインストールします。

Docxを使えるAIモデルはどれですか?

TypingMindに接続したどのモデルでも利用できます。AIスキルはプロバイダー固有のコードではなく、通常のMarkdownで書かれた指示です。そのため、GPT、Claude、Gemini、Grok、ローカルモデルのいずれも、リクエストが合致したときにこのスキルを読み込めます。

Docxは何個のAIモデルで使えますか?

数に制限はありません。スキルに対応したモデルであれば、GPT、Claude、Gemini、Grok、DeepSeek、Mistral、Llamaなど、どのモデルでもDocxを利用できます。すべてTypingMind上で、自分のAPIキーを使って利用できます。

AIスキル「Docx」は無料ですか?

はい。ur-grueがGitHubでMITライセンスの下で公開しています。支払いが必要なのは、利用したトークンに対する、ご自身が契約するAIプロバイダーへの料金だけです。

AIスキルとは何ですか?

AIスキルは、特定のタスクの実行方法をAIモデルに教える、再利用可能な指示のセットです。オープンなAgent Skills形式に従い、名前と説明を含むSKILL.mdファイルに加え、モデルが必要とするスクリプト、テンプレート、参照ファイルで構成されます。モデルはリクエストがスキルに合致したときだけ指示を読み込むため、インストール済みのスキルも、使うまでは費用がかかりません。

AIスキルは、プラグインやMCPサーバーとどう違いますか?

プラグインやMCPサーバーは、モデルが呼び出せる新しいツールを提供します。ツールとは、どこかで実行され、結果を返すコードです。一方、AIスキルは、タスクへの取り組み方、従うべき手順、望ましい出力の例といった知識や進め方をモデルに伝えます。スキルは通常のMarkdownで記述されているため、サーバー、APIキー、実行環境は不要で、どのモデルでも利用できます。

すべて見る

今すぐ自分専用のAIワークスペースを作成

ニュースレターに登録すると、新機能や今後のプレゼント企画のお知らせが届きます👇