jpskill.com
📄 ドキュメント コミュニティ

pdf-merge-split

複数のPDFファイルを一つにまとめたり、逆にPDFファイルをページごとに分割したりできるSkillで、ページの範囲指定や順番のカスタマイズも可能です。

📜 元の英語説明(参考)

Combine multiple PDFs into one or split a PDF into separate files. Use when a user asks to merge PDFs, combine PDF files, join documents together, split a PDF into pages, extract pages from a PDF, or separate a PDF into parts. Supports page range selection and custom ordering.

🇯🇵 日本人クリエイター向け解説

一言でいうと

複数のPDFファイルを一つにまとめたり、逆にPDFファイルをページごとに分割したりできるSkillで、ページの範囲指定や順番のカスタマイズも可能です。

※ jpskill.com 編集部が日本のビジネス現場向けに補足した解説です。Skill本体の挙動とは独立した参考情報です。

⚡ おすすめ: コマンド1行でインストール(60秒)

下記のコマンドをコピーしてターミナル(Mac/Linux)または PowerShell(Windows)に貼り付けてください。 ダウンロード → 解凍 → 配置まで全自動。

🍎 Mac / 🐧 Linux
mkdir -p ~/.claude/skills && cd ~/.claude/skills && curl -L -o pdf-merge-split.zip https://jpskill.com/download/15242.zip && unzip -o pdf-merge-split.zip && rm pdf-merge-split.zip
🪟 Windows (PowerShell)
$d = "$env:USERPROFILE\.claude\skills"; ni -Force -ItemType Directory $d | Out-Null; iwr https://jpskill.com/download/15242.zip -OutFile "$d\pdf-merge-split.zip"; Expand-Archive "$d\pdf-merge-split.zip" -DestinationPath $d -Force; ri "$d\pdf-merge-split.zip"

完了後、Claude Code を再起動 → 普通に「動画プロンプト作って」のように話しかけるだけで自動発動します。

💾 手動でダウンロードしたい(コマンドが難しい人向け)
  1. 1. 下の青いボタンを押して pdf-merge-split.zip をダウンロード
  2. 2. ZIPファイルをダブルクリックで解凍 → pdf-merge-split フォルダができる
  3. 3. そのフォルダを C:\Users\あなたの名前\.claude\skills\(Win)または ~/.claude/skills/(Mac)へ移動
  4. 4. Claude Code を再起動

⚠️ ダウンロード・利用は自己責任でお願いします。当サイトは内容・動作・安全性について責任を負いません。

🎯 このSkillでできること

下記の説明文を読むと、このSkillがあなたに何をしてくれるかが分かります。Claudeにこの分野の依頼をすると、自動で発動します。

📦 インストール方法 (3ステップ)

  1. 1. 上の「ダウンロード」ボタンを押して .skill ファイルを取得
  2. 2. ファイル名の拡張子を .skill から .zip に変えて展開(macは自動展開可)
  3. 3. 展開してできたフォルダを、ホームフォルダの .claude/skills/ に置く
    • · macOS / Linux: ~/.claude/skills/
    • · Windows: %USERPROFILE%\.claude\skills\

Claude Code を再起動すれば完了。「このSkillを使って…」と話しかけなくても、関連する依頼で自動的に呼び出されます。

詳しい使い方ガイドを見る →
最終更新
2026-05-18
取得日時
2026-05-18
同梱ファイル
1

📖 Skill本文(日本語訳)

※ 原文(英語/中国語)を Gemini で日本語化したものです。Claude 自身は原文を読みます。誤訳がある場合は原文をご確認ください。

PDF 結合 & 分割

概要

複数の PDF ファイルを単一のドキュメントに結合したり、PDF をページ範囲ごとに分割したりします。このスキルは、指定された順序での結合、ページ番号による分割、特定のページの抽出を処理し、可能な限りブックマークとメタデータを保持します。

手順

ユーザーが PDF ファイルの結合または分割を要求した場合、次の手順に従ってください。

ステップ 1: 操作の決定

ユーザーのニーズを尋ねるか、推測します。

  • Merge: 複数の PDF を 1 つの出力ファイルに結合します。
  • Split by pages: 単一の PDF をページ範囲ごとに複数のファイルに分割します。
  • Extract pages: 特定のページを新しい PDF に抽出します。
  • Split by size: PDF を N ページずつのチャンクに分割します。

ステップ 2: 入力ファイルの検証

すべての入力ファイルが存在し、有効な PDF であることを確認します。

import os
from PyPDF2 import PdfReader

def validate_pdfs(file_paths):
    results = []
    for path in file_paths:
        if not os.path.exists(path):
            results.append({"file": path, "status": "not found"})
            continue
        try:
            reader = PdfReader(path)
            results.append({
                "file": path,
                "status": "valid",
                "pages": len(reader.pages)
            })
        except Exception as e:
            results.append({"file": path, "status": f"invalid: {e}"})
    return results

