mcpField
P
ppt-template-creator

ppt-template-creator

github.com/anthropicsエージェントワークフロー40.9k2.3k 回インストール今日更新
リポジトリ

ppt-template-creator について

PowerPointテンプレートから、プレゼンテーションを直接作るのではなく、再利用可能な生成スキルを作成します。レイアウトとプレースホルダーを分析し、テンプレートや自己完結型の手順、サンプルをまとめます。

主な機能

  1. 01レイアウトとプレースホルダーの分析
  2. 02コンテンツ領域の境界記録
  3. 03assetsへのテンプレート格納
  4. 04自己完結型SKILL.mdの作成
  5. 05サンプル資料による検証

活用シーン

  1. 01企業テンプレートを再利用可能なスキルに変換
  2. 02スライド生成用のプレースホルダー位置を記録
  3. 03テンプレートベースの資料作成ワークフローを検証

インストール

コマンドをコピーしてターミナルで実行します。

$npx skills add https://github.com/anthropics/financial-services --skill ppt-template-creator

インストール後、Claude Code で/ppt-template-creatorを入力して読み込まれたか確認します。

詳細

PPT テンプレート作成ツール

このスキルはプレゼンテーションではなく、スキルを作成します。 PowerPoint テンプレートを、後からプレゼンテーションを生成できる再利用可能なスキルにしたい場合に使用します。プレゼンテーションを作成したいだけの場合は、代わりに pptx スキルを使用してください。

生成されるスキルには次のものが含まれます:

  • assets/template.pptx - テンプレートファイル
  • SKILL.md - 完全な手順(このメタスキルへの参照は不要です)

スキル構築全般のベストプラクティスについては、skill-creator スキルを参照してください。このスキルでは、PPT 固有のパターンに焦点を当てています。

ワークフロー

  1. ユーザーがテンプレートを提供する(.pptx または .potx)
  2. テンプレートを分析する - レイアウト、プレースホルダー、寸法を抽出します
  3. スキルを初期化する - skill-creator スキルを使用してスキルの構造を設定します
  4. テンプレートを追加する - .pptx を assets/template.pptx にコピーします
  5. SKILL.md を作成する - PPT 固有の詳細を含め、以下のテンプレートに従います
  6. サンプルを作成する - 検証用のサンプルプレゼンテーションを生成します
  7. パッケージ化する - skill-creator スキルを使用して .skill ファイルにパッケージ化します

ステップ 2:テンプレートを分析する

重要:プレースホルダーの位置を正確に抽出してください - これによってコンテンツ領域の境界が決まります。

from pptx import Presentation

prs = Presentation(template_path)
print(f"Dimensions: {prs.slide_width/914400:.2f}\" x {prs.slide_height/914400:.2f}\"")
print(f"Layouts: {len(prs.slide_layouts)}")

for idx, layout in enumerate(prs.slide_layouts):
    print(f"\n[{idx}] {layout.name}:")
    for ph in layout.placeholders:
        try:
            ph_idx = ph.placeholder_format.idx
            ph_type = ph.placeholder_format.type
            # IMPORTANT: Extract exact positions in inches
            left = ph.left / 914400
            top = ph.top / 914400
            width = ph.width / 914400
            height = ph.height / 914400
            print(f"    idx={ph_idx}, type={ph_type}")
            print(f"        x={left:.2f}\", y={top:.2f}\", w={width:.2f}\", h={height:.2f}\"")
        except:
            pass

記録する主な測定項目:

  • タイトルの位置:タイトルのプレースホルダーはどこにありますか?
  • サブタイトル/説明:サブタイトルの行はどこにありますか?
  • フッターのプレースホルダー:フッターや出典はどこに表示されますか?
  • コンテンツ領域:サブタイトルとフッターの間の空間がコンテンツ領域です
コンテンツの開始位置を正確に見つける

重要: コンテンツ領域は、必ずしもサブタイトルのプレースホルダーの直後から始まるとは限りません。多くのテンプレートでは、サブタイトルとコンテンツ領域の間に視覚的な枠線、線、または予約されたスペースがあります。

最適な方法: オブジェクトのプレースホルダーがあるレイアウト 2 や、それに類する「コンテンツ」レイアウトを確認します。このプレースホルダーの y 位置は、コンテンツを実際に開始すべき位置を示します。

# Find the OBJECT placeholder to determine true content start
for idx, layout in enumerate(prs.slide_layouts):
    for ph in layout.placeholders:
        try:
            if ph.placeholder_format.type == 7:  # OBJECT type
                top = ph.top / 914400
                print(f"Layout [{idx}] {layout.name}: OBJECT starts at y={top:.2f}\"")
                # This y value is where your content should start!
        except:
            pass

