Pdf Extract Templateのロゴ

Pdf Extract Template

組織
okou-ai
pdf-extract-template

Extract a template skill from a PDF document for filling slots, reusing structure and expression, or applying its visual style. Use when asked to extract a PDF template or its styles, turn a PDF into a Word template, or analyse a PDF's layout.

概要

公開者okou-ai
リポジトリokou-skills
スキル名pdf-extract-template
スター
81
フォーク
19
同梱ファイル
7
リンク
  • Markdown形式の指示

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

  • どのLLMでも利用可能

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

  • 7個の同梱ファイル

    モデルが作業中に読み取れるスクリプト、テンプレート、参考資料です。ファイルは読み取り専用で、実行されることはありません。

  • オープンソース

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

インストール

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

1

TypingMindにインストール

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

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

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

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

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

TypingMindで使用

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

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

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

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

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

    システムプロンプトには名前と説明だけが含まれます。関連するリクエストが初めてあったときに指示を取得するため、スキルを使わない間は指示の読み込みにトークンを消費しません。

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

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

スキルの指示

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

Extract a template package from a PDF

Input: one .pdf. Output: a loadable skill package whose instructions and resources match the selected reuse scope.

If the original .docx exists, use ../docx/SKILL.md instead. For slide PDFs, use ../presentation/SKILL.md unless the user requested a document template.

Run every command below from extract-template/pdf/.

Create page images to inspect the document's layout, typography and fillable areas, then choose the reuse scope. Keep the original for text and geometry. Reuse existing source captures; otherwise render once at the original page proportions:

bash
node ../scripts/render-document.mjs --input <source.pdf> --out source-render

Inspect the returned page images; the returned PDF is also available for reference. Use a new output directory for each render.

Choose the reuse scope

Read ../document-reuse.md, choose from representative rendered pages and the user's purpose, then use the matching section below. For style extraction, continue at Style extraction.

Slot filling

Copy the source to package/template.pdf. Write package/SKILL.md with the slot map and filling instructions from the shared guide. For each slot, record its page, meaning and filling format. Use an existing PDF form field's name where available; otherwise record the blank's rectangle and text appearance from the page.

Instruct the skill to fill a copy of template.pdf through its form fields or place text within the recorded blank areas. Keep the original page content and artwork intact; do not reconstruct the page or replace its fixed prose. Render the filled copy to verify the values fit and everything outside the slots remains unchanged. Continue at Publish the source package.

Structure and expression reuse

Copy the source to package/example.pdf. Write package/SKILL.md with the structure and writing rules from the shared guide, including source examples of the phrasing, tone and information order to reuse.

Record the layout of the blocks a new document needs, with their typography, spacing and repeat-or-omit rules. Extract reusable artwork into the package when needed. A PDF is a visual and writing example, not an editable paragraph tree: tell the skill how to compose new content into that layout using the example and packaged assets, allowing the recorded parts to grow or repeat. Identify any wording that stays fixed. Render the result and compare both its layout and expression with the example. Continue at Publish the source package.

Publish the source package

bash
node ../scripts/cover-page.mjs --input <the original .pdf> --out cover.png
bash
npx --yes --package="${CLI_PKG_URL}" okou user-template publish \
  --title "<user-visible template name>" \
  --kind document \
  --source <the original .pdf> \
  --cover cover.png \
  --page-count <pageCount from cover-page.mjs> \
  --package package

Keep the source copy in package/; --source supplies the catalog document and does not replace the files a later run needs. Publish without --cover and --page-count only when cover-page.mjs failed; report what it said. Say the template exists only after the command succeeds, then stop.

Style extraction

Prerequisites

bash
pip install pymupdf
python3 scripts/ensure_pandoc.py --dir ./vendor   # then run the export PATH line it prints

1. Analyse

bash
python3 scripts/analyze_pdf.py <source.pdf> --json styles.json

Read the report:

  • [structure tree] present → take the heading levels in step 3 from it.
  • "No text layer" → OCR the PDF first, then restart.
  • [body candidates] → the chosen group must be running prose. If its sample is a table header, an index or a caption, re-run with --body <rank>.

2. Declare the column count

Inspect the source page images. Re-run step 1 with --columns N.

3. Map the heading levels

Under [inferred styles], decide each group's role from its sample text and write the map:

--map 1=Heading1,2=Title,3=Heading2

Right side: Title, Subtitle, Heading1..Heading9 or skip. The largest group is usually the document title, not Heading1.

4. Settle the margins

Use the suggested row. Where measured disagrees with it by more than rounding, measure the page yourself and pass --top, --right or --left in cm. The bottom margin is never measured. Pass --bottom as:

  • the measured bound, when some page is full to the bottom;
  • for a Typst source with a footer, (page height − footer baseline − 0.73 × footer size) / 0.7, in cm;
  • otherwise the mirror of the top, which suggested already holds.

On a two-column document the two columns must come out the same width.

5. Build

bash
python3 scripts/build_reference.py styles.json reference.docx \
        --map 1=Heading1,2=Title,3=Heading2 [--bottom 2.2 ...]