ステップ 3: 操作の実行

結合の場合:

from PyPDF2 import PdfMerger

def merge_pdfs(input_paths, output_path):
    merger = PdfMerger()
    for path in input_paths:
        merger.append(path)
    merger.write(output_path)
    merger.close()
    return output_path

ページ範囲による分割の場合:

from PyPDF2 import PdfReader, PdfWriter

def split_pdf(input_path, ranges, output_dir="."):
    reader = PdfReader(input_path)
    output_files = []
    for i, (start, end) in enumerate(ranges):
        writer = PdfWriter()
        for page_num in range(start - 1, min(end, len(reader.pages))):
            writer.add_page(reader.pages[page_num])
        output_path = os.path.join(output_dir, f"split_{i+1}_pages_{start}-{end}.pdf")
        with open(output_path, "wb") as f:
            writer.write(f)
        output_files.append(output_path)
    return output_files

特定のページの抽出の場合:

def extract_pages(input_path, page_numbers, output_path):
    reader = PdfReader(input_path)
    writer = PdfWriter()
    for page_num in page_numbers:
        if 1 <= page_num <= len(reader.pages):
            writer.add_page(reader.pages[page_num - 1])
    with open(output_path, "wb") as f:
        writer.write(f)
    return output_path

ステップ 4: 結果の検証と報告

操作後、出力を検証します。

  1. 出力ファイルが存在し、有効な PDF であることを確認します。
  2. 各出力ファイルのページ数を報告します。
  3. ユーザーにファイルサイズを表示します。

例 1: 3 つのレポートを 1 つに結合する

ユーザーリクエスト: "report-q1.pdf、report-q2.pdf、および report-q3.pdf を annual-report.pdf に結合してください"

実行されたアクション:

  1. 3 つの入力ファイルすべてを検証します。
  2. 指定された順序で結合します。
  3. annual-report.pdf に書き込みます。

出力:

3 つの PDF ファイルを annual-report.pdf に結合しました

入力ファイル:
  1. report-q1.pdf (12 ページ)
  2. report-q2.pdf (15 ページ)
  3. report-q3.pdf (11 ページ)

出力: annual-report.pdf (38 ページ, 2.4 MB)

例 2: PDF を章ごとに分割する

ユーザーリクエスト: "textbook.pdf を個別のファイルに分割してください: 1-30 ページ、31-55 ページ、56-80 ページ"

実行されたアクション:

  1. textbook.pdf (80 ページ) を検証します。
  2. 3 つのページ範囲に分割します。
  3. 各範囲を個別のファイルとして保存します。

出力:

textbook.pdf を 3 つのファイルに分割しました:

  1. split_1_pages_1-30.pdf   (30 ページ, 1.1 MB)
  2. split_2_pages_31-55.pdf  (25 ページ, 0.9 MB)
  3. split_3_pages_56-80.pdf  (25 ページ, 0.8 MB)

すべてのファイルは現在のディレクトリに保存されました。

例 3: 特定のページを抽出する

ユーザーリクエスト: "presentation.pdf から 5、12、および 18-22 ページを抽出してください"

実行されたアクション:

  1. ページ指定を解析します: [5, 12, 18, 19, 20, 21, 22]
  2. それらのページを presentation.pdf から抽出します。
  3. extracted_pages.pdf として保存します。

出力:

presentation.pdf から 7 ページを抽出しました

抽出されたページ: 5, 12, 18, 19, 20, 21, 22
出力: extracted_pages.pdf (7 ページ, 540 KB)

ガイドライン

  • 処理する前に、必ず入力ファイルを検証してください。ファイルが見つからない場合や破損している場合は、明確なエラーを報告してください。
  • 元のファイルを保持してください。入力 PDF をインプレースで変更しないでください。
  • 結合する場合、ユーザーが指定した順序を尊重してください。順序が指定されていない場合は、アルファベット順を使用してください。
  • ユーザーが PDF ビューアで見るものと一致するように、すべてのユーザー向けの出力で 1 から始まるページ番号を使用してください。
  • 暗号化された PDF の場合は、処理する前にパスワードが必要であることをユーザーに通知してください。
  • 分割するときは、ページ範囲を含むわかりやすいファイル名を作成してください。
  • ユーザーが出力の規模を把握できるように、ページ数とともにファイルサイズを報告してください。
  • pip install PyPDF2 で PyPDF2 をインストールしてください(利用できない場合)。フォームフィールドの保持などの高度な機能については、代わりに pikepdf を使用してください。
📜 原文 SKILL.md(Claudeが読む英語/中国語)を展開

PDF Merge & Split

