<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>Forem: 陈旭元</title>
    <description>The latest articles on Forem by 陈旭元 (@_5656341800444985fe37f3).</description>
    <link>https://forem.com/_5656341800444985fe37f3</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F3852519%2F3e112c48-8c41-4369-90c6-23a831949309.png</url>
      <title>Forem: 陈旭元</title>
      <link>https://forem.com/_5656341800444985fe37f3</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://forem.com/feed/_5656341800444985fe37f3"/>
    <language>en</language>
    <item>
      <title>I Built an AI Agent Skill That Edits PowerPoint Speaker Notes via XML — Here's How</title>
      <dc:creator>陈旭元</dc:creator>
      <pubDate>Tue, 31 Mar 2026 05:37:29 +0000</pubDate>
      <link>https://forem.com/_5656341800444985fe37f3/i-built-an-ai-agent-skill-that-edits-powerpoint-speaker-notes-via-xml-heres-how-2aea</link>
      <guid>https://forem.com/_5656341800444985fe37f3/i-built-an-ai-agent-skill-that-edits-powerpoint-speaker-notes-via-xml-heres-how-2aea</guid>
      <description>&lt;p&gt;Most AI + PPTX tools create slides. I built one that only edits &lt;strong&gt;speaker notes&lt;/strong&gt; — the text presenters read while presenting.&lt;/p&gt;

&lt;p&gt;Here's the technical deep dive.&lt;/p&gt;

&lt;h3&gt;
  
  
  The Problem
&lt;/h3&gt;

&lt;p&gt;30-slide quarterly review deck, slides are done, speaker notes are empty on all 30 pages. Manual writing: 3-4 hours. python-pptx script: 1-2 hours of debugging XML mapping and escape characters.&lt;/p&gt;

&lt;p&gt;There are 300+ AI presentation tools. 99% focus on creating slides. Almost none touch speaker notes.&lt;/p&gt;

&lt;h3&gt;
  
  
  PPTX Internals: What You Need to Know
&lt;/h3&gt;

&lt;p&gt;PPTX files are ZIP archives of XML following ECMA-376 (ISO/IEC 29500). Unzip one and you'll see:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;pptx-unpacked/
├── ppt/
│   ├── slides/
│   │   ├── slide1.xml
│   │   └── _rels/
│   │       └── slide1.xml.rels
│   ├── notesSlides/
│   │   ├── notesSlide1.xml
│   │   └── notesSlide2.xml
│   └── _rels/
│       └── presentation.xml.rels
└── [Content_Types].xml
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Notes text lives in &lt;code&gt;&amp;lt;a:t&amp;gt;&lt;/code&gt; tags (DrawingML namespace) inside &lt;code&gt;ppt/notesSlides/notesSlideN.xml&lt;/code&gt;.&lt;/p&gt;

&lt;h3&gt;
  
  
  The notesSlide Mapping Trap
&lt;/h3&gt;

&lt;p&gt;Here's the non-obvious part: &lt;strong&gt;&lt;code&gt;notesSlide3.xml&lt;/code&gt; is NOT always slide 3&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;When you delete, reorder, or edit slides across different PowerPoint versions, notes file numbering gets gaps or misalignments. The real mapping is in &lt;code&gt;.rels&lt;/code&gt; files:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight xml"&gt;&lt;code&gt;&lt;span class="c"&gt;&amp;lt;!-- slide5.xml.rels --&amp;gt;&lt;/span&gt;
&lt;span class="nt"&gt;&amp;lt;Relationship&lt;/span&gt; &lt;span class="na"&gt;Id=&lt;/span&gt;&lt;span class="s"&gt;"rId2"&lt;/span&gt;
  &lt;span class="na"&gt;Type=&lt;/span&gt;&lt;span class="s"&gt;"http://schemas.openxmlformats.org/officeDocument/2006/relationships/notesSlide"&lt;/span&gt;
  &lt;span class="na"&gt;Target=&lt;/span&gt;&lt;span class="s"&gt;"../notesSlides/notesSlide3.xml"&lt;/span&gt;&lt;span class="nt"&gt;/&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This means slide 5's notes are in &lt;code&gt;notesSlide3.xml&lt;/code&gt;. Edit by number, and you'll modify the wrong page.&lt;/p&gt;