--map keys are the # column of [inferred styles]. Map every group that is a heading; leave captions and footnotes unmapped.

6. Verify

bash
python3 scripts/verify_roundtrip.py reference.docx styles.json \
        --map 1=Heading1,2=Title,3=Heading2

Same --map as step 5. Exit code must be 0. NOT MEASURED is not a failure.

7. Package

bash
python3 scripts/make_package.py <source.pdf> reference.docx styles.json <out dir> \
        --map 1=Heading1,2=Title,3=Heading2 --body 2 [--bottom 2.2 ...]

Pass every flag used in steps 1–5. The output directory name is the skill name; --name overrides it. Add anything the scripts could not measure to the package's Limits.

Optional: adjust styles, add a header or footer

bash
python3 scripts/set_style.py reference.docx --list
python3 scripts/set_style.py reference.docx "Block Text" --size 10.5 --color 6C757D
python3 scripts/set_style.py reference.docx "Source Code" --create --font Consolas --size 9
python3 scripts/set_header_footer.py reference.docx --header "Company" --footer "Page " --page-number
python3 scripts/set_header_footer.py reference.docx --header 'Title\tv2.3'   # left / right

Then step 6 with --structure-only, then step 7.

8. Publish

bash
node ../scripts/cover-page.mjs --input <source.pdf> --out cover.png
bash
npx --yes --package="${CLI_PKG_URL}" okou user-template publish \
  --title "<user-visible template name>" \
  --kind document \
  --source <source.pdf> \
  --cover cover.png \
  --page-count <pageCount from cover-page.mjs> \
  --package <out dir>

Publish without --cover and --page-count only when cover-page.mjs failed; report what it said. Say the template exists only after the command succeeds.

Rules

  • Reproduce the source. Do not correct an inverted hierarchy or a style left at a default; the package records it.
  • Steps 2–4 are not recorded in the PDF. Settle each against the evidence the step names, never the script's default.
  • The running head and foot are rebuilt from [running head/foot]. If that line lists body text, the source has no header; run set_header_footer.py reference.docx --clear.
  • Change the column layout only when asked.

Troubleshooting

SymptomAction
Every heading level is off by oneRedo step 3 from the sample column
Right margin far too largeNo line fills the column; measure it off a page and pass --right
Single-page PDF gives bad marginsRunning heads cannot be detected; measure all four and pass them
Paragraph metrics implausible, or the body candidate is a tableRe-run step 1 with --body <rank>
Body text splits into several groupsReal difference in size, colour or weight; keep the largest, --map <n>=skip the rest
Space after reads NOT MEASUREDNo paragraph is followed by a paragraph; pandoc's default stays
Heading before/after look offset_style.py --before/--after, then step 6 with --structure-only
Verify fails after a deliberate changeRe-run step 6 with --structure-only
Heading gaps near zero on a multi-column source--columns was not passed; redo step 2
A header or footer added later sits a few points offStep 1 sets the distance from the font's hhea metrics; when it printed no hhea line, install the source's font and rerun, or pass set_header_footer.py --header-distance PT --footer-distance PT (page edge to the line box, baseline − 1.16 × size for Noto Sans CJK)
LibreOffice preview shows a smaller gap above a heading than the sourceExpected. LibreOffice takes the larger of space-after and space-before; Word adds them, and the template is written for Word
Title→Subtitle or Subtitle→Heading gap doubles in WordBoth sides carry the same gap (Word adds them, LibreOffice takes the larger). Zero one side: set_style.py reference.docx "Subtitle" --before 0
A paragraph repeated on every page is listed as a running headBody text in the header band. Pass the margins you measured; the styles are unaffected

同梱ファイル

スキルが読み込まれている間、モデルは必要に応じてこれらを読み取ります。読み取り可能なファイルとして提供され、実行されることはありません。

よくある質問

AIスキル「Pdf Extract Template」では何ができますか?

Extract a template skill from a PDF document for filling slots, reusing structure and expression, or applying its visual style. Use when asked to extract a PDF template or its styles, turn a PDF into a Word template, or analyse a PDF's layout.

TypingMindでPdf Extract Templateを使うメリットは何ですか?

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

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

TypingMindで「プラグイン」→「スキル」→「GitHubからインストール」を開き、https://github.com/okou-ai/okou-skills/tree/main/extract-template/pdfを貼り付けてください。TypingMindがSKILL.mdを読み込み、関連ファイルをまとめて、チャットごとに有効にできるスキルとしてインストールします。

Pdf Extract Templateを使えるAIモデルはどれですか?

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

Pdf Extract Templateで使えるAIモデルの数に制限はありますか?

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

AIスキル「Pdf Extract Template」は無料ですか?

okou-aiがGitHubで公開しています。ライセンス条件はリポジトリでご確認ください。ご利用のAIプロバイダーに支払うのは、使用したトークンの料金だけです。

AIスキルとは何ですか?

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

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

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

すべて見る

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

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