Overview

Combine multiple PDF files into a single document or split a PDF into separate files by page ranges. This skill handles merging in a specified order, splitting by page numbers, extracting specific pages, and preserving bookmarks and metadata where possible.

Instructions

When a user asks to merge or split PDF files, follow these steps:

Step 1: Determine the operation

Ask or infer what the user needs:

  • Merge: Combine multiple PDFs into one output file
  • Split by pages: Break a single PDF into multiple files by page ranges
  • Extract pages: Pull specific pages out into a new PDF
  • Split by size: Divide a PDF into chunks of N pages each

Step 2: Validate the input files

Check that all input files exist and are valid PDFs:

import os
from PyPDF2 import PdfReader

def validate_pdfs(file_paths):
    results = []
    for path in file_paths:
        if not os.path.exists(path):
            results.append({"file": path, "status": "not found"})
            continue
        try:
            reader = PdfReader(path)
            results.append({
                "file": path,
                "status": "valid",
                "pages": len(reader.pages)
            })
        except Exception as e:
            results.append({"file": path, "status": f"invalid: {e}"})
    return results

Step 3: Perform the operation

For merging:

from PyPDF2 import PdfMerger

def merge_pdfs(input_paths, output_path):
    merger = PdfMerger()
    for path in input_paths:
        merger.append(path)
    merger.write(output_path)
    merger.close()
    return output_path

For splitting by page ranges:

from PyPDF2 import PdfReader, PdfWriter

def split_pdf(input_path, ranges, output_dir="."):
    reader = PdfReader(input_path)
    output_files = []
    for i, (start, end) in enumerate(ranges):
        writer = PdfWriter()
        for page_num in range(start - 1, min(end, len(reader.pages))):
            writer.add_page(reader.pages[page_num])
        output_path = os.path.join(output_dir, f"split_{i+1}_pages_{start}-{end}.pdf")
        with open(output_path, "wb") as f:
            writer.write(f)
        output_files.append(output_path)
    return output_files

For extracting specific pages:

def extract_pages(input_path, page_numbers, output_path):
    reader = PdfReader(input_path)
    writer = PdfWriter()
    for page_num in page_numbers:
        if 1 <= page_num <= len(reader.pages):
            writer.add_page(reader.pages[page_num - 1])
    with open(output_path, "wb") as f:
        writer.write(f)
    return output_path

Step 4: Verify and report results

After the operation, verify the output:

  1. Confirm the output file exists and is a valid PDF
  2. Report the page count of each output file
  3. Show file sizes for the user

Examples

Example 1: Merge three reports into one

User request: "Combine report-q1.pdf, report-q2.pdf, and report-q3.pdf into annual-report.pdf"

Actions taken:

  1. Validate all three input files
  2. Merge in the specified order
  3. Write to annual-report.pdf

Output:

Merged 3 PDF files into annual-report.pdf

Input files:
  1. report-q1.pdf (12 pages)
  2. report-q2.pdf (15 pages)
  3. report-q3.pdf (11 pages)

Output: annual-report.pdf (38 pages, 2.4 MB)

Example 2: Split a PDF into chapters

User request: "Split textbook.pdf into separate files: pages 1-30, 31-55, 56-80"

Actions taken:

  1. Validate textbook.pdf (80 pages)
  2. Split into three page ranges
  3. Save each range as a separate file

Output:

Split textbook.pdf into 3 files:

  1. split_1_pages_1-30.pdf   (30 pages, 1.1 MB)
  2. split_2_pages_31-55.pdf  (25 pages, 0.9 MB)
  3. split_3_pages_56-80.pdf  (25 pages, 0.8 MB)

All files saved to current directory.

Example 3: Extract specific pages

User request: "Pull out pages 5, 12, and 18-22 from presentation.pdf"

Actions taken:

  1. Parse the page specification: [5, 12, 18, 19, 20, 21, 22]
  2. Extract those pages from presentation.pdf
  3. Save as extracted_pages.pdf

Output:

Extracted 7 pages from presentation.pdf

Pages extracted: 5, 12, 18, 19, 20, 21, 22
Output: extracted_pages.pdf (7 pages, 540 KB)

Guidelines

  • Always validate input files before processing. Report clear errors for missing or corrupt files.
  • Preserve the original files. Never modify input PDFs in place.
  • When merging, respect the order specified by the user. If no order is given, use alphabetical.
  • Use 1-based page numbering in all user-facing output to match what users see in PDF viewers.
  • For encrypted PDFs, inform the user that a password is needed before processing.
  • When splitting, create descriptive filenames that include page ranges.
  • Report file sizes alongside page counts so the user knows the output scale.
  • Install PyPDF2 with pip install PyPDF2 if not available. For advanced features like preserving form fields, use pikepdf instead.