例: テンプレートによっては、次のようになっている場合があります:

  • サブタイトルの末尾が y=1.38"
  • しかし、OBJECT プレースホルダーは y=1.90" から始まる
  • この間隔(0.52")は枠線や線のために予約されています。ここにコンテンツを配置しないでください

サブタイトルの末尾ではなく、OBJECT プレースホルダーの y 位置をコンテンツの開始位置として使用してください。

ステップ 5:SKILL.md を作成する

生成されるスキルは、次の構造にしてください:

[company]-ppt-template/
├── SKILL.md
└── assets/
    └── template.pptx
生成される SKILL.md のテンプレート

生成される SKILL.md は、すべての手順を埋め込んだ自己完結型にする必要があります。このテンプレートを使用し、分析結果に基づいて角括弧内の値を埋めてください:

---
name: [company]-ppt-template
description: [Company] PowerPoint template for creating presentations. Use when creating [Company]-branded pitch decks, board materials, or client presentations.
---

# [Company] PPT Template

Template: `assets/template.pptx` ([WIDTH]" x [HEIGHT]", [N] layouts)

## Creating Presentations

```python
from pptx import Presentation

prs = Presentation("path/to/skill/assets/template.pptx")

# DELETE all existing slides first
while len(prs.slides) > 0:
    rId = prs.slides._sldIdLst[0].rId
    prs.part.drop_rel(rId)
    del prs.slides._sldIdLst[0]

# Add slides from layouts
slide = prs.slides.add_slide(prs.slide_layouts[LAYOUT_IDX])
```

## Key Layouts

| Index | Name | Use For |
|-------|------|---------|
| [0] | [Layout Name] | [Cover/title slide] |
| [N] | [Layout Name] | [Content with bullets] |
| [N] | [Layout Name] | [Two-column layout] |

## Placeholder Mapping

**CRITICAL: Include exact positions (x, y coordinates) for each placeholder.**

### Layout [N]: [Name]
| idx | Type | Position | Use |
|-----|------|----------|-----|
| [idx] | TITLE (1) | y=[Y]" | Slide title |
| [idx] | BODY (2) | y=[Y]" | Subtitle/description |
| [idx] | BODY (2) | y=[Y]" | Footer |
| [idx] | BODY (2) | y=[Y]" | Source/notes |

### Content Area Boundaries

**Document the safe content area for custom shapes/tables/charts:**

```
Content Area (for Layout [N]):
- Left margin: [X]" (content starts here)
- Top: [Y]" (below subtitle placeholder)
- Width: [W]"
- Height: [H]" (ends before footer)

For 4-quadrant layouts:
- Left column: x=[X]", width=[W]"
- Right column: x=[X]", width=[W]"
- Top row: y=[Y]", height=[H]"
- Bottom row: y=[Y]", height=[H]"
```

**Why this matters:** Custom content (textboxes, tables, charts) must stay within these boundaries to avoid overlapping with template placeholders like titles, footers, and source lines.

## Filling Content

**Do NOT add manual bullet characters** - slide master handles formatting.

```python
# Fill title
for shape in slide.shapes:
    if hasattr(shape, 'placeholder_format'):
        if shape.placeholder_format.type == 1:  # TITLE
            shape.text = "Slide Title"

# Fill content with hierarchy (level 0 = header, level 1 = bullet)
for shape in slide.shapes:
    if hasattr(shape, 'placeholder_format'):
        idx = shape.placeholder_format.idx
        if idx == [CONTENT_IDX]:
            tf = shape.text_frame
            for para in tf.paragraphs:
                para.clear()

            content = [
                ("Section Header", 0),
                ("First bullet point", 1),
                ("Second bullet point", 1),
            ]

            tf.paragraphs[0].text = content[0][0]
            tf.paragraphs[0].level = content[0][1]
            for text, level in content[1:]:
                p = tf.add_paragraph()
                p.text = text
                p.level = level
```

## Example: Cover Slide

```python
slide = prs.slides.add_slide(prs.slide_layouts[[COVER_IDX]])
for shape in slide.shapes:
    if hasattr(shape, 'placeholder_format'):
        idx = shape.placeholder_format.idx
        if idx == [TITLE_IDX]:
            shape.text = "Company Name"
        elif idx == [SUBTITLE_IDX]:
            shape.text = "Presentation Title | Date"
```

## Example: Content Slide

```python
slide = prs.slides.add_slide(prs.slide_layouts[[CONTENT_IDX]])
for shape in slide.shapes:
    if hasattr(shape, 'placeholder_format'):
        ph_type = shape.placeholder_format.type
        idx = shape.placeholder_format.idx
        if ph_type == 1:
            shape.text = "Executive Summary"
        elif idx == [BODY_IDX]:
            tf = shape.text_frame
            for para in tf.paragraphs:
                para.clear()
            content = [
                ("Key Findings", 0),
                ("Revenue grew 40% YoY to $50M", 1),
                ("Expanded to 3 new markets", 1),
                ("Recommendation", 0),
                ("Proceed with strategic initiative", 1),
            ]
            tf.paragraphs[0].text = content[0][0]
            tf.paragraphs[0].level = content[0][1]
            for text, level in content[1:]:
                p = tf.add_paragraph()
                p.text = text
                p.level = level
```

ステップ 6:出力例を作成する

スキルが正しく動作することを検証するため、サンプルプレゼンテーションを生成します。参照用として、スキルと同じ場所に保存してください。

生成されるスキルの PPT 固有ルール

  1. assets/ にテンプレートを配置する - .pptx ファイルは必ず同梱します
  2. 自己完結型の SKILL.md - すべての手順を埋め込み、外部参照は含めません
  3. 手動で箇条書きを作成しない - 階層構造には paragraph.level を使用します
  4. 最初にスライドを削除する - 新しいスライドを追加する前に、既存のスライドを必ずクリアします
  5. プレースホルダーを idx で記録する - プレースホルダーの idx 値はテンプレート固有です

コメント