&lt;p&gt;The skill resolves this automatically:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="k"&gt;for &lt;/span&gt;f &lt;span class="k"&gt;in &lt;/span&gt;pptx-unpacked/ppt/slides/_rels/slide&lt;span class="k"&gt;*&lt;/span&gt;.xml.rels&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="k"&gt;do
  &lt;/span&gt;&lt;span class="nv"&gt;slide&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="si"&gt;$(&lt;/span&gt;&lt;span class="nb"&gt;basename&lt;/span&gt; &lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="nv"&gt;$f&lt;/span&gt;&lt;span class="s2"&gt;"&lt;/span&gt; .xml.rels&lt;span class="si"&gt;)&lt;/span&gt;
  &lt;span class="nv"&gt;notes&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="si"&gt;$(&lt;/span&gt;&lt;span class="nb"&gt;grep&lt;/span&gt; &lt;span class="nt"&gt;-o&lt;/span&gt; &lt;span class="s1"&gt;'notesSlide[0-9]*\.xml'&lt;/span&gt; &lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="nv"&gt;$f&lt;/span&gt;&lt;span class="s2"&gt;"&lt;/span&gt; | &lt;span class="nb"&gt;head&lt;/span&gt; &lt;span class="nt"&gt;-1&lt;/span&gt;&lt;span class="si"&gt;)&lt;/span&gt;
  &lt;span class="o"&gt;[&lt;/span&gt; &lt;span class="nt"&gt;-n&lt;/span&gt; &lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="nv"&gt;$notes&lt;/span&gt;&lt;span class="s2"&gt;"&lt;/span&gt; &lt;span class="o"&gt;]&lt;/span&gt; &lt;span class="o"&gt;&amp;amp;&amp;amp;&lt;/span&gt; &lt;span class="nb"&gt;echo&lt;/span&gt; &lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="nv"&gt;$slide&lt;/span&gt;&lt;span class="s2"&gt; -&amp;gt; &lt;/span&gt;&lt;span class="nv"&gt;$notes&lt;/span&gt;&lt;span class="s2"&gt;"&lt;/span&gt;
&lt;span class="k"&gt;done&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  How the Skill Works
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Unpack PPTX → Resolve mapping → Read ALL slides → Generate drafts → User confirms → Write XML → Repack + verify
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The critical design decision: &lt;strong&gt;read the whole deck before writing any notes&lt;/strong&gt;. This prevents the common problem where page-by-page generation produces repetitive, disconnected notes.&lt;/p&gt;

&lt;h3&gt;
  
  
  XML Escape Handling
&lt;/h3&gt;

&lt;p&gt;Notes text may contain special characters that must be escaped:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Character&lt;/th&gt;
&lt;th&gt;XML Escape&lt;/th&gt;
&lt;th&gt;Required&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;&amp;amp;&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;&lt;code&gt;&amp;amp;amp;&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Always&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;&amp;lt;&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;&lt;code&gt;&amp;amp;lt;&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Always&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;&amp;gt;&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;&lt;code&gt;&amp;amp;gt;&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Recommended&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;"&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;&lt;code&gt;&amp;amp;quot;&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;In attributes&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;Multi-paragraph notes use separate &lt;code&gt;&amp;lt;a:p&amp;gt;&lt;/code&gt; elements, each with its own &lt;code&gt;&amp;lt;a:t&amp;gt;&lt;/code&gt; tag. You must preserve the full tag structure when editing.&lt;/p&gt;

&lt;h3&gt;
  
  
  Comparison with python-pptx
&lt;/h3&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Aspect&lt;/th&gt;
&lt;th&gt;python-pptx&lt;/th&gt;
&lt;th&gt;pptx-notes-editor&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Programming required&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Python&lt;/td&gt;
&lt;td&gt;None (natural language)&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Mapping detection&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Manual&lt;/td&gt;
&lt;td&gt;Automatic&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Context analysis&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Not supported&lt;/td&gt;
&lt;td&gt;Reads whole deck first&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;XML escaping&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Library handles&lt;/td&gt;
&lt;td&gt;Skill handles&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Writing styles&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Fixed template&lt;/td&gt;
&lt;td&gt;4 styles + custom&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Interactive confirm&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;No&lt;/td&gt;
&lt;td&gt;Page-by-page approval&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Notes export&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Requires code&lt;/td&gt;
&lt;td&gt;One command to Markdown&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;h3&gt;
  
  
  Install
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;mkdir&lt;/span&gt; &lt;span class="nt"&gt;-p&lt;/span&gt; ~/.claude/skills/pptx-notes-editor &lt;span class="o"&gt;&amp;amp;&amp;amp;&lt;/span&gt; curl &lt;span class="nt"&gt;-fsSL&lt;/span&gt; https://raw.githubusercontent.com/cm8421/pptx-notes-editor/main/SKILL.md &lt;span class="nt"&gt;-o&lt;/span&gt; ~/.claude/skills/pptx-notes-editor/SKILL.md

/skill &lt;span class="nb"&gt;install&lt;/span&gt; @cm8421/pptx-notes-editor
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Usage
&lt;/h3&gt;

&lt;p&gt;Just say what you want:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;"Rewrite speaker notes in narrative style"&lt;br&gt;
"Export all notes to markdown"&lt;br&gt;
"Add verbatim scripts to pages 5-10"&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;All operations are &lt;strong&gt;local&lt;/strong&gt; — no file uploads, no API calls.&lt;/p&gt;

&lt;p&gt;GitHub: &lt;a href="https://github.com/cm8421/pptx-notes-editor" rel="noopener noreferrer"&gt;https://github.com/cm8421/pptx-notes-editor&lt;/a&gt;&lt;/p&gt;

</description>
      <category>pptx</category>
      <category>ai</category>
      <category>productivity</category>
      <category>opensource</category>
    </item>
  </channel>
</rss>
