All skills
aktsmm avatar

/repurpose-deck-from-reference

@848fd9b
by yamapanaktsmm/agent-skills26 stars
4

Build a new-topic PPTX by reusing an existing reference deck's template (layouts / footers / fonts / palette) while replacing all content from primary sources. Use when "this Scout deck → make a GitHub Copilot app deck", "use this deck as template for new topic", "参照デックの体裁で別内容を作る", "既存 PPTX を流用して別テーマで作り直す". Different from translation (use powerpoint-automation) and from-scratch generation.

Use this Skill: https://skilld.dev/gh/aktsmm/agent-skills/repurpose-deck-from-reference

This session only. Nothing lands on disk.

referencessection-xml-template.md

≈863 tokens on demand. Your agent reads this file only when SKILL.md points to it.

Section XML Template

python-pptx は PowerPoint セクション(左ペインで章分けされるアレ)をサポートしないので、presentation.xml に p14:sectionLst を直接挿入する。

構造

<p:extLst>
  <p:ext uri="{521415D9-36F7-43E2-AB2F-B90AF26B5E84}">
    <p14:sectionLst xmlns:p14="http://schemas.microsoft.com/office/powerpoint/2010/main">
      <p14:section name="A. Overview" id="{NEW-GUID}">
        <p14:sldIdLst>
          <p14:sldId id="2076138485"/>
          <p14:sldId id="2076138486"/>
        </p14:sldIdLst>
      </p14:section>
      <p14:section name="B. Next" id="{NEW-GUID}">
        ...
      </p14:section>
    </p14:sectionLst>
  </p:ext>
</p:extLst>

</p:presentation> の直前に挿入する。

注意

  • セクション名に & < > を含むなら XML escape (&amp; / &lt; / &gt;)
  • id は GUID(uuid.uuid4() で生成)、波括弧 {...} で囲む、大文字
  • p14:sldId id= には presentation.xml の p:sldIdLst で使われている sldId の id 属性値(数値)を使う

実装例

import zipfile, shutil, re, uuid
from pathlib import Path

PATH = Path("...pptx")
TMP = PATH.with_suffix(".tmp.pptx")
P14_NS = "http://schemas.microsoft.com/office/powerpoint/2010/main"
SECTION_EXT_URI = "{521415D9-36F7-43E2-AB2F-B90AF26B5E84}"

SECTIONS = [
    ("A. Overview",                [1, 2, 3, 4]),
    ("B. Sessions の動かし方",      [5, 6, 7, 8]),
    ("C. GitHub 連携",              [9, 10]),
    ("D. Customize &amp; Collaborate", [11, 12]),  # MUST escape
    ("E. 継続実行と Sandboxes",     [13, 14, 15]),
    ("F. 導入と統制",                [16, 17, 18, 19]),
]


def build_section_xml(sld_ids_by_position):
    parts = [f'<p:extLst><p:ext uri="{SECTION_EXT_URI}">'
             f'<p14:sectionLst xmlns:p14="{P14_NS}">']
    for sec_name, positions in SECTIONS:
        sec_id = "{" + str(uuid.uuid4()).upper() + "}"
        parts.append(f'<p14:section name="{sec_name}" id="{sec_id}">'
                     f'<p14:sldIdLst>')
        for pos in positions:
            parts.append(f'<p14:sldId id="{sld_ids_by_position[pos - 1]}"/>')
        parts.append("</p14:sldIdLst></p14:section>")
    parts.append("</p14:sectionLst></p:ext></p:extLst>")
    return "".join(parts)


with zipfile.ZipFile(PATH, "r") as z:
    pres_xml = z.read("ppt/presentation.xml").decode("utf-8")
sld_lst = re.search(r"<p:sldIdLst>(.*?)</p:sldIdLst>", pres_xml, re.S)
sld_ids = re.findall(r'<p:sldId id="(\d+)"', sld_lst.group(1))
section_xml = build_section_xml(sld_ids)
pres_xml = re.sub(r"<p:extLst>.*?</p:extLst>", "", pres_xml, flags=re.S)
pres_xml = pres_xml.replace("</p:presentation>", f"{section_xml}</p:presentation>")
with zipfile.ZipFile(PATH, "r") as zin, zipfile.ZipFile(TMP, "w", zipfile.ZIP_DEFLATED) as zout:
    for item in zin.infolist():
        data = zin.read(item.filename)
        if item.filename == "ppt/presentation.xml":
            data = pres_xml.encode("utf-8")
        zout.writestr(item, data)
shutil.move(str(TMP), str(PATH))

Done Criteria

  • 全 section 名の & が &amp; に escape されている
  • 全 GUID が大文字、{...} で囲まれている
  • p14:sldId id= に渡す数値が presentation.xml の sldIdLst に実在する
  • 挿入後、python com_test.py で COM Open が通る
  • PowerPoint で開いてサイドペインに章が表示される

Source: SKILL.md on GitHub

2 warnings3mo3 checks · Risk MEDIUM
  • Gen Agent Trust Hub3mo

    The skill automates PowerPoint creation but utilizes sensitive system commands, including forcing process termination and dynamic code execution to modify scripts. It also includes screenshot capabilities that capture user interface content, requiring strict adherence to privacy masking guidelines.

  • Socket3mo

    No alerts

  • Snyk3mo

    Risk: MEDIUM · 2 issues

Signed by skilld at 848fd9b. This ties the file your Agent reads to that commit on GitHub. It does not review the instructions.

Last checked against GitHub 17 hours ago.

Activeupdated 3 months ago
argument-hint
<reference.pptx> と <new topic> + 一次情報 URL / 出典
user-invocable
true
metadata
{
  "author": "yamapan (https://github.com/aktsmm)"
}

README badge

README badge for aktsmm/agent-skills/repurpose-deck-from-reference