Skip to content

Turn any AI agent into an AI Scientist. The #1 Agent Skills library for science, used by 250,000+ scientists worldwide. 177 ready-to-use validated skills plus 100+ scientific databases covering biology, chemistry, medicine, and drug discovery. Compatible with Cursor, Claude Code, Codex, Pi, Antigravity, and the open Agent Skills standard.

Redesign PPTX poster generation

Timothy Kassis866c1dfba95b
diff --git a/skills/pptx-posters/SKILL.md b/skills/pptx-posters/SKILL.md
index f6ed5c5c..81f70585 100644
--- a/skills/pptx-posters/SKILL.md
+++ b/skills/pptx-posters/SKILL.md
@@ -1,414 +1,264 @@
---
name: pptx-posters
-description: Create research posters using HTML/CSS that can be exported to PDF or PPTX. Use this skill ONLY when the user explicitly requests PowerPoint/PPTX poster format. For standard research posters, use latex-posters instead. This skill provides modern web-based poster design with responsive layouts and easy visual integration.
-allowed-tools: Read Write Edit Bash
-license: MIT license
-required_environment_variables: [{"name": "OPENROUTER_API_KEY", "prompt": "OpenRouter API key for the skill's LLM-powered steps.", "required_for": "optional features"}]
-metadata: {"version": "1.2", "skill-author": "K-Dense Inc.", "openclaw": {"primaryEnv": "OPENROUTER_API_KEY", "envVars": [{"name": "OPENROUTER_API_KEY", "required": false, "description": "OpenRouter API key for the skill's LLM-powered steps."}]}}
+description: Create and audit editable scientific posters in macro-free PowerPoint (.pptx) from author-approved local content and assets. Use when the requested deliverable is a PowerPoint research/conference poster and exact physical, printer, accessibility, provenance, and package-security checks are required.
+license: MIT
+compatibility: Requires Python 3.10+, uv, and exact generation pins python-pptx 1.0.2, Pillow 12.3.0, and lxml 6.1.1. Validation and PPTX ZIP/XML inspection are local and network-free; final PowerPoint, accessibility, PDF, printer, and author review are manual.
+allowed-tools:
+ - Read
+ - Write
+ - Bash
+ - Glob
+ - Grep
+ - Python
+metadata:
+ version: "2.0"
+ skill-author: K-Dense Inc.
---
-# PPTX Research Posters (HTML-Based)
+# PPTX posters
-## Overview
+## Scope
-**⚠️ USE THIS SKILL ONLY WHEN USER EXPLICITLY REQUESTS PPTX/POWERPOINT POSTER FORMAT.**
+Use this skill only when the requested source/deliverable is an editable PowerPoint
+poster. Do not route an unspecified poster request here merely because PowerPoint is
+available.
-For standard research posters, use the **latex-posters** skill instead, which provides better typographic control and is the default for academic conferences.
+Version 2.0 generates a real one-slide `.pptx` from strict local JSON. It does not use
+HTML conversion, external templates, schematic/image-generation services, API keys,
+environment files, network requests, or mandatory figure styles.
-This skill creates research posters using HTML/CSS, which can then be exported to PDF or converted to PowerPoint format. The web-based approach offers:
-- Modern, responsive layouts
-- Easy integration of AI-generated visuals
-- Quick iteration and preview in browser
-- Export to PDF via browser print function
-- Conversion to PPTX if specifically needed
+## Hard gates
-## When to Use This Skill
+Stop instead of guessing when any gate is unmet:
-**ONLY use this skill when:**
-- User explicitly requests "PPTX poster", "PowerPoint poster", or "PPT poster"
-- User specifically asks for HTML-based poster
-- User needs to edit poster in PowerPoint after creation
-- LaTeX is not available or user requests non-LaTeX solution
+1. The author has not supplied exact poster content and source records.
+2. Any claim, number, citation, author, affiliation, funding statement, figure,
+ license, or QR target is unresolved.
+3. Current conference and printer requirements are not confirmed.
+4. Author approval is not bound to the current manifest content hash.
+5. An asset is remote, outside the manifest directory, unhashed, or unapproved.
+6. An input is `.pptm`, contains macros/external relationships/OLE/embedded files,
+ or is an untrusted template.
+7. The requested workflow needs PowerPoint to be opened or executed automatically.
+8. A script reports a package, layout, DPI, contrast, or output-plan blocker.
-**DO NOT use this skill when:**
-- User asks for a "poster" without specifying format → Use latex-posters
-- User asks for "research poster" or "conference poster" → Use latex-posters
-- User mentions LaTeX, tikzposter, beamerposter, or baposter → Use latex-posters
+Never fabricate missing material or leave a plausible placeholder. Drafts fail closed.
-## AI-Powered Visual Element Generation
+## Install exact generation dependencies
-**STANDARD WORKFLOW: Generate ALL major visual elements using AI before creating the HTML poster.**
+From the skill directory:
-This is the recommended approach for creating visually compelling posters:
-1. Plan all visual elements needed (hero image, intro, methods, results, conclusions)
-2. Generate each element using scientific-schematics or Nano Banana Pro
-3. Assemble generated images in the HTML template
-4. Add text content around the visuals
-
-**Target: 60-70% of poster area should be AI-generated visuals, 30-40% text.**
-
----
-
-### CRITICAL: Poster-Size Font Requirements
-
-**⚠️ ALL text within AI-generated visualizations MUST be poster-readable.**
-
-When generating graphics for posters, you MUST include font size specifications in EVERY prompt. Poster graphics are viewed from 4-6 feet away, so text must be LARGE.
-
-**MANDATORY prompt requirements for EVERY poster graphic:**
-
-```
-POSTER FORMAT REQUIREMENTS (STRICTLY ENFORCE):
-- ABSOLUTE MAXIMUM 3-4 elements per graphic (3 is ideal)
-- ABSOLUTE MAXIMUM 10 words total in the entire graphic
-- NO complex workflows with 5+ steps (split into 2-3 simple graphics instead)
-- NO multi-level nested diagrams (flatten to single level)
-- NO case studies with multiple sub-sections (one key point per case)
-- ALL text GIANT BOLD (80pt+ for labels, 120pt+ for key numbers)
-- High contrast ONLY (dark on white OR white on dark, NO gradients with text)
-- MANDATORY 50% white space minimum (half the graphic should be empty)
-- Thick lines only (5px+ minimum), large icons (200px+ minimum)
-- ONE SINGLE MESSAGE per graphic (not 3 related messages)
-```
-
-**⚠️ BEFORE GENERATING: Review your prompt and count elements**
-- If your description has 5+ items → STOP. Split into multiple graphics
-- If your workflow has 5+ stages → STOP. Show only 3-4 high-level steps
-- If your comparison has 4+ methods → STOP. Show only top 3 or Our vs Best Baseline
-
-**Example - WRONG (7-stage workflow):**
-```bash
-# ❌ Creates tiny unreadable text
-python scripts/generate_schematic.py "Drug discovery workflow: Stage 1 Target ID, Stage 2 Synthesis, Stage 3 Screening, Stage 4 Lead Opt, Stage 5 Validation, Stage 6 Clinical Trial, Stage 7 FDA Approval with metrics." -o figures/workflow.png
-```
-
-**Example - CORRECT (3 mega-stages):**
```bash
-# ✅ Same content, simplified to readable poster format
-python scripts/generate_schematic.py "POSTER FORMAT for A0. ULTRA-SIMPLE 3-box workflow: 'DISCOVER' → 'VALIDATE' → 'APPROVE'. Each word in GIANT bold (120pt+). Thick arrows (10px). 60% white space. ONLY these 3 words. NO substeps. Readable from 12 feet." -o figures/workflow_simple.png
+uv venv
+uv pip install "python-pptx==1.0.2" "Pillow==12.3.0" "lxml==6.1.1"
```
----
-
-### CRITICAL: Preventing Content Overflow
-
-**⚠️ POSTERS MUST NOT HAVE TEXT OR CONTENT CUT OFF AT EDGES.**
-
-**Prevention Rules:**
+Generation requires exactly:
-**1. Limit Content Sections (MAXIMUM 5-6 sections):**
-```
-✅ GOOD - 5 sections with room to breathe:
- - Title/Header
- - Introduction/Problem
- - Methods
- - Results (1-2 key findings)
- - Conclusions
-
-❌ BAD - 8+ sections crammed together
+```text
+python-pptx==1.0.2
+Pillow==12.3.0
+lxml==6.1.1
```
-**2. Word Count Limits:**
-- **Per section**: 50-100 words maximum
-- **Total poster**: 300-800 words MAXIMUM
-- **If you have more content**: Cut it or make a handout
+All CLIs use lazy optional imports, so `python -B scripts/<tool>.py --help` works
+without these packages. Use `-B` to avoid bytecode artifacts.
----
+## Establish requirements before layout
-## Core Capabilities
+Record these separately:
-### 1. HTML/CSS Poster Design
+- physical trim width/height and orientation;
+- bleed on each edge;
+- safe margin inside trim;
+- PowerPoint canvas width/height;
+- uniform physical-artboard/canvas print scale;
+- conference maximum dimensions and delivery format;
+- printer trim, bleed, margin, scaling, color-mode, and proof requirements;
+- final-output font and raster-DPI thresholds, each labeled as a heuristic or tied to
+ an exact source.
+- required font faces, workstation availability, embedding permission, and the
+ substitution/proof workflow.
-The HTML template (`assets/poster_html_template.html`) provides:
-- Fixed poster dimensions (36×48 inches = 2592×3456 pt)
-- Professional header with gradient styling
-- Three-column content layout
-- Block-based sections with modern styling
-- Footer with references and contact info
+There is no universal poster size. Microsoft currently limits each custom PowerPoint
+dimension to 1–56 inches and uses one size for all slides. If the physical artboard
+is larger, use a proportional canvas only when the printer confirms scaling.
-### 2. Poster Structure
+Read `references/poster_layout_design.md`.
-**Standard Layout:**
-```
-┌─────────────────────────────────────────┐
-│ HEADER: Title, Authors, Hero Image │
-├─────────────┬─────────────┬─────────────┤
-│ Introduction│ Results │ Discussion │
-│ │ │ │
-│ Methods │ (charts) │ Conclusions │
-│ │ │ │
-│ (diagram) │ (data) │ (summary) │
-├─────────────┴─────────────┴─────────────┤
-│ FOOTER: References & Contact Info │
-└─────────────────────────────────────────┘
-```
+## Build the manifest
-### 3. Visual Integration
+Copy `assets/poster_manifest_template.json` into the project. The template is
+deliberately invalid until every replacement token, false confirmation, and draft
+approval is resolved.
-Each section should prominently feature AI-generated visuals:
+Follow `references/manifest_spec.md` and `references/poster_content_guide.md`.
-**Hero Image (Header):**
-```html
-<img src="figures/hero.png" class="hero-image">
-```
-
-**Section Graphics:**
-```html
-<div class="block">
- <h2 class="block-title">Methods</h2>
- <div class="block-content">
- <img src="figures/workflow.png" class="block-image">
- <ul>
- <li>Brief methodology point</li>
- </ul>
- </div>
-</div>
-```
+The manifest requires:
-### 4. Generating Visual Elements
+- exact source IDs for document metadata, every element, and every asset;
+- `author_verified: true` on every source;
+- `author_approved: true` on every element and asset;
+- local PNG/JPEG paths and lowercase SHA-256 hashes;
+- exact provenance and license/permission for every optional image;
+- approved alt text and, when needed, a source-bound native long description;
+- explicit reading order and design rectangles;
+- visible exact fallback URL/text for every local QR image;
+- confirmed conference/printer rules;
+- declared sRGB contrast pairs and redundant data encoding;
+- approval bound to canonical manifest content.
-**Before creating the HTML, generate all visual elements:**
+To obtain the content hash after all non-approval fields pass:
```bash
-# Create figures directory
-mkdir -p figures
-
-# Hero image - SIMPLE, impactful
-python scripts/generate_schematic.py "POSTER FORMAT for A0. Hero banner: '[TOPIC]' in HUGE text (120pt+). Dark blue gradient background. ONE iconic visual. Minimal text. Readable from 15 feet." -o figures/hero.png
-
-# Introduction visual - ONLY 3 elements
-python scripts/generate_schematic.py "POSTER FORMAT for A0. SIMPLE visual with ONLY 3 icons: [icon1] → [icon2] → [icon3]. ONE word labels (80pt+). 50% white space. Readable from 8 feet." -o figures/intro.png
-
-# Methods flowchart - ONLY 4 steps
-python scripts/generate_schematic.py "POSTER FORMAT for A0. SIMPLE flowchart with ONLY 4 boxes: STEP1 → STEP2 → STEP3 → STEP4. GIANT labels (100pt+). Thick arrows. 50% white space. NO sub-steps." -o figures/workflow.png
-
-# Results visualization - ONLY 3 bars
-python scripts/generate_schematic.py "POSTER FORMAT for A0. SIMPLE bar chart with ONLY 3 bars: BASELINE (70%), EXISTING (85%), OURS (95%). GIANT percentages ON bars (120pt+). NO axis, NO legend. 50% white space." -o figures/results.png
-
-# Conclusions - EXACTLY 3 key findings
-python scripts/generate_schematic.py "POSTER FORMAT for A0. EXACTLY 3 cards: '95%' (150pt) 'ACCURACY' (60pt), '2X' (150pt) 'FASTER' (60pt), checkmark 'READY' (60pt). 50% white space. NO other text." -o figures/conclusions.png
+python -B scripts/validate_manifest.py poster.json \
+ --print-content-hash
```
----
-
-## Workflow for PPTX Poster Creation
-
-### Stage 1: Planning
+Give that exact manifest and hash to the author. Then set `approval.status` to
+`approved`, record approver and offset-aware timestamp, and copy the hash. Any
+non-approval edit invalidates approval.
-1. **Confirm PPTX is explicitly requested**
-2. **Determine poster requirements:**
- - Size: 36×48 inches (most common) or A0
- - Orientation: Portrait (most common)
-3. **Develop content outline:**
- - Identify 1-3 core messages
- - Plan 3-5 visual elements
- - Draft minimal text (300-800 words total)
-
-### Stage 2: Generate Visual Elements (AI-Powered)
-
-**CRITICAL: Generate SIMPLE figures with MINIMAL content.**
+Validate the approved manifest and local assets:
```bash
-mkdir -p figures
-
-# Generate each element with POSTER FORMAT specifications
-# (See examples in Section 4 above)
+python -B scripts/validate_manifest.py poster.json
```
-### Stage 3: Create HTML Poster
-
-1. **Copy the template:**
- ```bash
- cp skills/pptx-posters/assets/poster_html_template.html poster.html
- ```
-
-2. **Update content:**
- - Replace placeholder title and authors
- - Insert AI-generated images
- - Add minimal supporting text
- - Update references and contact info
-
-3. **Preview in browser:**
- ```bash
- open poster.html # macOS
- # or
- xdg-open poster.html # Linux
- ```
-
-### Stage 4: Export to PDF
-
-**Browser Print Method:**
-1. Open poster.html in Chrome or Firefox
-2. Print (Cmd/Ctrl + P)
-3. Select "Save as PDF"
-4. Set paper size to match poster dimensions
-5. Remove margins
-6. Enable "Background graphics"
-
-**Command Line (if Chrome available):**
-```bash
-# Chrome headless PDF export
-google-chrome --headless --print-to-pdf=poster.pdf \
- --print-to-pdf-no-header \
- --no-margins \
- poster.html
-```
-
-### Stage 5: Convert to PPTX (If Required)
+## Audit assets and palette before generation
-**Option 1: PDF to PPTX conversion**
```bash
-# Using LibreOffice
-libreoffice --headless --convert-to pptx poster.pdf
-
-# Or use online converters for simple cases
-```
-
-**Option 2: Direct PPTX creation with python-pptx**
-```python
-from pptx import Presentation
-from pptx.util import Inches, Pt
-
-prs = Presentation()
-prs.slide_width = Inches(48)
-prs.slide_height = Inches(36)
-
-slide = prs.slides.add_slide(prs.slide_layouts[6]) # Blank
+python -B scripts/inventory_images.py poster.json \
+ --output poster.assets.json
-# Add images from figures/
-slide.shapes.add_picture("figures/hero.png", Inches(0), Inches(0), width=Inches(48))
-# ... add other elements
+python -B scripts/check_palette.py poster.json \
+ --output poster.palette.json
-prs.save("poster.pptx")
+python -B scripts/plan_export.py poster.json \
+ --output poster.export-plan.json
```
----
-
-## HTML Template Structure
+Effective DPI is pixels divided by final placed inches, not image metadata DPI.
+The inventory fully decodes bounded images and blocks EXIF/XMP/comments and embedded
+text/application metadata;
+strip those offline, then rehash and reapprove the asset.
+Contrast uses WCAG 2.2 sRGB mathematics; applying those values to a physical poster is
+a design target, not a standalone conformance claim. Keep color-redundant labels,
+markers, shapes, patterns, or line styles.
-The provided template (`assets/poster_html_template.html`) includes:
+If the printer requires CMYK, the plan blocks print-readiness until a
+printer-approved conversion/profile and proof exist. Do not claim that a native
+PowerPoint PDF is CMYK-compliant.
-### CSS Variables for Customization
+Read `references/poster_design_principles.md`.
-```css
-/* Poster dimensions */
-body {
- width: 2592pt; /* 36 inches */
- height: 3456pt; /* 48 inches */
-}
+## Generate the PPTX
-/* Color scheme - customize these */
-.header {
- background: linear-gradient(135deg, #1a365d 0%, #2b6cb0 50%, #3182ce 100%);
-}
+Use a new output path:
-/* Typography */
-.poster-title { font-size: 108pt; }
-.authors { font-size: 48pt; }
-.block-title { font-size: 52pt; }
-.block-content { font-size: 34pt; }
+```bash
+python -B scripts/generate_poster.py poster.json \
+ --output poster.pptx \
+ --report poster.generation.json
```
-### Key Classes
-
-| Class | Purpose | Font Size |
-|-------|---------|-----------|
-| `.poster-title` | Main title | 108pt |
-| `.authors` | Author names | 48pt |
-| `.affiliations` | Institutions | 38pt |
-| `.block-title` | Section headers | 52pt |
-| `.block-content` | Body text | 34pt |
-| `.key-finding` | Highlight box | 36pt |
-
----
-
-## Quality Checklist
-
-### Step 0: Pre-Generation Review (MANDATORY)
+Generation:
-**For EACH planned graphic, verify:**
-- [ ] Can describe in 3-4 items or less? (NOT 5+)
-- [ ] Is it a simple workflow (3-4 steps, NOT 7+)?
-- [ ] Can describe all text in 10 words or less?
-- [ ] Does it convey ONE message (not multiple)?
+- creates a new blank presentation; it never loads a user template;
+- sets the approved canvas before adding content;
+- uses one native title placeholder, native text boxes, and local pictures;
+- preserves image aspect ratio with `contain` fitting;
+- disables text auto-shrink;
+- adds elements in approved reading order;
+- writes approved picture alt descriptions and explicit text language to PresentationML;
+- does not embed fonts, audio, video, OLE, ActiveX, links, or other media;
+- removes default printer-settings binary data and normalizes package timestamps;
+- inspects the package before and after the alt-text patch;
+- refuses overlaps, out-of-bounds shapes, low final font size/DPI, unsafe packages,
+ and existing destinations.
-**Reject these patterns:**
-- ❌ "7-stage workflow" → Simplify to "3 mega-stages"
-- ❌ "Multiple case studies" → One case per graphic
-- ❌ "Timeline 2015-2024 annual" → "ONLY 3 key years"
-- ❌ "Compare 6 methods" → "ONLY 2: ours vs best"
+It renders exact manifest text. It does not compose, summarize, research, or correct
+scientific content.
-### Step 2b: Post-Generation Review (MANDATORY)
+## Run final technical audits
-**For EACH generated figure at 25% zoom:**
+```bash
+python -B scripts/inspect_pptx.py poster.pptx \
+ --output poster.package.json
-**✅ PASS criteria (ALL must be true):**
-- [ ] Can read ALL text clearly
-- [ ] Count: 3-4 elements or fewer
-- [ ] White space: 50%+ empty
-- [ ] Understand in 2 seconds
-- [ ] NOT a complex 5+ stage workflow
-- [ ] NOT multiple nested sections
+python -B scripts/check_layout.py poster.pptx \
+ --manifest poster.json \
+ --output poster.layout.json
+```
-**❌ FAIL criteria (regenerate if ANY true):**
-- [ ] Text small/hard to read → Regenerate with "150pt+"
-- [ ] More than 4 elements → Regenerate "ONLY 3 elements"
-- [ ] Less than 50% white space → Regenerate "60% white space"
-- [ ] Complex multi-stage → SPLIT into 2-3 graphics
-- [ ] Multiple cases cramped → SPLIT into separate graphics
+The package inspector reads bounded ZIP metadata and selected XML only. It never
+extracts members or opens/executes the presentation. It rejects:
-### After Export
+- every non-`.pptx` extension, including `.pptm`;
+- packages outside the bounded one-slide generator profile;
+- macro/VBA, ActiveX, custom UI, OLE, embedded, executable, and binary parts;
+- every external relationship, including remote linked images and hyperlinks;
+- unsafe/duplicate ZIP paths, symlinks, encryption, oversized expansion, and
+ excessive compression ratios;
+- malformed or entity-bearing inspected XML;
+- missing internal relationship targets.
-- [ ] NO content cut off at ANY of the 4 edges (check carefully)
-- [ ] All images display correctly
-- [ ] Colors render as expected
-- [ ] Text readable at 25% scale
-- [ ] Graphics look SIMPLE (not like complex 7-stage workflows)
+Read `references/pptx_security.md`.
----
+## Manual PowerPoint and accessibility gate
-## Common Pitfalls to Avoid
+Automation cannot certify accessibility, text rendering, or scientific accuracy.
+In a fully patched PowerPoint:
-**AI-Generated Graphics Mistakes:**
-- ❌ Too many elements (10+ items) → Keep to 3-5 max
-- ❌ Text too small → Specify "GIANT (100pt+)" in prompts
-- ❌ No white space → Add "50% white space" to every prompt
-- ❌ Complex flowcharts (8+ steps) → Limit to 4-5 steps
+1. Open only the generated and technically clean file.
+2. Run Review > Check Accessibility.
+3. Inspect the Reading Order pane and object names.
+4. Review every alt text and native long description.
+5. Test keyboard and screen-reader navigation.
+6. Confirm fonts are installed/licensed; check embedding choices, substitution, glyphs,
+ equations, overflow, contrast, and all edges.
+7. Verify that color is never the only encoding.
+8. Test every QR code and its visible fallback URL/text.
+9. Obtain author sign-off on all content and citations.
-**HTML/Export Mistakes:**
-- ❌ Content exceeding poster dimensions → Check overflow in browser
-- ❌ Missing background graphics in PDF → Enable in print settings
-- ❌ Wrong paper size in PDF → Match poster dimensions exactly
-- ❌ Low-resolution images → Use 300 DPI minimum
+Microsoft's 18 pt slide recommendation is not a universal poster minimum. Evaluate
+font size at final physical output using the manifest's labeled basis and proofs.
-**Content Mistakes:**
-- ❌ Too much text (over 1000 words) → Cut to 300-800 words
-- ❌ Too many sections (7+) → Consolidate to 5-6
-- ❌ No clear visual hierarchy → Make key findings prominent
+## Export and print
----
+Use the approved export plan. When PDF is required, export from the reviewed
+PowerPoint using Standard/high print quality rather than Minimum size.
-## Integration with Other Skills
+Independently verify the PDF:
-This skill works with:
-- **Scientific Schematics**: Generate all poster diagrams and flowcharts
-- **Generate Image / Nano Banana Pro**: Create stylized graphics and hero images
-- **LaTeX Posters**: DEFAULT skill for poster creation (use this instead unless PPTX explicitly requested)
+- page/artboard dimensions, orientation, trim, and bleed;
+- one-page output if required;
+- fonts, clipping, glyphs, equations, and image resampling;
+- tags, reading order, alt text, language, and links;
+- RGB/CMYK conversion and physical color proof;
+- conference naming, file-size, and upload rules.
----
+Print a reduced-scale proof and obtain the printer's required proof. Re-run all checks
+after any change.
-## Template Assets
+Use `assets/poster_quality_checklist.md` for release sign-off.
-Available in `assets/` directory:
+## Bundled CLIs
-- `poster_html_template.html`: Main HTML poster template (36×48 inches)
-- `poster_quality_checklist.md`: Pre-submission validation checklist
+- `validate_manifest.py` — strict content/provenance/approval validator.
+- `generate_poster.py` — exact-pinned local PPTX generator.
+- `inspect_pptx.py` — non-executing ZIP/XML security inspector.
+- `check_layout.py` — bounds, overlap, reading-order, and final-font checker.
+- `inventory_images.py` — asset hash/metadata/effective-DPI manifest.
+- `check_palette.py` — WCAG contrast and heuristic palette report.
+- `plan_export.py` — dimensions, scale, fonts, color, media, export, and print preflight.
## References
-Available in `references/` directory:
-
-- `poster_content_guide.md`: Content organization and writing guidelines
-- `poster_design_principles.md`: Typography, color theory, and visual hierarchy
-- `poster_layout_design.md`: Layout principles and grid systems
-
+- `references/manifest_spec.md`
+- `references/poster_content_guide.md`
+- `references/poster_design_principles.md`
+- `references/poster_layout_design.md`
+- `references/pptx_security.md`
+- `references/security_validation.md`
+- `references/source_ledger.md`
diff --git a/skills/pptx-posters/assets/generation_dependencies.json b/skills/pptx-posters/assets/generation_dependencies.json
new file mode 100644
index 00000000..f8b1efff
--- /dev/null
+++ b/skills/pptx-posters/assets/generation_dependencies.json
@@ -0,0 +1,5 @@
+{
+ "python-pptx": "1.0.2",
+ "Pillow": "12.3.0",
+ "lxml": "6.1.1"
+}
diff --git a/skills/pptx-posters/assets/poster_html_template.html b/skills/pptx-posters/assets/poster_html_template.html
deleted file mode 100644
index dfe151b6..00000000
--- a/skills/pptx-posters/assets/poster_html_template.html
+++ /dev/null
@@ -1,257 +0,0 @@
-<!DOCTYPE html>
-<html>
-<head>
-<meta charset="UTF-8">
-<title>Research Poster Template - 36x48 inches</title>
-<style>
-/* PPTX POSTER TEMPLATE
- Generate images FIRST:
- - Hero: python scripts/generate_image.py "scientific banner" -o figures/hero.png
- - Workflow: python scripts/generate_schematic.py "workflow diagram" -o figures/workflow.png
- - Results: python scripts/generate_image.py "data visualization" -o figures/results.png
-*/
-
-html { background: #f0f4f8; }
-
-body {
- width: 2592pt;
- height: 3456pt;
- margin: 0;
- padding: 0;
- font-family: Arial, Helvetica, sans-serif;
- display: flex;
- flex-direction: column;
- background-color: #f7fafc;
-}
-
-.header {
- height: 420pt;
- background: linear-gradient(135deg, #1a365d 0%, #2b6cb0 50%, #3182ce 100%);
- display: flex;
- align-items: center;
- padding: 50pt 80pt;
- gap: 60pt;
-}
-
-.header-text { flex: 1; }
-
-.poster-title {
- color: #ffffff;
- font-size: 108pt;
- font-weight: bold;
- line-height: 1.1;
- margin: 0 0 35pt 0;
-}
-
-.authors {
- color: #e2e8f0;
- font-size: 48pt;
- margin: 0 0 20pt 0;
-}
-
-.affiliations {
- color: #a0aec0;
- font-size: 38pt;
- margin: 0;
-}
-
-.hero-image {
- width: 650pt;
- height: 380pt;
- border-radius: 24pt;
- object-fit: cover;
- box-shadow: 0 8pt 40pt rgba(0,0,0,0.3);
-}
-
-.main-content {
- flex: 1;
- display: flex;
- gap: 50pt;
- padding: 60pt 80pt;
-}
-
-.column {
- flex: 1;
- display: flex;
- flex-direction: column;
- gap: 50pt;
-}
-
-.block {
- background: #ffffff;
- border-radius: 24pt;
- padding: 45pt;
- box-shadow: 0 4pt 24pt rgba(0,0,0,0.08);
- border-left: 8pt solid #3182ce;
-}
-
-.block-title {
- font-size: 52pt;
- font-weight: bold;
- color: #1a365d;
- margin: 0 0 30pt 0;
- padding-bottom: 20pt;
- border-bottom: 3pt solid #e2e8f0;
-}
-
-.block-content {
- font-size: 34pt;
- line-height: 1.5;
- color: #2d3748;
-}
-
-.block-image {
- width: 100%;
- border-radius: 16pt;
- margin: 25pt 0;
-}
-
-ul {
- margin: 20pt 0;
- padding-left: 60pt;
-}
-
-li {
- font-size: 34pt;
- line-height: 1.6;
- color: #2d3748;
- margin-bottom: 18pt;
-}
-
-.key-finding {
- background: linear-gradient(135deg, #ebf8ff 0%, #bee3f8 100%);
- border-radius: 16pt;
- padding: 30pt;
- margin: 25pt 0;
- border-left: 6pt solid #3182ce;
-}
-
-.key-finding p {
- font-size: 36pt;
- font-weight: 600;
- color: #2b6cb0;
- margin: 0;
-}
-
-.placeholder {
- background: #edf2f7;
- border-radius: 16pt;
- border: 3pt dashed #a0aec0;
-}
-
-.footer {
- height: 220pt;
- background: linear-gradient(135deg, #1a365d 0%, #2d3748 100%);
- display: flex;
- align-items: center;
- padding: 0 80pt;
- gap: 60pt;
-}
-
-.references {
- flex: 2;
- color: #e2e8f0;
- font-size: 24pt;
-}
-
-.contact {
- flex: 1;
- text-align: right;
- color: #ffffff;
- font-size: 28pt;
-}
-</style>
-</head>
-<body>
-
-<div class="header">
- <div class="header-text">
- <h1 class="poster-title">Your Research Title Here</h1>
- <p class="authors">Author One¹*, Author Two², Author Three¹</p>
- <p class="affiliations">¹University of Example · ²Research Institute</p>
- </div>
- <img src="figures/hero.png" class="hero-image">
-</div>
-
-<div class="main-content">
- <div class="column">
- <div class="block">
- <h2 class="block-title">Introduction</h2>
- <div class="block-content">
- <img src="figures/intro.png" class="block-image">
- <p><b>Background:</b> Context about your research problem.</p>
- <p><b>Objective:</b> What you aimed to accomplish.</p>
- </div>
- </div>
- <div class="block" style="border-left-color: #38a169;">
- <h2 class="block-title">Methods</h2>
- <div class="block-content">
- <img src="figures/workflow.png" class="block-image">
- <ul>
- <li>Study design overview</li>
- <li>Key methodology</li>
- <li>Analysis approach</li>
- </ul>
- </div>
- </div>
- </div>
-
- <div class="column">
- <div class="block" style="flex: 1; border-left-color: #ed8936;">
- <h2 class="block-title">Results</h2>
- <div class="block-content">
- <div class="key-finding">
- <p>Key Finding: Your main result in one sentence</p>
- </div>
- <div id="chart1" class="placeholder" style="width: 100%; height: 400pt;"></div>
- <img src="figures/results.png" class="block-image">
- <ul>
- <li><b>Finding 1:</b> Description (p &lt; 0.001)</li>
- <li><b>Finding 2:</b> Description with effect size</li>
- </ul>
- </div>
- </div>
- </div>
-
- <div class="column">
- <div class="block">
- <h2 class="block-title">Discussion</h2>
- <div class="block-content">
- <ul>
- <li>Interpretation of findings</li>
- <li>Comparison to prior work</li>
- <li>Practical applications</li>
- </ul>
- </div>
- </div>
- <div class="block" style="border-left-color: #805ad5;">
- <h2 class="block-title">Conclusions</h2>
- <div class="block-content">
- <ul>
- <li><b>Conclusion 1:</b> Clear takeaway</li>
- <li><b>Conclusion 2:</b> Clear takeaway</li>
- <li><b>Future:</b> Next steps</li>
- </ul>
- </div>
- </div>
- <div class="block" style="border-left-color: #718096;">
- <h2 class="block-title" style="font-size: 42pt;">Acknowledgments</h2>
- <div class="block-content" style="font-size: 28pt;">
- <p>Funded by Grant #XXX. Thanks to collaborators.</p>
- </div>
- </div>
- </div>
-</div>
-
-<div class="footer">
- <div class="references">
- <p><b>References:</b> 1. Author (2024) Journal. 2. Author (2023) Journal.</p>
- </div>
- <div class="contact">
- <p>Contact: [email protected]</p>
- <p>Lab: labwebsite.edu</p>
- </div>
-</div>
-
-</body>
-</html>
diff --git a/skills/pptx-posters/assets/poster_manifest_template.json b/skills/pptx-posters/assets/poster_manifest_template.json
new file mode 100644
index 00000000..2212887c
--- /dev/null
+++ b/skills/pptx-posters/assets/poster_manifest_template.json
@@ -0,0 +1,154 @@
+{
+ "schema_version": "2.0",
+ "document": {
+ "id": "REPLACE_ME_DOCUMENT_ID",
+ "title": "REPLACE_ME_TITLE",
+ "subject": "REPLACE_ME_SUBJECT",
+ "language": "REPLACE_ME_BCP47_LANGUAGE",
+ "authors": [
+ "REPLACE_ME_AUTHOR"
+ ],
+ "source_ids": [
+ "REPLACE_ME_CONTENT_SOURCE_ID"
+ ]
+ },
+ "canvas": {
+ "width_in": "REPLACE_ME_POWERPOINT_WIDTH",
+ "height_in": "REPLACE_ME_POWERPOINT_HEIGHT",
+ "background_color": "#FFFFFF"
+ },
+ "physical_output": {
+ "trim_width_in": "REPLACE_ME_TRIM_WIDTH",
+ "trim_height_in": "REPLACE_ME_TRIM_HEIGHT",
+ "bleed_in": "REPLACE_ME_BLEED",
+ "safe_margin_in": "REPLACE_ME_SAFE_MARGIN",
+ "orientation": "REPLACE_ME_ORIENTATION"
+ },
+ "requirements": {
+ "conference": {
+ "confirmed": false,
+ "source_id": "REPLACE_ME_CONFERENCE_SOURCE_ID",
+ "max_width_in": "REPLACE_ME_CONFERENCE_MAX_WIDTH",
+ "max_height_in": "REPLACE_ME_CONFERENCE_MAX_HEIGHT",
+ "orientation": "REPLACE_ME_CONFERENCE_ORIENTATION",
+ "required_delivery_format": "REPLACE_ME_DELIVERY_FORMAT",
+ "notes": "REPLACE_ME_CONFERENCE_NOTES"
+ },
+ "printer": {
+ "confirmed": false,
+ "source_id": "REPLACE_ME_PRINTER_SOURCE_ID",
+ "trim_width_in": "REPLACE_ME_PRINTER_TRIM_WIDTH",
+ "trim_height_in": "REPLACE_ME_PRINTER_TRIM_HEIGHT",
+ "bleed_in": "REPLACE_ME_PRINTER_BLEED",
+ "safe_margin_in": "REPLACE_ME_PRINTER_SAFE_MARGIN",
+ "accepted_color_mode": "REPLACE_ME_COLOR_MODE",
+ "scaling_allowed": false,
+ "notes": "REPLACE_ME_PRINTER_NOTES"
+ }
+ },
+ "quality": {
+ "minimum_font_pt_final": "REPLACE_ME_FINAL_FONT_THRESHOLD",
+ "font_guidance_basis": "heuristic",
+ "font_guidance_source_id": null,
+ "minimum_raster_dpi_final": "REPLACE_ME_FINAL_DPI_THRESHOLD",
+ "raster_dpi_basis": "heuristic",
+ "raster_dpi_source_id": null
+ },
+ "palette": {
+ "colors": {
+ "black": "#000000",
+ "white": "#FFFFFF"
+ },
+ "contrast_pairs": [
+ {
+ "id": "black_on_white",
+ "foreground_color_id": "black",
+ "background_color_id": "white",
+ "usage": "normal_text"
+ }
+ ],
+ "data_series_redundant_encoding": false
+ },
+ "sources": [
+ {
+ "id": "REPLACE_ME_CONFERENCE_SOURCE_ID",
+ "kind": "conference_rule",
+ "citation": "REPLACE_ME_CONFERENCE_CITATION",
+ "locator": "REPLACE_ME_CONFERENCE_LOCATOR",
+ "author_verified": false
+ },
+ {
+ "id": "REPLACE_ME_PRINTER_SOURCE_ID",
+ "kind": "printer_rule",
+ "citation": "REPLACE_ME_PRINTER_CITATION",
+ "locator": "REPLACE_ME_PRINTER_LOCATOR",
+ "author_verified": false
+ },
+ {
+ "id": "REPLACE_ME_CONTENT_SOURCE_ID",
+ "kind": "author_content",
+ "citation": "REPLACE_ME_CONTENT_CITATION",
+ "locator": "REPLACE_ME_CONTENT_LOCATOR",
+ "author_verified": false
+ }
+ ],
+ "assets": [],
+ "elements": [
+ {
+ "id": "title",
+ "type": "text",
+ "reading_order": 1,
+ "x_in": "REPLACE_ME_X",
+ "y_in": "REPLACE_ME_Y",
+ "width_in": "REPLACE_ME_WIDTH",
+ "height_in": "REPLACE_ME_HEIGHT",
+ "source_ids": [
+ "REPLACE_ME_CONTENT_SOURCE_ID"
+ ],
+ "author_approved": false,
+ "allow_in_bleed": false,
+ "role": "title",
+ "text": "REPLACE_ME_TITLE",
+ "font_size_pt_design": "REPLACE_ME_DESIGN_FONT_SIZE",
+ "font_face": "REPLACE_ME_FONT",
+ "bold": true,
+ "align": "left",
+ "vertical_align": "middle",
+ "contrast_pair_id": "black_on_white",
+ "line_color_id": null,
+ "line_width_pt": 0,
+ "margin_in": "REPLACE_ME_MARGIN"
+ },
+ {
+ "id": "body",
+ "type": "text",
+ "reading_order": 2,
+ "x_in": "REPLACE_ME_X",
+ "y_in": "REPLACE_ME_Y",
+ "width_in": "REPLACE_ME_WIDTH",
+ "height_in": "REPLACE_ME_HEIGHT",
+ "source_ids": [
+ "REPLACE_ME_CONTENT_SOURCE_ID"
+ ],
+ "author_approved": false,
+ "allow_in_bleed": false,
+ "role": "body",
+ "text": "REPLACE_ME_AUTHOR_APPROVED_BODY_TEXT",
+ "font_size_pt_design": "REPLACE_ME_DESIGN_FONT_SIZE",
+ "font_face": "REPLACE_ME_FONT",
+ "bold": false,
+ "align": "left",
+ "vertical_align": "top",
+ "contrast_pair_id": "black_on_white",
+ "line_color_id": null,
+ "line_width_pt": 0,
+ "margin_in": "REPLACE_ME_MARGIN"
+ }
+ ],
+ "approval": {
+ "status": "draft",
+ "approved_by": null,
+ "approved_at": null,
+ "content_sha256": null
+ }
+}
diff --git a/skills/pptx-posters/assets/poster_quality_checklist.md b/skills/pptx-posters/assets/poster_quality_checklist.md
index 9338688b..5f77abbe 100644
--- a/skills/pptx-posters/assets/poster_quality_checklist.md
+++ b/skills/pptx-posters/assets/poster_quality_checklist.md
@@ -1,358 +1,192 @@
-# Research Poster Quality Checklist
-
-Use this comprehensive checklist before printing or presenting your research poster.
-
-## Pre-Compilation Checks
-
-### Content Completeness
-- [ ] Title is concise and descriptive (10-15 words)
-- [ ] All author names spelled correctly
-- [ ] Affiliations complete and accurate
-- [ ] Contact email address included
-- [ ] All sections present: Introduction, Methods, Results, Conclusions
-- [ ] References cited (5-10 key citations)
-- [ ] Acknowledgments included (funding, collaborators)
-- [ ] No placeholder text remaining (TODO, Lorem ipsum, etc.)
-
-### Visual Content
-- [ ] All figures prepared and high resolution (300+ DPI)
-- [ ] Figure captions written and descriptive
-- [ ] Logos available (university, funding agencies)
-- [ ] QR codes generated and tested
-- [ ] Icons/graphics sourced (if used)
-
-### LaTeX Configuration
-- [ ] Correct paper size specified (A0, A1, 36×48", etc.)
-- [ ] Correct orientation (portrait/landscape)
-- [ ] Minimal margins configured (5-15mm)
-- [ ] Font sizes appropriate (title 72pt+, body 24pt+)
-- [ ] Color scheme defined
-- [ ] All packages installed and working
-
-## Compilation Checks
-
-### Successful Compilation
-- [ ] PDF compiles without errors
-- [ ] No critical warnings in .log file
-- [ ] All citations resolved (no [?] marks)
-- [ ] All cross-references working
-- [ ] Bibliography generated correctly (if using BibTeX)
-
-### Warning Review
-Run in terminal: `grep -i "warning\|overfull\|underfull" poster.log`
-
-- [ ] No overfull hbox warnings (text too wide)
-- [ ] No underfull hbox warnings (excessive spacing)
-- [ ] No missing figure warnings
-- [ ] No missing font warnings
-- [ ] No undefined reference warnings
-
-## PDF Quality Checks
-
-### Automated Checks
-
-Run: `./scripts/review_poster.sh poster.pdf` or manually verify:
-
-#### Page Specifications
+# PPTX poster release checklist
+
+Use this checklist for the final generated package and every exported/printed
+derivative. A script pass is necessary but not sufficient.
+
+## 1. Requirements and approval
+
+- [ ] The organizer's current poster rule is recorded with an exact source ID.
+- [ ] The printer's current trim, bleed, safe-margin, scaling, file-format, and
+ color requirements are recorded with an exact source ID.
+- [ ] The selected physical trim size and orientation comply with those records.
+- [ ] No generic "standard poster size" was substituted for organizer/printer rules.
+- [ ] Every claim, number, citation, author name, affiliation, logo, figure, and
+ asset license has an exact source ID.
+- [ ] Every source record is marked author-verified.
+- [ ] Every element and asset is marked author-approved.
+- [ ] No placeholder, sample claim, invented citation, or inferred result remains.
+- [ ] The approving author reviewed the canonical content hash after the final edit.
+
+Run:
+
+```bash
+python -B scripts/validate_manifest.py poster.json
+```
+
+## 2. Safe local generation
+
+- [ ] Generation used the exact versions in `generation_dependencies.json`.
+- [ ] All optional image paths are manifest-relative local PNG/JPEG files.
+- [ ] Every asset hash matches.
+- [ ] Every asset has exact provenance and a license/permission statement.
+- [ ] No template file, remote image, URL download, API key, environment file,
+ image-generation service, or network service was used.
+- [ ] The output path was new; no existing file was replaced.
+- [ ] The generated file is `.pptx`, never `.pptm`.
+
+Run:
+
+```bash
+uv run --with "python-pptx==1.0.2" --with "Pillow==12.3.0" \
+ --with "lxml==6.1.1" \
+ python -B scripts/generate_poster.py poster.json --output poster.pptx
+```
+
+## 3. PPTX package security
+
+- [ ] ZIP member names have no traversal, absolute paths, symlinks, duplicates,
+ encryption, oversized entries, or excessive expansion ratios.
+- [ ] The package has the standard macro-free PresentationML content type.
+- [ ] The package matches the strict generated one-slide part profile.
+- [ ] No VBA, ActiveX, OLE, embedded package, executable/binary payload, external
+ link part, or custom UI is present.
+- [ ] No relationship has `TargetMode="External"`.
+- [ ] No remotely linked image is present.
+- [ ] Internal relationship targets resolve to existing package parts.
+- [ ] The presentation was inspected as ZIP/XML and was not opened or executed by
+ the inspection script.
+
+Run:
+
```bash
-pdfinfo poster.pdf | grep "Page size"
+python -B scripts/inspect_pptx.py poster.pptx
```
-- [ ] Page size matches requirements exactly
-- [ ] Single page document (not multi-page)
-- [ ] Correct orientation
-#### Font Embedding
+Treat any package finding as a release blocker. Do not "fix" an untrusted package
+by opening it in PowerPoint.
+
+## 4. Dimensions, scale, bleed, and margins
+
+- [ ] PowerPoint canvas width and height are each in the current 1–56 inch range.
+- [ ] Final physical trim dimensions are recorded separately from canvas dimensions.
+- [ ] Final artboard dimensions include twice the confirmed bleed on each axis.
+- [ ] Canvas and final artboard have the same aspect ratio.
+- [ ] Uniform print scale is explicit; no nonuniform stretching is allowed.
+- [ ] Printer permission is recorded if final output is scaled from the PPTX canvas.
+- [ ] All non-bleed content stays inside the confirmed safe margin from the trim edge.
+- [ ] Full-bleed imagery reaches the artboard edge and does not move text into bleed.
+- [ ] A physical or contract proof confirms trim and bleed behavior.
+
+Run:
+
```bash
-pdffonts poster.pdf
+python -B scripts/plan_export.py poster.json
```
-- [ ] All fonts show "yes" in "emb" column
-- [ ] No bitmap fonts (should be Type 1 or TrueType)
-#### Image Quality
+## 5. Layout and typography
+
+- [ ] No shape is out of bounds.
+- [ ] Every reported bounding-box overlap is either removed or documented as
+ intentional after visual inspection.
+- [ ] No text box visibly overflows, clips, wraps unexpectedly, or uses silent
+ auto-shrink.
+- [ ] Font sizes were assessed at final physical output, not only on the PPTX canvas.
+- [ ] The manifest labels its minimum-font value as a project heuristic or ties it
+ to an exact organizer/printer/source requirement.
+- [ ] Required fonts are available on the export workstation and printer workflow.
+- [ ] Font embedding rights and the chosen embed/not-embed workflow were reviewed;
+ the generator itself did not embed fonts.
+- [ ] Font substitution, equations, symbols, and scientific glyphs were checked.
+- [ ] Visual hierarchy and reading path remain clear at reduced-scale proof size.
+
+Run:
+
```bash
-pdfimages -list poster.pdf
+python -B scripts/check_layout.py poster.pptx --manifest poster.json
```
-- [ ] All images at least 300 DPI
-- [ ] No JPEG artifacts in figures
-- [ ] Vector graphics used where possible
-#### File Size
+The checker cannot determine rendered overflow or font substitution; inspect those
+in PowerPoint and in the exported PDF.
+
+## 6. Raster images and assets
+
+- [ ] Effective DPI is calculated from pixel dimensions divided by final placed
+ inches, not from file metadata.
+- [ ] Every placement meets the manifest's source-labeled or heuristic DPI threshold.
+- [ ] No image is stretched out of aspect ratio.
+- [ ] The final PDF and printer proof show no resampling artifacts.
+- [ ] Asset IDs, hashes, source IDs, provenance, permissions/licenses, and alt text are
+ in the inventory.
+- [ ] EXIF, XMP, comments, and embedded text/application metadata were stripped in
+ an author-reviewed offline workflow before hashing and approval.
+- [ ] Logos and images are authorized for this use.
+
+Run:
+
+```bash
+python -B scripts/inventory_images.py poster.json \
+ --output poster.assets.json
+```
+
+## 7. Color and graphical accessibility
+
+- [ ] Normal text pairs meet WCAG 2.2 SC 1.4.3 at 4.5:1.
+- [ ] Large text pairs meet 3:1 only when final text is at least 18 pt, or at least
+ 14 pt and bold.
+- [ ] Essential graphical objects meet the 3:1 non-text contrast screen where
+ WCAG 2.2 SC 1.4.11 is being used as the design target.
+- [ ] Information is never encoded by color alone.
+- [ ] Categories also use direct labels, shapes, markers, patterns, or line styles.
+- [ ] Palette selection is appropriate to data type: qualitative, sequential, or
+ diverging.
+- [ ] A grayscale/color-vision simulation is reviewed as a screen, not treated as
+ proof of accessibility.
+- [ ] A color proof confirms the printer's conversion and substrate behavior.
+
+Run:
+
```bash
-ls -lh poster.pdf
+python -B scripts/check_palette.py poster.json
```
-- [ ] Reasonable size (2-50 MB typical)
-- [ ] Not too large for email (<50 MB) if sharing digitally
-- [ ] Not suspiciously small (<1 MB - may indicate low quality)
-
-## Visual Inspection (100% Zoom)
-
-### Layout and Spacing
-- [ ] Content fills entire page (no excessive white margins)
-- [ ] Consistent spacing between columns (1-2cm)
-- [ ] Consistent spacing between blocks (1-2cm)
-- [ ] All elements aligned to grid
-- [ ] No overlapping text or figures
-- [ ] White space evenly distributed (30-40% total)
-- [ ] Visual balance across poster (no heavy/empty areas)
-
-### Typography
-- [ ] Title readable and prominent (72-120pt)
-- [ ] Section headers clear (48-72pt)
-- [ ] Body text large enough (24-36pt minimum, 30pt+ recommended)
-- [ ] Captions readable (18-24pt)
-- [ ] No text running off edges
-- [ ] Consistent font usage throughout
-- [ ] Line spacing adequate (1.2-1.5×)
-- [ ] No awkward hyphenation or word breaks
-- [ ] All special characters render correctly (Greek, math symbols)
-
-### Visual Elements
-- [ ] All figures display correctly
-- [ ] No pixelated or blurry images
-- [ ] Figure resolution high (zoom to 200% to verify)
-- [ ] Figure labels large and clear
-- [ ] Graph axes labeled with units
-- [ ] Color schemes consistent across figures
-- [ ] Legends readable and well-positioned
-- [ ] Logos crisp and professional
-- [ ] QR codes sharp and high-contrast (minimum 2×2cm)
-- [ ] No visual artifacts or rendering errors
-
-### Colors
-- [ ] Colors render as intended (not washed out)
-- [ ] High contrast between text and background (≥4.5:1)
-- [ ] Color scheme harmonious
-- [ ] Colors appropriate for printing (not too bright/neon)
-- [ ] Institutional colors used correctly
-- [ ] Color-blind friendly palette (avoid red-green only)
-
-### Content
-- [ ] Title complete and correctly positioned
-- [ ] All author names and affiliations visible
-- [ ] All sections present and labeled
-- [ ] Results section has figures/data
-- [ ] Conclusions clearly stated
-- [ ] References formatted consistently
-- [ ] Contact information clearly visible
-- [ ] No missing content
-
-## Reduced-Scale Print Test (CRITICAL)
-
-### Test Print Preparation
-Print poster at 25% scale:
-- A0 poster → Print on A4 paper
-- 36×48" poster → Print on Letter paper
-- A1 poster → Print on A5 paper
-
-### Readability from Distance
-
-**From 6 feet (2 meters):**
-- [ ] Title clearly readable
-- [ ] Authors identifiable
-- [ ] Main figures visible
-
-**From 4 feet (1.2 meters):**
-- [ ] Section headers readable
-- [ ] Figure captions readable
-- [ ] Key results visible
-
-**From 2 feet (0.6 meters):**
-- [ ] Body text readable
-- [ ] References readable
-- [ ] All details clear
-
-### Print Quality
-- [ ] Colors accurate (match screen expectations)
-- [ ] No banding or color shifts
-- [ ] Sharp edges (not blurry)
-- [ ] Consistent print density
-- [ ] No printer artifacts
-
-## Content Proofreading
-
-### Text Accuracy
-- [ ] Spell-checked all text
-- [ ] Grammar checked
-- [ ] All author names spelled correctly
-- [ ] All affiliations accurate
-- [ ] Email address correct
-- [ ] No typos in title or headers
-
-### Scientific Accuracy
-- [ ] All numbers and statistics verified
-- [ ] Units included and correct
-- [ ] Statistical significance correctly indicated
-- [ ] Sample sizes (n=) reported
-- [ ] Figure numbering consistent
-- [ ] Citations accurate and complete
-- [ ] Methodology accurately described
-- [ ] Results match figures/data
-- [ ] Conclusions supported by data
-
-### Consistency
-- [ ] Terminology consistent throughout
-- [ ] Abbreviations defined at first use
-- [ ] Consistent notation (italics for genes, etc.)
-- [ ] Consistent units (don't mix metric/imperial)
-- [ ] Consistent decimal places
-- [ ] Consistent citation format
-
-## Accessibility Checks
-
-### Color Contrast
-Test at: https://webaim.org/resources/contrastchecker/
-
-- [ ] Title-background contrast ≥ 7:1
-- [ ] Body text-background contrast ≥ 4.5:1
-- [ ] All text meets WCAG AA standard minimum
-
-### Color Blindness
-Test with simulator: https://www.color-blindness.com/coblis-color-blindness-simulator/
-
-- [ ] Information not lost with deuteranopia (red-green)
-- [ ] Key distinctions visible with protanopia
-- [ ] Patterns/shapes used in addition to color
-- [ ] No critical info conveyed by color alone
-
-### Visual Clarity
-- [ ] Clear visual hierarchy (size, weight, position)
-- [ ] Logical reading order
-- [ ] Grouping of related elements obvious
-- [ ] Important info emphasized appropriately
-
-## Peer Review
-
-### 30-Second Test
-Show poster to colleague for 30 seconds, then ask:
-- [ ] They can identify the research topic
-- [ ] They can state the main finding
-- [ ] They remember the key figure
-
-### 5-Minute Review
-Ask colleague to read poster (5 minutes), then ask:
-- [ ] They understand the research question
-- [ ] They can explain the approach
-- [ ] They can summarize the conclusions
-- [ ] They identify what makes it novel/important
-
-### Feedback
-- [ ] Noted any confusing elements
-- [ ] Identified any unclear figures
-- [ ] Checked for jargon that needs definition
-- [ ] Verified logical flow
-
-## Pre-Printing Final Checks
-
-### Technical Specifications
-- [ ] PDF size exactly matches conference requirements
-- [ ] Orientation correct (portrait vs landscape)
-- [ ] All fonts embedded (verified with pdffonts)
-- [ ] Color space correct (RGB for screen, CMYK if printer requires)
-- [ ] Resolution adequate (300+ DPI for all images)
-- [ ] Bleed area added if required (typically 3-5mm)
-- [ ] Crop marks visible if required
-- [ ] File naming convention followed
-
-### Printer Communication
-- [ ] Confirmed paper type (matte vs glossy)
-- [ ] Confirmed poster size
-- [ ] Provided color profile if required
-- [ ] Verified delivery deadline
-- [ ] Confirmed shipping/pickup arrangements
-- [ ] Discussed backup plan if issues arise
-
-### Backup and Storage
-- [ ] PDF saved with clear filename: `LastName_Conference_Poster.pdf`
-- [ ] Source .tex file backed up
-- [ ] All figure files backed up
-- [ ] Copy saved to cloud storage
-- [ ] Copy saved on USB drive for conference
-- [ ] Digital version ready to email if requested
-
-## Digital Presentation Checks
-
-If presenting digitally or sharing online:
-
-### File Optimization
-- [ ] PDF compressed if >10MB (for email)
-- [ ] Test opens in Adobe Reader
-- [ ] Test opens in Preview (Mac)
-- [ ] Test opens in browser PDF viewers
-- [ ] Test on mobile devices
-
-### Interactive Elements
-- [ ] All QR codes tested and functional
-- [ ] QR codes link to correct URLs
-- [ ] Hyperlinks work (if included)
-- [ ] Links open in new tabs/windows appropriately
-
-### Alternative Formats
-- [ ] PNG version created for social media (if needed)
-- [ ] Thumbnail image created
-- [ ] Poster description/abstract prepared
-- [ ] Hashtags and social media text ready
-
-## Conference-Specific
-
-### Requirements Verification
-- [ ] Poster size matches conference specifications exactly
-- [ ] Orientation matches requirements
-- [ ] File format correct (usually PDF)
-- [ ] Submission deadline met
-- [ ] File naming convention followed
-- [ ] Abstract/description submitted if required
-
-### Physical Preparation
-- [ ] Poster printed and inspected
-- [ ] Backup printed copy prepared
-- [ ] Push pins/mounting materials ready
-- [ ] Poster tube or flat portfolio for transport
-- [ ] Business cards/handouts prepared
-- [ ] Digital backup on laptop/phone
-
-### Presentation Preparation
-- [ ] 30-second elevator pitch prepared
-- [ ] 2-minute summary prepared
-- [ ] 5-minute detailed explanation prepared
-- [ ] Anticipated questions considered
-- [ ] Follow-up materials ready (QR code to paper, etc.)
-
-## Final Sign-Off
-
-Date: ________________
-
-Poster Title: _______________________________________________
-
-Conference: _______________________________________________
-
-Reviewed by: _______________________________________________
-
-All critical items checked: [ ]
-
-Ready for printing: [ ]
-
-Ready for presentation: [ ]
-
-Notes/Issues to address:
-_________________________________________________________
-_________________________________________________________
-_________________________________________________________
-
----
-
-## Quick Reference: Common Issues
-
-| Issue | Quick Fix |
-|-------|-----------|
-| Large white margins | Reduce margin in documentclass: `margin=5mm` |
-| Text too small | Increase scale: `scale=1.5` in beamerposter |
-| Blurry figures | Use vector graphics (PDF) or higher resolution (600+ DPI) |
-| Colors wrong | Check RGB vs CMYK, test print before final |
-| Fonts not embedded | Compile with: `pdflatex -dEmbedAllFonts=true` |
-| Content cut off | Check total width: columns + spacing + margins = pagewidth |
-| QR codes don't scan | Increase size (min 2×2cm), ensure high contrast |
-| File too large | Compress: `gs -sDEVICE=pdfwrite -dPDFSETTINGS=/printer ...` |
-
-## Checklist Version
-Version 1.0 - For use with LaTeX poster packages (beamerposter, tikzposter, baposter)
+## 8. PowerPoint accessibility
+
+- [ ] Every picture has concise, accurate alt text that conveys purpose.
+- [ ] Complex figures have an approved source-bound native long description when alt
+ text and adjacent prose are insufficient.
+- [ ] Important text is native text, not only pixels inside an image.
+- [ ] The visible title is the native slide-title placeholder and text language is
+ correct.
+- [ ] The Reading Order pane matches the intended logical sequence.
+- [ ] The PowerPoint Accessibility Checker has no unresolved errors.
+- [ ] A keyboard and screen-reader pass confirms the actual reading order.
+- [ ] Text links have meaningful visible labels.
+- [ ] Every QR code has the exact destination URL in visible fallback text.
+- [ ] Each final printed QR code was tested with multiple devices.
+- [ ] Language, author names, acronyms, captions, and table alternatives are correct.
+
+Automated XML inspection cannot certify these manual checks.
+
+## 9. Export and print
+
+- [ ] Export uses PowerPoint's Standard/high print quality, not Minimum size.
+- [ ] No audio, video, linked media, OLE, ActiveX, embedded file, or external
+ relationship was introduced after generation.
+- [ ] Exported PDF page size equals the final artboard expected by the printer.
+- [ ] Exported PDF is checked independently for tags, reading order, alt text,
+ links, fonts, clipping, image quality, and page dimensions.
+- [ ] RGB is distinguished from any printer-required CMYK conversion.
+- [ ] If CMYK is required, the printer-approved conversion/profile and proof are
+ complete; the native PowerPoint export is not represented as CMYK-compliant.
+- [ ] Conference file format, naming, file-size, and submission rules are met.
+- [ ] Printer deadline, substrate, mounting, delivery, and backup requirements are met.
+
+## 10. Final sign-off
+
+- [ ] Presenting/corresponding author approved all scientific content and citations.
+- [ ] Accessibility reviewer completed manual checks.
+- [ ] Printer or production contact approved dimensions, bleed, scale, and color.
+- [ ] The exact approved manifest, PPTX hash, asset inventory, audit reports, exported
+ PDF, and proof are retained together.
+- [ ] A final change triggers a new content hash, new author approval, regeneration,
+ re-export, and all checks again.
diff --git a/skills/pptx-posters/references/manifest_spec.md b/skills/pptx-posters/references/manifest_spec.md
new file mode 100644
index 00000000..b19b3b89
--- /dev/null
+++ b/skills/pptx-posters/references/manifest_spec.md
@@ -0,0 +1,297 @@
+# Poster manifest 2.0
+
+## Purpose
+
+The manifest is the only content input to the generator. It binds:
+
+- approved text and images;
+- exact source IDs;
+- local asset hashes and licenses;
+- PowerPoint canvas and physical output geometry;
+- conference and printer rules;
+- accessibility/quality thresholds and their basis;
+- reading order;
+- author approval to a canonical content hash.
+
+Unknown keys, duplicate JSON keys, non-finite numbers, remote asset paths, path escape,
+unapproved fields, unresolved sources, unused records, and common placeholders are
+rejected.
+
+## Template
+
+`assets/poster_manifest_template.json` is intentionally invalid. It contains
+replacement tokens, false confirmations, and draft approval so it cannot produce a
+poster accidentally.
+
+Copy it into a project directory, then replace every field with reviewed values.
+Asset paths are relative to that manifest's directory.
+
+## Top-level object
+
+Manifest version 2.0 requires exactly these keys:
+
+- `schema_version`
+- `document`
+- `canvas`
+- `physical_output`
+- `requirements`
+- `quality`
+- `palette`
+- `sources`
+- `assets`
+- `elements`
+- `approval`
+
+The validator rejects extensions to the schema rather than silently ignoring them.
+
+## `document`
+
+- `id`: stable identifier beginning with a letter.
+- `title`: exact approved title.
+- `subject`: exact approved description for core document metadata.
+- `language`: BCP 47-style language tag.
+- `authors`: exact ordered author names.
+- `source_ids`: exact records supporting title, subject, language, and author metadata.
+
+Exactly one text element with role `title` must match `document.title` verbatim.
+It must have `reading_order: 1`; generation uses it as the native PowerPoint slide
+title placeholder rather than as an undifferentiated text box.
+
+## `canvas`
+
+- `width_in`, `height_in`: PowerPoint slide dimensions, each 1–56 inches.
+- `background_color`: opaque six-digit sRGB hex.
+
+These are design dimensions, not automatically the physical trim size.
+
+## `physical_output`
+
+- `trim_width_in`, `trim_height_in`: finished physical dimensions.
+- `bleed_in`: physical bleed on each edge.
+- `safe_margin_in`: inset inside the trim edge for non-bleed content.
+- `orientation`: `portrait`, `landscape`, or `square`, matching trim dimensions.
+
+The physical artboard is trim plus twice the bleed. It must share the canvas aspect
+ratio.
+
+## `requirements`
+
+### `conference`
+
+The organizer record must be confirmed and provide:
+
+- exact `source_id`;
+- maximum width and height;
+- orientation (`portrait`, `landscape`, `square`, or `either`);
+- required delivery format (`PDF`, `PPTX`, `PDF_AND_PPTX`, or `OTHER`);
+- notes copied or summarized from the verified rule.
+
+The physical trim dimensions must fit.
+The referenced source record must have kind `conference_rule`.
+
+### `printer`
+
+The printer record must be confirmed and provide:
+
+- exact `source_id`;
+- trim width/height, bleed, and safe margin matching `physical_output`;
+- accepted color mode (`RGB`, `CMYK`, or `PRINTER_MANAGED`);
+- whether uniform scaling is allowed;
+- notes describing the confirmed workflow.
+
+If scaling is forbidden, canvas and physical artboard must be 1:1. A CMYK requirement
+does not prevent creation of an editable RGB PPTX, but the export plan blocks a claim
+of print readiness pending printer-approved conversion/proof.
+The referenced source record must have kind `printer_rule`.
+
+## `quality`
+
+- `minimum_font_pt_final`
+- `font_guidance_basis`
+- `font_guidance_source_id`
+- `minimum_raster_dpi_final`
+- `raster_dpi_basis`
+- `raster_dpi_source_id`
+
+Basis values are:
+
+- `heuristic`
+- `source_specific`
+- `conference_requirement`
+- `printer_requirement`
+
+A heuristic must have a null source ID. Every other basis requires an exact source
+ID. Values apply at final physical output, after uniform scaling.
+
+## `palette`
+
+`colors` maps stable IDs to opaque `#RRGGBB` sRGB values.
+
+Each `contrast_pairs` record contains:
+
+- `id`
+- `foreground_color_id`
+- `background_color_id`
+- `usage`: `normal_text`, `large_text`, or `non_text`
+
+The validator applies 4.5:1 to normal text and 3:1 to large text/non-text. A text
+element using `large_text` must be at least 18 pt final, or at least 14 pt final and
+bold.
+
+`data_series_redundant_encoding` must be true. This is an author confirmation that
+color is supplemented by labels, shapes, markers, patterns, or line styles. It is not
+an automated certification.
+
+## `sources`
+
+Each source has:
+
+- `id`
+- `kind`
+- `citation`
+- `locator`
+- `author_verified: true`
+
+Kinds include author content, publication, dataset, asset license, conference rule,
+printer rule, institutional rule, and other.
+
+Every source must be used, and every referenced ID must exist. The scripts do not
+resolve URLs, DOIs, or local records.
+
+## `assets`
+
+The array may be empty: figures, logos, and QR codes are optional. Only local
+PNG/JPEG assets are accepted when an asset is present. Each record has:
+
+- `id`
+- manifest-relative `path`
+- `role`: `figure`, `logo`, or `qr_code`
+- lowercase SHA-256
+- exact `source_id`
+- `license`: exact license or permission statement
+- `provenance`: exact author-verified origin or generation record
+- concise `alt_text`
+- `author_approved: true`
+- `qr_target`
+
+`qr_target` is null except for QR assets, where it is an exact `https://` URL. Files
+are bounded, final symlinks are rejected, paths cannot escape the manifest directory,
+and hashes must match.
+
+All asset records must be placed in the poster.
+Use one asset record for repeated placement of the same file; duplicate asset paths
+are rejected.
+
+The image inventory rejects EXIF, XMP, comments, and embedded text/application
+metadata to avoid publishing hidden or location-identifying information. Flatten and
+strip such metadata in an author-reviewed offline workflow, then hash and approve the
+resulting pixels as a new asset. ICC profiles and basic technical image fields are
+reported but not silently removed.
+
+## `elements`
+
+Elements are listed in ascending, contiguous `reading_order` from 1. The list order is
+not silently changed.
+
+Every element has:
+
+- `id`, `type`, and `reading_order`
+- design coordinates `x_in`, `y_in`, `width_in`, `height_in`
+- one or more exact `source_ids`
+- `author_approved: true`
+- `allow_in_bleed`
+
+All boxes must stay on the canvas. Non-bleed elements must remain inside the physical
+safe area mapped to the canvas. Text can never be allowed in bleed.
+
+### Text elements
+
+Text elements also specify:
+
+- `role`
+- exact `text`
+- `font_size_pt_design`
+- `font_face`
+- `bold`
+- horizontal and vertical alignment
+- `contrast_pair_id`
+- optional `line_color_id`
+- `line_width_pt`
+- `margin_in`
+
+Roles include title, authors, affiliation, heading, body, caption, reference,
+acknowledgement, contact, QR fallback, and other.
+
+Font size is checked after physical scaling. Text auto-shrink is disabled during
+generation.
+
+### Image elements
+
+Image elements also specify:
+
+- `asset_id`
+- `fit: "contain"`
+- `fallback_text_element_id`
+- `long_description_element_id`
+
+Contain fitting preserves aspect ratio and centers the image. A QR asset requires a
+square box and a fallback text element whose role is `qr_fallback` and whose text
+contains the exact `qr_target`. Other assets use null fallback IDs.
+
+`long_description_element_id` is null when approved alt text and adjacent native text
+are sufficient. For a complex figure that needs a longer explanation, it references
+an approved native text element with role `body`, `caption`, or `other`. That element
+must follow the image in reading order and include every source ID used by the image.
+QR assets use the required visible fallback text and therefore set this field to null.
+The reference is structural; a human must decide whether the description is complete.
+
+## Approval
+
+Draft form:
+
+```json
+{
+ "status": "draft",
+ "approved_by": null,
+ "approved_at": null,
+ "content_sha256": null
+}
+```
+
+After all non-approval fields validate:
+
+```bash
+python -B scripts/validate_manifest.py poster.json \
+ --print-content-hash
+```
+
+Give the exact manifest and reported hash to the author. Approved form requires:
+
+- `status: "approved"`
+- nonempty `approved_by`
+- ISO 8601 `approved_at` with UTC offset
+- exact lowercase `content_sha256`
+
+The hash covers every top-level field except `approval`, using canonical sorted
+UTF-8 JSON. Any content, source, requirement, palette, coordinate, or asset-metadata
+change invalidates approval.
+
+## Validation modes and exit codes
+
+Normal validation reads and hashes assets and requires approval:
+
+```bash
+python -B scripts/validate_manifest.py poster.json
+```
+
+`--structure-only` skips file reads/hashes but still validates path syntax. Use it for
+planning/audit only, never generation.
+
+`--print-content-hash` permits draft approval but does not permit placeholders,
+unverified sources, unapproved elements, or false requirements.
+
+CLIs use:
+
+- exit 0: pass;
+- exit 1: completed audit found a release-blocking issue;
+- exit 2: invalid input, unsafe input, missing dependency, or command error.
diff --git a/skills/pptx-posters/references/poster_content_guide.md b/skills/pptx-posters/references/poster_content_guide.md
index dd97de4e..bf08b8c2 100644
--- a/skills/pptx-posters/references/poster_content_guide.md
+++ b/skills/pptx-posters/references/poster_content_guide.md
@@ -1,748 +1,176 @@
-# Research Poster Content Guide
+# Source-bound poster content
-## Overview
-
-Content is king in research posters. This guide covers writing strategies, section-specific guidance, visual-text balance, and best practices for communicating research effectively in poster format.
-
-## Core Content Principles
-
-### 1. The 3-5 Minute Rule
+## Non-negotiable rule
-**Reality**: Most viewers spend 3-5 minutes at your poster
-- **1 minute**: Scanning from distance (title, figures)
-- **2-4 minutes**: Reading key points up close
-- **5+ minutes**: Engaged conversation (if interested)
+The generator renders approved manifest content. It does not research, infer, draft,
+summarize, complete, or "improve" scientific claims. Never invent poster text,
+citations, data, statistics, author details, affiliations, funding statements, image
+licenses, or QR destinations.
-**Design Implication**: Poster must work at three levels:
-1. **Distance view** (6-10 feet): Title and main figure visible
-2. **Browse view** (3-6 feet): Section headers and key results readable
-3. **Detail view** (1-3 feet): Full content accessible
-
-### 2. Tell a Story, Not a Paper
+If an exact source or author approval is missing, stop. Keep the manifest in `draft`
+status. Do not replace missing material with plausible prose.
-**Poster ≠ Condensed Paper**
+## Build an evidence packet first
-**Paper approach** (❌):
-- Comprehensive literature review
-- Detailed methodology
-- All results presented
-- Lengthy discussion
-- 50+ references
+Ask the author for the local, authoritative material needed for this poster:
-**Poster approach** (✅):
-- One sentence background
-- Visual methods diagram
-- 3-5 key results
-- 3-4 bullet point conclusions
-- 5-10 key references
+- accepted abstract or author-approved summary;
+- exact title, author order, affiliations, contact details, and identifiers;
+- final tables, figures, captions, units, sample sizes, statistics, and uncertainty;
+- bibliography or exact publication identifiers;
+- funding, conflict, ethics, registration, data, and code statements where applicable;
+- optional local logos and images plus provenance and ownership/license/permission
+ records;
+- organizer poster instructions and printer specifications;
+- exact QR destination and the visible fallback URL/text.
-**Story Arc for Posters**:
-```
-Hook (Problem) → Approach → Discovery → Impact
-```
+Record each item as a `sources[]` entry with a unique ID. A locator can be a DOI,
+stable URL, local controlled-record identifier, figure/table number, page/section,
+or dated author instruction. The scripts never dereference it.
-**Example**:
-- **Hook**: "Antibiotic resistance threatens millions of lives annually"
-- **Approach**: "We developed an AI system to predict resistance patterns"
-- **Discovery**: "Our model achieves 87% accuracy, 20% better than existing methods"
-- **Impact**: "Could reduce treatment failures by identifying resistance earlier"
+`author_verified: true` means a human author checked that source record. It does not
+mean an agent found a plausible web page.
-### 3. The 800-Word Maximum
+## Exact source IDs
-**Word Count Guidelines**:
-- **Ideal**: 300-500 words
-- **Maximum**: 800 words
-- **Hard limit**: 1000 words (beyond this, poster is unreadable)
+Every text or image element has `source_ids`. These IDs must exactly match records in
+`sources[]`; fuzzy title matching is forbidden.
-**Word Budget by Section**:
-| Section | Word Count | % of Total |
-|---------|-----------|------------|
-| Introduction/Background | 50-100 | 15% |
-| Methods | 100-150 | 25% |
-| Results (text) | 100-200 | 25% |
-| Discussion/Conclusions | 100-150 | 25% |
-| References/Acknowledgments | 50-100 | 10% |
+Use the smallest defensible source set:
-**Counting Tool**:
-```latex
-% Add word count to poster (remove for final)
-\usepackage{texcount}
-% Compile with: texcount -inc poster.tex
-```
-
-### 4. Visual-to-Text Ratio
-
-**Optimal Balance**: 40-50% visual content, 50-60% text+white space
-
-**Visual Content Includes**:
-- Figures and graphs
-- Photos and images
-- Diagrams and flowcharts
-- Icons and symbols
-- Color blocks and design elements
-
-**Too Text-Heavy** (❌):
-- Wall of text
-- Small figures
-- Intimidating to viewers
-- Low engagement
-
-**Well-Balanced** (✅):
-- Clear figures dominate
-- Text supports visuals
-- Easy to scan
-- Inviting appearance
-
-## Section-Specific Content Guidance
-
-### Title
-
-**Purpose**: Capture attention, convey topic, establish credibility
-
-**Characteristics of Effective Titles**:
-- **Concise**: 10-15 words maximum
-- **Descriptive**: Clearly states research topic
-- **Active**: Uses strong verbs when possible
-- **Specific**: Avoids vague terms
-- **Jargon-aware**: Balances field-specific terms with accessibility
-
-**Title Formulas**:
-
-**1. Descriptive**:
-```
-[Method/Approach] for [Problem/Application]
-
-Example: "Deep Learning for Early Detection of Alzheimer's Disease"
-```
-
-**2. Question**:
-```
-[Research Question]?
-
-Example: "Can Microbiome Diversity Predict Treatment Response?"
-```
-
-**3. Assertion**:
-```
-[Finding] in [Context]
-
-Example: "Novel Mechanism Identified in Drug Resistance Pathways"
-```
-
-**4. Colon Format**:
-```
-[Topic]: [Specific Approach/Finding]
-
-Example: "Urban Heat Islands: A Machine Learning Framework for Mitigation"
-```
-
-**Avoid**:
-- ❌ Generic titles: "A Study of X"
-- ❌ Overly cute or clever wordplay (confuses message)
-- ❌ Excessive jargon: "Utilization of CRISPR-Cas9..."
-- ❌ Unnecessarily long: "Investigation of the potential role of..."
-
-**LaTeX Title Formatting**:
-```latex
-% Emphasize key words with bold
-\title{Deep Learning for \textbf{Early Detection} of Alzheimer's Disease}
-
-% Two-line titles for long names
-\title{Machine Learning Framework for\\Urban Heat Island Mitigation}
-
-% Avoid ALL CAPS (harder to read)
-```
-
-### Authors and Affiliations
-
-**Best Practices**:
-- **Presenting author**: Bold, underline, or asterisk
-- **Corresponding author**: Include email
-- **Affiliations**: Superscript numbers or symbols
-- **Institutional logos**: 2-4 maximum
-
-**Format Examples**:
-```latex
-% Simple format
-\author{\textbf{Jane Smith}\textsuperscript{1}, John Doe\textsuperscript{2}}
-\institute{
- \textsuperscript{1}University of Example,
- \textsuperscript{2}Research Institute
-}
-
-% With contact
-\author{Jane Smith\textsuperscript{1,*}}
-\institute{
- \textsuperscript{1}Department, University\\
- \textsuperscript{*}[email protected]
-}
-```
-
-### Introduction/Background
-
-**Purpose**: Establish context, motivate research, state objective
-
-**Structure** (50-100 words):
-1. **Problem statement** (1-2 sentences): What's the issue?
-2. **Knowledge gap** (1-2 sentences): What's unknown/unsolved?
-3. **Research objective** (1 sentence): What did you do?
-
-**Example** (95 words):
-```
-Antibiotic resistance causes 700,000 deaths annually, projected to reach
-10 million by 2050. Current diagnostic methods require 48-72 hours,
-delaying appropriate treatment. Machine learning offers potential for
-rapid resistance prediction, but existing models lack generalizability
-across bacterial species.
-
-We developed a transformer-based deep learning model to predict antibiotic
-resistance from genomic sequences across multiple pathogen species. Our
-approach integrates evolutionary information and protein structure to
-improve cross-species accuracy.
-```
-
-**Visual Support**:
-- Conceptual diagram showing problem
-- Infographic with statistics
-- Image of application context
-
-**Common Mistakes**:
-- ❌ Extensive literature review
-- ❌ Too much background detail
-- ❌ Undefined acronyms at first use
-- ❌ Missing clear objective statement
-
-### Methods
-
-**Purpose**: Describe approach sufficiently for understanding (not replication)
-
-**Key Question**: "How did you do it?" not "How could someone else replicate it?"
-
-**Content Strategy**:
-- **Prioritize**: Visual methods diagram > text description
-- **Include**: Study design, key procedures, analysis approach
-- **Omit**: Detailed protocols, routine procedures, specific reagent details
-
-**Visual Methods (Highly Recommended)**:
-```latex
-% Flowchart of study design
-\begin{tikzpicture}[node distance=2cm]
- \node (start) [box] {Data Collection\\n=1,000 samples};
- \node (process) [box, below of=start] {Preprocessing\\Quality Control};
- \node (analysis) [box, below of=process] {Statistical Analysis\\Mixed Models};
- \node (end) [box, below of=analysis] {Validation\\Independent Cohort};
-
- \draw [arrow] (start) -- (process);
- \draw [arrow] (process) -- (analysis);
- \draw [arrow] (analysis) -- (end);
-\end{tikzpicture}
-```
-
-**Text Methods** (50-150 words):
-
-**For Experimental Studies**:
-```
-Methods
-• Study design: Randomized controlled trial (n=200)
-• Participants: Adults aged 18-65 with Type 2 diabetes
-• Intervention: 12-week exercise program vs. standard care
-• Outcomes: HbA1c (primary), insulin sensitivity (secondary)
-• Analysis: Linear mixed models, intention-to-treat
-```
-
-**For Computational Studies**:
-```
-Methods
-• Dataset: 10,000 labeled images from ImageNet
-• Architecture: ResNet-50 with custom attention mechanism
-• Training: 100 epochs, Adam optimizer, learning rate 0.001
-• Validation: 5-fold cross-validation
-• Comparison: Baseline CNN, VGG-16, Inception-v3
-```
-
-**Format Options**:
-- **Bullet points**: Quick scanning (recommended)
-- **Numbered list**: Sequential procedures
-- **Diagram + brief text**: Ideal combination
-- **Table**: Multiple conditions or parameters
-
-### Results
-
-**Purpose**: Present key findings visually and clearly
-
-**Golden Rule**: Show, don't tell
-
-**Content Allocation**:
-- **Figures**: 70-80% of Results section
-- **Text**: 20-30% (brief descriptions, statistics)
-
-**How Many Results**:
-- **Ideal**: 3-5 main findings
-- **Maximum**: 6-7 distinct results
-- **Focus**: Primary outcomes, most impactful findings
-
-**Figure Selection Criteria**:
-1. Does it support the main message?
-2. Is it self-explanatory with caption?
-3. Can it be understood in 10 seconds?
-4. Does it add information beyond text?
-
-**Figure Captions**:
-- **Descriptive**: Explain what is shown
-- **Standalone**: Understandable without reading full poster
-- **Statistical**: Include significance indicators, sample sizes
-- **Concise**: 1-3 sentences
-
-**Example Caption**:
-```latex
-\caption{Treatment significantly improved outcomes.
-Mean±SD shown for control (blue, n=45) and treatment (orange, n=47) groups.
-**p<0.01, ***p<0.001 (two-tailed t-test).}
-```
-
-**Text Support for Results** (100-200 words):
-- State main finding per figure
-- Include key statistics
-- Note trends or patterns
-- Avoid detailed interpretation (save for Discussion)
-
-**Example Results Text**:
-```
-Key Findings
-• Model achieved 87% accuracy on test set (vs. 73% baseline)
-• Performance consistent across 5 bacterial species (p<0.001)
-• Prediction speed: <30 seconds per isolate
-• Feature importance: protein structure (42%), sequence (35%),
- evolutionary conservation (23%)
-```
-
-**Data Presentation Formats**:
-
-**1. Bar Charts**: Comparing categories
-```latex
-\begin{tikzpicture}
- \begin{axis}[
- ybar,
- ylabel=Accuracy (\%),
- symbolic x coords={Baseline, Model A, Our Method},
- xtick=data,
- nodes near coords
- ]
- \addplot coordinates {(Baseline,73) (Model A,81) (Our Method,87)};
- \end{axis}
-\end{tikzpicture}
-```
-
-**2. Line Graphs**: Trends over time
-**3. Scatter Plots**: Correlations
-**4. Heatmaps**: Matrix data, clustering
-**5. Box Plots**: Distributions, comparisons
-**6. ROC Curves**: Classification performance
-
-### Discussion/Conclusions
-
-**Purpose**: Interpret findings, state implications, acknowledge limitations
-
-**Structure** (100-150 words):
-
-**1. Main Conclusions** (50-75 words):
-- 3-5 bullet points
-- Clear, specific takeaways
-- Linked to research objectives
-
-**Example**:
-```
-Conclusions
-• First cross-species model for antibiotic resistance prediction
- achieving >85% accuracy
-• Protein structure integration critical for generalizability
- (improved accuracy by 14%)
-• Prediction speed enables clinical decision support within
- consultation timeframe
-• Potential to reduce inappropriate antibiotic use by 20-30%
-```
-
-**2. Limitations** (25-50 words, optional but recommended):
-- Acknowledge key constraints
-- Brief, honest
-- Shows scientific rigor
-
-**Example**:
-```
-Limitations
-• Training data limited to 5 bacterial species
-• Requires genomic sequencing (not widely available)
-• Validation needed in prospective clinical trials
-```
-
-**3. Future Directions** (25-50 words, optional):
-- Next steps
-- Broader implications
-- Call to action
-
-**Example**:
-```
-Next Steps
-• Expand to 20+ additional species
-• Develop point-of-care sequencing integration
-• Launch multi-center clinical validation study (2025)
-```
-
-**Avoid**:
-- ❌ Overstating findings: "This revolutionary breakthrough..."
-- ❌ Extensive comparison to other work
-- ❌ New results in Discussion
-- ❌ Vague conclusions: "Further research is needed"
-
-### References
-
-**How Many**: 5-10 key citations
-
-**Selection Criteria**:
-- Include seminal work in the field
-- Recent relevant studies (last 5 years)
-- Methods cited in your poster
-- Controversial claims that need support
-
-**Format**: Abbreviated, consistent style
-
-**Examples**:
-
-**Numbered (Vancouver)**:
-```
-References
-1. Smith et al. (2023). Nature. 615:234-240.
-2. Jones & Lee (2024). Science. 383:112-118.
-3. Chen et al. (2022). Cell. 185:456-470.
-```
-
-**Author-Year (APA)**:
-```
-References
-Smith, J. et al. (2023). Title. Nature, 615, 234-240.
-Jones, A., & Lee, B. (2024). Title. Science, 383, 112-118.
-```
-
-**Minimal (For Space Constraints)**:
-```
-Key References: Smith (Nature 2023), Jones (Science 2024),
-Chen (Cell 2022). Full bibliography: [QR Code]
-```
-
-**Alternative**: QR code linking to full reference list
-
-### Acknowledgments
-
-**Include**:
-- Funding sources (with grant numbers)
-- Major collaborators
-- Core facilities used
-- Dataset sources
-
-**Format** (25-50 words):
-```
-Acknowledgments
-Funded by NIH Grant R01-123456 and NSF Award 7890123.
-We thank Dr. X for data access, the Y Core Facility for
-sequencing, and Z for helpful discussions.
-```
-
-### Contact Information
-
-**Essential Elements**:
-- Name of presenting/corresponding author
-- Email address
-- Optional: Lab website, Twitter/X, LinkedIn, ORCID
-
-**Format**:
-```
-Contact: Jane Smith, [email protected]
-Lab: smithlab.university.edu | Twitter: @smithlab
-```
-
-**QR Code Alternative**:
-- Link to personal/lab website
-- Link to paper preprint/publication
-- Link to code repository (GitHub)
-- Link to supplementary materials
-
-## Writing Style for Posters
-
-### Active vs. Passive Voice
-
-**Prefer Active Voice** (more engaging, clearer):
-- ✅ "We developed a model..."
-- ✅ "The treatment reduced symptoms..."
-
-**Passive Voice** (when appropriate):
-- ✅ "Samples were collected from..."
-- ✅ "Data were analyzed using..."
-
-### Sentence Length
-
-**Keep Sentences Short**:
-- **Ideal**: 10-15 words per sentence
-- **Maximum**: 20-25 words
-- **Avoid**: >30 words (hard to follow)
-
-**Example Revision**:
-- ❌ Long: "We performed a comprehensive analysis of gene expression data from 500 patients with colorectal cancer using RNA sequencing and identified 47 differentially expressed genes associated with treatment response." (31 words)
-- ✅ Short: "We analyzed RNA sequencing data from 500 colorectal cancer patients. We identified 47 genes associated with treatment response." (19 words total, two sentences)
-
-### Bullet Points vs. Paragraphs
-
-**Use Bullet Points For**:
-- ✅ Lists of items or findings
-- ✅ Key conclusions
-- ✅ Methods steps
-- ✅ Study characteristics
-
-**Use Short Paragraphs For**:
-- ✅ Narrative flow (Introduction)
-- ✅ Complex explanations
-- ✅ Connected ideas
-
-**Bullet Point Best Practices**:
-- Start with action verbs or nouns
-- Parallel structure throughout list
-- 3-7 bullets per list (not too many)
-- Brief (1-2 lines each)
-
-**Example**:
-```
-Methods
-• Participants: 200 adults (18-65 years)
-• Design: Double-blind RCT (12 weeks)
-• Intervention: Daily 30-min exercise
-• Control: Standard care
-• Analysis: Mixed models (SPSS v.28)
-```
-
-### Acronyms and Jargon
-
-**First Use Rule**: Define at first appearance
-```
-We used machine learning (ML) to analyze... Later, ML predicted...
-```
-
-**Common Acronyms**: May not need definition if universal to field
-- DNA, RNA, MRI, CT, PCR (in biomedical context)
-- AI, ML, CNN (in computer science context)
-
-**Avoid Excessive Jargon**:
-- ❌ "Utilized" → ✅ "Used"
-- ❌ "Implement utilization of" → ✅ "Use"
-- ❌ "A majority of" → ✅ "Most"
-
-### Numbers and Statistics
-
-**Present Statistics Clearly**:
-- Always include measure of variability (SD, SE, CI)
-- Report sample sizes: n=50
-- Indicate significance: p<0.05, p<0.01, p<0.001
-- Use symbols consistently: * for p<0.05, ** for p<0.01
-
-**Format Numbers**:
-- Round appropriately (avoid false precision)
-- Use consistent decimal places
-- Include units: 25 mg/dL, 37°C
-- Large numbers: 1,000 or 1000 (be consistent)
-
-**Example**:
-```
-Treatment increased response by 23.5% (95% CI: 18.2-28.8%, p<0.001, n=150)
-```
-
-## Visual-Text Integration
-
-### Figure-Text Relationship
-
-**Figure First, Text Second**:
-1. Design poster around key figures
-2. Add text to support and explain visuals
-3. Ensure figures can stand alone
-
-**Text Placement Relative to Figures**:
-- **Above**: Context, "What you're about to see"
-- **Below**: Explanation, statistics, caption
-- **Beside**: Comparison, interpretation
-
-### Callouts and Annotations
-
-**On-Figure Annotations**:
-```latex
-\begin{tikzpicture}
- \node[inner sep=0] (img) {\includegraphics[width=10cm]{figure.pdf}};
- \draw[->, thick, red] (8,5) -- (6,3) node[left] {Key region};
- \draw[red, thick] (3,2) circle (1cm) node[above=1.2cm] {Anomaly};
-\end{tikzpicture}
-```
-
-**Callout Boxes**:
-```latex
-\begin{tcolorbox}[colback=yellow!10, colframe=orange!80,
- title=Key Finding]
-Our method reduces errors by 34\% compared to state-of-the-art.
-\end{tcolorbox}
-```
-
-### Icons for Section Headers
-
-**Visual Section Markers**:
-```latex
-\usepackage{fontawesome5}
-
-\block{\faFlask~Introduction}{...}
-\block{\faCog~Methods}{...}
-\block{\faChartBar~Results}{...}
-\block{\faLightbulb~Conclusions}{...}
-```
-
-## Content Adaptation Strategies
-
-### From Paper to Poster
-
-**Condensation Process**:
-
-**1. Identify Core Message** (The Elevator Pitch):
-- What's the one thing you want people to remember?
-- If you had 30 seconds, what would you say?
-
-**2. Select Key Results**:
-- Choose 3-5 most impactful findings
-- Omit supporting/secondary results
-- Focus on figures with strong visual impact
-
-**3. Simplify Methods**:
-- Visual flowchart > text description
-- Omit routine procedures
-- Include only essential parameters
-
-**4. Trim Literature Review**:
-- One sentence background
-- One sentence gap/motivation
-- One sentence your contribution
-
-**5. Condense Discussion**:
-- Main conclusions only
-- Brief limitations
-- One sentence future direction
-
-### For Different Audiences
-
-**Specialist Audience** (Same Field):
-- Can use field-specific jargon
-- Less background needed
-- Focus on novel methodology
-- Emphasize nuanced findings
-
-**General Scientific Audience**:
-- Define key terms
-- More context/background
-- Broader implications
-- Visual metaphors helpful
-
-**Public/Lay Audience**:
-- Minimal jargon, all defined
-- Extensive context
-- Real-world applications
-- Analogies and simple language
-
-**Example Adaptation**:
-
-**Specialist**: "CRISPR-Cas9 knockout of BRCA1 induced synthetic lethality with PARP inhibitors"
-
-**General**: "We used gene editing to make cancer cells vulnerable to existing drugs"
-
-**Public**: "We found a way to make cancer treatments work better by targeting specific genetic weaknesses"
-
-## Quality Control Checklist
-
-### Content Review
-
-**Clarity**:
-- [ ] Main message immediately clear
-- [ ] All acronyms defined
-- [ ] Sentences short and direct
-- [ ] No unnecessary jargon
-
-**Completeness**:
-- [ ] Research question/objective stated
-- [ ] Methods sufficiently described
-- [ ] Key results presented
-- [ ] Conclusions drawn
-- [ ] Limitations acknowledged
-
-**Accuracy**:
-- [ ] All statistics correct
-- [ ] Figure captions accurate
-- [ ] References properly cited
-- [ ] No overstated claims
-
-**Engagement**:
-- [ ] Compelling title
-- [ ] Visual interest
-- [ ] Clear take-home message
-- [ ] Conversation starters
-
-### Readability Testing
-
-**Distance Test**:
-- Print at 25% scale
-- View from 2-3 feet (simulates 8-12 feet for full poster)
-- Can you read: Title? Section headers? Body text?
-
-**Scan Test**:
-- Give poster to colleague for 30 seconds
-- Ask: "What is this poster about?"
-- They should identify: Topic, approach, main finding
-
-**Detail Test**:
-- Ask colleague to read poster thoroughly (5 min)
-- Ask: "What are the key conclusions?"
-- Verify understanding matches your intent
-
-## Common Content Mistakes
-
-**1. Too Much Text**
-- ❌ >1000 words
-- ❌ Long paragraphs
-- ❌ Full paper condensed
-- ✅ 300-800 words, bullet points, key findings only
-
-**2. Unclear Message**
-- ❌ Multiple unrelated findings
-- ❌ No clear conclusion
-- ❌ Vague implications
-- ✅ 1-3 main points, explicit conclusions
-
-**3. Methods Overkill**
-- ❌ Detailed protocols
-- ❌ All parameters listed
-- ❌ Routine procedures described
-- ✅ Visual flowchart, key details only
-
-**4. Poor Figure Integration**
-- ❌ Figures without context
-- ❌ Unclear captions
-- ❌ Text doesn't reference figures
-- ✅ Figures central, well-captioned, text integrated
-
-**5. Missing Context**
-- ❌ No background
-- ❌ Undefined acronyms
-- ❌ Assumes expert knowledge
-- ✅ Brief context, definitions, accessible to broader audience
-
-## Conclusion
-
-Effective poster content:
-- **Concise**: 300-800 words maximum
-- **Visual**: 40-50% figures and graphics
-- **Clear**: One main message, 3-5 key findings
-- **Engaging**: Compelling story, not just facts
-- **Accessible**: Appropriate for target audience
-- **Actionable**: Clear implications and next steps
-
-Remember: Your poster is a conversation starter, not a comprehensive treatise. Design content to intrigue, engage, and invite discussion.
+- a title/author element can cite the accepted-submission or author-roster record;
+- a result sentence should cite the exact table, figure, analysis output, or
+ publication location supporting it;
+- a figure should cite its data/figure provenance and its asset-license record;
+- a conference dimension should cite the organizer's current instruction;
+- a printer constraint should cite the current quote, specification, or written
+ confirmation.
+The validator rejects unknown and unused source IDs. This catches misspellings and
+stale records instead of guessing what the author meant.
+
+## Content selection is author-controlled
+
+There is no universal section list, word count, visual percentage, number of figures,
+or citation count. Use the organizer's requirements and the research story.
+
+A useful author review asks:
+
+1. What question should a viewer understand?
+2. Which exact result supports the take-home message?
+3. Which method detail is necessary to interpret that result?
+4. Which limitation prevents overstatement?
+5. What action or follow-up should the viewer take?
+
+Possible sections include context, objective, methods, results, limitations,
+conclusions, references, acknowledgments, and contact information. Include only those
+that are supported and appropriate. Clinical, qualitative, engineering, humanities,
+and computational posters often need different structures.
+
+## Preserve scientific meaning
+
+For each candidate edit:
+
+- preserve direction, magnitude, units, denominators, uncertainty, and qualifiers;
+- distinguish observed association from causation;
+- retain negative/null results when necessary to prevent a misleading summary;
+- keep population, intervention, comparator, endpoint, and time frame where relevant;
+- do not convert a model metric into a clinical or practical claim;
+- do not add significance language that the source does not support;
+- do not remove limitations that materially change interpretation;
+- define acronyms for the intended audience;
+- keep citation labels synchronized with the exact bibliography.
+
+An agent may propose shorter wording, but the author must approve the exact resulting
+text and renew the manifest content hash.
+
+## Figures and data
+
+Figures are optional. Use author-supplied local assets or assets generated separately
+from exact author data in a reviewed workflow. This skill makes no network or model
+calls. Do not create substitute data, redraw values from memory, or ask an image model
+to depict scientific results.
+
+Before approval, verify:
+
+- values, labels, units, error definitions, sample sizes, and statistical notation;
+- category order, axes, scales, transformations, baselines, and truncation;
+- correspondence between caption and plotted data;
+- direct labels or a clear legend;
+- redundant encoding beyond color;
+- asset hash, source ID, exact provenance, license/permission, and concise alt text;
+- a source-bound native long description when alt text and adjacent prose are
+ insufficient for a complex figure;
+- final effective DPI for raster assets.
+
+If a chart must be regenerated, regenerate it from the author's exact data using a
+separate, reviewed analysis workflow. Record the tool/version or controlled workflow,
+input source IDs, date, human reviewer, and permission to use the output. Then add the
+resulting local image and provenance to the manifest.
+
+## Citations and references
+
+Copy citations only from the author's verified bibliography or primary source record.
+Never fabricate missing metadata. Keep identifiers exact, including DOI capitalization
+and version/date where those distinguish records.
+
+Space pressure does not justify an ambiguous citation. If the organizer permits a
+short display form, keep a stable identifier and provide an exact accessible full-list
+destination. The visible poster still needs enough information for a viewer to
+identify the source without relying solely on a QR code.
+
+## QR codes
+
+A QR image is only a local asset. The scripts do not generate it, resolve it, follow
+it, or create a hyperlink.
+
+For every QR asset:
+
+- record one exact `https://` target in `asset.qr_target`;
+- provide a separate text element with role `qr_fallback`;
+- include that exact URL verbatim in the fallback text;
+- cite the same source record from the image and fallback text;
+- write alt text that states the QR code's purpose and destination;
+- test the exported and printed code manually on multiple devices.
+
+Do not use a QR code as the only way to access essential poster content.
+
+## Approval binding
+
+Approval is content-specific:
+
+1. Complete the manifest with local assets and all exact source IDs.
+2. Keep `approval.status` as `draft`.
+3. Run the validator with `--print-content-hash`.
+4. Give the exact manifest and reported hash to the approving author.
+5. After approval, set `status`, `approved_by`, `approved_at`, and
+ `content_sha256`.
+6. Run normal validation and generation.
+
+Any change outside `approval` changes the canonical hash. The validator then refuses
+generation until an author approves the new hash.
+
+## Placeholder policy
+
+The bundled template intentionally contains replacement tokens, false confirmations,
+and draft approval. It must fail validation.
+
+The validator rejects common placeholder forms such as TODO, TBD, Lorem ipsum,
+REPLACE_ME, generic bracketed fields, and unresolved template labels. Do not weaken
+this policy to make a draft generate. Replace every field with reviewed content or
+stop.
+
+## Final content review
+
+Before release, the presenting/corresponding author should compare the poster against
+the original evidence packet and check:
+
+- title, author order, affiliations, correspondence, and funding;
+- every claim, number, unit, citation, image, and caption;
+- methods and limitations needed for valid interpretation;
+- consistency between poster text and figures;
+- accessibility text, visible QR fallbacks, and meaningful contact information;
+- conference and printer compliance;
+- the final manifest hash and generated PPTX hash.
+
+An automated pass never substitutes for scientific sign-off.
diff --git a/skills/pptx-posters/references/poster_design_principles.md b/skills/pptx-posters/references/poster_design_principles.md
index 2454bff0..90ac1ca0 100644
--- a/skills/pptx-posters/references/poster_design_principles.md
+++ b/skills/pptx-posters/references/poster_design_principles.md
@@ -1,806 +1,226 @@
-# Research Poster Design Principles
+# Poster design and accessibility principles
-## Overview
+## Requirements outrank conventions
-Effective poster design balances visual appeal, readability, and scientific content. This guide covers typography, color theory, visual hierarchy, accessibility, and evidence-based design principles for research posters.
+There is no universal poster size, orientation, grid, body font, margin, image DPI,
+word count, or number of columns. Confirm the current organizer and printer rules,
+record exact source IDs, and design against those constraints.
-## Core Design Principles
+Use generic advice only as a labeled project heuristic. Do not transform a heuristic
+into a conference or accessibility requirement.
-### 1. Visual Hierarchy
+## Visual hierarchy
-Guide viewers through content in logical order using size, color, position, and contrast.
-
-**Hierarchy Levels**:
+Make the research question, key result, and interpretation easy to locate without
+forcing every poster into one visual style.
-1. **Primary (Title)**: Largest, most prominent
- - Size: 72-120pt
- - Position: Top center or top spanning
- - Weight: Bold
- - Purpose: Capture attention from 20+ feet
-
-2. **Secondary (Section Headers)**: Organize content
- - Size: 48-72pt
- - Weight: Bold or semi-bold
- - Purpose: Section navigation, readable from 10 feet
-
-3. **Tertiary (Body Text)**: Main content
- - Size: 24-36pt minimum
- - Weight: Regular
- - Purpose: Detailed information, readable from 4-6 feet
-
-4. **Quaternary (Captions, References)**: Supporting info
- - Size: 18-24pt
- - Weight: Regular or light
- - Purpose: Context and attribution
-
-**Implementation**:
-```latex
-% Define hierarchy in LaTeX
-\setbeamerfont{title}{size=\VeryHuge,series=\bfseries} % 90pt+
-\setbeamerfont{block title}{size=\Huge,series=\bfseries} % 60pt
-\setbeamerfont{block body}{size=\LARGE} % 30pt
-\setbeamerfont{caption}{size=\large} % 24pt
-```
-
-### 2. White Space (Negative Space)
-
-Empty space is not wasted space—it enhances readability and guides attention.
-
-**White Space Functions**:
-- **Breathing room**: Prevents overwhelming viewers
-- **Grouping**: Shows which elements belong together
-- **Focus**: Draws attention to important elements
-- **Flow**: Creates visual pathways through content
-
-**Guidelines**:
-- Minimum 5-10% margins on all sides
-- Consistent spacing between blocks (1-2cm)
-- Space around figures equal to or greater than border width
-- Group related items closely, separate unrelated items
-- Don't fill every inch—aim for 40-60% text coverage
-
-**LaTeX Implementation**:
-```latex
-% beamerposter spacing
-\setbeamertemplate{block begin}{
- \vskip2ex % Space before block
- ...
-}
-
-% tikzposter spacing
-\documentclass[..., blockverticalspace=15mm, colspace=15mm]{tikzposter}
-
-% Manual spacing
-\vspace{2cm} % Vertical space
-\hspace{1cm} % Horizontal space
-```
-
-### 3. Alignment and Grid Systems
-
-Proper alignment creates professional, organized appearance.
-
-**Alignment Types**:
-- **Left-aligned text**: Most readable for body text (Western audiences)
-- **Center-aligned**: Headers, titles, symmetric layouts
-- **Right-aligned**: Rarely used, special cases only
-- **Justified**: Avoid (creates uneven spacing)
-
-**Grid Systems**:
-- **2-column**: Simple, traditional, good for narrative flow
-- **3-column**: Most common, balanced, versatile
-- **4-column**: Complex, information-dense, requires careful design
-- **Asymmetric**: Creative, modern, requires expertise
-
-**Best Practices**:
-- Align block edges to invisible grid lines
-- Keep consistent column widths (unless intentionally asymmetric)
-- Align similar elements (all figures, all text blocks)
-- Use consistent margins throughout
-
-### 4. Visual Flow and Reading Patterns
-
-Design for natural eye movement and logical content progression.
-
-**Common Reading Patterns**:
-
-**Z-Pattern (Landscape posters)**:
-```
-Start → → → Top Right
- ↓
-Middle Left → → Middle
- ↓
-Bottom Left → → → End
-```
-
-**F-Pattern (Portrait posters)**:
-```
-Title → → → →
-↓
-Section 1 → →
-↓
-Section 2 → →
-↓
-Section 3 → →
-↓
-Conclusion → →
-```
-
-**Gutenberg Diagram**:
-```
-Primary Area Strong Fallow
-(top-left) (top-right)
- ↓ ↓
-Weak Fallow Terminal Area
-(bottom-left) (bottom-right)
-```
-
-**Implementation Strategy**:
-1. Place most important content in "hot zones" (top-left, center)
-2. Create visual paths with arrows, lines, or color
-3. Use numbering for sequential information (Methods steps)
-4. Design left-to-right, top-to-bottom flow (Western audiences)
-5. Position conclusions prominently (bottom-right is natural endpoint)
-
-## Typography
-
-### Font Selection
-
-**Recommended Fonts**:
-
-**Sans-Serif (Recommended for posters)**:
-- **Helvetica**: Clean, professional, widely available
-- **Arial**: Similar to Helvetica, universal compatibility
-- **Calibri**: Modern, friendly, good readability
-- **Open Sans**: Contemporary, excellent web and print
-- **Roboto**: Modern, Google design, highly readable
-- **Lato**: Warm, professional, works at all sizes
-
-**Serif (Use sparingly)**:
-- **Times New Roman**: Traditional, formal
-- **Garamond**: Elegant, good for humanities
-- **Georgia**: Designed for screens, readable
-
-**Avoid**:
-- ❌ Comic Sans (unprofessional)
-- ❌ Decorative or script fonts (illegible from distance)
-- ❌ Mixing more than 2-3 font families
-
-**LaTeX Implementation**:
-```latex
-% Helvetica (sans-serif)
-\usepackage{helvet}
-\renewcommand{\familydefault}{\sfdefault}
-
-% Arial-like
-\usepackage{avant}
-\renewcommand{\familydefault}{\sfdefault}
-
-% Modern fonts with fontspec (requires LuaLaTeX/XeLaTeX)
-\usepackage{fontspec}
-\setmainfont{Helvetica Neue}
-\setsansfont{Open Sans}
-```
-
-### Font Sizing
-
-**Absolute Minimum Sizes** (readable from 4-6 feet):
-- Title: 72pt+ (85-120pt recommended)
-- Section headers: 48-72pt
-- Body text: 24-36pt (30pt+ recommended)
-- Captions/small text: 18-24pt
-- References: 16-20pt minimum
-
-**Testing Readability**:
-- Print at 25% scale
-- Read from 2-3 feet distance
-- If legible, full-scale poster will be readable from 8-12 feet
-
-**Size Conversion**:
-| LaTeX Command | Approximate Size | Use Case |
-|---------------|------------------|----------|
-| `\tiny` | 10pt | Avoid on posters |
-| `\small` | 16pt | Minimal use only |
-| `\normalsize` | 20pt | References (scaled up) |
-| `\large` | 24pt | Captions, small text |
-| `\Large` | 28pt | Body text (minimum) |
-| `\LARGE` | 32pt | Body text (recommended) |
-| `\huge` | 36pt | Subheadings |
-| `\Huge` | 48pt | Section headers |
-| `\VeryHuge` | 72pt+ | Title |
-
-### Text Formatting Best Practices
-
-**Use**:
-- ✅ **Bold** for emphasis and headers
-- ✅ Short paragraphs (3-5 lines maximum)
-- ✅ Bullet points for lists
-- ✅ Adequate line spacing (1.2-1.5)
-- ✅ High contrast (dark text on light background)
-
-**Avoid**:
-- ❌ Italics from distance (hard to read)
-- ❌ ALL CAPS FOR LONG TEXT (SLOW TO READ)
-- ❌ Underlines (old-fashioned, interferes with descenders)
-- ❌ Long paragraphs (> 6 lines)
-- ❌ Light text on light backgrounds
-
-**Line Spacing**:
-```latex
-% Increase line spacing for readability
-\usepackage{setspace}
-\setstretch{1.3} % 1.3x normal spacing
-
-% Or in specific blocks
-\begin{spacing}{1.5}
- Your text here with extra spacing
-\end{spacing}
-```
-
-## Color Theory for Posters
-
-### Color Psychology and Meaning
-
-Colors convey meaning and affect viewer perception:
-
-| Color | Associations | Use Cases |
-|-------|--------------|-----------|
-| **Blue** | Trust, professionalism, science | Academic, medical, technology |
-| **Green** | Nature, health, growth | Environmental, biology, health |
-| **Red** | Energy, urgency, passion | Attention, warnings, bold statements |
-| **Orange** | Creativity, enthusiasm | Innovative research, friendly approach |
-| **Purple** | Wisdom, creativity, luxury | Humanities, arts, premium research |
-| **Gray** | Neutral, professional, modern | Technology, minimal designs |
-| **Yellow** | Optimism, attention, caution | Highlights, energy, caution areas |
-
-### Color Scheme Types
-
-**1. Monochromatic**: Variations of single hue
-- **Pros**: Harmonious, professional, easy to execute
-- **Cons**: Can be boring, less visual interest
-- **Use**: Conservative conferences, institutional branding
-
-```latex
-% Monochromatic blue scheme
-\definecolor{darkblue}{RGB}{0,51,102}
-\definecolor{medblue}{RGB}{51,102,153}
-\definecolor{lightblue}{RGB}{204,229,255}
-```
-
-**2. Analogous**: Adjacent colors on color wheel
-- **Pros**: Harmonious, visually comfortable
-- **Cons**: Low contrast, may lack excitement
-- **Use**: Nature/biology topics, smooth gradients
-
-```latex
-% Analogous blue-green scheme
-\definecolor{blue}{RGB}{0,102,204}
-\definecolor{teal}{RGB}{0,153,153}
-\definecolor{green}{RGB}{51,153,102}
-```
-
-**3. Complementary**: Opposite colors on wheel
-- **Pros**: High contrast, vibrant, energetic
-- **Cons**: Can be overwhelming if intense
-- **Use**: Drawing attention, modern designs
-
-```latex
-% Complementary blue-orange scheme
-\definecolor{primary}{RGB}{0,71,171} % Blue
-\definecolor{accent}{RGB}{255,127,0} % Orange
-```
-
-**4. Triadic**: Three evenly spaced colors
-- **Pros**: Balanced, vibrant, visually rich
-- **Cons**: Can appear busy if not balanced
-- **Use**: Multi-topic posters, creative fields
-
-```latex
-% Triadic scheme
-\definecolor{blue}{RGB}{0,102,204}
-\definecolor{red}{RGB}{204,0,51}
-\definecolor{yellow}{RGB}{255,204,0}
-```
-
-**5. Split-Complementary**: Base + two adjacent to complement
-- **Pros**: High contrast but less tense than complementary
-- **Cons**: Complex to balance
-- **Use**: Sophisticated designs, experienced designers
-
-### High-Contrast Combinations
-
-Ensure readability with sufficient contrast:
-
-**Excellent Contrast (Use these)**:
-- Dark blue on white
-- Black on white
-- White on dark blue/green/purple
-- Dark gray on light yellow
-- Black on light cyan
-
-**Poor Contrast (Avoid)**:
-- ❌ Red on green (color-blind issue)
-- ❌ Yellow on white
-- ❌ Light gray on white
-- ❌ Blue on black (hard to read)
-- ❌ Any pure colors on each other
-
-**Contrast Ratio Standards**:
-- Minimum: 4.5:1 (WCAG AA)
-- Recommended: 7:1 (WCAG AAA)
-- Test at: https://webaim.org/resources/contrastchecker/
-
-**LaTeX Color Contrast**:
-```latex
-% High contrast header
-\setbeamercolor{block title}{bg=black, fg=white}
-
-% Medium contrast body
-\setbeamercolor{block body}{bg=gray!10, fg=black}
-
-% Check contrast manually or use online tools
-```
-
-### Color-Blind Friendly Palettes
-
-~8% of males and ~0.5% of females have color vision deficiency.
-
-**Safe Color Combinations**:
-- Blue + Orange (most universally distinguishable)
-- Blue + Yellow
-- Blue + Red
-- Purple + Green (use with caution)
-
-**Avoid**:
-- ❌ Red + Green (indistinguishable to most common color blindness)
-- ❌ Green + Brown
-- ❌ Blue + Purple (can be problematic)
-- ❌ Light green + Yellow
-
-**Recommended Palettes**:
-
-**IBM Color Blind Safe** (excellent accessibility):
-```latex
-\definecolor{ibmblue}{RGB}{100,143,255}
-\definecolor{ibmmagenta}{RGB}{254,97,0}
-\definecolor{ibmpurple}{RGB}{220,38,127}
-\definecolor{ibmcyan}{RGB}{33,191,115}
-```
-
-**Okabe-Ito Palette** (scientifically tested):
-```latex
-\definecolor{okorange}{RGB}{230,159,0}
-\definecolor{okskyblue}{RGB}{86,180,233}
-\definecolor{okgreen}{RGB}{0,158,115}
-\definecolor{okyellow}{RGB}{240,228,66}
-\definecolor{okblue}{RGB}{0,114,178}
-\definecolor{okvermillion}{RGB}{213,94,0}
-\definecolor{okpurple}{RGB}{204,121,167}
-```
-
-**Paul Tol's Bright Palette**:
-```latex
-\definecolor{tolblue}{RGB}{68,119,170}
-\definecolor{tolred}{RGB}{204,102,119}
-\definecolor{tolgreen}{RGB}{34,136,51}
-\definecolor{tolyellow}{RGB}{238,221,136}
-\definecolor{tolcyan}{RGB}{102,204,238}
-```
-
-### Institutional Branding
-
-Match university or department colors:
-
-```latex
-% Example: Stanford colors
-\definecolor{stanford-red}{RGB}{140,21,21}
-\definecolor{stanford-gray}{RGB}{83,86,90}
-
-% Example: MIT colors
-\definecolor{mit-red}{RGB}{163,31,52}
-\definecolor{mit-gray}{RGB}{138,139,140}
-
-% Example: Cambridge colors
-\definecolor{cambridge-blue}{RGB}{163,193,173}
-\definecolor{cambridge-lblue}{RGB}{212,239,223}
-```
-
-## Accessibility Considerations
-
-### Universal Design Principles
-
-Design posters usable by the widest range of people:
-
-**1. Visual Accessibility**:
-- High contrast text (minimum 4.5:1 ratio)
-- Large font sizes (24pt+ body text)
-- Color-blind safe palettes
-- Clear visual hierarchy
-- Avoid relying solely on color to convey information
-
-**2. Cognitive Accessibility**:
-- Clear, simple language
-- Logical organization
-- Consistent layout
-- Visual cues for navigation (arrows, numbers)
-- Avoid clutter and information overload
-
-**3. Physical Accessibility**:
-- Position critical content at wheelchair-accessible height (3-5 feet)
-- Include QR codes to digital versions
-- Provide printed handouts for detail viewing
-- Consider lighting and reflection in poster material choice
-
-### Alternative Text and Descriptions
-
-Make posters accessible to screen readers (for digital versions):
-
-```latex
-% Add alt text to figures
-\includegraphics[width=\linewidth]{figure.pdf}
-% Alternative: Include detailed caption
-\caption{Bar graph showing mean±SD of treatment outcomes.
-Control group (blue): 45±5\%; Treatment group (orange): 78±6\%.
-Asterisks indicate significance: *p<0.05, **p<0.01.}
-```
-
-### Multi-Modal Information
-
-Don't rely on single sensory channel:
-
-**Use Redundant Encoding**:
-- Color + Shape (not just color for categories)
-- Color + Pattern (hatching, stippling)
-- Color + Label (text labels on graph elements)
-- Text + Icons (visual + verbal)
-
-**Example**:
-```latex
-% Good: Color + shape + label
-\begin{tikzpicture}
- \draw[fill=blue, circle] (0,0) circle (0.3) node[right] {Male: 45\%};
- \draw[fill=red, rectangle] (0,-1) rectangle (0.6,-0.4) node[right] {Female: 55\%};
-\end{tikzpicture}
-```
-
-## Layout Composition
-
-### Rule of Thirds
-
-Divide poster into 3×3 grid; place key elements at intersections:
-
-```
-+-----+-----+-----+
-| × | | × | ← Top third (title, logos)
-+-----+-----+-----+
-| | × | | ← Middle third (main content)
-+-----+-----+-----+
-| × | | × | ← Bottom third (conclusions)
-+-----+-----+-----+
- ↑ ↑
-Left Right
-```
-
-**Power Points** (intersections):
-- Top-left: Primary section start
-- Top-right: Logos, QR codes
-- Center: Key figure or main result
-- Bottom-right: Conclusions, contact
-
-### Balance and Symmetry
-
-**Symmetric Layouts**:
-- Formal, traditional, stable
-- Easy to design
-- Can appear static or boring
-- Good for conservative audiences
-
-**Asymmetric Layouts**:
-- Dynamic, modern, interesting
-- Harder to execute well
-- More visually engaging
-- Good for creative fields
-
-**Visual Weight Balance**:
-- Large elements = heavy weight
-- Dark colors = heavy weight
-- Dense text = heavy weight
-- Distribute weight evenly across poster
-
-### Proximity and Grouping
-
-**Gestalt Principles**:
-
-**Proximity**: Items close together are perceived as related
-```
-[Introduction] [Methods]
-
-[Results] [Discussion]
-```
-
-**Similarity**: Similar items are perceived as grouped
-- Use consistent colors for related sections
-- Same border styles for similar content types
-
-**Continuity**: Eyes follow lines and paths
-- Use arrows to guide through methods
-- Align elements to create invisible lines
-
-**Closure**: Mind completes incomplete shapes
-- Use partial borders to group without boxing in
-
-## Visual Elements
-
-### Icons and Graphics
-
-Strategic use of icons enhances comprehension:
-
-**Benefits**:
-- Universal language (crosses linguistic barriers)
-- Faster processing than text
-- Adds visual interest
-- Clarifies concepts
-
-**Best Practices**:
-- Use consistent style (all line, all filled, all flat)
-- Appropriate size (1-3cm typical)
-- Label ambiguous icons
-- Source: Font Awesome, Noun Project, academic icon sets
-
-**LaTeX Implementation**:
-```latex
-% Font Awesome icons
-\usepackage{fontawesome5}
-\faFlask{} Methods \quad \faChartBar{} Results
-
-% Custom icons with TikZ
-\begin{tikzpicture}
- \node[circle, draw, thick, minimum size=1cm] {\Huge \faAtom};
-\end{tikzpicture}
-```
-
-### Borders and Dividers
-
-**Use Borders To**:
-- Define sections
-- Group related content
-- Add visual interest
-- Match institutional branding
-
-**Border Styles**:
-- Solid lines: Traditional, formal
-- Dashed lines: Informal, secondary info
-- Rounded corners: Friendly, modern
-- Drop shadows: Depth, modern (use sparingly)
-
-**Guidelines**:
-- Keep consistent width (2-5pt typical)
-- Use sparingly (not every element needs a border)
-- Match border color to content or theme
-- Ensure sufficient padding inside borders
-
-```latex
-% tikzposter borders
-\usecolorstyle{Denmark}
-\tikzposterlatexaffectionproofoff % Remove bottom-right logo
-
-% Custom border style
-\defineblockstyle{CustomBlock}{
- titlewidthscale=1, bodywidthscale=1, titleleft,
- titleoffsetx=0pt, titleoffsety=0pt, bodyoffsetx=0pt, bodyoffsety=0pt,
- bodyverticalshift=0pt, roundedcorners=10, linewidth=2pt,
- titleinnersep=8mm, bodyinnersep=8mm
-}{
- \draw[draw=blocktitlebgcolor, fill=blockbodybgcolor,
- rounded corners=\blockroundedcorners, line width=\blocklinewidth]
- (blockbody.south west) rectangle (blocktitle.north east);
-}
-```
-
-### Background and Texture
-
-**Background Options**:
-
-**Plain (Recommended)**:
-- White or very light color
-- Maximum readability
-- Professional
-- Print-friendly
-
-**Gradient**:
-- Subtle gradients acceptable
-- Top-to-bottom or radial
-- Avoid strong contrasts that interfere with text
-
-**Textured**:
-- Very subtle textures only
-- Watermarks of logos/molecules (5-10% opacity)
-- Avoid patterns that create visual noise
-
-**Avoid**:
-- ❌ Busy backgrounds
-- ❌ Images behind text
-- ❌ High contrast backgrounds
-- ❌ Repeating patterns that cause visual artifacts
-
-```latex
-% Gradient background in tikzposter
-\documentclass{tikzposter}
-\definecolorstyle{GradientStyle}{
- % ...color definitions...
-}{
- \colorlet{backgroundcolor}{white!90!blue}
- \colorlet{framecolor}{white!70!blue}
-}
-
-% Watermark
-\usepackage{tikz}
-\AddToShipoutPictureBG{
- \AtPageCenter{
- \includegraphics[width=0.5\paperwidth,opacity=0.05]{university-seal.pdf}
- }
-}
-```
-
-## Common Design Mistakes
-
-### Critical Errors
-
-**1. Too Much Text** (Most common mistake)
-- ❌ More than 1000 words
-- ❌ Long paragraphs (>5 lines)
-- ❌ Small font sizes to fit more content
-- ✅ Solution: Cut ruthlessly, use bullet points, focus on key messages
-
-**2. Poor Contrast**
-- ❌ Light text on light background
-- ❌ Colored text on colored background
-- ✅ Solution: Dark on light or light on dark, test contrast ratio
-
-**3. Font Size Too Small**
-- ❌ Body text under 24pt
-- ❌ Trying to fit full paper content
-- ✅ Solution: 30pt+ body text, prioritize key findings
-
-**4. Cluttered Layout**
-- ❌ No white space
-- ❌ Elements touching edges
-- ❌ Random placement
-- ✅ Solution: Generous margins, grid alignment, intentional white space
-
-**5. Inconsistent Styling**
-- ❌ Multiple font families
-- ❌ Varying header styles
-- ❌ Misaligned elements
-- ✅ Solution: Define style guide, use templates, align to grid
-
-### Moderate Issues
-
-**6. Poor Figure Quality**
-- ❌ Pixelated images (<300 DPI)
-- ❌ Tiny axis labels
-- ❌ Unreadable legends
-- ✅ Solution: Vector graphics (PDF/SVG), large labels, clear legends
-
-**7. Color Overload**
-- ❌ Too many colors (>5 distinct hues)
-- ❌ Neon or overly saturated colors
-- ✅ Solution: Limit to 2-3 main colors, use tints/shades for variation
-
-**8. Ignoring Visual Hierarchy**
-- ❌ All text same size
-- ❌ No clear entry point
-- ✅ Solution: Vary sizes significantly, clear title, visual flow
-
-**9. Information Overload**
-- ❌ Trying to show everything
-- ❌ Too many figures
-- ✅ Solution: Show 3-5 key results, link to full paper via QR code
-
-**10. Poor Typography**
-- ❌ Justified text (uneven spacing)
-- ❌ All caps body text
-- ❌ Mixing serif and sans-serif randomly
-- ✅ Solution: Left-align body, sentence case, consistent fonts
-
-## Design Checklist
-
-### Before Printing
-
-- [ ] Title visible and readable from 20+ feet
-- [ ] Body text minimum 24pt, ideally 30pt+
-- [ ] High contrast (4.5:1 minimum) throughout
-- [ ] Color-blind friendly palette
-- [ ] Less than 800 words total
-- [ ] White space around all elements
-- [ ] Consistent alignment and spacing
-- [ ] All figures high resolution (300+ DPI)
-- [ ] Figure labels readable (18pt+ minimum)
-- [ ] No orphaned text or awkward breaks
-- [ ] Contact information included
-- [ ] QR codes tested and functional
-- [ ] Consistent font usage (2-3 families max)
-- [ ] All acronyms defined
-- [ ] Proper institutional branding/logos
-- [ ] Print test at 25% scale for readability check
-
-### Content Review
-
-- [ ] Clear narrative arc (problem → approach → findings → impact)
-- [ ] 1-3 main messages clearly communicated
-- [ ] Methods concise but reproducible
-- [ ] Results visually presented (not just text)
-- [ ] Conclusions actionable and clear
-- [ ] References cited appropriately
-- [ ] No typos or grammatical errors
-- [ ] Figures have descriptive captions
-- [ ] Data visualizations are clear and honest
-- [ ] Statistical significance properly indicated
-
-## Evidence-Based Design Recommendations
-
-Research on poster effectiveness shows:
-
-**Findings from Studies**:
-1. **Viewers spend 3-5 minutes average** on posters
- - Design for scanning, not deep reading
- - Most important info must be visible immediately
-
-2. **Visual content processed 60,000× faster** than text
- - Use figures, not paragraphs, to convey key findings
- - Images attract attention first
-
-3. **High contrast improves recall** by 40%
- - Dark on light > light on dark for comprehension
- - Color contrast aids memory retention
-
-4. **White space increases comprehension** by 20%
- - Don't fear empty space
- - Margins and padding are essential
-
-5. **Three-column layouts most effective** for portrait posters
- - Balanced visual weight
- - Natural reading flow
-
-6. **QR codes increase engagement** by 30%
- - Provide digital access to full paper
- - Link to videos, code repositories, data
-
-## Resources and Tools
-
-### Color Tools
-- **Coolors.co**: Generate color palettes
-- **Adobe Color**: Color wheel and accessibility checker
-- **ColorBrewer**: Scientific visualization palettes
-- **WebAIM Contrast Checker**: Test contrast ratios
-
-### Design Resources
-- **Canva**: Poster mockups and inspiration
-- **Figma**: Design prototypes before LaTeX
-- **Noun Project**: Icons and graphics
-- **Font Awesome**: Icon fonts for LaTeX
-
-### Testing Tools
-- **Coblis**: Color blindness simulator
-- **Vischeck**: Another color blindness checker
-- **Accessibility Checker**: WCAG compliance
-
-### LaTeX Packages
-- `xcolor`: Extended color support
-- `tcolorbox`: Colored boxes and frames
-- `fontawesome5`: Icon fonts
-- `qrcode`: QR code generation
-- `tikz`: Custom graphics
-
-## Conclusion
-
-Effective poster design requires balancing aesthetics, readability, and scientific content. Follow these core principles:
-
-1. **Less is more**: Prioritize key messages over comprehensive detail
-2. **Size matters**: Make text large enough to read from distance
-3. **Contrast is critical**: Ensure all text is highly readable
-4. **Accessibility first**: Design for diverse audiences
-5. **Visual hierarchy**: Guide viewers through content logically
-6. **Test early**: Print at reduced scale and gather feedback
-
-Remember: A poster is an advertisement for your research and a conversation starter—not a substitute for reading the full paper.
+- Use a small, consistent set of text roles.
+- Prefer left-aligned body text for left-to-right languages unless language or design
+ requirements indicate otherwise.
+- Keep related evidence, caption, and interpretation spatially grouped.
+- Use spacing, alignment, size, and weight before adding decorative effects.
+- Avoid unexplained icons, dense backgrounds, and text over uncontrolled imagery.
+- Do not rely on a predicted "eye pattern"; confirm the actual reading order.
+The generated PPTX uses fixed font sizes and disables text auto-shrink. A visual check
+is still required because the XML package does not reveal font substitution or
+rendered overflow.
+
+## Font size means final-output size
+
+PowerPoint stores point sizes on the PPTX canvas. When the printer scales the canvas,
+the physical text scales too:
+
+`final point size = design point size × physical artboard width / canvas width`
+
+Use the same ratio on height; unequal ratios are prohibited.
+
+Microsoft's PowerPoint accessibility guidance recommends 18 pt or larger for ordinary
+slides. That is a [Microsoft slide recommendation](https://support.microsoft.com/en-us/office/make-your-powerpoint-presentations-accessible-to-people-with-disabilities-6f7772b2-2f33-4bd2-8ca7-dae3b2b3ef25),
+not a universal poster minimum. Poster viewing distance, typeface, substrate, lighting,
+audience, and organizer rules can require larger text.
+
+The manifest therefore requires:
+
+- a final-output minimum;
+- a basis labeled `heuristic`, `source_specific`,
+ `conference_requirement`, or `printer_requirement`;
+- an exact source ID for every non-heuristic basis.
+
+Test a reduced-scale print and the full-size proof under expected viewing conditions.
+
+## Font availability and substitution
+
+A typeface name in PresentationML is a request, not proof that the font is installed,
+licensed for embedding, or rendered identically by another workstation. Microsoft's
+[font-embedding guidance](https://support.microsoft.com/en-us/office/benefits-of-embedding-custom-fonts-cb3982aa-ea76-4323-b008-86670f222dbc)
+notes that embedding can preserve layout but that not every font permits it and that
+embedding only used characters limits editing.
+
+The generator does not install or embed fonts. Before release:
+
+- use fonts licensed for the intended authoring, sharing, embedding, and print use;
+- confirm every declared face is installed on the review/export workstation;
+- inspect substitutions, missing glyphs, equations, and line wrapping in PowerPoint;
+- decide with the printer whether embedding is appropriate and permitted;
+- inspect the actual exported PDF's font records and rendered glyphs.
+
+## Text contrast
+
+[WCAG 2.2 SC 1.4.3](https://www.w3.org/TR/WCAG22/#contrast-minimum) specifies:
+
+- 4.5:1 for normal text;
+- 3:1 for large text, defined as at least 18 pt, or at least 14 pt and bold.
+
+WCAG is written for web content. This skill uses its sRGB contrast mathematics and
+thresholds as an explicit design target for poster/PPTX color pairs; a passing ratio
+does not by itself establish that a physical poster or exported PDF conforms to WCAG.
+Print conversion, transparency, gradients, images behind text, paper, glare, and
+lighting require manual review and proofing.
+
+The manifest declares each foreground/background pair and its usage. Text elements
+must reference a declared pair. The validator rejects a pair below its declared
+threshold.
+
+## Non-text contrast and color redundancy
+
+[WCAG 2.2 SC 1.4.11](https://www.w3.org/TR/WCAG22/#non-text-contrast) uses 3:1
+against adjacent colors for graphical parts required to understand content.
+[SC 1.4.1](https://www.w3.org/TR/WCAG22/#use-of-color) says color must not be
+the only visual means of conveying information.
+
+For plots and diagrams:
+
+- directly label important series and regions when practical;
+- combine color with shape, marker, pattern, line style, position, or text;
+- retain meaningful distinctions in grayscale;
+- avoid assigning semantic meaning to a hue without another cue;
+- check the rendered figure, not just the palette's color list.
+
+The palette checker reports exact pair ratios and heuristic grayscale L* separation.
+It explicitly does not certify color-vision accessibility.
+
+## Choosing palettes
+
+[ColorBrewer](https://colorbrewer2.org/) separates qualitative, sequential, and
+diverging schemes and provides filters for colorblind-safe, print-friendly, and
+photocopy-safe options. Its palettes were designed for maps; use the data-type logic,
+then test the actual poster figure and background.
+
+[Paul Tol's colour-scheme technical note](https://sronpersonalpages.nl/~pault/data/colourschemes.pdf)
+provides schemes intended to remain clear for color-blind readers. Choose a scheme
+for its documented purpose and supported category count. Do not assume every color
+in a named scheme has sufficient text or line contrast against white.
+
+Palette provenance does not replace contrast checks, redundant encodings, color-vision
+simulation, or print proofing.
+
+## Alt text and native text
+
+Microsoft says visuals need concise alternative text describing their purpose and
+important content. See
+[Make PowerPoint presentations accessible](https://support.microsoft.com/en-us/office/make-your-powerpoint-presentations-accessible-to-people-with-disabilities-6f7772b2-2f33-4bd2-8ca7-dae3b2b3ef25).
+
+This generator requires approved alt text for every local picture and writes it to
+the standard PresentationML nonvisual drawing description. The technical inspector
+checks that the description exists. It also supports a source-bound native text
+element as a long description for a complex figure.
+
+Alt text still needs human review:
+
+- describe the purpose and essential conclusion, not every pixel;
+- avoid repeating adjacent text verbatim;
+- do not begin with redundant phrases such as "image of";
+- include essential values and relationships when they are not available in nearby
+ native text;
+- keep important words as native PowerPoint text rather than only inside a raster
+ image.
+
+When concise alt text and adjacent prose do not communicate a figure's essential
+relationships, values, uncertainty, and conclusion, set
+`long_description_element_id` to an approved native body/caption/other text element.
+It must follow the image in reading order and cite every source used by the image.
+The structural check cannot determine whether the long description is scientifically
+or semantically complete.
+
+An XML attribute being present does not prove that the description is accurate.
+
+## Reading order
+
+Screen readers use an object's reading order, which can differ from its visual
+position. Microsoft recommends the Accessibility Checker and Reading Order pane.
+
+The manifest requires the visible title first, then contiguous `reading_order` values.
+The generator uses a native title placeholder, adds remaining shapes in that order,
+and writes explicit language on text runs. This is only a deterministic starting
+point. In the final PowerPoint:
+
+1. run Review > Check Accessibility;
+2. inspect the Reading Order pane;
+3. verify every object name and sequence;
+4. navigate with a keyboard;
+5. test with a screen reader.
+
+Groups, charts, SmartArt, decorative objects, and exported PDF tags need separate
+manual review. The strict generator intentionally limits its shape set to native text
+boxes and local pictures.
+
+## QR codes and links
+
+A QR code is not an accessibility substitute.
+
+- Include the exact destination URL as visible native text.
+- Use meaningful surrounding language that describes the destination.
+- Add alt text to the QR image.
+- Keep the fallback text in logical reading order.
+- Test the final exported/printed code with multiple devices.
+- Do not put essential content only behind the QR destination.
+
+The generator does not create a clickable external relationship. This allows the
+package inspector to reject all external relationships consistently.
+
+## Raster quality
+
+File metadata DPI does not determine poster quality. Use effective DPI:
+
+`effective DPI = source pixels / final placed inches`
+
+Calculate it independently for width and height at the final physical output. The
+asset inventory reports the lower value. The threshold must be labeled as a heuristic
+or tied to the exact organizer/printer/source rule.
+
+PowerPoint can compress inserted pictures. Microsoft documents High fidelity and
+per-document "Do not compress images in file" settings. Review those settings in the
+actual export application, then inspect the PDF and proof for resampling; the source
+PPTX effective-DPI calculation does not prove export resolution.
+
+Vector artwork may be preferable for line art, but this strict generator accepts only
+bounded local PNG/JPEG assets. If vector content is required, convert it through an
+author-reviewed, offline workflow and verify the rasterized result and text
+accessibility; do not silently substitute or redraw scientific content.
+
+## Audio, video, and linked media
+
+PowerPoint supports audio and video, including formats and linked-file workflows that
+vary by version. None is needed for a static printed poster. The strict manifest and
+package profile therefore allow only local PNG/JPEG still images and reject audio,
+video, linked media, transitions, timing, and other interactive content. Put optional
+external material behind a visible, verified URL/QR fallback rather than embedding or
+linking media in the PPTX.
+
+## Manual accessibility gate
+
+Before release:
+
+- run PowerPoint's Accessibility Checker;
+- verify reading order and object names;
+- review every alt text and native long description;
+- test screen-reader and keyboard navigation;
+- inspect text contrast, non-text contrast, and redundant encoding;
+- review reduced-scale and full-size proofs;
+- verify exported PDF tags and reading order;
+- test visible fallback links and QR codes;
+- get author and accessibility-reviewer sign-off.
+
+Automation finds technical defects. It cannot certify accessibility or scientific
+accuracy.
diff --git a/skills/pptx-posters/references/poster_layout_design.md b/skills/pptx-posters/references/poster_layout_design.md
index b00a5842..75ab1230 100644
--- a/skills/pptx-posters/references/poster_layout_design.md
+++ b/skills/pptx-posters/references/poster_layout_design.md
@@ -1,900 +1,189 @@
-# Poster Layout and Design Guide
+# PowerPoint poster dimensions, layout, and output
-## Overview
+## Keep six concepts separate
-Effective poster layout organizes content for maximum impact and comprehension. This guide covers grid systems, spatial organization, visual flow, and layout patterns for research posters.
+1. **Physical trim size** — finished width and height after cutting.
+2. **Bleed** — artwork extending beyond each trim edge when the printer requires it.
+3. **Physical artboard** — trim plus bleed on both sides:
+ `artboard = trim + 2 × bleed`.
+4. **Safe margin** — inset inside the trim edge for non-bleed content.
+5. **PowerPoint canvas** — the slide width and height stored in the PPTX.
+6. **Print/export scale** — uniform conversion from canvas to physical artboard.
-## Grid Systems and Column Layouts
+Raster effective DPI and final font size depend on physical placement, not merely the
+canvas.
-### Common Grid Patterns
+## Current PowerPoint size limits
-#### 1. Two-Column Layout
+[Microsoft's current slide-size guidance](https://support.microsoft.com/en-us/office/change-the-size-of-your-powerpoint-slides-040a811c-be43-40b9-8d04-0de5ed79987e)
+states that each custom dimension is from 1 to 56 inches (2.54–142.24 cm). It also
+states that all slides in a presentation have the same size.
-**Characteristics**:
-- Simple, traditional structure
-- Easy to design and execute
-- Clear narrative flow
-- Good for text-heavy content
-- Best for A1 size or smaller
+Do not bypass this limit by supplying pixel values; PowerPoint converts entered units.
+This skill accepts inches and enforces the 1–56 inch range.
-**Content Organization**:
-```
-+-------------------------+
-| Title/Header |
-+-------------------------+
-| Column 1 | Column 2 |
-| | |
-| Intro | Results |
-| | |
-| Methods | Discussion |
-| | |
-| | Conclusions |
-+-------------------------+
-| References/Contact |
-+-------------------------+
-```
-
-**LaTeX Implementation (beamerposter)**:
-```latex
-\begin{columns}[t]
- \begin{column}{.48\linewidth}
- \begin{block}{Introduction}
- % Content
- \end{block}
- \begin{block}{Methods}
- % Content
- \end{block}
- \end{column}
-
- \begin{column}{.48\linewidth}
- \begin{block}{Results}
- % Content
- \end{block}
- \begin{block}{Conclusions}
- % Content
- \end{block}
- \end{column}
-\end{columns}
-```
-
-**Best For**:
-- Small posters (A1, A2)
-- Narrative-heavy content
-- Simple comparisons (before/after, control/treatment)
-- Linear storytelling
-
-**Limitations**:
-- Limited space for multiple results
-- Can appear basic or dated
-- Less visual variety
-
-#### 2. Three-Column Layout (Most Popular)
-
-**Characteristics**:
-- Balanced, professional appearance
-- Optimal for A0 posters
-- Versatile content distribution
-- Natural visual rhythm
-- Industry standard
-
-**Content Organization**:
-```
-+--------------------------------+
-| Title/Header |
-+--------------------------------+
-| Column 1 | Column 2 | Column 3|
-| | | |
-| Intro | Results | Results |
-| | (Fig 1) | (Fig 2) |
-| Methods | | |
-| | Results | Discuss |
-| Methods | (Fig 3) | |
-| (cont.) | | Concl. |
-+--------------------------------+
-| Acknowledgments/Refs |
-+--------------------------------+
-```
-
-**LaTeX Implementation (tikzposter)**:
-```latex
-\begin{columns}
- \column{0.33}
- \block{Introduction}{...}
- \block{Methods}{...}
-
- \column{0.33}
- \block{Results Part 1}{...}
- \block{Results Part 2}{...}
-
- \column{0.33}
- \block{Results Part 3}{...}
- \block{Discussion}{...}
- \block{Conclusions}{...}
-\end{columns}
-```
-
-**Best For**:
-- Standard A0 conference posters
-- Multiple results/figures (4-6)
-- Balanced content distribution
-- Professional academic presentations
-
-**Strengths**:
-- Visual balance and symmetry
-- Adequate space for text and figures
-- Clear section delineation
-- Easy to scan left-to-right
-
-#### 3. Four-Column Layout
-
-**Characteristics**:
-- Information-dense
-- Modern, structured appearance
-- Best for large posters (>A0)
-- Requires careful design
-- More complex to balance
-
-**Content Organization**:
-```
-+----------------------------------------+
-| Title/Header |
-+----------------------------------------+
-| Col 1 | Col 2 | Col 3 | Col 4 |
-| | | | |
-| Intro | Method | Results | Results |
-| | (Flow) | (Fig 1) | (Fig 3) |
-| Motiv. | | | |
-| | Method | Results | Discuss. |
-| Hypoth.| (Stats)| (Fig 2) | |
-| | | | Concl. |
-+----------------------------------------+
-| References/Contact |
-+----------------------------------------+
-```
-
-**LaTeX Implementation (baposter)**:
-```latex
-\begin{poster}{columns=4, colspacing=1em, ...}
-
- \headerbox{Intro}{name=intro, column=0, row=0}{...}
- \headerbox{Methods}{name=methods, column=1, row=0}{...}
- \headerbox{Results 1}{name=res1, column=2, row=0}{...}
- \headerbox{Results 2}{name=res2, column=3, row=0}{...}
-
- % Continue with below=... for stacking
-
-\end{poster}
-```
-
-**Best For**:
-- Large format posters (48×72")
-- Data-heavy presentations
-- Comparison studies (multiple conditions)
-- Engineering/technical posters
-
-**Challenges**:
-- Can appear crowded
-- Requires more white space management
-- Harder to achieve visual balance
-- Risk of overwhelming viewers
-
-#### 4. Asymmetric Layouts
-
-**Characteristics**:
-- Dynamic, modern appearance
-- Flexible content arrangement
-- Emphasizes hierarchy
-- Requires design expertise
-- Best for creative fields
-
-**Example Pattern**:
-```
-+--------------------------------+
-| Title/Header |
-+--------------------------------+
-| Wide Column | Narrow Column |
-| (66%) | (33%) |
-| | |
-| Intro + | Key |
-| Methods | Figure |
-| (narrative) | (emphasized) |
-| | |
-+--------------------------------+
-| Results (spanning full width) |
-+--------------------------------+
-| Discussion | Conclusions |
-| (50%) | (50%) |
-+--------------------------------+
-```
-
-**LaTeX Implementation (tikzposter)**:
-```latex
-\begin{columns}
- \column{0.65}
- \block{Introduction and Methods}{
- % Combined narrative section
- }
-
- \column{0.35}
- \block{}{
- % Key figure with minimal text
- \includegraphics[width=\linewidth]{key-figure.pdf}
- }
-\end{columns}
-
-\block[width=1.0\linewidth]{Results}{
- % Full-width results section
-}
-```
-
-**Best For**:
-- Design-oriented conferences
-- Single key finding with supporting content
-- Modern, non-traditional fields
-- Experienced poster designers
-
-### Grid Alignment Principles
-
-**Baseline Grid**:
-- Establish invisible horizontal lines
-- Align all text blocks to grid
-- Typical spacing: 5mm or 10mm increments
-- Creates visual rhythm and professionalism
-
-**Column Grid**:
-- Divide width into equal units (12, 16, or 24 units common)
-- Elements span multiple units
-- Allows flexible but structured layouts
-
-**Example 12-Column Grid**:
-```
-| 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 |10 |11 |12 |
-|-------|-------|-------|-------|-------|-------|
-| Block spanning 6 units| Block spanning 6 units|
-| Block spanning 12 units |
-| 4 units | 8 units (emphasized) |
-```
-
-**LaTeX Grid Helper**:
-```latex
-% Debug grid overlay (remove for final version)
-\usepackage{tikz}
-\AddToShipoutPictureBG{
- \begin{tikzpicture}[remember picture, overlay]
- \draw[help lines, step=5cm, very thin, gray!30]
- (current page.south west) grid (current page.north east);
- \end{tikzpicture}
-}
-```
-
-## Visual Flow and Reading Patterns
-
-### Z-Pattern (Landscape Posters)
-
-Viewers' eyes naturally follow a Z-shape on landscape layouts:
-
-```
-START → → → → → → → → → → → → → → TOP RIGHT
- ↓ ↓
- ↓ ↓
-MIDDLE LEFT → → → → → → → → → MIDDLE RIGHT
- ↓ ↓
- ↓ ↓
-BOTTOM LEFT → → → → → → → → → → → → END
-```
-
-**Design Strategy**:
-1. **Top-left**: Title and introduction (entry point)
-2. **Top-right**: Institution logo, QR code
-3. **Center**: Key result or main figure
-4. **Bottom-right**: Conclusions and contact (exit point)
-
-**Content Placement**:
-- Critical information at corners and center
-- Support information along diagonal paths
-- Use arrows or visual cues to reinforce flow
-
-### F-Pattern (Portrait Posters)
-
-Portrait posters follow F-shaped eye movement:
-
-```
-TITLE → → → → → → → → → → → →
- ↓
-INTRO → → → →
- ↓
-METHODS
- ↓
-RESULTS → → →
- ↓
-RESULTS (cont.)
- ↓
-DISCUSSION
- ↓
-CONCLUSIONS → → → → → → → → →
-```
-
-**Design Strategy**:
-1. Place engaging content at top-left
-2. Use section headers to create horizontal scan points
-3. Most important figures in upper-middle area
-4. Conclusions visible without scrolling (if digital) or from distance
-
-### Gutenberg Diagram
-
-Classic newspaper layout principle:
-
-```
-+------------------+------------------+
-| PRIMARY AREA | STRONG FALLOW |
-| (most attention) | (moderate attn) |
-| ↓ | ↓ |
-+------------------+------------------+
-| WEAK FALLOW | TERMINAL AREA |
-| (least attention)| (final resting) |
-| | ↑ |
-+------------------+------------------+
-```
-
-**Optimization**:
-- **Primary Area** (top-left): Introduction, problem statement
-- **Strong Fallow** (top-right): Supporting figure, logo
-- **Weak Fallow** (bottom-left): Methods details, references
-- **Terminal Area** (bottom-right): Conclusions, take-home message
-
-### Directional Cues
-
-Guide viewers explicitly through content:
-
-**Numerical Ordering**:
-```latex
-\block{❶ Introduction}{...}
-\block{❷ Methods}{...}
-\block{❸ Results}{...}
-\block{❹ Conclusions}{...}
-```
-
-**Arrows and Lines**:
-```latex
-\begin{tikzpicture}
- \node[block] (intro) {Introduction};
- \node[block, right=of intro] (methods) {Methods};
- \node[block, right=of methods] (results) {Results};
- \draw[->, thick, blue] (intro) -- (methods);
- \draw[->, thick, blue] (methods) -- (results);
-\end{tikzpicture}
-```
-
-**Color Progression**:
-- Light to dark shades indicating progression
-- Cool to warm colors showing importance increase
-- Consistent color for related sections
+If a required physical artboard exceeds 56 inches on an edge:
-## Spatial Organization Strategies
+- choose a smaller proportional canvas;
+- preserve the exact artboard aspect ratio;
+- record the uniform output scale;
+- confirm that the printer permits scaling;
+- scale design fonts so their final point sizes remain correct;
+- calculate image DPI at final physical placement.
-### Header/Title Area
+Do not scale width and height independently.
-**Typical Size**: 10-15% of total poster height
+## Scale equations
-**Essential Elements**:
-- **Title**: Concise, descriptive (10-15 words max)
-- **Authors**: Full names, presenting author emphasized
-- **Affiliations**: Institutions, departments
-- **Logos**: University, funding agencies (2-4 max)
-- **Conference info** (optional): Name, date, location
+For a proportional design:
-**Layout Options**:
+```text
+scale_x = physical_artboard_width / canvas_width
+scale_y = physical_artboard_height / canvas_height
+scale_x must equal scale_y
-**Centered**:
-```
-+----------------------------------------+
-| [Logo] POSTER TITLE HERE [Logo]|
-| Authors and Affiliations |
-+----------------------------------------+
-```
-
-**Left-aligned**:
-```
-+----------------------------------------+
-| POSTER TITLE HERE [Logo] |
-| Authors and Affiliations [Logo] |
-+----------------------------------------+
-```
-
-**Split**:
-```
-+----------------------------------------+
-| [Logo] | Authors & Affil. |
-| POSTER TITLE | email@edu |
-| | [QR Code] |
-+----------------------------------------+
-```
-
-**LaTeX Header (beamerposter)**:
-```latex
-\begin{columns}[T]
- \begin{column}{.15\linewidth}
- \includegraphics[width=\linewidth]{logo1.pdf}
- \end{column}
-
- \begin{column}{.7\linewidth}
- \centering
- {\VeryHuge\textbf{Your Research Title Here}}\\[0.5cm]
- {\Large Author One\textsuperscript{1}, Author Two\textsuperscript{2}}\\[0.3cm]
- {\normalsize \textsuperscript{1}University A, \textsuperscript{2}University B}
- \end{column}
-
- \begin{column}{.15\linewidth}
- \includegraphics[width=\linewidth]{logo2.pdf}
- \end{column}
-\end{columns}
-```
-
-### Main Content Area
-
-**Typical Size**: 70-80% of total poster
-
-**Organization Principles**:
-
-**1. Top-to-Bottom Flow**:
-```
-Introduction/Background
- ↓
-Methods/Approach
- ↓
-Results (Multiple panels)
- ↓
-Discussion/Conclusions
-```
-
-**2. Left-to-Right, Top-to-Bottom**:
-```
-[Intro] [Results 1] [Results 3]
-[Methods] [Results 2] [Discussion]
+final_font_pt = design_font_pt × scale
+final_placed_width_in = design_width_in × scale
+effective_dpi_x = image_width_px / final_placed_width_in
```
-**3. Centralized Main Figure**:
-```
-[Intro] [Main Figure] [Discussion]
-[Methods] (center) [Conclusions]
-```
+The manifest validator allows only a small numerical tolerance between `scale_x` and
+`scale_y`.
-**Section Sizing**:
-- Introduction: 10-15% of content area
-- Methods: 15-20%
-- Results: 40-50% (largest section)
-- Discussion/Conclusions: 15-20%
+## Bleed and safe area
-### Footer Area
+Bleed and safe margin are printer-specific. A conference board dimension does not
+establish either.
-**Typical Size**: 5-10% of total poster height
+The manifest treats the physical artboard, including bleed, as the area mapped to the
+PowerPoint canvas. It computes the safe inset on the canvas as:
-**Common Elements**:
-- References (abbreviated, 5-10 key citations)
-- Acknowledgments (funding, collaborators)
-- Contact information
-- QR codes (paper, code, data)
-- Social media handles (optional)
-- Conference hashtags
+`(bleed + safe margin) / print scale`
-**Layout**:
-```
-+----------------------------------------+
-| References: 1. Author (2023) ... | 📱 |
-| Acknowledgments: Funded by ... | QR |
-| Contact: [email protected] | Code |
-+----------------------------------------+
-```
+Native text must remain inside that boundary. Only intentional imagery may set
+`allow_in_bleed: true`.
-**LaTeX Footer**:
-```latex
-\begin{block}{}
- \footnotesize
- \begin{columns}[T]
- \begin{column}{0.7\linewidth}
- \textbf{References}
- \begin{enumerate}
- \item Author A et al. (2023). Journal. doi:...
- \item Author B et al. (2024). Conference.
- \end{enumerate}
-
- \textbf{Acknowledgments}
- This work was supported by Grant XYZ.
-
- \textbf{Contact}: [email protected]
- \end{column}
-
- \begin{column}{0.25\linewidth}
- \centering
- \qrcode[height=3cm]{https://doi.org/10.1234/paper}\\
- \tiny Scan for full paper
- \end{column}
- \end{columns}
-\end{block}
-```
+PowerPoint generation is not a press-ready preflight. The printer must confirm crop,
+trim, bleed, substrate, and proofing behavior.
-## White Space Management
+## Conference examples show variation
-### Margins and Padding
+These are dated examples, not presets:
-**Outer Margins**:
-- Minimum: 2-3cm (0.75-1 inch)
-- Recommended: 3-5cm (1-2 inches)
-- Prevents edge trimming issues in printing
-- Provides visual breathing room
+- [CSCW 2026](https://cscw.acm.org/2026/posters.html) allocated a 48 × 48 inch
+ space, recommended no more than 45 inches on either side, allowed up to 47 inches,
+ and said A0 or A1 could be acceptable.
+- [IEEE DSC 2025](https://attend.ieee.org/dsc-2025/call-for-posters/) required
+ posters to fit an A1 space (84.1 × 59.4 cm).
-**Inner Spacing**:
-- Between columns: 1-2cm
-- Between blocks: 1-2cm
-- Inside blocks (padding): 0.5-1.5cm
-- Around figures: 0.5-1cm
+The differences are the point: check the current instruction for the actual event.
+Board size, maximum poster size, submission-document format, and physical print size
+can be different rules.
-**LaTeX Margin Control**:
-```latex
-% beamerposter
-\usepackage[size=a0, scale=1.4]{beamerposter}
-\setbeamersize{text margin left=3cm, text margin right=3cm}
+## Choosing a layout
-% tikzposter
-\documentclass[..., margin=30mm, innermargin=15mm]{tikzposter}
+Choose a grid after content, orientation, language direction, and required dimensions
+are known.
-% baposter
-\begin{poster}{
- colspacing=1.5em, % Horizontal spacing
- ...
-}
-```
+- A single narrative path can use one broad column or a sequence of panels.
+- Two columns can work for comparisons or smaller formats.
+- Three or more columns can shorten lines on wide canvases but increase navigation
+ complexity.
+- An asymmetric grid can emphasize one key result if the reading order remains clear.
-### Active White Space vs. Passive White Space
-
-**Active White Space**: Intentionally placed for specific purpose
-- Around key figures (draws attention)
-- Between major sections (creates clear separation)
-- Above/below titles (emphasizes hierarchy)
-
-**Passive White Space**: Natural result of layout
-- Margins and borders
-- Line spacing
-- Gaps between elements
-
-**Balance**: Aim for 30-40% white space overall
-
-### Visual Breathing Room
-
-**Avoid**:
-- ❌ Elements touching edges
-- ❌ Text blocks directly adjacent
-- ❌ Figures without surrounding space
-- ❌ Cramped, claustrophobic feel
-
-**Implement**:
-- ✅ Clear separation between sections
-- ✅ Space around focal points
-- ✅ Generous padding inside boxes
-- ✅ Balanced distribution of content
-
-## Block and Box Design
-
-### Block Types and Functions
-
-**Title Block**: Poster header
-- Full width, top position
-- High visual weight
-- Contains identifying information
-
-**Content Blocks**: Main sections
-- Column-based or free-floating
-- Hierarchical sizing (larger = more important)
-- Clear headers and structure
-
-**Callout Blocks**: Emphasized information
-- Key findings or quotes
-- Different color or style
-- Visually distinct
-
-**Reference Blocks**: Supporting info
-- Footer position
-- Smaller, less prominent
-- Informational, not critical
-
-### Block Styling Options
-
-**Border Styles**:
-```latex
-% Rounded corners (friendly, modern)
-\begin{block}{Title}
- % beamerposter with rounded
- \setbeamertemplate{block begin}[rounded]
-
-% Sharp corners (formal, traditional)
- \setbeamertemplate{block begin}[default]
-
-% No border (minimal, clean)
- \setbeamercolor{block title}{bg=white, fg=black}
- \setbeamercolor{block body}{bg=white, fg=black}
-```
+No column count is inherently standard or accessible. Use consistent alignment and
+spacing, and leave enough room for the actual approved content without shrinking type.
-**Shadow and Depth**:
-```latex
-% tikzposter shadow
-\tikzset{
- block/.append style={
- drop shadow={shadow xshift=2mm, shadow yshift=-2mm}
- }
-}
-
-% tcolorbox drop shadow
-\usepackage{tcolorbox}
-\begin{tcolorbox}[enhanced, drop shadow]
- Content with shadow
-\end{tcolorbox}
-```
+The strict manifest places every text or image element in an explicit rectangle.
+Elements are listed in contiguous reading order and are generated in that order.
-**Background Shading**:
-- **Solid**: Clean, professional
-- **Gradient**: Modern, dynamic
-- **Transparent**: Layered, sophisticated
+## Bounds and overlap
-### Relationship and Grouping
+The layout checker reads PresentationML transforms directly. It reports:
-**Visual Grouping Techniques**:
-
-**1. Proximity**: Place related items close
-```
-[Intro Text]
-[Related Figure]
- ↓ grouped
-[Methods Text]
-[Methods Diagram]
-```
-
-**2. Color Coding**: Use color to show relationships
-- All "Methods" blocks in blue
-- All "Results" blocks in green
-- Conclusions in orange
-
-**3. Borders**: Enclose related elements
-```latex
-\begin{tcolorbox}[title=Experimental Pipeline]
- \begin{enumerate}
- \item Sample preparation
- \item Data collection
- \item Analysis
- \end{enumerate}
-\end{tcolorbox}
-```
-
-**4. Alignment**: Aligned elements appear related
-```
-[Block A Left-aligned]
-[Block B Left-aligned]
- vs.
-[Block C Centered]
-```
-
-## Responsive and Adaptive Layouts
-
-### Designing for Different Poster Sizes
-
-**Scaling Strategy**:
-- Design for target size (e.g., A0)
-- Test at other common sizes (A1, 36×48")
-- Use relative sizing (percentages, not absolute)
-
-**Font Scaling**:
-```latex
-% Scale fonts proportionally
-\usepackage[size=a0, scale=1.4]{beamerposter} % A0 at 140%
-\usepackage[size=a1, scale=1.0]{beamerposter} % A1 at 100%
-
-% Or define sizes relatively
-\newcommand{\titlesize}{\fontsize{96}{110}\selectfont}
-\newcommand{\headersize}{\fontsize{60}{72}\selectfont}
-```
-
-**Content Adaptation**:
-- **A0 (full)**: All content, 5-6 figures
-- **A1 (reduced)**: Condense to 3-4 main figures
-- **A2 (compact)**: Key finding only, 1-2 figures
-
-### Portrait vs. Landscape Orientation
-
-**Portrait (Vertical)**:
-- **Pros**: Traditional, more common stands, natural reading flow
-- **Cons**: Less width for figures, can feel cramped
-- **Best for**: Text-heavy posters, multi-section flow, conferences
-
-**Landscape (Horizontal)**:
-- **Pros**: Wide figures, natural for timelines, modern feel
-- **Cons**: Harder to read from distance, less common
-- **Best for**: Timelines, wide data visualizations, non-traditional venues
-
-**LaTeX Orientation**:
-```latex
-% Portrait
-\usepackage[size=a0, orientation=portrait]{beamerposter}
-\documentclass[..., portrait]{tikzposter}
-
-% Landscape
-\usepackage[size=a0, orientation=landscape]{beamerposter}
-\documentclass[..., landscape]{tikzposter}
-```
-
-## Layout Patterns by Research Type
-
-### Experimental Research
-
-**Typical Flow**:
-```
-[Title and Authors]
-+---------------------------+
-| Background | Methods |
-| Problem | (Diagram) |
-+---------------------------+
-| Results (Figure 1) |
-| Results (Figure 2) |
-+---------------------------+
-| Discussion | Conclusions |
-| Limitations| Future Work |
-+---------------------------+
-[References and Contact]
-```
-
-**Emphasis**: Visual results, clear methodology
-
-### Computational/Modeling
-
-**Typical Flow**:
-```
-[Title and Authors]
-+---------------------------+
-| Motivation | Algorithm |
-| | (Flowchart) |
-+---------------------------+
-| Implementation Details |
-+---------------------------+
-| Results | Results |
-| (Benchmark)| (Comparison) |
-+---------------------------+
-| Conclusions| Code QR |
-+---------------------------+
-[GitHub, Docker, Documentation]
-```
-
-**Emphasis**: Algorithm clarity, reproducibility
-
-### Clinical/Medical
-
-**Typical Flow**:
-```
-[Title and Authors]
-+---------------------------+
-| Background | Methods |
-| Clinical | - Design |
-| Need | - Population |
-| | - Outcomes |
-+---------------------------+
-| Results | |
-| (Primary Outcome) | Key|
-| | Fig|
-+---------------------------+
-| Discussion | Clinical |
-| | Implications |
-+---------------------------+
-[Trial Registration, Ethics, Funding]
-```
-
-**Emphasis**: Patient outcomes, clinical relevance
-
-### Review/Meta-Analysis
-
-**Typical Flow**:
-```
-[Title and Authors]
-+---------------------------+
-| Research | Search |
-| Question | Strategy |
-| | (PRISMA Flow) |
-+---------------------------+
-| Included Studies Overview |
-+---------------------------+
-| Findings | Findings |
-| (Theme 1) | (Theme 2) |
-+---------------------------+
-| Synthesis | Gaps & |
-| | Future Needs |
-+---------------------------+
-[Systematic Review Registration]
-```
+- shapes outside the slide;
+- direct bounding-box intersections;
+- text without explicit size;
+- text below the manifest's final-output minimum;
+- direct shape order and, when a manifest is supplied, exact object-name/order
+ comparison against approved `reading_order`.
-**Emphasis**: Comprehensive coverage, synthesis
+Bounding boxes are conservative. A report can include an intentional overlay, while
+a clean report can still hide text overflow, rotation, group-transform, chart, SmartArt,
+or font-substitution problems. The generator avoids groups, charts, SmartArt, and
+overlays so that a clean direct-box check is meaningful.
-## Layout Testing and Iteration
+Always inspect in PowerPoint and in the exported PDF.
-### Design Iteration Process
+## Images
-**1. Sketch Phase**:
-- Hand-draw rough layout
-- Experiment with different arrangements
-- Mark primary, secondary, tertiary content
+Image placement uses `contain` fitting:
-**2. Digital Mockup**:
-- Create low-fidelity version in LaTeX
-- Use placeholder text/figures
-- Test different grid systems
+- preserve the source aspect ratio;
+- center the image inside its approved element box;
+- do not crop or stretch;
+- use final placed dimensions for effective DPI.
-**3. Content Integration**:
-- Replace placeholders with actual content
-- Adjust spacing and sizing
-- Refine visual hierarchy
+If the scientific message depends on a crop, create and approve a new local asset,
+hash it, and update its source/alt text. Do not apply a silent crop during generation.
-**4. Refinement**:
-- Fine-tune alignment
-- Balance visual weight
-- Optimize white space
+QR placement boxes must be square. Test the final physical QR code; pixel count and
+box geometry do not guarantee scan reliability.
-**5. Testing**:
-- Print at reduced scale (25%)
-- View from distance
-- Get colleague feedback
+## Color mode
-### Feedback Checklist
+Treat PowerPoint as an RGB authoring workflow. Its documented automation color
+property is RGB, and the generated package uses opaque sRGB hex colors.
-**Visual Balance**:
-- [ ] No single area feels too heavy or too light
-- [ ] Color distributed evenly across poster
-- [ ] Text and figures balanced
-- [ ] White space well-distributed
+If the printer accepts RGB, record that requirement and approve a proof. If the
+printer manages conversion, obtain its profile/process and approve a proof. If the
+printer requires CMYK, the export plan blocks a claim of readiness until a
+printer-approved conversion and proof are complete. Do not label a native PowerPoint
+PDF as CMYK-compliant without verifying the actual output.
-**Hierarchy and Flow**:
-- [ ] Clear entry point (title visible)
-- [ ] Logical reading path
-- [ ] Section relationships clear
-- [ ] Conclusions easy to find
+Transparency, gradients, photographs, and institutional colors can change during
+conversion. Contrast calculations on source sRGB values do not predict the printed
+result.
-**Technical Execution**:
-- [ ] Consistent alignment
-- [ ] Uniform spacing
-- [ ] Professional appearance
-- [ ] No awkward breaks or orphans
+## PDF export
-## Common Layout Mistakes
+[Microsoft's export guidance](https://support.microsoft.com/en-us/powerpoint/export-a-presentation)
+distinguishes Standard quality for publishing/printing from Minimum size. Use the
+current PowerPoint interface and Standard/high print quality when PDF is required.
-**1. Unbalanced Visual Weight**
-- ❌ All content on left, empty right side
-- ❌ Large figure dominating, tiny text elsewhere
-- ✅ Distribute content evenly across poster
+After export, independently verify:
-**2. Inconsistent Spacing**
-- ❌ Random gaps between blocks
-- ❌ Elements touching in some places, spaced in others
-- ✅ Use consistent spacing values throughout
+- PDF page/artboard dimensions and orientation;
+- one-page output when the organizer expects one page;
+- trim/bleed handling;
+- fonts, glyphs, equations, clipping, and substitutions;
+- image quality and resampling;
+- color and printer proof;
+- tags, reading order, alt text, links, and language;
+- conference naming, file-size, and upload requirements.
-**3. Poor Column Width**
-- ❌ Extremely narrow columns (hard to read)
-- ❌ Very wide columns (eye tracking difficult)
-- ✅ Optimal: 40-80 characters per line
+[Microsoft's PowerPoint PDF accessibility documentation](https://learn.microsoft.com/en-us/office/pdf/powerpoint/powerpointpdfaccessibility)
+describes modern tagged-PDF behavior, but availability varies by PowerPoint version
+and channel. Verify the installed version and the actual PDF; do not infer PDF
+accessibility from the PPTX.
-**4. Ignoring Grid**
-- ❌ Random placement of elements
-- ❌ Misaligned blocks
-- ✅ Align to invisible grid, consistent positioning
+## Resizing existing content
-**5. Overcrowding**
-- ❌ No white space, cramped feel
-- ❌ Trying to fit too much content
-- ✅ Generous margins, clear separation
+Microsoft presents **Maximize** and **Ensure Fit** when changing slide size. Maximize
+can move content outside the slide; Ensure Fit can make content smaller.
-## Conclusion
+This workflow sets dimensions before adding content and does not repurpose an existing
+slide. If a human later changes the size, treat that as a layout change:
-Effective layout design:
-- Uses appropriate grid systems (2, 3, or 4 columns)
-- Follows natural eye movement patterns
-- Maintains visual balance and hierarchy
-- Provides adequate white space
-- Groups related content clearly
-- Adapts to different poster sizes and orientations
+1. re-check physical/canvas aspect and print scale;
+2. re-check every final font size and effective DPI;
+3. re-run bounds and overlap checks;
+4. renew author approval because layout and possibly content hash changed;
+5. re-export and re-proof.
-Remember: Layout should support content, not compete with it. When viewers focus on your research rather than your design, you've succeeded.
+## Final physical review
+Inspect a reduced-scale proof and the printer's full-size or contract proof. Confirm
+readability at expected distances, trim, bleed, margins, color, raster quality, QR
+function, mounting constraints, and accessibility. No XML or geometry checker can
+simulate the final venue.
diff --git a/skills/pptx-posters/references/pptx_security.md b/skills/pptx-posters/references/pptx_security.md
new file mode 100644
index 00000000..b556f26f
--- /dev/null
+++ b/skills/pptx-posters/references/pptx_security.md
@@ -0,0 +1,202 @@
+# PPTX package security
+
+## Threat model
+
+A presentation can be more than visible slide XML. A package can contain VBA,
+ActiveX, OLE objects, embedded files, external relationships, linked images, malformed
+XML, duplicate/traversing ZIP names, or highly compressed payloads.
+
+Do not open an untrusted presentation or template to see whether it is safe. Opening
+is execution by a complex Office application and is outside these scripts.
+
+This skill:
+
+- generates from a built-in blank `python-pptx` presentation only;
+- accepts no external template;
+- accepts no `.pptm`, `.potx`, `.potm`, `.ppsx`, `.ppsm`, legacy `.ppt`, or
+ arbitrary office package;
+- inspects `.pptx` as a bounded one-slide generated-poster ZIP/XML profile without
+ extraction;
+- rejects every external relationship, even an ordinary hyperlink;
+- uses visible QR fallback text instead of creating external hyperlinks.
+
+## Package facts
+
+[ECMA-376](https://ecma-international.org/publications-and-standards/standards/ecma-376/)
+defines Office Open XML vocabularies, representation, and packaging.
+[ISO/IEC 29500-2:2021](https://www.iso.org/standard/77818.html) defines Open
+Packaging Conventions, which combine parts and relationships into one package.
+
+The inspector expects a standard macro-free PresentationML package with at least:
+
+- `[Content_Types].xml`
+- `_rels/.rels`
+- `ppt/presentation.xml`
+- `ppt/_rels/presentation.xml.rels`
+- exactly one slide part and one matching slide relationship.
+
+It requires the standard macro-free presentation main content type. It resolves
+internal relationship targets against package parts.
+
+[Microsoft's supported-format list](https://support.microsoft.com/en-us/office/file-formats-that-are-supported-in-powerpoint-252c6fa0-a4bc-41be-ac82-b77c9773f9dc)
+identifies `.pptm` as a macro-enabled presentation containing VBA code. A `.pptx`
+extension alone is not sufficient assurance, so the inspector also checks content
+types, relationships, and package part names.
+
+## Rejected active and embedded content
+
+The inspector rejects:
+
+- VBA/macro-enabled content types and `vbaProject` parts;
+- `.pptm` and every non-`.pptx` extension;
+- `ppt/activeX`, control properties, custom UI, and related relationships;
+- OLE object relationships and markup;
+- `ppt/embeddings` and package relationships;
+- external-link package areas;
+- audio, video, linked media, timing, transitions, embedded fonts, 3D models, and
+ other parts outside the static generated-poster profile;
+- notes, comments, custom properties, web extensions, and interactive hyperlink/action
+ markup outside the one-slide poster profile;
+- package signatures, because generation changes the package and never preserves an
+ unverified signature;
+- executable/script/binary suffixes.
+
+[Microsoft's Open XML OLE object documentation](https://learn.microsoft.com/en-us/dotnet/api/documentformat.openxml.presentation.oleobject?view=openxml-3.0.1)
+shows that PresentationML OLE objects can be embedded or linked. Neither is needed for
+a static poster and both are rejected.
+
+## External relationships
+
+An OPC relationship can target an internal package part or an external resource.
+Microsoft's
+[OPC target-mode documentation](https://learn.microsoft.com/en-us/windows/win32/api/msopc/nf-msopc-iopcrelationship-gettargetmode)
+distinguishes the two. The strict policy rejects any relationship with
+`TargetMode="External"`.
+
+This includes:
+
+- remote or linked images;
+- ordinary web hyperlinks;
+- linked OLE objects or workbooks;
+- external media or data.
+
+The policy is intentionally stricter than PowerPoint's feature set. The visible
+poster may contain an `https://` URL as plain text, and a local QR image may encode
+that URL, but the PPTX does not create a clickable external relationship.
+
+Internal targets are normalized relative to the source part, must remain inside the
+package, and must exist.
+
+## ZIP preflight
+
+The inspector reads the central directory before selected XML:
+
+- input file limit: 512 MiB;
+- central-directory limit: 64 MiB;
+- member limit: 4,096;
+- single uncompressed member limit: 128 MiB;
+- total uncompressed limit: 1 GiB;
+- compression-ratio limit: 100:1;
+- allowed methods: stored or deflated;
+- no encrypted members;
+- no symbolic-link members;
+- no absolute, traversing, backslash, duplicate, or case-colliding names.
+- no multi-disk or ZIP64 package in this strict bounded profile.
+- no package part outside the exact generated-poster path allowlist.
+- PNG/JPEG media suffixes must match their byte signatures and streams must pass ZIP
+ CRC validation.
+
+These are defensive local policy limits, not ECMA/ISO or PowerPoint product limits.
+Adjusting them is a security decision and requires new tests.
+
+The ZIP footer is read directly before Python's `ZipFile` constructs its member list.
+Declared member count and central-directory size are therefore bounded before the
+library materializes attacker-controlled entries.
+
+The code never calls `ZipFile.extract` or `extractall`. Python's
+[`zipfile` documentation](https://docs.python.org/3/library/zipfile.html) warns
+that callers must prevent archive members from escaping the destination; not
+extracting removes that path entirely.
+
+## XML handling
+
+Every bounded XML part and every relationship part is parsed. The strict generated
+profile requires UTF-8 XML; NUL, document-type, and entity declarations are rejected
+before parsing, including attempts to hide declarations in another encoding. Content types,
+relationship roots/IDs/target modes, the one-slide relationship, and internal target
+existence are checked explicitly.
+
+The inspector does not:
+
+- resolve external entities;
+- execute macros or scripts;
+- activate OLE/ActiveX;
+- follow links;
+- render slides;
+- invoke PowerPoint, LibreOffice, or a shell command;
+- deserialize arbitrary Python objects.
+
+## Alt text markup
+
+The generator writes each approved picture description to PresentationML nonvisual
+drawing properties (`p:cNvPr` `descr`). Microsoft's
+[NonVisualDrawingProperties documentation](https://learn.microsoft.com/en-us/dotnet/api/documentformat.openxml.presentation.nonvisualdrawingproperties?view=openxml-3.0.1)
+describes this element and its drawing description property.
+
+The inspector counts pictures with nonempty descriptions. Presence is not semantic
+quality; review alt text in PowerPoint.
+
+The generator also uses the visible poster title as the native slide-title placeholder
+and writes the manifest language on text runs. The inspector reports title count and
+missing run-language metadata. These structural fields still require PowerPoint,
+screen-reader, and exported-PDF review. Longer descriptions remain approved native
+text elements in reading order rather than hidden package attachments.
+
+## Safe generation sequence
+
+1. Validate strict local JSON, requirements, sources, approval hash, and asset hashes.
+2. Decode bounded local images with exact-pinned Pillow and reject EXIF/XMP/comments
+ or embedded text/application metadata.
+3. Create a new presentation with exact-pinned `python-pptx` and its exact-pinned
+ `lxml` dependency; never load a user template.
+4. Remove the built-in template's inert binary printer-settings part and normalize
+ ZIP timestamps.
+5. Inspect the cleaned generated package.
+6. Copy the package while adding approved picture descriptions and text language.
+7. Inspect the patched package again.
+8. Run layout/font/image/palette audits.
+9. Publish to a new destination without replacement.
+
+The temporary files are private and in the destination directory. Final publication
+uses a same-filesystem hard link that fails if the destination already exists.
+
+## Untrusted inputs
+
+For a third-party PPTX:
+
+```bash
+python -B scripts/inspect_pptx.py untrusted.pptx
+```
+
+If it reports a finding, quarantine or discard the file. Do not open it to remediate.
+
+Even a clean report is not an antivirus verdict. The checker recognizes a deliberately
+small package profile; it cannot prove that every Office parser vulnerability or
+malicious payload is absent. Apply organizational malware scanning, sandboxing,
+Office Protected View, patching, and provenance controls as required.
+
+Do not use an inspected third-party file as a generator template. This skill has no
+template-input feature.
+
+## Residual technical limits
+
+- Standard ZIP/XML validation is not full ECMA-376 schema validation.
+- Standalone package inspection checks image signatures/CRC, not image decoder
+ safety. Generation separately performs bounded, exact-pinned Pillow decoding.
+- It does not render text, equations, fonts, transparency, or color.
+- It cannot certify accessibility, scientific accuracy, or print readiness.
+- It intentionally rejects safe but unnecessary features such as hyperlinks and
+ embedded files.
+- Password-protected/encrypted packages are rejected rather than decrypted.
+
+These limits are design boundaries, not invitations to bypass the checks.
diff --git a/skills/pptx-posters/references/security_validation.md b/skills/pptx-posters/references/security_validation.md
new file mode 100644
index 00000000..6ee3d247
--- /dev/null
+++ b/skills/pptx-posters/references/security_validation.md
@@ -0,0 +1,90 @@
+# Security validation record
+
+Validation date: **2026-07-24**.
+
+## Baseline
+
+The repository `SECURITY.md` snapshot records **10 findings** for the former v1.2
+skill, with maximum severity **CRITICAL**:
+
+- three CRITICAL cross-file/environment/network transmission findings;
+- four MEDIUM credential, prompt, and environment-harvesting findings;
+- three LOW dependency, environment-file, and broken-reference findings.
+
+The affected implementation used two external schematic-generation scripts plus
+network, credential, environment-file, subprocess, and model behavior.
+
+## Remediation
+
+- Deleted both external schematic scripts and the unused HTML template.
+- Removed network/model calls, credentials, environment access, subprocesses, external
+ templates, mandatory figures, and cross-skill behavior.
+- Replaced the workflow with strict local JSON, exact source IDs, author approval
+ binding, optional hashed PNG/JPEG assets, and deterministic one-slide generation.
+- Added bounded ZIP central-directory, part-path, content-type, relationship, XML,
+ image-signature, macro, OLE, ActiveX, embedded-file, and external-link checks.
+- Added safe no-overwrite publication, lazy optional imports, exact dependency pins,
+ and AST policy tests that prohibit network, process, environment, executable
+ deserialization, and dynamic-code behavior.
+
+## Validation results
+
+- Agent Skills reference validator: **PASS**
+- Dependency-free CLI help checks: **PASS**
+- Synthetic tests with standard library only: **47 passed, 2 exact-pin tests skipped**
+- Exact-pinned round trip (`python-pptx==1.0.2`, `Pillow==12.3.0`,
+ `lxml==6.1.1`): **49 passed**
+- Generated PPTX reopen, deterministic hash, package reinspection, alt text, title,
+ language, layout, image inventory, and no-overwrite checks: **PASS**
+- Explicit AST parse with bytecode disabled: **14 Python files parsed**
+- Bytecode artifacts: **0**
+- IDE lints: **0**
+- Diff whitespace check: **PASS**
+- Documented local-path check: **PASS**
+- External Markdown links checked: **39, no failures**
+- Direct behavioral security scan: **SAFE, 0 findings**
+- Pull-request gate with `--fail-on HIGH`: **PASS**
+ - CRITICAL: 0
+ - HIGH: 0
+ - LOW: 2
+
+## Residual LOW findings
+
+The LLM-assisted pull-request scan reported:
+
+1. **Bounded resource use.** Full image decoding is capped at 100 million pixels;
+ archives are capped at 512 MiB compressed, 1 GiB expanded, 4,096 members, 128 MiB
+ per member, and 100:1 expansion. Repeated maximum-size local inputs can still use
+ material CPU/memory. These documented limits are accepted; callers should apply
+ an execution timeout appropriate to their environment.
+2. **Invented broken-path variants.** The scan claimed `templates/` paths and swapped
+ `assets/`/`references/` variants that do not occur in the skill. The deterministic
+ local-path test resolves every actual documented path and passes.
+
+Neither finding permits network access, credential access, code execution, macro
+activation, or overwrite. No CRITICAL or HIGH issue remains. The repository-level
+`SECURITY.md` is intentionally unchanged; its generated snapshot can update through
+the repository's normal scan process.
+
+## Reproduction
+
+```bash
+PYTHONDONTWRITEBYTECODE=1 python3 -B -m unittest discover \
+ -s skills/pptx-posters/tests -p "test_*.py" -v
+
+PYTHONDONTWRITEBYTECODE=1 uv run --no-project \
+ --with "python-pptx==1.0.2" \
+ --with "Pillow==12.3.0" \
+ --with "lxml==6.1.1" \
+ python -B -m unittest discover \
+ -s skills/pptx-posters/tests -p "test_*.py" -v
+
+uv run skills-ref validate skills/pptx-posters
+
+uv run skill-scanner scan skills/pptx-posters --use-behavioral
+
+uv run python scan_pr_skills.py \
+ --fail-on HIGH \
+ --output /tmp/pptx-posters-pr-scan.md \
+ skills/pptx-posters
+```
diff --git a/skills/pptx-posters/references/source_ledger.md b/skills/pptx-posters/references/source_ledger.md
new file mode 100644
index 00000000..77dc51f1
--- /dev/null
+++ b/skills/pptx-posters/references/source_ledger.md
@@ -0,0 +1,256 @@
+# Source ledger
+
+Research cutoff: **2026-07-24**. Recheck live organizer, printer, package, and
+application guidance before production use.
+
+This ledger records the upstream basis for skill behavior. It is not a poster's
+scientific bibliography.
+
+Method: targeted `parallel-cli search` and `parallel-cli extract` queries restricted
+to the official domains cited below, followed by cross-checking canonical pages.
+Retrieval dates are stated where a page exposed no publication/update date.
+
+## Microsoft PowerPoint
+
+### Poster-specific product guidance
+
+- [Microsoft Create poster templates for PowerPoint](https://create.microsoft.com/en-us/templates/posters)
+ (official Microsoft Create).
+ - Describes editable PowerPoint poster/flyer templates and saving, printing, or
+ sending the result as PDF.
+
+Skill impact: confirms PowerPoint as a supported poster authoring format, but does
+not establish research-poster dimensions or printer requirements. This strict
+generator does not ingest downloaded templates or use the page's AI design features.
+
+### Slide dimensions and scaling
+
+- [Change the size of your PowerPoint slides](https://support.microsoft.com/en-us/office/change-the-size-of-your-powerpoint-slides-040a811c-be43-40b9-8d04-0de5ed79987e)
+ (Microsoft Support; checked 2026-07-24; no publication date exposed).
+ - Custom width/height each range from 1 to 56 inches.
+ - Units can be inches, centimeters, or pixels; PowerPoint converts them.
+ - All slides in a presentation have the same size.
+ - Maximize can cause content not to fit; Ensure Fit can make content smaller.
+
+Skill impact: enforce 1–56 inches, one slide, exact aspect ratio, explicit physical
+scale, and no reuse/resizing of existing content.
+
+### Export
+
+- [Export a presentation](https://support.microsoft.com/en-us/powerpoint/export-a-presentation)
+ (Microsoft Support; checked 2026-07-24).
+ - Standard is the option for publishing online and printing; Minimum size
+ prioritizes a smaller file.
+
+Skill impact: provide a manual export plan and require independent PDF/print checks.
+The scripts do not invoke Office or an alternative converter.
+
+### Accessibility
+
+- [Make your PowerPoint presentations accessible to people with disabilities](https://support.microsoft.com/en-us/office/make-your-powerpoint-presentations-accessible-to-people-with-disabilities-6f7772b2-2f33-4bd2-8ca7-dae3b2b3ef25)
+ (Microsoft Support; checked 2026-07-24).
+ - Use Accessibility Checker and Reading Order pane.
+ - Add alt text to visuals.
+ - Do not use color alone.
+ - Use sufficient text/background contrast.
+ - Use meaningful hyperlink text.
+ - Test with a screen reader.
+ - Recommends 18 pt or larger for ordinary slides.
+
+- [Rules for the Accessibility Checker](https://support.microsoft.com/en-us/accessibility/office-accessibility/rules-for-the-accessibility-checker)
+ (Microsoft Support).
+ - Includes missing alt text and logical reading order checks.
+
+- [PowerPoint PDF Accessibility](https://learn.microsoft.com/en-us/office/pdf/powerpoint/powerpointpdfaccessibility)
+ (Microsoft Learn; last updated 2026-05-12).
+ - Documents tagged-PDF behavior and applicable PowerPoint versions/channels.
+
+Skill impact: automate only structural checks; require final Accessibility Checker,
+reading-order, screen-reader, and exported-PDF review. The 18 pt recommendation is
+identified as slide-specific, not a universal poster minimum.
+
+### Fonts, pictures, and media
+
+- [Benefits of embedding custom fonts](https://support.microsoft.com/en-us/office/benefits-of-embedding-custom-fonts-cb3982aa-ea76-4323-b008-86670f222dbc)
+ (Microsoft Support; published 2026-05-04 in the extracted result).
+ - Embedding can preserve layout, styling, and characters when a recipient lacks a
+ font, but not all fonts permit embedding.
+ - Embedding only used characters limits later editing; embedding all characters is
+ the PowerPoint option intended for editing by others.
+
+- [Change the default resolution for inserting pictures in Office](https://support.microsoft.com/en-us/office/change-the-default-resolution-for-inserting-pictures-in-office-f4aca5b4-6332-48c6-9488-bf5e0094a7d2)
+ and [Turn off picture compression](https://support.microsoft.com/en-us/office/turn-off-picture-compression-81a6b603-0266-4451-b08e-fc1bf58da658)
+ (Microsoft Support; checked 2026-07-24).
+ - Microsoft documents High fidelity/minimal compression and a per-document option
+ not to compress images.
+
+- [Video and audio file formats supported in PowerPoint](https://support.microsoft.com/en-us/office/video-and-audio-file-formats-supported-in-powerpoint-d8b12450-26db-4c7b-a5c1-593d3418fb59)
+ (Microsoft Support; checked 2026-07-24).
+ - PowerPoint supports several audio/video formats and notes deprecations beginning
+ in version 2505 for older formats.
+
+Skill impact: the generator records font names but does not install or embed fonts;
+availability, embedding rights, substitution, and the exported PDF are checked
+manually. It accepts only fully decoded local PNG/JPEG still images, reports effective
+DPI, and excludes every audio/video or linked-media feature from its package profile.
+
+### Color API
+
+- [PowerPoint ColorFormat.RGB property](https://learn.microsoft.com/en-us/office/vba/api/powerpoint.colorformat.rgb)
+ (Microsoft Learn).
+
+Skill impact: author opaque sRGB colors, label PowerPoint as an RGB workflow, and
+block claims of CMYK readiness until printer-approved conversion/proof.
+
+### File formats and macros
+
+- [File formats supported in PowerPoint](https://support.microsoft.com/en-us/office/file-formats-that-are-supported-in-powerpoint-252c6fa0-a4bc-41be-ac82-b77c9773f9dc)
+ (Microsoft Support).
+ - Identifies `.pptm` as a VBA-containing macro-enabled presentation.
+
+- [Save a presentation that contains VBA macros](https://support.microsoft.com/en-us/office/save-a-presentation-that-contains-vba-macros-e6010530-f899-49a9-9fa5-78338a1c2580)
+ (Microsoft Support).
+ - Macro-bearing presentations require macro-enabled extensions such as `.pptm`.
+
+Skill impact: accept/generate only `.pptx`, then inspect content types and package
+parts rather than trusting the extension alone.
+
+## Office Open XML and packaging
+
+- [ECMA-376](https://ecma-international.org/publications-and-standards/standards/ecma-376/)
+ (Ecma International).
+ - Defines Office Open XML vocabularies, document representation, and packaging.
+
+- [ISO/IEC 29500-2:2021](https://www.iso.org/standard/77818.html)
+ (ISO).
+ - Defines Open Packaging Conventions for combining parts and relationships.
+
+- [Open XML SDK overview](https://learn.microsoft.com/en-us/office/open-xml/open-xml-sdk)
+ (Microsoft Learn).
+ - Connects the SDK and file formats to ECMA-376 and ISO/IEC 29500.
+
+- [IOpcRelationship::GetTargetMode](https://learn.microsoft.com/en-us/windows/win32/api/msopc/nf-msopc-iopcrelationship-gettargetmode)
+ (Microsoft Learn).
+ - Distinguishes internal package-part targets from external targets.
+
+- [PowerPoint `.pptx` extensions to Office Open XML](https://learn.microsoft.com/en-us/openspecs/office_standards/ms-pptx/efd8bb2d-d888-4e2e-af25-cad476730c9f)
+ (Microsoft Open Specifications; published protocol revision shown as 2024-08-20
+ during research).
+
+- [PresentationML OLE Object](https://learn.microsoft.com/en-us/dotnet/api/documentformat.openxml.presentation.oleobject?view=openxml-3.0.1)
+ (Microsoft Learn / ISO schema remarks).
+ - OLE objects can contain embedded or linked objects/controls.
+
+- [Presentation NonVisualDrawingProperties](https://learn.microsoft.com/en-us/dotnet/api/documentformat.openxml.presentation.nonvisualdrawingproperties?view=openxml-3.0.1)
+ (Microsoft Learn / ISO schema remarks).
+ - `p:cNvPr` stores nonvisual properties including the drawing description used
+ for picture alt text.
+
+Skill impact: bounded ZIP/XML inspection, relationship target/mode checks, rejection
+of embedded/active/external content, and standard alt-description markup.
+
+## Python package APIs and versions
+
+### python-pptx
+
+- [python-pptx on PyPI](https://pypi.org/project/python-pptx/)
+ - Current stable at cutoff: **1.0.2**, released 2024-08-07.
+ - Requires Python 3.8 or later.
+ - Described as creating, reading, and updating PowerPoint 2007+ `.pptx` files.
+
+- [python-pptx v1.0.2 repository tag](https://github.com/scanny/python-pptx/tree/v1.0.2)
+ (official GitHub repository).
+ - GitHub had tags through v1.0.2; the GitHub Releases list returned no published
+ releases during the 2026-07-23 check. PyPI release history is therefore the
+ version authority used here.
+
+- [Presentation API](https://python-pptx.readthedocs.io/en/latest/api/presentation.html)
+ - `Presentation()`, `save`, `slide_width`, and `slide_height`; dimensions are EMU.
+
+- [Shapes API](https://python-pptx.readthedocs.io/en/latest/api/shapes.html)
+ - `add_textbox`, `add_picture`, and explicit shape position/size.
+
+- [Text API](https://python-pptx.readthedocs.io/en/latest/api/text.html)
+ - Font sizes and text-frame behavior.
+
+Skill impact: exact pin `python-pptx==1.0.2`; use only documented creation, slide,
+shape, text, color, and core-property APIs. Alt descriptions are added afterward
+using standard PresentationML because the public python-pptx API does not expose a
+complete poster accessibility workflow.
+
+### Pillow
+
+- [Pillow on PyPI](https://pypi.org/project/pillow/)
+ - Current stable at cutoff: **12.3.0**, released 2026-07-01.
+ - Requires Python 3.10 or later.
+
+- [Pillow documentation](https://pillow.readthedocs.io/)
+ (documentation identified itself as 12.3.0 at cutoff).
+
+Skill impact: exact pin `Pillow==12.3.0`; bounded verification of local PNG/JPEG
+dimensions, mode, frames, and effective DPI. Heavy imports remain lazy so every
+CLI's help works without optional packages.
+
+### lxml
+
+- [lxml on PyPI](https://pypi.org/project/lxml/)
+ - Current stable at cutoff: **6.1.1**, released 2026-05-18.
+ - Requires Python 3.8 or later.
+ - The 6.1.1 release includes security-related fixes in bundled XML/XSLT libraries.
+
+Skill impact: exact transitive pin `lxml==6.1.1` for `python-pptx` generation.
+The dependency-free inspector still uses bounded standard-library XML parsing and
+rejects DTD/entity declarations before parsing.
+
+## Accessibility standards
+
+- [Web Content Accessibility Guidelines (WCAG) 2.2](https://www.w3.org/TR/WCAG22/)
+ (W3C Recommendation, 2024-12-12).
+ - SC 1.4.1: do not use color as the only visual means of conveying information.
+ - SC 1.4.3: 4.5:1 for normal text; 3:1 for large text.
+ - Large text: at least 18 pt, or at least 14 pt and bold.
+ - SC 1.4.11: 3:1 for graphical parts required to understand content.
+
+Skill impact: exact sRGB contrast calculations with usage-specific thresholds and
+mandatory redundant encoding. WCAG is used as a declared design target; no claim is
+made that a physical poster or PPTX is a conforming web page.
+
+## Palette authorities
+
+- [ColorBrewer 2](https://colorbrewer2.org/)
+ (Penn State/Cynthia Brewer project).
+ - Distinguishes qualitative, sequential, and diverging schemes.
+ - Offers colorblind-safe, print-friendly, and photocopy-safe filters.
+
+- [Paul Tol, Colour Schemes, issue 3.2](https://sronpersonalpages.nl/~pault/data/colourschemes.pdf)
+ (SRON/EPS/TN/09-002, 2021-08-18).
+ - Documents clear colour schemes intended to work for colour-blind readers and
+ gives scheme-specific values/order.
+
+Skill impact: explain scheme selection and caveats. No bundled palette is represented
+as universally accessible; rendered contrast and redundant encoding remain required.
+
+## Conference examples — not universal rules
+
+- [CSCW 2026 posters](https://cscw.acm.org/2026/posters.html)
+ (official event page checked 2026-07-24; its explicit 2026 important dates include
+ a 2026-07-10 camera-ready deadline).
+ - Allocated 48 × 48 inches; recommended no side over 45 inches, allowed up to
+ 47 inches; stated A0 or A1 could be acceptable.
+
+- [IEEE DSC 2025 poster instructions](https://attend.ieee.org/dsc-2025/call-for-posters/)
+ (official organizer page).
+ - Required the physical poster to fit A1 space: 84.1 × 59.4 cm.
+
+Skill impact: use these only to demonstrate variation. The validator requires the
+actual event's confirmed rule and exact source ID.
+
+## Secure standard-library APIs
+
+- [Python `zipfile`](https://docs.python.org/3/library/zipfile.html)
+- [Python `xml.etree.ElementTree`](https://docs.python.org/3/library/xml.etree.elementtree.html)
+- [Python `json`](https://docs.python.org/3/library/json.html)
+
+Skill impact: no archive extraction; strict duplicate/non-finite JSON handling;
+bounded XML parts; DTD/entity rejection; no network, shell invocation, dynamic code
+execution, or arbitrary object deserialization.
diff --git a/skills/pptx-posters/scripts/_common.py b/skills/pptx-posters/scripts/_common.py
new file mode 100644
index 00000000..adec5af2
--- /dev/null
+++ b/skills/pptx-posters/scripts/_common.py
@@ -0,0 +1,397 @@
+#!/usr/bin/env python3
+"""Shared, dependency-free safety helpers for the poster command-line tools."""
+
+from __future__ import annotations
+
+import hashlib
+import json
+import math
+import os
+import re
+import stat
+import tempfile
+from datetime import datetime
+from pathlib import Path
+from typing import Any, Iterable
+
+MAX_JSON_BYTES = 2 * 1024 * 1024
+MAX_INPUT_BYTES = 512 * 1024 * 1024
+MAX_ASSET_BYTES = 128 * 1024 * 1024
+MAX_REPORT_BYTES = 8 * 1024 * 1024
+PPTX_MIN_INCHES = 1.0
+PPTX_MAX_INCHES = 56.0
+EMU_PER_INCH = 914_400
+
+_REMOTE_OR_SCHEME = re.compile(r"^[A-Za-z][A-Za-z0-9+.-]*:")
+_HEX_COLOR = re.compile(r"^#[0-9A-Fa-f]{6}$")
+_PLACEHOLDER_PATTERNS = (
+ re.compile(
+ r"\b(?:TODO|TBD|TBC|FIXME|LOREM\s+IPSUM|"
+ r"REPLACE(?:[_ -]?ME)?(?:[_ -][A-Z0-9]+)*|"
+ r"PLACEHOLDER|INSERT[_ -]HERE|YOUR[_ -](?:TITLE|NAME|TEXT|URL))\b",
+ re.IGNORECASE,
+ ),
+ re.compile(
+ r"(?:<|\[)\s*(?:title|author|affiliation|content|citation|source|"
+ r"url|doi|path|value)\s*(?:>|\])",
+ re.IGNORECASE,
+ ),
+)
+
+
+class CliError(ValueError):
+ """An expected validation or command-line error."""
+
+
+def checked_input_file(
+ value: str | os.PathLike[str],
+ *,
+ max_bytes: int = MAX_INPUT_BYTES,
+ suffixes: Iterable[str] | None = None,
+) -> Path:
+ """Return a bounded regular input file while rejecting a final symlink."""
+ path = Path(value)
+ if path.is_symlink():
+ raise CliError(f"input must not be a symlink: {path}")
+ try:
+ info = path.stat()
+ except OSError as exc:
+ raise CliError(f"cannot access input file {path}: {exc}") from exc
+ if not stat.S_ISREG(info.st_mode):
+ raise CliError(f"input is not a regular file: {path}")
+ if info.st_size > max_bytes:
+ raise CliError(
+ f"input is {info.st_size} bytes; limit is {max_bytes} bytes"
+ )
+ resolved = path.resolve()
+ if suffixes is not None:
+ allowed = {suffix.lower() for suffix in suffixes}
+ if resolved.suffix.lower() not in allowed:
+ raise CliError(
+ f"input suffix must be one of {', '.join(sorted(allowed))}: {path}"
+ )
+ return resolved
+
+
+def checked_output_file(
+ value: str | os.PathLike[str],
+ *,
+ suffix: str | None = None,
+) -> Path:
+ """Validate a new output path; existing destinations are never overwritten."""
+ path = Path(value)
+ if path.name in {"", ".", ".."}:
+ raise CliError("output must name a file")
+ if path.is_symlink():
+ raise CliError(f"output must not be a symlink: {path}")
+ parent = path.parent
+ if not parent.exists() or not parent.is_dir():
+ raise CliError(f"output parent directory does not exist: {parent}")
+ if parent.is_symlink():
+ raise CliError(f"output parent must not be a symlink: {parent}")
+ destination = parent.resolve() / path.name
+ if destination.exists():
+ raise CliError(f"refusing to overwrite existing output: {destination}")
+ if suffix is not None and destination.suffix.lower() != suffix.lower():
+ raise CliError(f"output must use the {suffix} suffix: {destination}")
+ return destination
+
+
+def private_temp_file(destination: Path, *, suffix: str = ".tmp") -> tuple[int, Path]:
+ """Create a private same-directory temporary file for an output."""
+ descriptor, raw_path = tempfile.mkstemp(
+ prefix=f".{destination.name}.",
+ suffix=suffix,
+ dir=destination.parent,
+ )
+ temporary = Path(raw_path)
+ os.chmod(temporary, 0o600)
+ return descriptor, temporary
+
+
+def commit_temp_file(temporary: Path, destination: Path) -> None:
+ """Publish a temporary file without replacing an existing destination."""
+ if destination.exists():
+ raise CliError(f"refusing to overwrite existing output: {destination}")
+ try:
+ os.link(temporary, destination)
+ except FileExistsError as exc:
+ raise CliError(
+ f"refusing to overwrite existing output: {destination}"
+ ) from exc
+ except OSError as exc:
+ raise CliError(f"cannot publish output {destination}: {exc}") from exc
+ os.chmod(destination, 0o600)
+
+
+def atomic_write_bytes(path: Path, payload: bytes) -> None:
+ """Write bytes through a private temporary file without replacement."""
+ destination = checked_output_file(path)
+ descriptor, temporary = private_temp_file(destination)
+ try:
+ with os.fdopen(descriptor, "wb") as handle:
+ handle.write(payload)
+ handle.flush()
+ os.fsync(handle.fileno())
+ commit_temp_file(temporary, destination)
+ finally:
+ try:
+ temporary.unlink()
+ except FileNotFoundError:
+ pass
+
+
+def emit_json(
+ document: dict[str, Any],
+ *,
+ output: str | os.PathLike[str] | None = None,
+) -> None:
+ """Print deterministic JSON or safely write it to a new file."""
+ payload = (
+ json.dumps(document, indent=2, sort_keys=True, ensure_ascii=False) + "\n"
+ ).encode("utf-8")
+ if len(payload) > MAX_REPORT_BYTES:
+ raise CliError(
+ f"report is {len(payload)} bytes; limit is {MAX_REPORT_BYTES} bytes"
+ )
+ if output is None:
+ print(payload.decode("utf-8"), end="")
+ return
+ atomic_write_bytes(Path(output), payload)
+
+
+def _object_without_duplicates(pairs: list[tuple[str, Any]]) -> dict[str, Any]:
+ result: dict[str, Any] = {}
+ for key, value in pairs:
+ if key in result:
+ raise CliError(f"duplicate JSON key: {key!r}")
+ result[key] = value
+ return result
+
+
+def _reject_nonfinite_constant(value: str) -> None:
+ raise CliError(f"non-finite JSON number is not allowed: {value}")
+
+
+def load_json_file(
+ value: str | os.PathLike[str],
+ *,
+ max_bytes: int = MAX_JSON_BYTES,
+) -> tuple[Path, Any]:
+ """Read strict UTF-8 JSON with duplicate and non-finite values rejected."""
+ path = checked_input_file(value, max_bytes=max_bytes, suffixes={".json"})
+ try:
+ raw = path.read_bytes()
+ text = raw.decode("utf-8")
+ except UnicodeDecodeError as exc:
+ raise CliError(f"JSON must be UTF-8: {path}") from exc
+ except OSError as exc:
+ raise CliError(f"cannot read JSON {path}: {exc}") from exc
+ try:
+ document = json.loads(
+ text,
+ object_pairs_hook=_object_without_duplicates,
+ parse_constant=_reject_nonfinite_constant,
+ )
+ except json.JSONDecodeError as exc:
+ raise CliError(
+ f"invalid JSON in {path} at line {exc.lineno}, column {exc.colno}: "
+ f"{exc.msg}"
+ ) from exc
+ return path, document
+
+
+def reject_unknown_keys(
+ value: Any,
+ *,
+ context: str,
+ allowed: set[str],
+ required: set[str],
+) -> dict[str, Any]:
+ """Return an object after enforcing exact keys."""
+ if not isinstance(value, dict):
+ raise CliError(f"{context} must be an object")
+ unknown = sorted(set(value) - allowed)
+ missing = sorted(required - set(value))
+ if unknown:
+ raise CliError(f"{context} has unknown key(s): {', '.join(unknown)}")
+ if missing:
+ raise CliError(f"{context} is missing key(s): {', '.join(missing)}")
+ return value
+
+
+def require_string(
+ value: Any,
+ *,
+ context: str,
+ minimum: int = 1,
+ maximum: int = 10_000,
+) -> str:
+ """Validate a bounded string without trimming or changing its content."""
+ if not isinstance(value, str):
+ raise CliError(f"{context} must be a string")
+ if not minimum <= len(value) <= maximum:
+ raise CliError(
+ f"{context} length must be between {minimum} and {maximum} characters"
+ )
+ if any(ord(character) < 32 and character not in "\t\n\r" for character in value):
+ raise CliError(f"{context} contains a forbidden control character")
+ if any(0xD800 <= ord(character) <= 0xDFFF for character in value):
+ raise CliError(f"{context} contains an unpaired Unicode surrogate")
+ return value
+
+
+def require_bool(value: Any, *, context: str) -> bool:
+ if not isinstance(value, bool):
+ raise CliError(f"{context} must be true or false")
+ return value
+
+
+def finite_number(
+ value: Any,
+ *,
+ context: str,
+ minimum: float | None = None,
+ maximum: float | None = None,
+) -> float:
+ """Validate a finite JSON number, excluding booleans."""
+ if isinstance(value, bool) or not isinstance(value, (int, float)):
+ raise CliError(f"{context} must be a number")
+ number = float(value)
+ if not math.isfinite(number):
+ raise CliError(f"{context} must be finite")
+ if minimum is not None and number < minimum:
+ raise CliError(f"{context} must be at least {minimum}")
+ if maximum is not None and number > maximum:
+ raise CliError(f"{context} must be at most {maximum}")
+ return number
+
+
+def positive_int(value: Any, *, context: str, maximum: int) -> int:
+ if isinstance(value, bool) or not isinstance(value, int):
+ raise CliError(f"{context} must be an integer")
+ if value < 1 or value > maximum:
+ raise CliError(f"{context} must be between 1 and {maximum}")
+ return value
+
+
+def canonical_json_hash(value: Any) -> str:
+ """Return SHA-256 for canonical UTF-8 JSON."""
+ payload = json.dumps(
+ value,
+ ensure_ascii=False,
+ allow_nan=False,
+ sort_keys=True,
+ separators=(",", ":"),
+ ).encode("utf-8")
+ return hashlib.sha256(payload).hexdigest()
+
+
+def sha256_file(path: Path, *, max_bytes: int = MAX_ASSET_BYTES) -> str:
+ """Hash a bounded regular file without loading it all into memory."""
+ checked = checked_input_file(path, max_bytes=max_bytes)
+ digest = hashlib.sha256()
+ with checked.open("rb") as handle:
+ while True:
+ block = handle.read(1024 * 1024)
+ if not block:
+ break
+ digest.update(block)
+ return digest.hexdigest()
+
+
+def resolve_local_asset(
+ manifest_path: Path,
+ relative_value: Any,
+ *,
+ suffixes: set[str],
+) -> Path:
+ """Resolve a manifest-relative local file while preventing path escape."""
+ raw = require_string(relative_value, context="asset.path", maximum=512)
+ if _REMOTE_OR_SCHEME.match(raw) or raw.startswith(("/", "\\")):
+ raise CliError(f"asset.path must be a relative local path: {raw!r}")
+ if "\\" in raw:
+ raise CliError("asset.path must use forward slashes")
+ relative = Path(raw)
+ if any(part in {"", ".", ".."} for part in relative.parts):
+ raise CliError(f"asset.path contains an unsafe segment: {raw!r}")
+ root = manifest_path.parent.resolve()
+ candidate = (root / relative).resolve()
+ try:
+ candidate.relative_to(root)
+ except ValueError as exc:
+ raise CliError(f"asset.path escapes the manifest directory: {raw!r}") from exc
+ return checked_input_file(
+ candidate,
+ max_bytes=MAX_ASSET_BYTES,
+ suffixes=suffixes,
+ )
+
+
+def has_placeholder(value: Any) -> tuple[str, str] | None:
+ """Return the first JSON path and placeholder string, if present."""
+
+ def walk(item: Any, path: str) -> tuple[str, str] | None:
+ if isinstance(item, str):
+ for pattern in _PLACEHOLDER_PATTERNS:
+ if pattern.search(item):
+ return path, item
+ return None
+ if isinstance(item, list):
+ for index, child in enumerate(item):
+ found = walk(child, f"{path}[{index}]")
+ if found:
+ return found
+ return None
+ if isinstance(item, dict):
+ for key, child in item.items():
+ found = walk(child, f"{path}.{key}")
+ if found:
+ return found
+ return None
+
+ return walk(value, "$")
+
+
+def parse_aware_datetime(value: Any, *, context: str) -> str:
+ """Validate an ISO 8601 timestamp that includes a UTC offset."""
+ text = require_string(value, context=context, maximum=64)
+ normalized = text[:-1] + "+00:00" if text.endswith("Z") else text
+ try:
+ parsed = datetime.fromisoformat(normalized)
+ except ValueError as exc:
+ raise CliError(f"{context} must be an ISO 8601 timestamp") from exc
+ if parsed.tzinfo is None or parsed.utcoffset() is None:
+ raise CliError(f"{context} must include a UTC offset")
+ return text
+
+
+def parse_hex_color(value: Any, *, context: str) -> str:
+ """Validate and normalize an opaque six-digit sRGB color."""
+ text = require_string(value, context=context, maximum=7)
+ if not _HEX_COLOR.fullmatch(text):
+ raise CliError(f"{context} must be a six-digit hex color such as #1A2B3C")
+ return text.upper()
+
+
+def _linear_channel(channel: int) -> float:
+ encoded = channel / 255.0
+ if encoded <= 0.04045:
+ return encoded / 12.92
+ return ((encoded + 0.055) / 1.055) ** 2.4
+
+
+def relative_luminance(color: str) -> float:
+ channels = tuple(int(color[index : index + 2], 16) for index in (1, 3, 5))
+ red, green, blue = (_linear_channel(channel) for channel in channels)
+ return 0.2126 * red + 0.7152 * green + 0.0722 * blue
+
+
+def contrast_ratio(first: str, second: str) -> float:
+ """Return the WCAG contrast ratio of two normalized sRGB colors."""
+ first_luminance = relative_luminance(first)
+ second_luminance = relative_luminance(second)
+ lighter = max(first_luminance, second_luminance)
+ darker = min(first_luminance, second_luminance)
+ return (lighter + 0.05) / (darker + 0.05)
+
diff --git a/skills/pptx-posters/scripts/_manifest.py b/skills/pptx-posters/scripts/_manifest.py
new file mode 100644
index 00000000..69b2153a
--- /dev/null
+++ b/skills/pptx-posters/scripts/_manifest.py
@@ -0,0 +1,1319 @@
+#!/usr/bin/env python3
+"""Strict poster-manifest validation shared by generation and audit tools."""
+
+from __future__ import annotations
+
+import re
+from pathlib import Path
+from typing import Any
+
+from _common import (
+ PPTX_MAX_INCHES,
+ PPTX_MIN_INCHES,
+ CliError,
+ canonical_json_hash,
+ contrast_ratio,
+ finite_number,
+ has_placeholder,
+ load_json_file,
+ parse_aware_datetime,
+ parse_hex_color,
+ positive_int,
+ reject_unknown_keys,
+ require_bool,
+ require_string,
+ resolve_local_asset,
+ sha256_file,
+)
+
+MANIFEST_SCHEMA_VERSION = "2.0"
+REPORT_SCHEMA_VERSION = "1.0"
+MAX_ELEMENTS = 250
+MAX_SOURCES = 500
+MAX_ASSETS = 100
+ASSET_SUFFIXES = {".png", ".jpg", ".jpeg"}
+
+_ID = re.compile(r"^[A-Za-z][A-Za-z0-9_.-]{0,63}$")
+_SHA256 = re.compile(r"^[0-9a-f]{64}$")
+_RELATIVE_PATH = re.compile(r"^[^:/\\][^:\\]*$")
+
+_TOP_KEYS = {
+ "schema_version",
+ "document",
+ "canvas",
+ "physical_output",
+ "requirements",
+ "quality",
+ "palette",
+ "sources",
+ "assets",
+ "elements",
+ "approval",
+}
+_SOURCE_KINDS = {
+ "author_content",
+ "publication",
+ "dataset",
+ "asset_license",
+ "conference_rule",
+ "printer_rule",
+ "institutional_rule",
+ "other",
+}
+_FONT_BASES = {
+ "heuristic",
+ "source_specific",
+ "conference_requirement",
+ "printer_requirement",
+}
+_TEXT_ROLES = {
+ "title",
+ "authors",
+ "affiliation",
+ "heading",
+ "body",
+ "caption",
+ "reference",
+ "acknowledgement",
+ "contact",
+ "qr_fallback",
+ "other",
+}
+
+
+def _identifier(value: Any, *, context: str) -> str:
+ text = require_string(value, context=context, maximum=64)
+ if not _ID.fullmatch(text):
+ raise CliError(
+ f"{context} must start with a letter and contain only letters, "
+ "digits, period, underscore, or hyphen"
+ )
+ return text
+
+
+def _nullable_source_id(value: Any, *, context: str) -> str | None:
+ if value is None:
+ return None
+ return _identifier(value, context=context)
+
+
+def _string_list(
+ value: Any,
+ *,
+ context: str,
+ minimum: int,
+ maximum: int,
+) -> list[str]:
+ if not isinstance(value, list):
+ raise CliError(f"{context} must be an array")
+ if not minimum <= len(value) <= maximum:
+ raise CliError(
+ f"{context} must contain between {minimum} and {maximum} values"
+ )
+ result = [
+ require_string(item, context=f"{context}[{index}]", maximum=500)
+ for index, item in enumerate(value)
+ ]
+ if len(set(result)) != len(result):
+ raise CliError(f"{context} must not contain duplicates")
+ return result
+
+
+def _source_id_list(value: Any, *, context: str) -> list[str]:
+ raw = _string_list(value, context=context, minimum=1, maximum=16)
+ return [
+ _identifier(item, context=f"{context}[{index}]")
+ for index, item in enumerate(raw)
+ ]
+
+
+def manifest_content_hash(document: dict[str, Any]) -> str:
+ """Hash all author-controlled manifest content except the approval record."""
+ return canonical_json_hash(
+ {key: value for key, value in document.items() if key != "approval"}
+ )
+
+
+def _validate_document(value: Any) -> dict[str, Any]:
+ document = reject_unknown_keys(
+ value,
+ context="document",
+ allowed={"id", "title", "subject", "language", "authors", "source_ids"},
+ required={"id", "title", "subject", "language", "authors", "source_ids"},
+ )
+ _identifier(document["id"], context="document.id")
+ require_string(document["title"], context="document.title", maximum=500)
+ require_string(document["subject"], context="document.subject", maximum=1_000)
+ language = require_string(
+ document["language"], context="document.language", maximum=35
+ )
+ if not re.fullmatch(r"[A-Za-z]{2,8}(?:-[A-Za-z0-9]{1,8})*", language):
+ raise CliError("document.language must be a BCP 47-style language tag")
+ _string_list(
+ document["authors"],
+ context="document.authors",
+ minimum=1,
+ maximum=50,
+ )
+ _source_id_list(document["source_ids"], context="document.source_ids")
+ return document
+
+
+def _validate_canvas(value: Any) -> tuple[dict[str, Any], float, float]:
+ canvas = reject_unknown_keys(
+ value,
+ context="canvas",
+ allowed={"width_in", "height_in", "background_color"},
+ required={"width_in", "height_in", "background_color"},
+ )
+ width = finite_number(
+ canvas["width_in"],
+ context="canvas.width_in",
+ minimum=PPTX_MIN_INCHES,
+ maximum=PPTX_MAX_INCHES,
+ )
+ height = finite_number(
+ canvas["height_in"],
+ context="canvas.height_in",
+ minimum=PPTX_MIN_INCHES,
+ maximum=PPTX_MAX_INCHES,
+ )
+ parse_hex_color(canvas["background_color"], context="canvas.background_color")
+ return canvas, width, height
+
+
+def _validate_physical_output(
+ value: Any,
+) -> tuple[dict[str, Any], float, float, float, float, float, float]:
+ physical = reject_unknown_keys(
+ value,
+ context="physical_output",
+ allowed={
+ "trim_width_in",
+ "trim_height_in",
+ "bleed_in",
+ "safe_margin_in",
+ "orientation",
+ },
+ required={
+ "trim_width_in",
+ "trim_height_in",
+ "bleed_in",
+ "safe_margin_in",
+ "orientation",
+ },
+ )
+ trim_width = finite_number(
+ physical["trim_width_in"],
+ context="physical_output.trim_width_in",
+ minimum=1.0,
+ maximum=200.0,
+ )
+ trim_height = finite_number(
+ physical["trim_height_in"],
+ context="physical_output.trim_height_in",
+ minimum=1.0,
+ maximum=200.0,
+ )
+ bleed = finite_number(
+ physical["bleed_in"],
+ context="physical_output.bleed_in",
+ minimum=0.0,
+ maximum=2.0,
+ )
+ safe_margin = finite_number(
+ physical["safe_margin_in"],
+ context="physical_output.safe_margin_in",
+ minimum=0.0,
+ maximum=10.0,
+ )
+ if 2 * safe_margin >= min(trim_width, trim_height):
+ raise CliError("physical_output.safe_margin_in consumes the trim area")
+ orientation = require_string(
+ physical["orientation"],
+ context="physical_output.orientation",
+ maximum=16,
+ )
+ expected = (
+ "square"
+ if abs(trim_width - trim_height) <= 1e-6
+ else ("landscape" if trim_width > trim_height else "portrait")
+ )
+ if orientation != expected:
+ raise CliError(
+ "physical_output.orientation does not match the trim dimensions "
+ f"(expected {expected!r})"
+ )
+ artboard_width = trim_width + 2 * bleed
+ artboard_height = trim_height + 2 * bleed
+ return (
+ physical,
+ trim_width,
+ trim_height,
+ bleed,
+ safe_margin,
+ artboard_width,
+ artboard_height,
+ )
+
+
+def _validate_sources(value: Any) -> dict[str, dict[str, Any]]:
+ if not isinstance(value, list) or not 1 <= len(value) <= MAX_SOURCES:
+ raise CliError(f"sources must contain between 1 and {MAX_SOURCES} objects")
+ result: dict[str, dict[str, Any]] = {}
+ for index, item in enumerate(value):
+ context = f"sources[{index}]"
+ source = reject_unknown_keys(
+ item,
+ context=context,
+ allowed={"id", "kind", "citation", "locator", "author_verified"},
+ required={"id", "kind", "citation", "locator", "author_verified"},
+ )
+ source_id = _identifier(source["id"], context=f"{context}.id")
+ if source_id in result:
+ raise CliError(f"duplicate source id: {source_id}")
+ kind = require_string(source["kind"], context=f"{context}.kind", maximum=32)
+ if kind not in _SOURCE_KINDS:
+ raise CliError(
+ f"{context}.kind must be one of {', '.join(sorted(_SOURCE_KINDS))}"
+ )
+ require_string(
+ source["citation"], context=f"{context}.citation", maximum=2_000
+ )
+ require_string(source["locator"], context=f"{context}.locator", maximum=2_000)
+ if not require_bool(
+ source["author_verified"], context=f"{context}.author_verified"
+ ):
+ raise CliError(f"{context}.author_verified must be true")
+ result[source_id] = source
+ return result
+
+
+def _validate_requirements(
+ value: Any,
+ *,
+ trim_width: float,
+ trim_height: float,
+ bleed: float,
+ safe_margin: float,
+ print_scale: float,
+) -> tuple[dict[str, Any], set[str]]:
+ requirements = reject_unknown_keys(
+ value,
+ context="requirements",
+ allowed={"conference", "printer"},
+ required={"conference", "printer"},
+ )
+ conference = reject_unknown_keys(
+ requirements["conference"],
+ context="requirements.conference",
+ allowed={
+ "confirmed",
+ "source_id",
+ "max_width_in",
+ "max_height_in",
+ "orientation",
+ "required_delivery_format",
+ "notes",
+ },
+ required={
+ "confirmed",
+ "source_id",
+ "max_width_in",
+ "max_height_in",
+ "orientation",
+ "required_delivery_format",
+ "notes",
+ },
+ )
+ if not require_bool(
+ conference["confirmed"], context="requirements.conference.confirmed"
+ ):
+ raise CliError("requirements.conference.confirmed must be true")
+ conference_source = _identifier(
+ conference["source_id"], context="requirements.conference.source_id"
+ )
+ max_width = finite_number(
+ conference["max_width_in"],
+ context="requirements.conference.max_width_in",
+ minimum=1.0,
+ maximum=200.0,
+ )
+ max_height = finite_number(
+ conference["max_height_in"],
+ context="requirements.conference.max_height_in",
+ minimum=1.0,
+ maximum=200.0,
+ )
+ conference_orientation = require_string(
+ conference["orientation"],
+ context="requirements.conference.orientation",
+ maximum=16,
+ )
+ if conference_orientation not in {"portrait", "landscape", "square", "either"}:
+ raise CliError(
+ "requirements.conference.orientation must be portrait, landscape, "
+ "square, or either"
+ )
+ physical_orientation = (
+ "square"
+ if abs(trim_width - trim_height) <= 1e-6
+ else ("landscape" if trim_width > trim_height else "portrait")
+ )
+ if (
+ conference_orientation != "either"
+ and conference_orientation != physical_orientation
+ ):
+ raise CliError("physical output violates the confirmed conference orientation")
+ if trim_width > max_width + 1e-6 or trim_height > max_height + 1e-6:
+ raise CliError("physical output exceeds the confirmed conference dimensions")
+ delivery = require_string(
+ conference["required_delivery_format"],
+ context="requirements.conference.required_delivery_format",
+ maximum=32,
+ )
+ if delivery not in {"PDF", "PPTX", "PDF_AND_PPTX", "OTHER"}:
+ raise CliError(
+ "requirements.conference.required_delivery_format must be PDF, PPTX, "
+ "PDF_AND_PPTX, or OTHER"
+ )
+ require_string(
+ conference["notes"],
+ context="requirements.conference.notes",
+ minimum=0,
+ maximum=2_000,
+ )
+
+ printer = reject_unknown_keys(
+ requirements["printer"],
+ context="requirements.printer",
+ allowed={
+ "confirmed",
+ "source_id",
+ "trim_width_in",
+ "trim_height_in",
+ "bleed_in",
+ "safe_margin_in",
+ "accepted_color_mode",
+ "scaling_allowed",
+ "notes",
+ },
+ required={
+ "confirmed",
+ "source_id",
+ "trim_width_in",
+ "trim_height_in",
+ "bleed_in",
+ "safe_margin_in",
+ "accepted_color_mode",
+ "scaling_allowed",
+ "notes",
+ },
+ )
+ if not require_bool(printer["confirmed"], context="requirements.printer.confirmed"):
+ raise CliError("requirements.printer.confirmed must be true")
+ printer_source = _identifier(
+ printer["source_id"], context="requirements.printer.source_id"
+ )
+ printer_trim_width = finite_number(
+ printer["trim_width_in"],
+ context="requirements.printer.trim_width_in",
+ minimum=1.0,
+ maximum=200.0,
+ )
+ printer_trim_height = finite_number(
+ printer["trim_height_in"],
+ context="requirements.printer.trim_height_in",
+ minimum=1.0,
+ maximum=200.0,
+ )
+ printer_bleed = finite_number(
+ printer["bleed_in"],
+ context="requirements.printer.bleed_in",
+ minimum=0.0,
+ maximum=2.0,
+ )
+ printer_margin = finite_number(
+ printer["safe_margin_in"],
+ context="requirements.printer.safe_margin_in",
+ minimum=0.0,
+ maximum=10.0,
+ )
+ for actual, required, label in (
+ (trim_width, printer_trim_width, "trim width"),
+ (trim_height, printer_trim_height, "trim height"),
+ (bleed, printer_bleed, "bleed"),
+ (safe_margin, printer_margin, "safe margin"),
+ ):
+ if abs(actual - required) > 1e-6:
+ raise CliError(
+ f"physical output {label} does not match the confirmed printer rule"
+ )
+ color_mode = require_string(
+ printer["accepted_color_mode"],
+ context="requirements.printer.accepted_color_mode",
+ maximum=32,
+ )
+ if color_mode not in {"RGB", "CMYK", "PRINTER_MANAGED"}:
+ raise CliError(
+ "requirements.printer.accepted_color_mode must be RGB, CMYK, "
+ "or PRINTER_MANAGED"
+ )
+ scaling_allowed = require_bool(
+ printer["scaling_allowed"], context="requirements.printer.scaling_allowed"
+ )
+ if not scaling_allowed and abs(print_scale - 1.0) > 1e-6:
+ raise CliError(
+ "printer forbids scaling but canvas and physical artboard differ"
+ )
+ require_string(
+ printer["notes"],
+ context="requirements.printer.notes",
+ minimum=0,
+ maximum=2_000,
+ )
+ return requirements, {conference_source, printer_source}
+
+
+def _validate_quality(value: Any) -> tuple[dict[str, Any], set[str]]:
+ quality = reject_unknown_keys(
+ value,
+ context="quality",
+ allowed={
+ "minimum_font_pt_final",
+ "font_guidance_basis",
+ "font_guidance_source_id",
+ "minimum_raster_dpi_final",
+ "raster_dpi_basis",
+ "raster_dpi_source_id",
+ },
+ required={
+ "minimum_font_pt_final",
+ "font_guidance_basis",
+ "font_guidance_source_id",
+ "minimum_raster_dpi_final",
+ "raster_dpi_basis",
+ "raster_dpi_source_id",
+ },
+ )
+ finite_number(
+ quality["minimum_font_pt_final"],
+ context="quality.minimum_font_pt_final",
+ minimum=1.0,
+ maximum=200.0,
+ )
+ finite_number(
+ quality["minimum_raster_dpi_final"],
+ context="quality.minimum_raster_dpi_final",
+ minimum=1.0,
+ maximum=2_400.0,
+ )
+ used: set[str] = set()
+ for prefix in ("font_guidance", "raster_dpi"):
+ basis = require_string(
+ quality[f"{prefix}_basis"],
+ context=f"quality.{prefix}_basis",
+ maximum=32,
+ )
+ if basis not in _FONT_BASES:
+ raise CliError(
+ f"quality.{prefix}_basis must be one of "
+ f"{', '.join(sorted(_FONT_BASES))}"
+ )
+ source_id = _nullable_source_id(
+ quality[f"{prefix}_source_id"],
+ context=f"quality.{prefix}_source_id",
+ )
+ if basis == "heuristic" and source_id is not None:
+ raise CliError(
+ f"quality.{prefix}_source_id must be null when basis is heuristic"
+ )
+ if basis != "heuristic" and source_id is None:
+ raise CliError(
+ f"quality.{prefix}_source_id is required for basis {basis!r}"
+ )
+ if source_id is not None:
+ used.add(source_id)
+ return quality, used
+
+
+def _validate_palette(
+ value: Any,
+ *,
+ enforce_thresholds: bool = True,
+) -> tuple[dict[str, Any], dict[str, str], dict[str, dict[str, Any]]]:
+ palette = reject_unknown_keys(
+ value,
+ context="palette",
+ allowed={"colors", "contrast_pairs", "data_series_redundant_encoding"},
+ required={"colors", "contrast_pairs", "data_series_redundant_encoding"},
+ )
+ raw_colors = palette["colors"]
+ if not isinstance(raw_colors, dict) or not 2 <= len(raw_colors) <= 64:
+ raise CliError("palette.colors must contain between 2 and 64 named colors")
+ colors: dict[str, str] = {}
+ for raw_id, value in raw_colors.items():
+ color_id = _identifier(raw_id, context=f"palette.colors[{raw_id!r}]")
+ colors[color_id] = parse_hex_color(
+ value, context=f"palette.colors.{color_id}"
+ )
+
+ raw_pairs = palette["contrast_pairs"]
+ if not isinstance(raw_pairs, list) or not 1 <= len(raw_pairs) <= 128:
+ raise CliError("palette.contrast_pairs must contain between 1 and 128 pairs")
+ pairs: dict[str, dict[str, Any]] = {}
+ for index, item in enumerate(raw_pairs):
+ context = f"palette.contrast_pairs[{index}]"
+ pair = reject_unknown_keys(
+ item,
+ context=context,
+ allowed={
+ "id",
+ "foreground_color_id",
+ "background_color_id",
+ "usage",
+ },
+ required={
+ "id",
+ "foreground_color_id",
+ "background_color_id",
+ "usage",
+ },
+ )
+ pair_id = _identifier(pair["id"], context=f"{context}.id")
+ if pair_id in pairs:
+ raise CliError(f"duplicate contrast pair id: {pair_id}")
+ foreground_id = _identifier(
+ pair["foreground_color_id"],
+ context=f"{context}.foreground_color_id",
+ )
+ background_id = _identifier(
+ pair["background_color_id"],
+ context=f"{context}.background_color_id",
+ )
+ if foreground_id not in colors or background_id not in colors:
+ raise CliError(f"{context} references an unknown palette color")
+ usage = require_string(pair["usage"], context=f"{context}.usage", maximum=24)
+ thresholds = {"normal_text": 4.5, "large_text": 3.0, "non_text": 3.0}
+ if usage not in thresholds:
+ raise CliError(
+ f"{context}.usage must be normal_text, large_text, or non_text"
+ )
+ ratio = contrast_ratio(colors[foreground_id], colors[background_id])
+ if enforce_thresholds and ratio + 1e-9 < thresholds[usage]:
+ raise CliError(
+ f"{context} contrast is {ratio:.2f}:1, below the "
+ f"{thresholds[usage]:.1f}:1 threshold for {usage}"
+ )
+ pairs[pair_id] = pair
+ if not require_bool(
+ palette["data_series_redundant_encoding"],
+ context="palette.data_series_redundant_encoding",
+ ):
+ raise CliError("palette.data_series_redundant_encoding must be true")
+ return palette, colors, pairs
+
+
+def _validate_asset_path_syntax(value: Any, *, context: str) -> str:
+ path = require_string(value, context=context, maximum=512)
+ if not _RELATIVE_PATH.fullmatch(path) or path.startswith(("/", "\\")):
+ raise CliError(f"{context} must be a relative local path")
+ if "\\" in path or any(part in {"", ".", ".."} for part in Path(path).parts):
+ raise CliError(f"{context} contains an unsafe path segment")
+ if Path(path).suffix.lower() not in ASSET_SUFFIXES:
+ raise CliError(
+ f"{context} must use one of {', '.join(sorted(ASSET_SUFFIXES))}"
+ )
+ return path
+
+
+def _validate_assets(
+ value: Any,
+ *,
+ manifest_path: Path,
+ verify_assets: bool,
+) -> tuple[dict[str, dict[str, Any]], dict[str, Path], set[str]]:
+ if not isinstance(value, list) or len(value) > MAX_ASSETS:
+ raise CliError(f"assets must be an array with at most {MAX_ASSETS} objects")
+ assets: dict[str, dict[str, Any]] = {}
+ paths: dict[str, Path] = {}
+ used_sources: set[str] = set()
+ used_path_values: set[str] = set()
+ for index, item in enumerate(value):
+ context = f"assets[{index}]"
+ asset = reject_unknown_keys(
+ item,
+ context=context,
+ allowed={
+ "id",
+ "path",
+ "role",
+ "sha256",
+ "source_id",
+ "license",
+ "provenance",
+ "alt_text",
+ "author_approved",
+ "qr_target",
+ },
+ required={
+ "id",
+ "path",
+ "role",
+ "sha256",
+ "source_id",
+ "license",
+ "provenance",
+ "alt_text",
+ "author_approved",
+ "qr_target",
+ },
+ )
+ asset_id = _identifier(asset["id"], context=f"{context}.id")
+ if asset_id in assets:
+ raise CliError(f"duplicate asset id: {asset_id}")
+ path_value = _validate_asset_path_syntax(
+ asset["path"], context=f"{context}.path"
+ )
+ if path_value in used_path_values:
+ raise CliError(
+ f"{context}.path duplicates another asset path: {path_value!r}"
+ )
+ used_path_values.add(path_value)
+ role = require_string(asset["role"], context=f"{context}.role", maximum=16)
+ if role not in {"figure", "logo", "qr_code"}:
+ raise CliError(f"{context}.role must be figure, logo, or qr_code")
+ digest = require_string(
+ asset["sha256"], context=f"{context}.sha256", maximum=64
+ )
+ if not _SHA256.fullmatch(digest):
+ raise CliError(f"{context}.sha256 must be 64 lowercase hex characters")
+ source_id = _identifier(
+ asset["source_id"], context=f"{context}.source_id"
+ )
+ used_sources.add(source_id)
+ require_string(asset["license"], context=f"{context}.license", maximum=500)
+ require_string(
+ asset["provenance"],
+ context=f"{context}.provenance",
+ maximum=2_000,
+ )
+ require_string(
+ asset["alt_text"], context=f"{context}.alt_text", maximum=1_000
+ )
+ if not require_bool(
+ asset["author_approved"], context=f"{context}.author_approved"
+ ):
+ raise CliError(f"{context}.author_approved must be true")
+ qr_target = asset["qr_target"]
+ if role == "qr_code":
+ target = require_string(
+ qr_target, context=f"{context}.qr_target", maximum=2_000
+ )
+ authority = target[len("https://") :].split("/", 1)[0]
+ if (
+ not target.startswith("https://")
+ or not authority
+ or "@" in authority
+ or any(character.isspace() for character in target)
+ ):
+ raise CliError(
+ f"{context}.qr_target must be an absolute https:// URL "
+ "without credentials or whitespace"
+ )
+ elif qr_target is not None:
+ raise CliError(f"{context}.qr_target must be null for non-QR assets")
+ if verify_assets:
+ path = resolve_local_asset(
+ manifest_path,
+ path_value,
+ suffixes=ASSET_SUFFIXES,
+ )
+ actual_digest = sha256_file(path)
+ if actual_digest != digest:
+ raise CliError(
+ f"{context}.sha256 mismatch for {path_value!r}: "
+ f"expected {digest}, got {actual_digest}"
+ )
+ paths[asset_id] = path
+ assets[asset_id] = asset
+ return assets, paths, used_sources
+
+
+def _validate_box(
+ item: dict[str, Any],
+ *,
+ context: str,
+ canvas_width: float,
+ canvas_height: float,
+) -> tuple[float, float, float, float]:
+ x = finite_number(item["x_in"], context=f"{context}.x_in", minimum=0.0)
+ y = finite_number(item["y_in"], context=f"{context}.y_in", minimum=0.0)
+ width = finite_number(
+ item["width_in"], context=f"{context}.width_in", minimum=0.01
+ )
+ height = finite_number(
+ item["height_in"], context=f"{context}.height_in", minimum=0.01
+ )
+ if x + width > canvas_width + 1e-6 or y + height > canvas_height + 1e-6:
+ raise CliError(f"{context} extends beyond the PowerPoint canvas")
+ return x, y, width, height
+
+
+def _validate_elements(
+ value: Any,
+ *,
+ document: dict[str, Any],
+ canvas_width: float,
+ canvas_height: float,
+ print_scale: float,
+ bleed: float,
+ safe_margin: float,
+ quality: dict[str, Any],
+ colors: dict[str, str],
+ contrast_pairs: dict[str, dict[str, Any]],
+ assets: dict[str, dict[str, Any]],
+) -> tuple[dict[str, dict[str, Any]], set[str], set[str]]:
+ if not isinstance(value, list) or not 1 <= len(value) <= MAX_ELEMENTS:
+ raise CliError(f"elements must contain between 1 and {MAX_ELEMENTS} objects")
+ elements: dict[str, dict[str, Any]] = {}
+ used_sources: set[str] = set()
+ used_assets: set[str] = set()
+ reading_orders: list[int] = []
+ title_matches = 0
+ safe_inset_design = (bleed + safe_margin) / print_scale
+
+ common = {
+ "id",
+ "type",
+ "reading_order",
+ "x_in",
+ "y_in",
+ "width_in",
+ "height_in",
+ "source_ids",
+ "author_approved",
+ "allow_in_bleed",
+ }
+ text_keys = common | {
+ "role",
+ "text",
+ "font_size_pt_design",
+ "font_face",
+ "bold",
+ "align",
+ "vertical_align",
+ "contrast_pair_id",
+ "line_color_id",
+ "line_width_pt",
+ "margin_in",
+ }
+ image_keys = common | {
+ "asset_id",
+ "fit",
+ "fallback_text_element_id",
+ "long_description_element_id",
+ }
+
+ for index, item in enumerate(value):
+ context = f"elements[{index}]"
+ if not isinstance(item, dict):
+ raise CliError(f"{context} must be an object")
+ element_type = require_string(
+ item.get("type"), context=f"{context}.type", maximum=16
+ )
+ allowed = text_keys if element_type == "text" else image_keys
+ if element_type not in {"text", "image"}:
+ raise CliError(f"{context}.type must be text or image")
+ element = reject_unknown_keys(
+ item,
+ context=context,
+ allowed=allowed,
+ required=allowed,
+ )
+ element_id = _identifier(element["id"], context=f"{context}.id")
+ if element_id in elements:
+ raise CliError(f"duplicate element id: {element_id}")
+ order = positive_int(
+ element["reading_order"],
+ context=f"{context}.reading_order",
+ maximum=MAX_ELEMENTS,
+ )
+ reading_orders.append(order)
+ x, y, width, height = _validate_box(
+ element,
+ context=context,
+ canvas_width=canvas_width,
+ canvas_height=canvas_height,
+ )
+ source_ids = _source_id_list(
+ element["source_ids"], context=f"{context}.source_ids"
+ )
+ used_sources.update(source_ids)
+ if not require_bool(
+ element["author_approved"], context=f"{context}.author_approved"
+ ):
+ raise CliError(f"{context}.author_approved must be true")
+ allow_in_bleed = require_bool(
+ element["allow_in_bleed"], context=f"{context}.allow_in_bleed"
+ )
+ if not allow_in_bleed:
+ if (
+ x < safe_inset_design - 1e-6
+ or y < safe_inset_design - 1e-6
+ or x + width > canvas_width - safe_inset_design + 1e-6
+ or y + height > canvas_height - safe_inset_design + 1e-6
+ ):
+ raise CliError(
+ f"{context} crosses the confirmed final safe margin; "
+ "only intentional bleed imagery may set allow_in_bleed=true"
+ )
+
+ if element_type == "text":
+ if allow_in_bleed:
+ raise CliError(f"{context}: text must not be placed in the bleed area")
+ role = require_string(
+ element["role"], context=f"{context}.role", maximum=32
+ )
+ if role not in _TEXT_ROLES:
+ raise CliError(
+ f"{context}.role must be one of {', '.join(sorted(_TEXT_ROLES))}"
+ )
+ text = require_string(
+ element["text"], context=f"{context}.text", maximum=20_000
+ )
+ if role == "title" and text == document["title"]:
+ title_matches += 1
+ design_font = finite_number(
+ element["font_size_pt_design"],
+ context=f"{context}.font_size_pt_design",
+ minimum=1.0,
+ maximum=500.0,
+ )
+ final_font = design_font * print_scale
+ minimum_font = float(quality["minimum_font_pt_final"])
+ if final_font + 1e-6 < minimum_font:
+ raise CliError(
+ f"{context} final font is {final_font:.2f} pt, below the "
+ f"manifest's {minimum_font:.2f} pt minimum"
+ )
+ require_string(
+ element["font_face"], context=f"{context}.font_face", maximum=100
+ )
+ bold = require_bool(element["bold"], context=f"{context}.bold")
+ align = require_string(
+ element["align"], context=f"{context}.align", maximum=16
+ )
+ if align not in {"left", "center", "right"}:
+ raise CliError(f"{context}.align must be left, center, or right")
+ vertical = require_string(
+ element["vertical_align"],
+ context=f"{context}.vertical_align",
+ maximum=16,
+ )
+ if vertical not in {"top", "middle", "bottom"}:
+ raise CliError(
+ f"{context}.vertical_align must be top, middle, or bottom"
+ )
+ pair_id = _identifier(
+ element["contrast_pair_id"],
+ context=f"{context}.contrast_pair_id",
+ )
+ if pair_id not in contrast_pairs:
+ raise CliError(f"{context} references unknown contrast pair {pair_id!r}")
+ pair = contrast_pairs[pair_id]
+ usage = pair["usage"]
+ if usage == "non_text":
+ raise CliError(f"{context} must use a text contrast pair")
+ if usage == "large_text":
+ is_large = final_font >= 18.0 or (bold and final_font >= 14.0)
+ if not is_large:
+ raise CliError(
+ f"{context} uses a large_text contrast pair but is not "
+ "at least 18 pt final, or 14 pt final and bold"
+ )
+ line_color_id = element["line_color_id"]
+ if line_color_id is not None:
+ line_id = _identifier(
+ line_color_id, context=f"{context}.line_color_id"
+ )
+ if line_id not in colors:
+ raise CliError(f"{context} references unknown line color {line_id!r}")
+ line_width = finite_number(
+ element["line_width_pt"],
+ context=f"{context}.line_width_pt",
+ minimum=0.0,
+ maximum=72.0,
+ )
+ if line_color_id is None and line_width != 0:
+ raise CliError(
+ f"{context}.line_width_pt must be 0 when line_color_id is null"
+ )
+ margin = finite_number(
+ element["margin_in"],
+ context=f"{context}.margin_in",
+ minimum=0.0,
+ maximum=5.0,
+ )
+ if 2 * margin >= min(width, height):
+ raise CliError(f"{context}.margin_in consumes the text box")
+ else:
+ asset_id = _identifier(
+ element["asset_id"], context=f"{context}.asset_id"
+ )
+ if asset_id not in assets:
+ raise CliError(f"{context} references unknown asset {asset_id!r}")
+ used_assets.add(asset_id)
+ if assets[asset_id]["source_id"] not in source_ids:
+ raise CliError(
+ f"{context}.source_ids must include the asset's exact source_id"
+ )
+ fit = require_string(element["fit"], context=f"{context}.fit", maximum=16)
+ if fit != "contain":
+ raise CliError(f"{context}.fit must be contain")
+ fallback_id = element["fallback_text_element_id"]
+ long_description_id = element["long_description_element_id"]
+ if long_description_id is not None:
+ _identifier(
+ long_description_id,
+ context=f"{context}.long_description_element_id",
+ )
+ if assets[asset_id]["role"] == "qr_code":
+ _identifier(
+ fallback_id,
+ context=f"{context}.fallback_text_element_id",
+ )
+ if abs(width - height) > 1e-6:
+ raise CliError(f"{context}: QR placement box must be square")
+ if long_description_id is not None:
+ raise CliError(
+ f"{context}.long_description_element_id must be null for "
+ "QR assets; use the required visible fallback text"
+ )
+ elif fallback_id is not None:
+ raise CliError(
+ f"{context}.fallback_text_element_id must be null for non-QR assets"
+ )
+ elements[element_id] = element
+
+ expected_order = list(range(1, len(value) + 1))
+ if sorted(reading_orders) != expected_order:
+ raise CliError(
+ "elements.reading_order values must be unique and contiguous from 1"
+ )
+ if reading_orders != expected_order:
+ raise CliError(
+ "elements must be listed in ascending reading_order so generation "
+ "does not silently reorder approved content"
+ )
+ if title_matches != 1:
+ raise CliError(
+ "exactly one title element must match document.title verbatim"
+ )
+ title = next(
+ element
+ for element in elements.values()
+ if element["type"] == "text"
+ and element["role"] == "title"
+ and element["text"] == document["title"]
+ )
+ if title["reading_order"] != 1:
+ raise CliError(
+ "the exact title element must have reading_order 1 so it can be the "
+ "native PowerPoint slide title"
+ )
+
+ for element_id, element in elements.items():
+ if element["type"] != "image":
+ continue
+ asset = assets[element["asset_id"]]
+ long_description_id = element["long_description_element_id"]
+ if long_description_id is not None:
+ description = elements.get(long_description_id)
+ if description is None or description["type"] != "text":
+ raise CliError(
+ f"image {element_id!r} references missing text long description "
+ f"{long_description_id!r}"
+ )
+ if description["role"] not in {"body", "caption", "other"}:
+ raise CliError(
+ f"long description {long_description_id!r} must have role "
+ "'body', 'caption', or 'other'"
+ )
+ if description["reading_order"] <= element["reading_order"]:
+ raise CliError(
+ f"long description {long_description_id!r} must follow image "
+ f"{element_id!r} in reading order"
+ )
+ if not set(element["source_ids"]).issubset(description["source_ids"]):
+ raise CliError(
+ f"long description {long_description_id!r} must include every "
+ f"source_id used by image {element_id!r}"
+ )
+ if asset["role"] != "qr_code":
+ continue
+ fallback_id = element["fallback_text_element_id"]
+ fallback = elements.get(fallback_id)
+ if fallback is None or fallback["type"] != "text":
+ raise CliError(
+ f"QR image {element_id!r} references missing text fallback "
+ f"{fallback_id!r}"
+ )
+ if fallback["role"] != "qr_fallback":
+ raise CliError(
+ f"QR fallback {fallback_id!r} must have role 'qr_fallback'"
+ )
+ if asset["qr_target"] not in fallback["text"]:
+ raise CliError(
+ f"QR fallback {fallback_id!r} must contain the exact QR target URL"
+ )
+ return elements, used_sources, used_assets
+
+
+def _validate_approval(
+ value: Any,
+ *,
+ content_hash: str,
+ require_approval: bool,
+) -> dict[str, Any]:
+ approval = reject_unknown_keys(
+ value,
+ context="approval",
+ allowed={"status", "approved_by", "approved_at", "content_sha256"},
+ required={"status", "approved_by", "approved_at", "content_sha256"},
+ )
+ status = require_string(approval["status"], context="approval.status", maximum=16)
+ if status not in {"draft", "approved"}:
+ raise CliError("approval.status must be draft or approved")
+ if require_approval and status != "approved":
+ raise CliError("approval.status must be approved")
+ if status == "approved":
+ require_string(
+ approval["approved_by"],
+ context="approval.approved_by",
+ maximum=200,
+ )
+ parse_aware_datetime(approval["approved_at"], context="approval.approved_at")
+ digest = require_string(
+ approval["content_sha256"],
+ context="approval.content_sha256",
+ maximum=64,
+ )
+ if not _SHA256.fullmatch(digest):
+ raise CliError(
+ "approval.content_sha256 must be 64 lowercase hex characters"
+ )
+ if digest != content_hash:
+ raise CliError(
+ "approval.content_sha256 does not match the current manifest content; "
+ "author approval must be renewed after every content change"
+ )
+ else:
+ for key in ("approved_by", "approved_at", "content_sha256"):
+ if approval[key] is not None:
+ raise CliError(f"approval.{key} must be null while status is draft")
+ return approval
+
+
+def validate_manifest_document(
+ document: Any,
+ *,
+ manifest_path: Path,
+ verify_assets: bool = True,
+ require_approval: bool = True,
+ enforce_contrast: bool = True,
+) -> dict[str, Any]:
+ """Validate a parsed manifest and return a non-content audit report."""
+ manifest = reject_unknown_keys(
+ document,
+ context="manifest",
+ allowed=_TOP_KEYS,
+ required=_TOP_KEYS,
+ )
+ if manifest["schema_version"] != MANIFEST_SCHEMA_VERSION:
+ raise CliError(
+ f"schema_version must be {MANIFEST_SCHEMA_VERSION!r}, got "
+ f"{manifest['schema_version']!r}"
+ )
+ placeholder = has_placeholder(manifest)
+ if placeholder is not None:
+ path, text = placeholder
+ raise CliError(f"placeholder content is forbidden at {path}: {text!r}")
+
+ document_record = _validate_document(manifest["document"])
+ _, canvas_width, canvas_height = _validate_canvas(manifest["canvas"])
+ (
+ _,
+ trim_width,
+ trim_height,
+ bleed,
+ safe_margin,
+ artboard_width,
+ artboard_height,
+ ) = _validate_physical_output(manifest["physical_output"])
+ scale_x = artboard_width / canvas_width
+ scale_y = artboard_height / canvas_height
+ if abs(scale_x - scale_y) > max(1e-6, scale_x * 0.001):
+ raise CliError(
+ "PowerPoint canvas and final artboard have different aspect ratios; "
+ "nonuniform print scaling is forbidden"
+ )
+ print_scale = (scale_x + scale_y) / 2.0
+
+ sources = _validate_sources(manifest["sources"])
+ requirements, requirement_sources = _validate_requirements(
+ manifest["requirements"],
+ trim_width=trim_width,
+ trim_height=trim_height,
+ bleed=bleed,
+ safe_margin=safe_margin,
+ print_scale=print_scale,
+ )
+ quality, quality_sources = _validate_quality(manifest["quality"])
+ _, colors, contrast_pairs = _validate_palette(
+ manifest["palette"],
+ enforce_thresholds=enforce_contrast,
+ )
+ assets, asset_paths, asset_sources = _validate_assets(
+ manifest["assets"],
+ manifest_path=manifest_path,
+ verify_assets=verify_assets,
+ )
+ elements, element_sources, used_assets = _validate_elements(
+ manifest["elements"],
+ document=document_record,
+ canvas_width=canvas_width,
+ canvas_height=canvas_height,
+ print_scale=print_scale,
+ bleed=bleed,
+ safe_margin=safe_margin,
+ quality=quality,
+ colors=colors,
+ contrast_pairs=contrast_pairs,
+ assets=assets,
+ )
+ if set(assets) != used_assets:
+ unused = sorted(set(assets) - used_assets)
+ raise CliError(f"unused assets are forbidden: {', '.join(unused)}")
+
+ used_sources = (
+ requirement_sources
+ | quality_sources
+ | asset_sources
+ | element_sources
+ | set(document_record["source_ids"])
+ )
+ unknown_sources = sorted(used_sources - set(sources))
+ if unknown_sources:
+ raise CliError(
+ f"unknown exact source id(s): {', '.join(unknown_sources)}"
+ )
+ expected_source_kinds = {
+ requirements["conference"]["source_id"]: "conference_rule",
+ requirements["printer"]["source_id"]: "printer_rule",
+ }
+ for source_id, expected_kind in expected_source_kinds.items():
+ if sources[source_id]["kind"] != expected_kind:
+ raise CliError(
+ f"source {source_id!r} must have kind {expected_kind!r} for its "
+ "declared requirement"
+ )
+ for prefix, expected_kind in (
+ ("font_guidance", "conference_rule"),
+ ("raster_dpi", "conference_rule"),
+ ):
+ basis = quality[f"{prefix}_basis"]
+ source_id = quality[f"{prefix}_source_id"]
+ if basis == "conference_requirement" and sources[source_id]["kind"] != expected_kind:
+ raise CliError(
+ f"quality.{prefix}_source_id must reference a conference_rule"
+ )
+ if (
+ basis == "printer_requirement"
+ and sources[source_id]["kind"] != "printer_rule"
+ ):
+ raise CliError(
+ f"quality.{prefix}_source_id must reference a printer_rule"
+ )
+ unused_sources = sorted(set(sources) - used_sources)
+ if unused_sources:
+ raise CliError(f"unused source records are forbidden: {', '.join(unused_sources)}")
+
+ content_hash = manifest_content_hash(manifest)
+ approval = _validate_approval(
+ manifest["approval"],
+ content_hash=content_hash,
+ require_approval=require_approval,
+ )
+ return {
+ "schema_version": REPORT_SCHEMA_VERSION,
+ "valid": True,
+ "manifest_path": str(manifest_path),
+ "manifest_schema_version": MANIFEST_SCHEMA_VERSION,
+ "content_sha256": content_hash,
+ "approval_status": approval["status"],
+ "assets_verified": verify_assets,
+ "asset_paths": {key: str(value) for key, value in asset_paths.items()},
+ "counts": {
+ "sources": len(sources),
+ "assets": len(assets),
+ "elements": len(elements),
+ "text_elements": sum(
+ element["type"] == "text" for element in elements.values()
+ ),
+ "image_elements": sum(
+ element["type"] == "image" for element in elements.values()
+ ),
+ },
+ "canvas": {
+ "width_in": canvas_width,
+ "height_in": canvas_height,
+ },
+ "physical_output": {
+ "trim_width_in": trim_width,
+ "trim_height_in": trim_height,
+ "bleed_in": bleed,
+ "safe_margin_in": safe_margin,
+ "artboard_width_in": artboard_width,
+ "artboard_height_in": artboard_height,
+ "print_scale": print_scale,
+ "print_scale_percent": print_scale * 100.0,
+ },
+ "quality_basis": {
+ "minimum_font_pt_final": float(quality["minimum_font_pt_final"]),
+ "font_guidance_basis": quality["font_guidance_basis"],
+ "minimum_raster_dpi_final": float(
+ quality["minimum_raster_dpi_final"]
+ ),
+ "raster_dpi_basis": quality["raster_dpi_basis"],
+ },
+ "delivery": {
+ "conference_format": requirements["conference"][
+ "required_delivery_format"
+ ],
+ "printer_color_mode": requirements["printer"][
+ "accepted_color_mode"
+ ],
+ "printer_scaling_allowed": requirements["printer"]["scaling_allowed"],
+ },
+ }
+
+
+def load_and_validate_manifest(
+ value: str | Path,
+ *,
+ verify_assets: bool = True,
+ require_approval: bool = True,
+ enforce_contrast: bool = True,
+) -> tuple[Path, dict[str, Any], dict[str, Any]]:
+ """Load strict JSON and validate the complete poster manifest."""
+ path, document = load_json_file(value)
+ report = validate_manifest_document(
+ document,
+ manifest_path=path,
+ verify_assets=verify_assets,
+ require_approval=require_approval,
+ enforce_contrast=enforce_contrast,
+ )
+ return path, document, report
+
diff --git a/skills/pptx-posters/scripts/_pptx.py b/skills/pptx-posters/scripts/_pptx.py
new file mode 100644
index 00000000..2f5a3d70
--- /dev/null
+++ b/skills/pptx-posters/scripts/_pptx.py
@@ -0,0 +1,1485 @@
+#!/usr/bin/env python3
+"""Bounded, non-executing PPTX package inspection and layout analysis."""
+
+from __future__ import annotations
+
+import posixpath
+import re
+import shutil
+import stat
+import struct
+import xml.etree.ElementTree as ET
+import zipfile
+from pathlib import Path, PurePosixPath
+from typing import Any
+
+from _common import (
+ EMU_PER_INCH,
+ MAX_INPUT_BYTES,
+ CliError,
+ checked_input_file,
+)
+
+REPORT_SCHEMA_VERSION = "1.0"
+MAX_MEMBERS = 4_096
+MAX_TOTAL_UNCOMPRESSED = 1024 * 1024 * 1024
+MAX_MEMBER_UNCOMPRESSED = 128 * 1024 * 1024
+MAX_XML_BYTES = 8 * 1024 * 1024
+MAX_COMPRESSION_RATIO = 100.0
+MAX_CENTRAL_DIRECTORY_BYTES = 64 * 1024 * 1024
+DETERMINISTIC_ZIP_DATETIME = (1980, 1, 1, 0, 0, 0)
+
+P_NS = "http://schemas.openxmlformats.org/presentationml/2006/main"
+A_NS = "http://schemas.openxmlformats.org/drawingml/2006/main"
+R_NS = "http://schemas.openxmlformats.org/officeDocument/2006/relationships"
+PKG_REL_NS = "http://schemas.openxmlformats.org/package/2006/relationships"
+CT_NS = "http://schemas.openxmlformats.org/package/2006/content-types"
+
+STANDARD_PRESENTATION_CONTENT_TYPE = (
+ "application/vnd.openxmlformats-officedocument.presentationml."
+ "presentation.main+xml"
+)
+REQUIRED_PARTS = {
+ "[Content_Types].xml",
+ "_rels/.rels",
+ "ppt/_rels/presentation.xml.rels",
+ "ppt/presentation.xml",
+}
+FORBIDDEN_PREFIXES = (
+ "_xmlsignatures/",
+ "customxml/",
+ "customui/",
+ "ppt/activex/",
+ "ppt/comments/",
+ "ppt/ctrlprops/",
+ "ppt/embeddings/",
+ "ppt/externallinks/",
+ "ppt/fonts/",
+ "ppt/model3d/",
+ "ppt/notesmasters/",
+ "ppt/notesslides/",
+ "ppt/persons/",
+ "ppt/vba/",
+ "ppt/webextensions/",
+ "webextensions/",
+)
+FORBIDDEN_RELATIONSHIP_MARKERS = (
+ "activex",
+ "attachedtemplate",
+ "control",
+ "customui",
+ "externallink",
+ "relationships/hyperlink",
+ "notesmaster",
+ "notesslide",
+ "oleobject",
+ "person",
+ "relationships/package",
+ "relationships/audio",
+ "relationships/media",
+ "relationships/video",
+ "webextension",
+ "vbaproject",
+)
+FORBIDDEN_CONTENT_TYPE_MARKERS = (
+ "activex",
+ "macroenabled",
+ "oleobject",
+ "vba",
+ "vnd.ms-package",
+)
+FORBIDDEN_BINARY_SUFFIXES = {
+ ".7z",
+ ".app",
+ ".applescript",
+ ".bat",
+ ".bin",
+ ".class",
+ ".cmd",
+ ".com",
+ ".doc",
+ ".docm",
+ ".docx",
+ ".dll",
+ ".dylib",
+ ".exe",
+ ".hta",
+ ".htm",
+ ".html",
+ ".jar",
+ ".js",
+ ".lnk",
+ ".msi",
+ ".pdf",
+ ".ppt",
+ ".pptm",
+ ".pptx",
+ ".ps1",
+ ".py",
+ ".rar",
+ ".rb",
+ ".sh",
+ ".so",
+ ".svg",
+ ".vbs",
+ ".xls",
+ ".xlsm",
+ ".xlsx",
+ ".zip",
+}
+ALLOWED_CONTENT_TYPES = {
+ "application/vnd.openxmlformats-package.core-properties+xml",
+ "application/vnd.openxmlformats-package.relationships+xml",
+ "application/vnd.openxmlformats-officedocument.extended-properties+xml",
+ "application/vnd.openxmlformats-officedocument.presentationml.presProps+xml",
+ "application/vnd.openxmlformats-officedocument.presentationml.presentation.main+xml",
+ "application/vnd.openxmlformats-officedocument.presentationml.slide+xml",
+ "application/vnd.openxmlformats-officedocument.presentationml.slideLayout+xml",
+ "application/vnd.openxmlformats-officedocument.presentationml.slideMaster+xml",
+ "application/vnd.openxmlformats-officedocument.presentationml.tableStyles+xml",
+ "application/vnd.openxmlformats-officedocument.presentationml.viewProps+xml",
+ "application/vnd.openxmlformats-officedocument.theme+xml",
+ "application/xml",
+ "image/jpeg",
+ "image/png",
+}
+ALLOWED_PART_PATTERNS = tuple(
+ re.compile(pattern)
+ for pattern in (
+ r"\[Content_Types\]\.xml",
+ r"_rels/\.rels",
+ r"docProps/(?:app|core)\.xml",
+ r"docProps/thumbnail\.jpeg",
+ r"ppt/(?:presentation|presProps|tableStyles|viewProps)\.xml",
+ r"ppt/_rels/presentation\.xml\.rels",
+ r"ppt/theme/theme[1-9][0-9]*\.xml",
+ r"ppt/slideMasters/slideMaster[1-9][0-9]*\.xml",
+ r"ppt/slideMasters/_rels/slideMaster[1-9][0-9]*\.xml\.rels",
+ r"ppt/slideLayouts/slideLayout[1-9][0-9]*\.xml",
+ r"ppt/slideLayouts/_rels/slideLayout[1-9][0-9]*\.xml\.rels",
+ r"ppt/slides/slide[1-9][0-9]*\.xml",
+ r"ppt/slides/_rels/slide[1-9][0-9]*\.xml\.rels",
+ r"ppt/media/image[1-9][0-9]*\.(?:jpeg|jpg|png)",
+ r"ppt/printerSettings/printerSettings[1-9][0-9]*\.bin",
+ )
+)
+
+
+def _finding(code: str, message: str, *, location: str | None = None) -> dict[str, Any]:
+ record: dict[str, Any] = {"code": code, "message": message}
+ if location is not None:
+ record["location"] = location
+ return record
+
+
+def _allowed_generated_part(name: str) -> bool:
+ """Return whether a part belongs to the strict generated-poster profile."""
+ return any(pattern.fullmatch(name) for pattern in ALLOWED_PART_PATTERNS)
+
+
+def _preflight_zip_directory(path: Path) -> list[dict[str, Any]]:
+ """Bound the central directory before ZipFile materializes all members."""
+ findings: list[dict[str, Any]] = []
+ file_size = path.stat().st_size
+ if file_size < 22:
+ return [_finding("NOT_ZIP", "file is too short to contain a ZIP directory")]
+ with path.open("rb") as handle:
+ if handle.read(4) != b"PK\x03\x04":
+ return [_finding("NOT_ZIP", "file does not begin with a ZIP local header")]
+ tail_size = min(file_size, 65_557)
+ handle.seek(file_size - tail_size)
+ tail = handle.read(tail_size)
+ marker = b"PK\x05\x06"
+ index = tail.rfind(marker)
+ if index < 0 or index + 22 > len(tail):
+ return [_finding("ZIP_DIRECTORY_INVALID", "end-of-central-directory not found")]
+ try:
+ (
+ signature,
+ disk_number,
+ central_disk,
+ entries_on_disk,
+ total_entries,
+ central_size,
+ central_offset,
+ comment_length,
+ ) = struct.unpack_from("<4s4H2LH", tail, index)
+ except struct.error as exc:
+ return [_finding("ZIP_DIRECTORY_INVALID", str(exc))]
+ if signature != marker:
+ findings.append(
+ _finding("ZIP_DIRECTORY_INVALID", "invalid central-directory signature")
+ )
+ eocd_offset = file_size - tail_size + index
+ if eocd_offset + 22 + comment_length != file_size:
+ findings.append(
+ _finding(
+ "ZIP_DIRECTORY_INVALID",
+ "central-directory comment length or trailing bytes are invalid",
+ )
+ )
+ if (
+ disk_number != 0
+ or central_disk != 0
+ or entries_on_disk != total_entries
+ ):
+ findings.append(
+ _finding("ZIP_MULTIDISK", "multi-disk ZIP packages are forbidden")
+ )
+ if (
+ total_entries == 0xFFFF
+ or central_size == 0xFFFFFFFF
+ or central_offset == 0xFFFFFFFF
+ ):
+ findings.append(
+ _finding(
+ "ZIP64_DIRECTORY",
+ "ZIP64 central directories are outside the strict PPTX profile",
+ )
+ )
+ return findings
+ if total_entries > MAX_MEMBERS:
+ findings.append(
+ _finding(
+ "ZIP_MEMBER_LIMIT",
+ f"package declares {total_entries} members; limit is {MAX_MEMBERS}",
+ )
+ )
+ if central_size > MAX_CENTRAL_DIRECTORY_BYTES:
+ findings.append(
+ _finding(
+ "ZIP_DIRECTORY_SIZE",
+ f"central directory is {central_size} bytes; limit is "
+ f"{MAX_CENTRAL_DIRECTORY_BYTES}",
+ )
+ )
+ if central_offset + central_size != eocd_offset:
+ findings.append(
+ _finding(
+ "ZIP_DIRECTORY_INVALID",
+ "central-directory offset/size does not end at the ZIP footer",
+ )
+ )
+ return findings
+
+
+def _unsafe_xml(text: str) -> bool:
+ upper = text.upper()
+ return "<!DOCTYPE" in upper or "<!ENTITY" in upper
+
+
+def _parse_xml(raw: bytes, *, location: str) -> ET.Element:
+ if len(raw) > MAX_XML_BYTES:
+ raise CliError(
+ f"XML part {location} is {len(raw)} bytes; limit is {MAX_XML_BYTES}"
+ )
+ try:
+ text = raw.decode("utf-8-sig")
+ except UnicodeDecodeError as exc:
+ raise CliError(
+ f"XML part {location} must be UTF-8 in the strict generated profile"
+ ) from exc
+ if "\x00" in text:
+ raise CliError(f"NUL is forbidden in XML part {location}")
+ if _unsafe_xml(text):
+ raise CliError(f"DTD or entity declaration is forbidden in {location}")
+ try:
+ return ET.fromstring(text)
+ except ET.ParseError as exc:
+ raise CliError(f"malformed XML in {location}: {exc}") from exc
+
+
+def _relationship_source_directory(rels_name: str) -> str:
+ if rels_name == "_rels/.rels":
+ return ""
+ marker = "/_rels/"
+ if marker not in rels_name or not rels_name.endswith(".rels"):
+ raise CliError(f"invalid relationship part name: {rels_name}")
+ prefix, leaf = rels_name.split(marker, 1)
+ source_leaf = leaf[: -len(".rels")]
+ return posixpath.dirname(f"{prefix}/{source_leaf}")
+
+
+def _resolve_internal_target(rels_name: str, target: str) -> str:
+ if not target or "\x00" in target or "\\" in target:
+ raise CliError(f"unsafe internal relationship target in {rels_name}: {target!r}")
+ if target.startswith("/") or "%" in target or "?" in target or "#" in target:
+ raise CliError(
+ f"unsupported internal relationship target in {rels_name}: {target!r}"
+ )
+ base = _relationship_source_directory(rels_name)
+ normalized = posixpath.normpath(posixpath.join(base, target))
+ if normalized in {"", ".", ".."} or normalized.startswith("../"):
+ raise CliError(
+ f"relationship target escapes the package in {rels_name}: {target!r}"
+ )
+ return normalized
+
+
+def _preflight_members(
+ archive: zipfile.ZipFile,
+) -> tuple[list[zipfile.ZipInfo], list[dict[str, Any]], set[str], int]:
+ findings: list[dict[str, Any]] = []
+ members = archive.infolist()
+ if len(members) > MAX_MEMBERS:
+ return (
+ members,
+ [
+ _finding(
+ "ZIP_MEMBER_LIMIT",
+ f"package has {len(members)} members; limit is {MAX_MEMBERS}",
+ )
+ ],
+ set(),
+ 0,
+ )
+ names: set[str] = set()
+ casefold_names: set[str] = set()
+ total_uncompressed = 0
+
+ for info in members:
+ name = info.filename
+ location = name or "<empty>"
+ if (
+ not name
+ or "\x00" in name
+ or "\\" in name
+ or ":" in name
+ or "%" in name
+ ):
+ findings.append(
+ _finding(
+ "ZIP_UNSAFE_NAME",
+ "empty, NUL, backslash, colon, or percent-encoded member name",
+ location=location,
+ )
+ )
+ continue
+ pure = PurePosixPath(name)
+ if pure.is_absolute() or any(part in {"", ".", ".."} for part in pure.parts):
+ findings.append(
+ _finding("ZIP_TRAVERSAL", "absolute or traversing member path", location=name)
+ )
+ if name in names or name.casefold() in casefold_names:
+ findings.append(
+ _finding("ZIP_DUPLICATE_NAME", "duplicate or case-colliding member", location=name)
+ )
+ names.add(name)
+ casefold_names.add(name.casefold())
+ unix_mode = (info.external_attr >> 16) & 0o170000
+ if unix_mode == stat.S_IFLNK:
+ findings.append(
+ _finding("ZIP_SYMLINK", "symbolic-link member is forbidden", location=name)
+ )
+ if info.flag_bits & 0x1:
+ findings.append(
+ _finding("ZIP_ENCRYPTED", "encrypted member is forbidden", location=name)
+ )
+ if info.compress_type not in {zipfile.ZIP_STORED, zipfile.ZIP_DEFLATED}:
+ findings.append(
+ _finding(
+ "ZIP_COMPRESSION_METHOD",
+ f"unsupported compression method {info.compress_type}",
+ location=name,
+ )
+ )
+ total_uncompressed += info.file_size
+ if total_uncompressed > MAX_TOTAL_UNCOMPRESSED:
+ findings.append(
+ _finding(
+ "ZIP_TOTAL_SIZE",
+ f"package expands beyond {MAX_TOTAL_UNCOMPRESSED} bytes",
+ location=name,
+ )
+ )
+ return members, findings, names, total_uncompressed
+ if info.file_size > MAX_MEMBER_UNCOMPRESSED:
+ findings.append(
+ _finding(
+ "ZIP_MEMBER_SIZE",
+ f"member expands to {info.file_size} bytes; "
+ f"limit is {MAX_MEMBER_UNCOMPRESSED}",
+ location=name,
+ )
+ )
+ return members, findings, names, total_uncompressed
+ if info.file_size:
+ if info.compress_size == 0:
+ ratio = float("inf")
+ else:
+ ratio = info.file_size / info.compress_size
+ if ratio > MAX_COMPRESSION_RATIO:
+ findings.append(
+ _finding(
+ "ZIP_COMPRESSION_RATIO",
+ f"compression ratio {ratio:.1f}:1 exceeds "
+ f"{MAX_COMPRESSION_RATIO:.1f}:1",
+ location=name,
+ )
+ )
+ return members, findings, names, total_uncompressed
+ lowered = name.lower()
+ if lowered.startswith(FORBIDDEN_PREFIXES):
+ findings.append(
+ _finding(
+ "FORBIDDEN_PACKAGE_PART",
+ "active, external, or embedded package area is forbidden",
+ location=name,
+ )
+ )
+ if lowered == "docprops/custom.xml":
+ findings.append(
+ _finding(
+ "FORBIDDEN_CUSTOM_PROPERTIES",
+ "custom document properties are outside the strict poster profile",
+ location=name,
+ )
+ )
+ if PurePosixPath(lowered).suffix in FORBIDDEN_BINARY_SUFFIXES:
+ findings.append(
+ _finding(
+ "FORBIDDEN_BINARY_PART",
+ "binary or executable package part is forbidden",
+ location=name,
+ )
+ )
+ if not _allowed_generated_part(name):
+ findings.append(
+ _finding(
+ "UNKNOWN_PACKAGE_PART",
+ "part is outside the strict one-slide generated-poster profile",
+ location=name,
+ )
+ )
+ if lowered.startswith("ppt/media/") and PurePosixPath(lowered).suffix not in {
+ ".jpeg",
+ ".jpg",
+ ".png",
+ }:
+ findings.append(
+ _finding(
+ "FORBIDDEN_MEDIA_PART",
+ "non-image media part is forbidden",
+ location=name,
+ )
+ )
+
+ missing = sorted(REQUIRED_PARTS - names)
+ if missing:
+ findings.append(
+ _finding(
+ "MISSING_REQUIRED_PART",
+ f"missing required package part(s): {', '.join(missing)}",
+ )
+ )
+ return members, findings, names, total_uncompressed
+
+
+def _inspect_content_types(
+ archive: zipfile.ZipFile,
+ names: set[str],
+) -> list[dict[str, Any]]:
+ findings: list[dict[str, Any]] = []
+ if "[Content_Types].xml" not in names:
+ return findings
+ try:
+ root = _parse_xml(
+ archive.read("[Content_Types].xml"),
+ location="[Content_Types].xml",
+ )
+ except (KeyError, OSError, RuntimeError, zipfile.BadZipFile, CliError) as exc:
+ return [
+ _finding(
+ "CONTENT_TYPES_INVALID",
+ str(exc),
+ location="[Content_Types].xml",
+ )
+ ]
+ if root.tag != f"{{{CT_NS}}}Types":
+ findings.append(
+ _finding(
+ "CONTENT_TYPES_INVALID",
+ "root element is not the OPC content-types element",
+ location="[Content_Types].xml",
+ )
+ )
+ return findings
+ main_type = None
+ seen_defaults: set[str] = set()
+ seen_overrides: set[str] = set()
+ for node in root:
+ content_type = node.attrib.get("ContentType", "")
+ lowered = content_type.lower()
+ if node.tag not in {f"{{{CT_NS}}}Default", f"{{{CT_NS}}}Override"}:
+ findings.append(
+ _finding(
+ "CONTENT_TYPES_INVALID",
+ "unexpected element in content-types part",
+ location="[Content_Types].xml",
+ )
+ )
+ continue
+ if content_type not in ALLOWED_CONTENT_TYPES:
+ findings.append(
+ _finding(
+ "UNEXPECTED_CONTENT_TYPE",
+ f"content type is outside the strict profile: {content_type!r}",
+ location="[Content_Types].xml",
+ )
+ )
+ if any(marker in lowered for marker in FORBIDDEN_CONTENT_TYPE_MARKERS):
+ findings.append(
+ _finding(
+ "FORBIDDEN_CONTENT_TYPE",
+ f"forbidden content type {content_type!r}",
+ location="[Content_Types].xml",
+ )
+ )
+ if node.tag == f"{{{CT_NS}}}Default":
+ extension = node.attrib.get("Extension", "")
+ if (
+ not extension
+ or extension in seen_defaults
+ or "/" in extension
+ or "\\" in extension
+ or "." in extension
+ ):
+ findings.append(
+ _finding(
+ "CONTENT_TYPES_INVALID",
+ f"invalid or duplicate default extension {extension!r}",
+ location="[Content_Types].xml",
+ )
+ )
+ seen_defaults.add(extension)
+ continue
+ part_name = node.attrib.get("PartName", "")
+ normalized_part = part_name[1:] if part_name.startswith("/") else ""
+ if (
+ not normalized_part
+ or normalized_part in seen_overrides
+ or normalized_part not in names
+ ):
+ findings.append(
+ _finding(
+ "CONTENT_TYPES_INVALID",
+ f"invalid, duplicate, or missing override part {part_name!r}",
+ location="[Content_Types].xml",
+ )
+ )
+ seen_overrides.add(normalized_part)
+ if (
+ node.tag == f"{{{CT_NS}}}Override"
+ and part_name == "/ppt/presentation.xml"
+ ):
+ main_type = content_type
+ if main_type != STANDARD_PRESENTATION_CONTENT_TYPE:
+ findings.append(
+ _finding(
+ "PRESENTATION_CONTENT_TYPE",
+ "ppt/presentation.xml is not a standard macro-free PPTX main part",
+ location="[Content_Types].xml",
+ )
+ )
+ return findings
+
+
+def _inspect_relationships(
+ archive: zipfile.ZipFile,
+ names: set[str],
+) -> tuple[list[dict[str, Any]], int]:
+ findings: list[dict[str, Any]] = []
+ relationship_count = 0
+ for rels_name in sorted(name for name in names if name.endswith(".rels")):
+ try:
+ root = _parse_xml(archive.read(rels_name), location=rels_name)
+ except (KeyError, OSError, RuntimeError, zipfile.BadZipFile, CliError) as exc:
+ findings.append(
+ _finding("RELATIONSHIPS_INVALID", str(exc), location=rels_name)
+ )
+ continue
+ if root.tag != f"{{{PKG_REL_NS}}}Relationships":
+ findings.append(
+ _finding(
+ "RELATIONSHIPS_INVALID",
+ "root element is not the OPC relationships element",
+ location=rels_name,
+ )
+ )
+ continue
+ seen_ids: set[str] = set()
+ for relationship in root:
+ if relationship.tag != f"{{{PKG_REL_NS}}}Relationship":
+ findings.append(
+ _finding(
+ "RELATIONSHIPS_INVALID",
+ "unexpected element in relationship part",
+ location=rels_name,
+ )
+ )
+ continue
+ relationship_count += 1
+ relationship_id = relationship.attrib.get("Id", "")
+ relationship_type = relationship.attrib.get("Type", "")
+ target = relationship.attrib.get("Target", "")
+ target_mode = relationship.attrib.get("TargetMode", "")
+ if not relationship_id or relationship_id in seen_ids:
+ findings.append(
+ _finding(
+ "RELATIONSHIPS_INVALID",
+ f"missing or duplicate relationship Id {relationship_id!r}",
+ location=rels_name,
+ )
+ )
+ seen_ids.add(relationship_id)
+ if not relationship_type:
+ findings.append(
+ _finding(
+ "RELATIONSHIPS_INVALID",
+ "relationship Type is required",
+ location=rels_name,
+ )
+ )
+ if target_mode == "External":
+ code = (
+ "REMOTE_LINKED_IMAGE"
+ if relationship_type.lower().endswith("/image")
+ else "EXTERNAL_RELATIONSHIP"
+ )
+ findings.append(
+ _finding(
+ code,
+ f"external target is forbidden: {target!r}",
+ location=rels_name,
+ )
+ )
+ continue
+ if target_mode not in {"", "Internal"}:
+ findings.append(
+ _finding(
+ "RELATIONSHIP_TARGET_MODE_INVALID",
+ f"unsupported TargetMode {target_mode!r}",
+ location=rels_name,
+ )
+ )
+ continue
+ type_lower = relationship_type.lower()
+ if any(marker in type_lower for marker in FORBIDDEN_RELATIONSHIP_MARKERS):
+ findings.append(
+ _finding(
+ "FORBIDDEN_RELATIONSHIP_TYPE",
+ f"forbidden relationship type {relationship_type!r}",
+ location=rels_name,
+ )
+ )
+ try:
+ resolved = _resolve_internal_target(rels_name, target)
+ except CliError as exc:
+ findings.append(
+ _finding(
+ "RELATIONSHIP_TARGET_INVALID",
+ str(exc),
+ location=rels_name,
+ )
+ )
+ continue
+ if resolved not in names:
+ findings.append(
+ _finding(
+ "RELATIONSHIP_TARGET_MISSING",
+ f"internal target does not exist: {resolved!r}",
+ location=rels_name,
+ )
+ )
+ return findings, relationship_count
+
+
+def _inspect_all_xml_parts(
+ archive: zipfile.ZipFile,
+ names: set[str],
+) -> list[dict[str, Any]]:
+ """Reject malformed or entity-bearing XML anywhere in the strict package."""
+ findings: list[dict[str, Any]] = []
+ for part_name in sorted(name for name in names if name.endswith(".xml")):
+ try:
+ _parse_xml(archive.read(part_name), location=part_name)
+ except (KeyError, OSError, RuntimeError, zipfile.BadZipFile, CliError) as exc:
+ findings.append(
+ _finding("XML_PART_INVALID", str(exc), location=part_name)
+ )
+ return findings
+
+
+def _inspect_one_slide_profile(
+ archive: zipfile.ZipFile,
+ names: set[str],
+) -> list[dict[str, Any]]:
+ """Require exactly one slide and one matching presentation relationship."""
+ findings: list[dict[str, Any]] = []
+ slide_names = sorted(
+ name
+ for name in names
+ if name.startswith("ppt/slides/slide")
+ and name.endswith(".xml")
+ and "/_rels/" not in name
+ )
+ if len(slide_names) != 1:
+ return [
+ _finding(
+ "SLIDE_COUNT",
+ f"strict poster profile requires exactly one slide; found {len(slide_names)}",
+ location="ppt/presentation.xml",
+ )
+ ]
+ try:
+ presentation = _parse_xml(
+ archive.read("ppt/presentation.xml"),
+ location="ppt/presentation.xml",
+ )
+ presentation_rels = _parse_xml(
+ archive.read("ppt/_rels/presentation.xml.rels"),
+ location="ppt/_rels/presentation.xml.rels",
+ )
+ except (KeyError, OSError, RuntimeError, zipfile.BadZipFile, CliError) as exc:
+ return [
+ _finding(
+ "PRESENTATION_PROFILE_INVALID",
+ str(exc),
+ location="ppt/presentation.xml",
+ )
+ ]
+ slide_ids = presentation.findall(
+ f"./{{{P_NS}}}sldIdLst/{{{P_NS}}}sldId"
+ )
+ if len(slide_ids) != 1:
+ findings.append(
+ _finding(
+ "SLIDE_ID_COUNT",
+ f"presentation must declare exactly one slide Id; found {len(slide_ids)}",
+ location="ppt/presentation.xml",
+ )
+ )
+ return findings
+ relationship_id = slide_ids[0].attrib.get(f"{{{R_NS}}}id", "")
+ targets: dict[str, str] = {}
+ for relationship in presentation_rels:
+ if relationship.attrib.get("TargetMode", "") == "External":
+ continue
+ try:
+ target = _resolve_internal_target(
+ "ppt/_rels/presentation.xml.rels",
+ relationship.attrib.get("Target", ""),
+ )
+ except CliError:
+ continue
+ targets[relationship.attrib.get("Id", "")] = target
+ if targets.get(relationship_id) != slide_names[0]:
+ findings.append(
+ _finding(
+ "SLIDE_RELATIONSHIP",
+ "the declared slide Id does not resolve to the sole slide part",
+ location="ppt/presentation.xml",
+ )
+ )
+ return findings
+
+
+def _inspect_image_payloads(
+ archive: zipfile.ZipFile,
+ names: set[str],
+) -> list[dict[str, Any]]:
+ """Check strict-profile image signatures and stream through CRC validation."""
+ findings: list[dict[str, Any]] = []
+ image_names = sorted(
+ name
+ for name in names
+ if name.startswith("ppt/media/") or name == "docProps/thumbnail.jpeg"
+ )
+ for part_name in image_names:
+ try:
+ with archive.open(part_name, "r") as handle:
+ prefix = handle.read(16)
+ while handle.read(1024 * 1024):
+ pass
+ except (OSError, RuntimeError, zipfile.BadZipFile) as exc:
+ findings.append(
+ _finding("IMAGE_PART_INVALID", str(exc), location=part_name)
+ )
+ continue
+ suffix = PurePosixPath(part_name).suffix.lower()
+ signature_ok = (
+ prefix.startswith(b"\x89PNG\r\n\x1a\n")
+ if suffix == ".png"
+ else prefix.startswith(b"\xff\xd8\xff")
+ )
+ if not signature_ok:
+ findings.append(
+ _finding(
+ "IMAGE_SIGNATURE",
+ "image bytes do not match the declared PNG/JPEG suffix",
+ location=part_name,
+ )
+ )
+ return findings
+
+
+def _inspect_slide_accessibility(
+ archive: zipfile.ZipFile,
+ names: set[str],
+) -> dict[str, Any]:
+ picture_count = 0
+ pictures_with_alt_text = 0
+ missing_alt: list[dict[str, str]] = []
+ slide_title_count = 0
+ text_run_count = 0
+ text_runs_with_language = 0
+ missing_language: list[dict[str, str]] = []
+ slide_names = sorted(
+ name
+ for name in names
+ if name.startswith("ppt/slides/slide")
+ and name.endswith(".xml")
+ and "/_rels/" not in name
+ )
+ for slide_name in slide_names:
+ try:
+ root = _parse_xml(archive.read(slide_name), location=slide_name)
+ except (KeyError, OSError, RuntimeError, zipfile.BadZipFile, CliError):
+ continue
+ for shape in root.findall(f".//{{{P_NS}}}sp"):
+ placeholder = shape.find(
+ f"./{{{P_NS}}}nvSpPr/{{{P_NS}}}nvPr/{{{P_NS}}}ph"
+ )
+ if (
+ placeholder is not None
+ and placeholder.attrib.get("type") in {"title", "ctrTitle"}
+ and "".join(
+ node.text or ""
+ for node in shape.findall(f".//{{{A_NS}}}t")
+ ).strip()
+ ):
+ slide_title_count += 1
+ for run_index, run in enumerate(root.findall(f".//{{{A_NS}}}r"), 1):
+ text = run.find(f"./{{{A_NS}}}t")
+ if text is None or not (text.text or ""):
+ continue
+ text_run_count += 1
+ properties = run.find(f"./{{{A_NS}}}rPr")
+ language = "" if properties is None else properties.attrib.get("lang", "")
+ if language:
+ text_runs_with_language += 1
+ else:
+ missing_language.append(
+ {"slide": slide_name, "run": str(run_index)}
+ )
+ for picture in root.findall(f".//{{{P_NS}}}pic"):
+ picture_count += 1
+ properties = picture.find(f"./{{{P_NS}}}nvPicPr/{{{P_NS}}}cNvPr")
+ name = ""
+ description = ""
+ if properties is not None:
+ name = properties.attrib.get("name", "")
+ description = properties.attrib.get("descr", "").strip()
+ if description:
+ pictures_with_alt_text += 1
+ else:
+ missing_alt.append({"slide": slide_name, "name": name})
+ return {
+ "picture_count": picture_count,
+ "pictures_with_alt_text": pictures_with_alt_text,
+ "pictures_missing_alt_text": missing_alt,
+ "slide_title_count": slide_title_count,
+ "text_run_count": text_run_count,
+ "text_runs_with_language": text_runs_with_language,
+ "text_runs_missing_language": missing_language,
+ "manual_check_required": (
+ "PowerPoint Accessibility Checker, Reading Order pane, and a screen-reader "
+ "test remain required; package inspection cannot establish accessibility."
+ ),
+ }
+
+
+def _inspect_forbidden_markup(
+ archive: zipfile.ZipFile,
+ names: set[str],
+) -> list[dict[str, Any]]:
+ findings: list[dict[str, Any]] = []
+ for part_name in sorted(
+ name
+ for name in names
+ if name.startswith("ppt/")
+ and name.endswith(".xml")
+ and "/_rels/" not in name
+ ):
+ try:
+ root = _parse_xml(archive.read(part_name), location=part_name)
+ except (KeyError, OSError, RuntimeError, zipfile.BadZipFile, CliError) as exc:
+ findings.append(
+ _finding("PRESENTATION_XML_INVALID", str(exc), location=part_name)
+ )
+ continue
+ for node in root.iter():
+ local = _local_name(node.tag).lower()
+ namespace = node.tag.split("}", 1)[0].lower()
+ if local in {
+ "audio",
+ "cmd",
+ "control",
+ "hlinkclick",
+ "hlinkhover",
+ "oleobj",
+ "snd",
+ "timing",
+ "transition",
+ "video",
+ } or any(
+ marker in namespace
+ for marker in ("activex", "model3d", "webextension")
+ ):
+ findings.append(
+ _finding(
+ "FORBIDDEN_PRESENTATION_MARKUP",
+ f"active or embedded markup element {local!r} is forbidden",
+ location=part_name,
+ )
+ )
+ break
+ return findings
+
+
+def inspect_pptx(value: str | Path) -> dict[str, Any]:
+ """Inspect a PPTX as ZIP/XML without opening it in PowerPoint or python-pptx."""
+ path = checked_input_file(value, max_bytes=MAX_INPUT_BYTES)
+ findings: list[dict[str, Any]] = []
+ if path.suffix.lower() != ".pptx":
+ findings.append(
+ _finding(
+ "FILE_EXTENSION",
+ "only the macro-free .pptx extension is accepted; .pptm is rejected",
+ location=str(path),
+ )
+ )
+ return {
+ "schema_version": REPORT_SCHEMA_VERSION,
+ "path": str(path),
+ "safe": False,
+ "findings": findings,
+ }
+ findings.extend(_preflight_zip_directory(path))
+ if findings:
+ return {
+ "schema_version": REPORT_SCHEMA_VERSION,
+ "path": str(path),
+ "safe": False,
+ "findings": findings,
+ }
+
+ member_count = 0
+ total_uncompressed = 0
+ relationship_count = 0
+ accessibility: dict[str, Any] = {
+ "picture_count": 0,
+ "pictures_with_alt_text": 0,
+ "pictures_missing_alt_text": [],
+ "slide_title_count": 0,
+ "text_run_count": 0,
+ "text_runs_with_language": 0,
+ "text_runs_missing_language": [],
+ "manual_check_required": True,
+ }
+ try:
+ with zipfile.ZipFile(path, "r") as archive:
+ members, member_findings, names, total_uncompressed = _preflight_members(
+ archive
+ )
+ member_count = len(members)
+ findings.extend(member_findings)
+ if not member_findings:
+ findings.extend(_inspect_content_types(archive, names))
+ findings.extend(_inspect_all_xml_parts(archive, names))
+ rel_findings, relationship_count = _inspect_relationships(
+ archive, names
+ )
+ findings.extend(rel_findings)
+ findings.extend(_inspect_one_slide_profile(archive, names))
+ findings.extend(_inspect_forbidden_markup(archive, names))
+ findings.extend(_inspect_image_payloads(archive, names))
+ accessibility = _inspect_slide_accessibility(archive, names)
+ except (OSError, RuntimeError, zipfile.BadZipFile, zipfile.LargeZipFile) as exc:
+ findings.append(_finding("ZIP_READ_ERROR", str(exc)))
+
+ return {
+ "schema_version": REPORT_SCHEMA_VERSION,
+ "path": str(path),
+ "safe": not findings,
+ "limits": {
+ "max_archive_bytes": MAX_INPUT_BYTES,
+ "max_members": MAX_MEMBERS,
+ "max_central_directory_bytes": MAX_CENTRAL_DIRECTORY_BYTES,
+ "max_member_uncompressed_bytes": MAX_MEMBER_UNCOMPRESSED,
+ "max_total_uncompressed_bytes": MAX_TOTAL_UNCOMPRESSED,
+ "max_compression_ratio": MAX_COMPRESSION_RATIO,
+ },
+ "package": {
+ "member_count": member_count,
+ "total_uncompressed_bytes": total_uncompressed,
+ "relationship_count": relationship_count,
+ },
+ "accessibility": accessibility,
+ "findings": findings,
+ "inspection_method": (
+ "Bounded ZIP central-directory and selected XML-part inspection only; "
+ "members were not extracted and the presentation was not opened or executed."
+ ),
+ }
+
+
+def require_safe_pptx(value: str | Path) -> dict[str, Any]:
+ report = inspect_pptx(value)
+ if not report["safe"]:
+ codes = ", ".join(item["code"] for item in report["findings"])
+ raise CliError(f"unsafe PPTX package ({codes})")
+ return report
+
+
+def _local_name(tag: str) -> str:
+ return tag.rsplit("}", 1)[-1]
+
+
+def _shape_transform(shape: ET.Element) -> tuple[int, int, int, int] | None:
+ kind = _local_name(shape.tag)
+ if kind == "graphicFrame":
+ transform = shape.find(f"./{{{P_NS}}}xfrm")
+ else:
+ transform = shape.find(f"./{{{P_NS}}}spPr/{{{A_NS}}}xfrm")
+ if transform is None:
+ return None
+ offset = transform.find(f"./{{{A_NS}}}off")
+ extent = transform.find(f"./{{{A_NS}}}ext")
+ if offset is None or extent is None:
+ return None
+ try:
+ return (
+ int(offset.attrib["x"]),
+ int(offset.attrib["y"]),
+ int(extent.attrib["cx"]),
+ int(extent.attrib["cy"]),
+ )
+ except (KeyError, ValueError):
+ return None
+
+
+def _shape_name(shape: ET.Element) -> str:
+ properties = shape.find(f".//{{{P_NS}}}cNvPr")
+ return "" if properties is None else properties.attrib.get("name", "")
+
+
+def _shape_text(shape: ET.Element) -> str:
+ return "".join(
+ node.text or "" for node in shape.findall(f".//{{{A_NS}}}t")
+ ).strip()
+
+
+def _font_sizes_pt(shape: ET.Element) -> list[float]:
+ sizes: list[float] = []
+ for tag in ("rPr", "defRPr", "endParaRPr"):
+ for node in shape.findall(f".//{{{A_NS}}}{tag}"):
+ raw = node.attrib.get("sz")
+ if raw is None:
+ continue
+ try:
+ sizes.append(int(raw) / 100.0)
+ except ValueError:
+ continue
+ return sizes
+
+
+def _intersection(
+ first: tuple[int, int, int, int],
+ second: tuple[int, int, int, int],
+) -> tuple[int, int]:
+ first_x, first_y, first_w, first_h = first
+ second_x, second_y, second_w, second_h = second
+ overlap_w = min(first_x + first_w, second_x + second_w) - max(
+ first_x, second_x
+ )
+ overlap_h = min(first_y + first_h, second_y + second_h) - max(
+ first_y, second_y
+ )
+ return max(0, overlap_w), max(0, overlap_h)
+
+
+def analyze_layout(
+ value: str | Path,
+ *,
+ print_scale: float = 1.0,
+ minimum_font_pt_final: float = 18.0,
+) -> dict[str, Any]:
+ """Check direct slide shapes for bounds, overlap, and explicit font sizes."""
+ if print_scale <= 0:
+ raise CliError("print_scale must be greater than zero")
+ if minimum_font_pt_final <= 0:
+ raise CliError("minimum_font_pt_final must be greater than zero")
+ package_report = require_safe_pptx(value)
+ path = Path(package_report["path"])
+ issues: list[dict[str, Any]] = []
+ slides: list[dict[str, Any]] = []
+
+ with zipfile.ZipFile(path, "r") as archive:
+ presentation = _parse_xml(
+ archive.read("ppt/presentation.xml"),
+ location="ppt/presentation.xml",
+ )
+ slide_size = presentation.find(f"./{{{P_NS}}}sldSz")
+ if slide_size is None:
+ raise CliError("ppt/presentation.xml does not declare slide dimensions")
+ try:
+ slide_width = int(slide_size.attrib["cx"])
+ slide_height = int(slide_size.attrib["cy"])
+ except (KeyError, ValueError) as exc:
+ raise CliError("invalid slide dimensions in ppt/presentation.xml") from exc
+
+ slide_names = sorted(
+ (
+ name
+ for name in archive.namelist()
+ if name.startswith("ppt/slides/slide")
+ and name.endswith(".xml")
+ and "/_rels/" not in name
+ ),
+ key=lambda name: (
+ len(PurePosixPath(name).stem),
+ PurePosixPath(name).stem,
+ ),
+ )
+ for slide_index, slide_name in enumerate(slide_names, 1):
+ root = _parse_xml(archive.read(slide_name), location=slide_name)
+ tree = root.find(f"./{{{P_NS}}}cSld/{{{P_NS}}}spTree")
+ if tree is None:
+ issues.append(
+ {
+ "code": "MISSING_SHAPE_TREE",
+ "slide": slide_index,
+ "message": "slide has no shape tree",
+ }
+ )
+ continue
+ shapes: list[dict[str, Any]] = []
+ for child in list(tree):
+ kind = _local_name(child.tag)
+ if kind not in {"sp", "pic", "graphicFrame", "cxnSp", "grpSp"}:
+ continue
+ name = _shape_name(child)
+ if kind == "grpSp":
+ issues.append(
+ {
+ "code": "GROUP_REQUIRES_MANUAL_REVIEW",
+ "slide": slide_index,
+ "shape": name,
+ "message": (
+ "group transforms are not flattened by this checker"
+ ),
+ }
+ )
+ continue
+ box = _shape_transform(child)
+ if box is None:
+ issues.append(
+ {
+ "code": "MISSING_TRANSFORM",
+ "slide": slide_index,
+ "shape": name,
+ "message": "shape position or size could not be read",
+ }
+ )
+ continue
+ x, y, width, height = box
+ text = _shape_text(child)
+ sizes = _font_sizes_pt(child)
+ shape_record = {
+ "reading_order": len(shapes) + 1,
+ "name": name,
+ "kind": kind,
+ "x_in": x / EMU_PER_INCH,
+ "y_in": y / EMU_PER_INCH,
+ "width_in": width / EMU_PER_INCH,
+ "height_in": height / EMU_PER_INCH,
+ "has_text": bool(text),
+ "_box": box,
+ }
+ shapes.append(shape_record)
+ if x < 0 or y < 0 or x + width > slide_width or y + height > slide_height:
+ issues.append(
+ {
+ "code": "OUT_OF_BOUNDS",
+ "slide": slide_index,
+ "shape": name,
+ "message": "shape extends outside the slide canvas",
+ }
+ )
+ if text:
+ if not sizes:
+ issues.append(
+ {
+ "code": "FONT_SIZE_UNSPECIFIED",
+ "slide": slide_index,
+ "shape": name,
+ "message": (
+ "text has no explicit run/default font size; "
+ "theme inheritance requires manual review"
+ ),
+ }
+ )
+ else:
+ minimum_design = min(sizes)
+ minimum_final = minimum_design * print_scale
+ shape_record["minimum_font_pt_design"] = minimum_design
+ shape_record["minimum_font_pt_final"] = minimum_final
+ if minimum_final + 1e-6 < minimum_font_pt_final:
+ issues.append(
+ {
+ "code": "FONT_TOO_SMALL",
+ "slide": slide_index,
+ "shape": name,
+ "message": (
+ f"minimum final font {minimum_final:.2f} pt "
+ f"is below {minimum_font_pt_final:.2f} pt"
+ ),
+ }
+ )
+
+ for first_index, first in enumerate(shapes):
+ first_box = first["_box"]
+ if first_box[2] <= 0 or first_box[3] <= 0:
+ continue
+ for second in shapes[first_index + 1 :]:
+ second_box = second["_box"]
+ if second_box[2] <= 0 or second_box[3] <= 0:
+ continue
+ overlap_width, overlap_height = _intersection(
+ first_box, second_box
+ )
+ if overlap_width > 0 and overlap_height > 0:
+ overlap_area = overlap_width * overlap_height
+ smaller_area = min(
+ first_box[2] * first_box[3],
+ second_box[2] * second_box[3],
+ )
+ issues.append(
+ {
+ "code": "SHAPE_OVERLAP",
+ "slide": slide_index,
+ "shapes": [first["name"], second["name"]],
+ "overlap_fraction_of_smaller": (
+ overlap_area / smaller_area
+ ),
+ "message": (
+ "direct shape bounding boxes overlap; determine "
+ "whether this is intentional"
+ ),
+ }
+ )
+ for shape in shapes:
+ shape.pop("_box", None)
+ slides.append(
+ {
+ "slide": slide_index,
+ "part": slide_name,
+ "shape_count": len(shapes),
+ "reading_order": [
+ {"order": shape["reading_order"], "name": shape["name"]}
+ for shape in shapes
+ ],
+ "shapes": shapes,
+ }
+ )
+
+ return {
+ "schema_version": REPORT_SCHEMA_VERSION,
+ "path": str(path),
+ "pass": not issues,
+ "slide_size": {
+ "width_in": slide_width / EMU_PER_INCH,
+ "height_in": slide_height / EMU_PER_INCH,
+ },
+ "print_scale": print_scale,
+ "minimum_font_pt_final": minimum_font_pt_final,
+ "minimum_font_basis": (
+ "Caller-supplied requirement or project heuristic; this value is not "
+ "a universal poster standard."
+ ),
+ "slides": slides,
+ "issues": issues,
+ "manual_checks": [
+ "Review text overflow in PowerPoint; XML bounds do not reveal rendered overflow.",
+ "Confirm Reading Order pane order and test with a screen reader.",
+ "Inspect intentional overlays, rotated objects, groups, charts, and SmartArt manually.",
+ ],
+ }
+
+
+def strip_generated_printer_settings(source: Path, destination: Path) -> None:
+ """Remove python-pptx's inert default printer-settings binary from new output."""
+ with zipfile.ZipFile(source, "r") as input_archive:
+ _, preflight_findings, _, _ = _preflight_members(input_archive)
+ unexpected = [
+ finding
+ for finding in preflight_findings
+ if not (
+ finding["code"] == "FORBIDDEN_BINARY_PART"
+ and str(finding.get("location", "")).startswith(
+ "ppt/printerSettings/"
+ )
+ )
+ ]
+ if unexpected:
+ codes = ", ".join(finding["code"] for finding in unexpected)
+ raise CliError(
+ f"generated package has unexpected ZIP findings before cleanup: {codes}"
+ )
+ with zipfile.ZipFile(
+ destination,
+ "w",
+ compression=zipfile.ZIP_DEFLATED,
+ compresslevel=6,
+ allowZip64=True,
+ ) as output_archive:
+ for info in input_archive.infolist():
+ if info.filename.startswith("ppt/printerSettings/"):
+ continue
+ info.date_time = DETERMINISTIC_ZIP_DATETIME
+ if info.filename == "[Content_Types].xml":
+ root = _parse_xml(
+ input_archive.read(info.filename),
+ location=info.filename,
+ )
+ for node in list(root):
+ if (
+ node.tag == f"{{{CT_NS}}}Default"
+ and node.attrib.get("Extension", "").lower() == "bin"
+ and node.attrib.get("ContentType", "").endswith(
+ ".printerSettings"
+ )
+ ):
+ root.remove(node)
+ output_archive.writestr(
+ info,
+ ET.tostring(
+ root,
+ encoding="utf-8",
+ xml_declaration=True,
+ ),
+ )
+ continue
+ if info.filename.endswith(".rels"):
+ root = _parse_xml(
+ input_archive.read(info.filename),
+ location=info.filename,
+ )
+ changed = False
+ for relationship in list(root):
+ if relationship.attrib.get("Type", "").endswith(
+ "/printerSettings"
+ ):
+ root.remove(relationship)
+ changed = True
+ if changed:
+ output_archive.writestr(
+ info,
+ ET.tostring(
+ root,
+ encoding="utf-8",
+ xml_declaration=True,
+ ),
+ )
+ continue
+ with input_archive.open(info, "r") as source_handle:
+ with output_archive.open(info, "w") as destination_handle:
+ shutil.copyfileobj(
+ source_handle,
+ destination_handle,
+ length=1024 * 1024,
+ )
+
+
+def patch_accessibility_metadata(
+ source: Path,
+ destination: Path,
+ *,
+ alt_text_by_shape_name: dict[str, str],
+ language: str,
+) -> None:
+ """Add picture descriptions and explicit run language to a generated PPTX."""
+ require_safe_pptx(source)
+ found: dict[str, int] = {name: 0 for name in alt_text_by_shape_name}
+ with zipfile.ZipFile(source, "r") as input_archive:
+ with zipfile.ZipFile(
+ destination,
+ "w",
+ compression=zipfile.ZIP_DEFLATED,
+ compresslevel=6,
+ allowZip64=True,
+ ) as output_archive:
+ for info in input_archive.infolist():
+ info.date_time = DETERMINISTIC_ZIP_DATETIME
+ if (
+ info.filename.startswith("ppt/slides/slide")
+ and info.filename.endswith(".xml")
+ and "/_rels/" not in info.filename
+ ):
+ root = _parse_xml(
+ input_archive.read(info.filename),
+ location=info.filename,
+ )
+ changed = False
+ for picture in root.findall(f".//{{{P_NS}}}pic"):
+ properties = picture.find(
+ f"./{{{P_NS}}}nvPicPr/{{{P_NS}}}cNvPr"
+ )
+ if properties is None:
+ continue
+ name = properties.attrib.get("name", "")
+ if name not in alt_text_by_shape_name:
+ continue
+ properties.set("descr", alt_text_by_shape_name[name])
+ properties.set("title", name)
+ found[name] += 1
+ changed = True
+ for run in root.findall(f".//{{{A_NS}}}r"):
+ properties = run.find(f"./{{{A_NS}}}rPr")
+ if properties is None:
+ properties = ET.Element(f"{{{A_NS}}}rPr")
+ run.insert(0, properties)
+ if properties.attrib.get("lang") != language:
+ properties.set("lang", language)
+ changed = True
+ for tag in ("defRPr", "endParaRPr"):
+ for properties in root.findall(f".//{{{A_NS}}}{tag}"):
+ if properties.attrib.get("lang") != language:
+ properties.set("lang", language)
+ changed = True
+ payload = (
+ ET.tostring(
+ root,
+ encoding="utf-8",
+ xml_declaration=True,
+ )
+ if changed
+ else input_archive.read(info.filename)
+ )
+ output_archive.writestr(info, payload)
+ continue
+ with input_archive.open(info, "r") as source_handle:
+ with output_archive.open(info, "w") as destination_handle:
+ shutil.copyfileobj(
+ source_handle,
+ destination_handle,
+ length=1024 * 1024,
+ )
+ missing = [name for name, count in found.items() if count != 1]
+ if missing:
+ raise CliError(
+ "could not apply alt text exactly once for shape(s): "
+ + ", ".join(sorted(missing))
+ )
+
diff --git a/skills/pptx-posters/scripts/check_layout.py b/skills/pptx-posters/scripts/check_layout.py
new file mode 100644
index 00000000..12107480
--- /dev/null
+++ b/skills/pptx-posters/scripts/check_layout.py
@@ -0,0 +1,179 @@
+#!/usr/bin/env python3
+"""Check PPTX shape bounds, overlap, reading order, and final font size."""
+
+from __future__ import annotations
+
+import argparse
+import math
+import sys
+from typing import Any
+
+from _common import CliError, emit_json
+from _manifest import load_and_validate_manifest
+from _pptx import analyze_layout
+
+
+def _positive_float(value: str) -> float:
+ try:
+ number = float(value)
+ except ValueError as exc:
+ raise argparse.ArgumentTypeError("expected a number") from exc
+ if not math.isfinite(number) or number <= 0:
+ raise argparse.ArgumentTypeError("value must be finite and greater than zero")
+ return number
+
+
+def build_parser() -> argparse.ArgumentParser:
+ parser = argparse.ArgumentParser(
+ description=(
+ "Inspect direct PPTX shape bounding boxes for overlap and out-of-bounds "
+ "placement, list package reading order, and screen explicit font sizes "
+ "at final print scale. No rendering or network access occurs."
+ )
+ )
+ parser.add_argument("pptx", help="local macro-free .pptx file")
+ source = parser.add_mutually_exclusive_group()
+ source.add_argument(
+ "--manifest",
+ help="approved poster manifest supplying print scale and font requirement",
+ )
+ source.add_argument(
+ "--print-scale",
+ type=_positive_float,
+ default=None,
+ help="physical-artboard/canvas scale when no manifest is supplied",
+ )
+ parser.add_argument(
+ "--minimum-font-pt-final",
+ type=_positive_float,
+ help=(
+ "final-output font threshold; default is manifest value or an explicit "
+ "18 pt project heuristic"
+ ),
+ )
+ parser.add_argument("--output", help="optional new JSON report path")
+ return parser
+
+
+def _manifest_settings(path: str) -> tuple[float, float, dict[str, Any]]:
+ _, document, validation = load_and_validate_manifest(
+ path,
+ verify_assets=False,
+ require_approval=True,
+ )
+ scale = float(validation["physical_output"]["print_scale"])
+ minimum = float(document["quality"]["minimum_font_pt_final"])
+ basis = {
+ "kind": document["quality"]["font_guidance_basis"],
+ "source_id": document["quality"]["font_guidance_source_id"],
+ }
+ return scale, minimum, {
+ "document": document,
+ "validation": validation,
+ "font_basis": basis,
+ }
+
+
+def apply_manifest_checks(
+ report: dict[str, Any],
+ document: dict[str, Any],
+ validation: dict[str, Any],
+) -> None:
+ """Append approved-canvas and direct reading-order mismatches to a report."""
+ expected = validation["canvas"]
+ actual = report["slide_size"]
+ if (
+ abs(float(expected["width_in"]) - float(actual["width_in"])) > 0.001
+ or abs(float(expected["height_in"]) - float(actual["height_in"])) > 0.001
+ ):
+ report["issues"].append(
+ {
+ "code": "CANVAS_MISMATCH",
+ "message": "PPTX slide dimensions do not match the approved manifest",
+ "expected": expected,
+ "actual": actual,
+ }
+ )
+ expected_order = [
+ {
+ "order": int(element["reading_order"]),
+ "name": (
+ f"R{int(element['reading_order']):03d}_"
+ f"{'TEXT' if element['type'] == 'text' else 'IMAGE'}_"
+ f"{element['id']}"
+ ),
+ }
+ for element in document["elements"]
+ ]
+ actual_order = (
+ report["slides"][0]["reading_order"] if report["slides"] else []
+ )
+ if actual_order != expected_order:
+ report["issues"].append(
+ {
+ "code": "READING_ORDER_MISMATCH",
+ "message": (
+ "direct PPTX shape order/names do not match the approved manifest"
+ ),
+ "expected": expected_order,
+ "actual": actual_order,
+ }
+ )
+
+
+def main(argv: list[str] | None = None) -> int:
+ parser = build_parser()
+ try:
+ args = parser.parse_args(argv)
+ manifest_context: dict[str, Any] | None = None
+ if args.manifest:
+ print_scale, manifest_minimum, manifest_context = _manifest_settings(
+ args.manifest
+ )
+ minimum_font = (
+ args.minimum_font_pt_final
+ if args.minimum_font_pt_final is not None
+ else manifest_minimum
+ )
+ else:
+ print_scale = args.print_scale if args.print_scale is not None else 1.0
+ minimum_font = (
+ args.minimum_font_pt_final
+ if args.minimum_font_pt_final is not None
+ else 18.0
+ )
+ report = analyze_layout(
+ args.pptx,
+ print_scale=print_scale,
+ minimum_font_pt_final=minimum_font,
+ )
+ if manifest_context is not None:
+ validation = manifest_context["validation"]
+ apply_manifest_checks(
+ report,
+ manifest_context["document"],
+ validation,
+ )
+ report["manifest"] = {
+ "path": validation["manifest_path"],
+ "content_sha256": validation["content_sha256"],
+ }
+ report["minimum_font_basis"] = manifest_context["font_basis"]
+ else:
+ report["minimum_font_basis"] = {
+ "kind": (
+ "caller_supplied"
+ if args.minimum_font_pt_final is not None
+ else "project_heuristic"
+ ),
+ "source_id": None,
+ }
+ report["pass"] = not report["issues"]
+ emit_json(report, output=args.output)
+ return 0 if report["pass"] else 1
+ except CliError as exc:
+ parser.exit(2, f"error: {exc}\n")
+
+
+if __name__ == "__main__":
+ sys.exit(main())
diff --git a/skills/pptx-posters/scripts/check_palette.py b/skills/pptx-posters/scripts/check_palette.py
new file mode 100644
index 00000000..a9ffc2f7
--- /dev/null
+++ b/skills/pptx-posters/scripts/check_palette.py
@@ -0,0 +1,142 @@
+#!/usr/bin/env python3
+"""Report declared WCAG contrast and heuristic palette separation."""
+
+from __future__ import annotations
+
+import argparse
+import itertools
+import sys
+from typing import Any
+
+from _common import CliError, contrast_ratio, emit_json, parse_hex_color, relative_luminance
+from _manifest import load_and_validate_manifest
+
+THRESHOLDS = {"normal_text": 4.5, "large_text": 3.0, "non_text": 3.0}
+
+
+def _lstar(color: str) -> float:
+ luminance = relative_luminance(color)
+ delta = 6.0 / 29.0
+ transformed = (
+ luminance ** (1.0 / 3.0)
+ if luminance > delta**3
+ else luminance / (3.0 * delta**2) + 4.0 / 29.0
+ )
+ return 116.0 * transformed - 16.0
+
+
+def audit_palette(document: dict[str, Any]) -> dict[str, Any]:
+ palette = document["palette"]
+ colors = {
+ color_id: parse_hex_color(value, context=f"palette.colors.{color_id}")
+ for color_id, value in palette["colors"].items()
+ }
+ declared: list[dict[str, Any]] = []
+ issues: list[dict[str, Any]] = []
+ for pair in palette["contrast_pairs"]:
+ foreground = colors[pair["foreground_color_id"]]
+ background = colors[pair["background_color_id"]]
+ ratio = contrast_ratio(foreground, background)
+ threshold = THRESHOLDS[pair["usage"]]
+ passed = ratio + 1e-9 >= threshold
+ declared.append(
+ {
+ "id": pair["id"],
+ "foreground_color_id": pair["foreground_color_id"],
+ "foreground": foreground,
+ "background_color_id": pair["background_color_id"],
+ "background": background,
+ "usage": pair["usage"],
+ "ratio": round(ratio, 3),
+ "threshold": threshold,
+ "pass": passed,
+ }
+ )
+ if not passed:
+ issues.append(
+ {
+ "code": "DECLARED_CONTRAST_FAILURE",
+ "pair_id": pair["id"],
+ "message": (
+ f"{ratio:.2f}:1 is below {threshold:.1f}:1 for "
+ f"{pair['usage']}"
+ ),
+ }
+ )
+
+ pairwise: list[dict[str, Any]] = []
+ for first_id, second_id in itertools.combinations(colors, 2):
+ first = colors[first_id]
+ second = colors[second_id]
+ pairwise.append(
+ {
+ "first_color_id": first_id,
+ "second_color_id": second_id,
+ "contrast_ratio": round(contrast_ratio(first, second), 3),
+ "grayscale_delta_lstar": round(abs(_lstar(first) - _lstar(second)), 3),
+ }
+ )
+ return {
+ "schema_version": "1.0",
+ "pass": not issues,
+ "declared_contrast_pairs": declared,
+ "pairwise_screen": pairwise,
+ "redundant_encoding_confirmed": palette[
+ "data_series_redundant_encoding"
+ ],
+ "issues": issues,
+ "standards_basis": {
+ "normal_text": "WCAG 2.2 SC 1.4.3, 4.5:1",
+ "large_text": (
+ "WCAG 2.2 SC 1.4.3, 3:1; large text is at least 18 pt, "
+ "or 14 pt and bold"
+ ),
+ "non_text": (
+ "WCAG 2.2 SC 1.4.11, 3:1 for graphical parts required "
+ "to understand content"
+ ),
+ },
+ "pairwise_notice": (
+ "Pairwise contrast and CIE L* separation are screening data, not a "
+ "color-vision accessibility certification. Keep direct labels and "
+ "redundant shape, marker, pattern, or line-style encoding."
+ ),
+ }
+
+
+def build_parser() -> argparse.ArgumentParser:
+ parser = argparse.ArgumentParser(
+ description=(
+ "Audit an approved poster manifest's declared sRGB foreground/background "
+ "pairs against WCAG 2.2 and report heuristic pairwise separation. "
+ "No network is used."
+ )
+ )
+ parser.add_argument("manifest", help="approved local poster manifest JSON")
+ parser.add_argument("--output", help="optional new JSON report path")
+ return parser
+
+
+def main(argv: list[str] | None = None) -> int:
+ parser = build_parser()
+ try:
+ args = parser.parse_args(argv)
+ _, document, validation = load_and_validate_manifest(
+ args.manifest,
+ verify_assets=False,
+ require_approval=True,
+ enforce_contrast=False,
+ )
+ report = audit_palette(document)
+ report["manifest"] = {
+ "path": validation["manifest_path"],
+ "content_sha256": validation["content_sha256"],
+ }
+ emit_json(report, output=args.output)
+ return 0 if report["pass"] else 1
+ except CliError as exc:
+ parser.exit(2, f"error: {exc}\n")
+
+
+if __name__ == "__main__":
+ sys.exit(main())
diff --git a/skills/pptx-posters/scripts/generate_poster.py b/skills/pptx-posters/scripts/generate_poster.py
new file mode 100644
index 00000000..e5530080
--- /dev/null
+++ b/skills/pptx-posters/scripts/generate_poster.py
@@ -0,0 +1,427 @@
+#!/usr/bin/env python3
+"""Generate one macro-free PPTX poster from approved, strictly local JSON."""
+
+from __future__ import annotations
+
+import argparse
+import os
+import sys
+from datetime import datetime
+from importlib.metadata import PackageNotFoundError, version
+from pathlib import Path
+from typing import Any
+
+from _common import (
+ CliError,
+ checked_output_file,
+ commit_temp_file,
+ emit_json,
+ private_temp_file,
+ sha256_file,
+)
+from _manifest import load_and_validate_manifest
+from _pptx import (
+ analyze_layout,
+ patch_accessibility_metadata,
+ require_safe_pptx,
+ strip_generated_printer_settings,
+)
+from inventory_images import build_inventory
+
+EXPECTED_VERSIONS = {
+ "python-pptx": "1.0.2",
+ "Pillow": "12.3.0",
+ "lxml": "6.1.1",
+}
+
+
+def _require_exact_dependencies() -> dict[str, str]:
+ installed: dict[str, str] = {}
+ for distribution, expected in EXPECTED_VERSIONS.items():
+ try:
+ actual = version(distribution)
+ except PackageNotFoundError as exc:
+ raise CliError(
+ f"{distribution}=={expected} is required; install exact pins with "
+ '`uv pip install "python-pptx==1.0.2" "Pillow==12.3.0" '
+ '"lxml==6.1.1"`'
+ ) from exc
+ if actual != expected:
+ raise CliError(
+ f"{distribution}=={expected} is required for reproducible "
+ f"generation, but {actual} is installed"
+ )
+ installed[distribution] = actual
+ return installed
+
+
+def _rgb(value: str, rgb_class: Any) -> Any:
+ return rgb_class(
+ int(value[1:3], 16),
+ int(value[3:5], 16),
+ int(value[5:7], 16),
+ )
+
+
+def _set_text_shape(
+ slide: Any,
+ element: dict[str, Any],
+ *,
+ order: int,
+ colors: dict[str, str],
+ contrast_pairs: dict[str, dict[str, Any]],
+ Inches: Any,
+ Pt: Any,
+ RGBColor: Any,
+ PP_ALIGN: Any,
+ MSO_ANCHOR: Any,
+ MSO_AUTO_SIZE: Any,
+ existing_shape: Any | None = None,
+) -> None:
+ if existing_shape is None:
+ shape = slide.shapes.add_textbox(
+ Inches(float(element["x_in"])),
+ Inches(float(element["y_in"])),
+ Inches(float(element["width_in"])),
+ Inches(float(element["height_in"])),
+ )
+ else:
+ shape = existing_shape
+ shape.left = Inches(float(element["x_in"]))
+ shape.top = Inches(float(element["y_in"]))
+ shape.width = Inches(float(element["width_in"]))
+ shape.height = Inches(float(element["height_in"]))
+ shape.name = f"R{order:03d}_TEXT_{element['id']}"
+ text_frame = shape.text_frame
+ text_frame.clear()
+ text_frame.text = element["text"]
+ text_frame.word_wrap = True
+ text_frame.auto_size = MSO_AUTO_SIZE.NONE
+ margin = Inches(float(element["margin_in"]))
+ text_frame.margin_left = margin
+ text_frame.margin_right = margin
+ text_frame.margin_top = margin
+ text_frame.margin_bottom = margin
+ text_frame.vertical_anchor = {
+ "top": MSO_ANCHOR.TOP,
+ "middle": MSO_ANCHOR.MIDDLE,
+ "bottom": MSO_ANCHOR.BOTTOM,
+ }[element["vertical_align"]]
+
+ pair = contrast_pairs[element["contrast_pair_id"]]
+ foreground = colors[pair["foreground_color_id"]]
+ background = colors[pair["background_color_id"]]
+ shape.fill.solid()
+ shape.fill.fore_color.rgb = _rgb(background, RGBColor)
+ line_color_id = element["line_color_id"]
+ if line_color_id is None:
+ shape.line.fill.background()
+ else:
+ shape.line.color.rgb = _rgb(colors[line_color_id], RGBColor)
+ shape.line.width = Pt(float(element["line_width_pt"]))
+
+ alignment = {
+ "left": PP_ALIGN.LEFT,
+ "center": PP_ALIGN.CENTER,
+ "right": PP_ALIGN.RIGHT,
+ }[element["align"]]
+ for paragraph in text_frame.paragraphs:
+ paragraph.alignment = alignment
+ for run in paragraph.runs:
+ run.font.name = element["font_face"]
+ run.font.size = Pt(float(element["font_size_pt_design"]))
+ run.font.bold = bool(element["bold"])
+ run.font.color.rgb = _rgb(foreground, RGBColor)
+
+
+def _add_picture(
+ slide: Any,
+ element: dict[str, Any],
+ *,
+ order: int,
+ asset: dict[str, Any],
+ asset_path: Path,
+ metadata: dict[str, Any],
+ Inches: Any,
+) -> tuple[str, str]:
+ width_px = int(metadata["width_px"])
+ height_px = int(metadata["height_px"])
+ box_width = float(element["width_in"])
+ box_height = float(element["height_in"])
+ fit = min(box_width / width_px, box_height / height_px)
+ placed_width = width_px * fit
+ placed_height = height_px * fit
+ left = float(element["x_in"]) + (box_width - placed_width) / 2.0
+ top = float(element["y_in"]) + (box_height - placed_height) / 2.0
+ picture = slide.shapes.add_picture(
+ str(asset_path),
+ Inches(left),
+ Inches(top),
+ width=Inches(placed_width),
+ height=Inches(placed_height),
+ )
+ shape_name = f"R{order:03d}_IMAGE_{element['id']}"
+ picture.name = shape_name
+ return shape_name, asset["alt_text"]
+
+
+def _build_presentation(
+ document: dict[str, Any],
+ validation: dict[str, Any],
+ *,
+ image_inventory: dict[str, Any],
+ output_path: Path,
+) -> dict[str, str]:
+ try:
+ from pptx import Presentation
+ from pptx.dml.color import RGBColor
+ from pptx.enum.text import MSO_ANCHOR, MSO_AUTO_SIZE, PP_ALIGN
+ from pptx.util import Inches, Pt
+ except ImportError as exc:
+ raise CliError(
+ "python-pptx is required; install the exact pins with "
+ '`uv pip install "python-pptx==1.0.2" "Pillow==12.3.0" '
+ '"lxml==6.1.1"`'
+ ) from exc
+
+ presentation = Presentation()
+ presentation.slide_width = Inches(float(document["canvas"]["width_in"]))
+ presentation.slide_height = Inches(float(document["canvas"]["height_in"]))
+ slide = presentation.slides.add_slide(presentation.slide_layouts[5])
+ title_placeholder = slide.shapes.title
+ if title_placeholder is None:
+ raise CliError("built-in title-only layout did not provide a title placeholder")
+ slide.background.fill.solid()
+ slide.background.fill.fore_color.rgb = _rgb(
+ document["canvas"]["background_color"], RGBColor
+ )
+
+ core = presentation.core_properties
+ core.title = document["document"]["title"]
+ core.subject = document["document"]["subject"]
+ core.author = "; ".join(document["document"]["authors"])
+ core.language = document["document"]["language"]
+ approved_at = document["approval"]["approved_at"]
+ normalized_time = (
+ approved_at[:-1] + "+00:00" if approved_at.endswith("Z") else approved_at
+ )
+ approval_time = datetime.fromisoformat(normalized_time)
+ core.created = approval_time
+ core.modified = approval_time
+
+ colors = {
+ color_id: value.upper()
+ for color_id, value in document["palette"]["colors"].items()
+ }
+ pairs = {
+ pair["id"]: pair for pair in document["palette"]["contrast_pairs"]
+ }
+ assets = {asset["id"]: asset for asset in document["assets"]}
+ paths = {
+ asset_id: Path(path)
+ for asset_id, path in validation["asset_paths"].items()
+ }
+ metadata = {
+ record["id"]: record["metadata"] for record in image_inventory["images"]
+ }
+ alt_text_by_shape_name: dict[str, str] = {}
+ for element in document["elements"]:
+ order = int(element["reading_order"])
+ if element["type"] == "text":
+ _set_text_shape(
+ slide,
+ element,
+ order=order,
+ colors=colors,
+ contrast_pairs=pairs,
+ Inches=Inches,
+ Pt=Pt,
+ RGBColor=RGBColor,
+ PP_ALIGN=PP_ALIGN,
+ MSO_ANCHOR=MSO_ANCHOR,
+ MSO_AUTO_SIZE=MSO_AUTO_SIZE,
+ existing_shape=(
+ title_placeholder if element["role"] == "title" else None
+ ),
+ )
+ else:
+ asset = assets[element["asset_id"]]
+ shape_name, alt_text = _add_picture(
+ slide,
+ element,
+ order=order,
+ asset=asset,
+ asset_path=paths[element["asset_id"]],
+ metadata=metadata[element["asset_id"]],
+ Inches=Inches,
+ )
+ alt_text_by_shape_name[shape_name] = alt_text
+ presentation.save(output_path)
+ return alt_text_by_shape_name
+
+
+def generate_poster(
+ manifest_value: str | Path,
+ output_value: str | Path,
+) -> dict[str, Any]:
+ """Generate, patch, technically inspect, and publish a new PPTX poster."""
+ dependency_versions = _require_exact_dependencies()
+ destination = checked_output_file(output_value, suffix=".pptx")
+ manifest_path, document, validation = load_and_validate_manifest(
+ manifest_value,
+ verify_assets=True,
+ require_approval=True,
+ )
+ image_inventory = build_inventory(manifest_path, document, validation)
+ if not image_inventory["pass"]:
+ messages = "; ".join(issue["message"] for issue in image_inventory["issues"])
+ raise CliError(f"image inventory failed: {messages}")
+
+ source_descriptor, source_temp = private_temp_file(
+ destination, suffix=".pptx"
+ )
+ sanitized_descriptor, sanitized_temp = private_temp_file(
+ destination, suffix=".pptx"
+ )
+ patched_descriptor, patched_temp = private_temp_file(
+ destination, suffix=".pptx"
+ )
+ os.close(source_descriptor)
+ os.close(sanitized_descriptor)
+ os.close(patched_descriptor)
+ try:
+ alt_texts = _build_presentation(
+ document,
+ validation,
+ image_inventory=image_inventory,
+ output_path=source_temp,
+ )
+ strip_generated_printer_settings(source_temp, sanitized_temp)
+ require_safe_pptx(sanitized_temp)
+ patch_accessibility_metadata(
+ sanitized_temp,
+ patched_temp,
+ alt_text_by_shape_name=alt_texts,
+ language=document["document"]["language"],
+ )
+ package_report = require_safe_pptx(patched_temp)
+ accessibility = package_report["accessibility"]
+ if accessibility["pictures_missing_alt_text"]:
+ raise CliError("generated PPTX contains a picture without alt text")
+ if accessibility["slide_title_count"] != 1:
+ raise CliError(
+ "generated PPTX must contain exactly one native slide-title placeholder"
+ )
+ if accessibility["text_runs_missing_language"]:
+ raise CliError("generated PPTX contains text without explicit language")
+ layout_report = analyze_layout(
+ patched_temp,
+ print_scale=float(validation["physical_output"]["print_scale"]),
+ minimum_font_pt_final=float(
+ document["quality"]["minimum_font_pt_final"]
+ ),
+ )
+ expected_order = [
+ (
+ f"R{int(element['reading_order']):03d}_"
+ f"{'TEXT' if element['type'] == 'text' else 'IMAGE'}_"
+ f"{element['id']}"
+ )
+ for element in document["elements"]
+ ]
+ actual_order = [
+ item["name"]
+ for item in layout_report["slides"][0]["reading_order"]
+ ]
+ if actual_order != expected_order:
+ raise CliError(
+ "generated PPTX direct shape order does not match approved reading order"
+ )
+ if not layout_report["pass"]:
+ codes = ", ".join(issue["code"] for issue in layout_report["issues"])
+ raise CliError(f"generated PPTX failed layout checks: {codes}")
+ commit_temp_file(patched_temp, destination)
+ finally:
+ for temporary in (source_temp, sanitized_temp, patched_temp):
+ try:
+ temporary.unlink()
+ except FileNotFoundError:
+ pass
+
+ return {
+ "schema_version": "1.0",
+ "generated": True,
+ "output": {
+ "path": str(destination),
+ "sha256": sha256_file(destination),
+ "size_bytes": destination.stat().st_size,
+ },
+ "manifest": {
+ "path": str(manifest_path),
+ "content_sha256": validation["content_sha256"],
+ "approved_by": document["approval"]["approved_by"],
+ "approved_at": document["approval"]["approved_at"],
+ },
+ "dependencies": dependency_versions,
+ "package_security": {
+ "safe": package_report["safe"],
+ "member_count": package_report["package"]["member_count"],
+ "external_relationships": 0,
+ "macros_or_embedded_objects": 0,
+ },
+ "technical_checks": {
+ "layout_pass": layout_report["pass"],
+ "image_inventory_pass": image_inventory["pass"],
+ "pictures_with_alt_text": accessibility["pictures_with_alt_text"],
+ "picture_count": accessibility["picture_count"],
+ "native_slide_title_count": accessibility["slide_title_count"],
+ "text_runs_with_language": accessibility["text_runs_with_language"],
+ "text_run_count": accessibility["text_run_count"],
+ },
+ "manual_checks_required": [
+ "PowerPoint Accessibility Checker and Reading Order pane",
+ "alt-text and native long-description completeness",
+ "screen-reader and keyboard navigation",
+ "rendered text overflow, font substitution, equations, and glyphs",
+ "PDF page size, tags, font rendering, and image quality after export",
+ "physical color proof, trim, bleed, safe margin, and final scaling",
+ "QR scan test plus visible fallback URL/text",
+ "author sign-off on every claim, number, citation, and source",
+ ],
+ }
+
+
+def build_parser() -> argparse.ArgumentParser:
+ parser = argparse.ArgumentParser(
+ description=(
+ "Generate one editable, macro-free PPTX poster from strict, approved "
+ "local JSON and local PNG/JPEG assets. The command refuses placeholders, "
+ "unknown sources, unapproved content, remote assets, unsafe package "
+ "features, low effective DPI, overlap, bounds errors, and overwrites."
+ )
+ )
+ parser.add_argument("manifest", help="approved local poster manifest JSON")
+ parser.add_argument(
+ "--output",
+ required=True,
+ help="new .pptx path; an existing destination is never overwritten",
+ )
+ parser.add_argument("--report", help="optional new JSON generation report path")
+ return parser
+
+
+def main(argv: list[str] | None = None) -> int:
+ parser = build_parser()
+ try:
+ args = parser.parse_args(argv)
+ if args.report is not None:
+ checked_output_file(args.report, suffix=".json")
+ report = generate_poster(args.manifest, args.output)
+ emit_json(report, output=args.report)
+ return 0
+ except CliError as exc:
+ parser.exit(2, f"error: {exc}\n")
+
+
+if __name__ == "__main__":
+ sys.exit(main())
diff --git a/skills/pptx-posters/scripts/generate_schematic.py b/skills/pptx-posters/scripts/generate_schematic.py
deleted file mode 100644
index 43331870..00000000
--- a/skills/pptx-posters/scripts/generate_schematic.py
+++ /dev/null
@@ -1,139 +0,0 @@
-#!/usr/bin/env python3
-"""
-Scientific schematic generation using Nano Banana 2.
-
-Generate any scientific diagram by describing it in natural language.
-Nano Banana 2 handles everything automatically with smart iterative refinement.
-
-Smart iteration: Only regenerates if quality is below threshold for your document type.
-Quality review: Uses Gemini 3.6 Flash for professional scientific evaluation.
-
-Usage:
- # Generate for journal paper (highest quality threshold)
- python generate_schematic.py "CONSORT flowchart" -o flowchart.png --doc-type journal
-
- # Generate for presentation (lower threshold, faster)
- python generate_schematic.py "Transformer architecture" -o transformer.png --doc-type presentation
-
- # Generate for poster
- python generate_schematic.py "MAPK signaling pathway" -o pathway.png --doc-type poster
-"""
-
-import argparse
-import os
-import subprocess
-import sys
-from pathlib import Path
-
-
-def main():
- """Command-line interface."""
- parser = argparse.ArgumentParser(
- description="Generate scientific schematics using AI with smart iterative refinement",
- formatter_class=argparse.RawDescriptionHelpFormatter,
- epilog="""
-How it works:
- Simply describe your diagram in natural language
- Nano Banana 2 generates it automatically with:
- - Smart iteration (only regenerates if quality is below threshold)
- - Quality review by Gemini 3.6 Flash
- - Document-type aware quality thresholds
- - Publication-ready output
-
-Document Types (quality thresholds):
- journal 8.5/10 - Nature, Science, peer-reviewed journals
- conference 8.0/10 - Conference papers
- thesis 8.0/10 - Dissertations, theses
- grant 8.0/10 - Grant proposals
- preprint 7.5/10 - arXiv, bioRxiv, etc.
- report 7.5/10 - Technical reports
- poster 7.0/10 - Academic posters
- presentation 6.5/10 - Slides, talks
- default 7.5/10 - General purpose
-
-Examples:
- # Generate for journal paper (strict quality)
- python generate_schematic.py "CONSORT participant flow" -o flowchart.png --doc-type journal
-
- # Generate for poster (moderate quality)
- python generate_schematic.py "Transformer architecture" -o arch.png --doc-type poster
-
- # Generate for slides (faster, lower threshold)
- python generate_schematic.py "System diagram" -o system.png --doc-type presentation
-
- # Custom max iterations
- python generate_schematic.py "Complex pathway" -o pathway.png --iterations 2
-
- # Verbose output
- python generate_schematic.py "Circuit diagram" -o circuit.png -v
-
-Environment Variables:
- OPENROUTER_API_KEY Required for AI generation
- """
- )
-
- parser.add_argument("prompt",
- help="Description of the diagram to generate")
- parser.add_argument("-o", "--output", required=True,
- help="Output file path")
- parser.add_argument("--doc-type", default="default",
- choices=["journal", "conference", "poster", "presentation",
- "report", "grant", "thesis", "preprint", "default"],
- help="Document type for quality threshold (default: default)")
- parser.add_argument("--iterations", type=int, default=2,
- help="Maximum refinement iterations (default: 2, max: 2)")
- parser.add_argument("--api-key",
- help="OpenRouter API key (or use OPENROUTER_API_KEY env var)")
- parser.add_argument("-v", "--verbose", action="store_true",
- help="Verbose output")
-
- args = parser.parse_args()
-
- # Check for API key
- api_key = args.api_key or os.getenv("OPENROUTER_API_KEY")
- if not api_key:
- print("Error: OPENROUTER_API_KEY environment variable not set")
- print("\nFor AI generation, you need an OpenRouter API key.")
- print("Get one at: https://openrouter.ai/keys")
- print("\nSet it with:")
- print(" export OPENROUTER_API_KEY='your_api_key'")
- print("\nOr use --api-key flag")
- sys.exit(1)
-
- # Find AI generation script
- script_dir = Path(__file__).parent
- ai_script = script_dir / "generate_schematic_ai.py"
-
- if not ai_script.exists():
- print(f"Error: AI generation script not found: {ai_script}")
- sys.exit(1)
-
- # Build command
- cmd = [sys.executable, str(ai_script), args.prompt, "-o", args.output]
-
- if args.doc_type != "default":
- cmd.extend(["--doc-type", args.doc_type])
-
- # Enforce max 2 iterations
- iterations = min(args.iterations, 2)
- if iterations != 2:
- cmd.extend(["--iterations", str(iterations)])
-
- if args.verbose:
- cmd.append("-v")
-
- # Execute — pass API key via environment to avoid exposure in process listings
- try:
- env = os.environ.copy()
- if api_key:
- env["OPENROUTER_API_KEY"] = api_key
- result = subprocess.run(cmd, check=False, env=env)
- sys.exit(result.returncode)
- except Exception as e:
- print(f"Error executing AI generation: {e}")
- sys.exit(1)
-
-
-if __name__ == "__main__":
- main()
-
diff --git a/skills/pptx-posters/scripts/generate_schematic_ai.py b/skills/pptx-posters/scripts/generate_schematic_ai.py
deleted file mode 100644
index 651b6c76..00000000
--- a/skills/pptx-posters/scripts/generate_schematic_ai.py
+++ /dev/null
@@ -1,817 +0,0 @@
-#!/usr/bin/env python3
-"""
-AI-powered scientific schematic generation using Nano Banana 2.
-
-This script uses a smart iterative refinement approach:
-1. Generate initial image with Nano Banana 2
-2. AI quality review using Gemini 3.6 Flash for scientific critique
-3. Only regenerate if quality is below threshold for document type
-4. Repeat until quality meets standards (max iterations)
-
-Requirements:
- - OPENROUTER_API_KEY environment variable
- - requests library
-
-Usage:
- python generate_schematic_ai.py "Create a flowchart showing CONSORT participant flow" -o flowchart.png
- python generate_schematic_ai.py "Neural network architecture diagram" -o architecture.png --iterations 2
- python generate_schematic_ai.py "Simple block diagram" -o diagram.png --doc-type poster
-"""
-
-import argparse
-import base64
-import json
-import os
-import sys
-import time
-from pathlib import Path
-from typing import Optional, Dict, Any, List, Tuple
-
-try:
- import requests
-except ImportError:
- print("Error: requests library not found. Install with: pip install requests")
- sys.exit(1)
-
-# Try to load .env file from multiple potential locations
-def _load_env_file():
- """Load .env file from current directory or script directory only."""
- try:
- from dotenv import load_dotenv
- except ImportError:
- return False
-
- for candidate in [Path.cwd() / ".env", Path(__file__).resolve().parent / ".env"]:
- if candidate.exists():
- load_dotenv(dotenv_path=candidate, override=False)
- return True
-
- return False
-
-
-class ScientificSchematicGenerator:
- """Generate scientific schematics using AI with smart iterative refinement.
-
- Uses Gemini 3.6 Flash for quality review to determine if regeneration is needed.
- Multiple passes only occur if the generated schematic doesn't meet the
- quality threshold for the target document type.
- """
-
- # Quality thresholds by document type (score out of 10)
- # Higher thresholds for more formal publications
- QUALITY_THRESHOLDS = {
- "journal": 8.5, # Nature, Science, etc. - highest standards
- "conference": 8.0, # Conference papers - high standards
- "poster": 7.0, # Academic posters - good quality
- "presentation": 6.5, # Slides/talks - clear but less formal
- "report": 7.5, # Technical reports - professional
- "grant": 8.0, # Grant proposals - must be compelling
- "thesis": 8.0, # Dissertations - formal academic
- "preprint": 7.5, # arXiv, etc. - good quality
- "default": 7.5, # Default threshold
- }
-
- # Scientific diagram best practices prompt template
- SCIENTIFIC_DIAGRAM_GUIDELINES = """
-Create a high-quality scientific diagram with these requirements:
-
-VISUAL QUALITY:
-- Clean white or light background (no textures or gradients)
-- High contrast for readability and printing
-- Professional, publication-ready appearance
-- Sharp, clear lines and text
-- Adequate spacing between elements to prevent crowding
-
-TYPOGRAPHY:
-- Clear, readable sans-serif fonts (Arial, Helvetica style)
-- Minimum 10pt font size for all labels
-- Consistent font sizes throughout
-- All text horizontal or clearly readable
-- No overlapping text
-
-SCIENTIFIC STANDARDS:
-- Accurate representation of concepts
-- Clear labels for all components
-- Include scale bars, legends, or axes where appropriate
-- Use standard scientific notation and symbols
-- Include units where applicable
-
-ACCESSIBILITY:
-- Colorblind-friendly color palette (use Okabe-Ito colors if using color)
-- High contrast between elements
-- Redundant encoding (shapes + colors, not just colors)
-- Works well in grayscale
-
-LAYOUT:
-- Logical flow (left-to-right or top-to-bottom)
-- Clear visual hierarchy
-- Balanced composition
-- Appropriate use of whitespace
-- No clutter or unnecessary decorative elements
-
-IMPORTANT - NO FIGURE NUMBERS:
-- Do NOT include "Figure 1:", "Fig. 1", or any figure numbering in the image
-- Do NOT add captions or titles like "Figure: ..." at the top or bottom
-- Figure numbers and captions are added separately in the document/LaTeX
-- The diagram should contain only the visual content itself
-"""
-
- def __init__(self, api_key: Optional[str] = None, verbose: bool = False):
- """
- Initialize the generator.
-
- Args:
- api_key: OpenRouter API key (or use OPENROUTER_API_KEY env var)
- verbose: Print detailed progress information
- """
- # Priority: 1) explicit api_key param, 2) environment variable, 3) .env file
- self.api_key = api_key or os.getenv("OPENROUTER_API_KEY")
-
- # If not found in environment, try loading from .env file
- if not self.api_key:
- _load_env_file()
- self.api_key = os.getenv("OPENROUTER_API_KEY")
-
- if not self.api_key:
- raise ValueError(
- "OPENROUTER_API_KEY not found. Please either:\n"
- " 1. Set the OPENROUTER_API_KEY environment variable\n"
- " 2. Add OPENROUTER_API_KEY to your .env file\n"
- " 3. Pass api_key parameter to the constructor\n"
- "Get your API key from: https://openrouter.ai/keys"
- )
-
- self.verbose = verbose
- self._last_error = None # Track last error for better reporting
- self.base_url = "https://openrouter.ai/api/v1"
- # Nano Banana 2 - Google's advanced image generation model
- # https://openrouter.ai/google/gemini-3.6-flash
- self.image_model = "google/gemini-3.1-flash-image-preview"
- # Gemini 3.6 Flash for quality review - excellent vision and reasoning
- self.review_model = "google/gemini-3.6-flash"
-
- def _log(self, message: str):
- """Log message if verbose mode is enabled."""
- if self.verbose:
- print(f"[{time.strftime('%H:%M:%S')}] {message}")
-
- def _make_request(self, model: str, messages: List[Dict[str, Any]],
- modalities: Optional[List[str]] = None) -> Dict[str, Any]:
- """
- Make a request to OpenRouter API.
-
- Args:
- model: Model identifier
- messages: List of message dictionaries
- modalities: Optional list of modalities (e.g., ["image", "text"])
-
- Returns:
- API response as dictionary
- """
- headers = {
- "Authorization": f"Bearer {self.api_key}",
- "Content-Type": "application/json",
- "HTTP-Referer": "https://github.com/scientific-writer",
- "X-Title": "Scientific Schematic Generator"
- }
-
- payload = {
- "model": model,
- "messages": messages
- }
-
- if modalities:
- payload["modalities"] = modalities
-
- self._log(f"Making request to {model}...")
-
- try:
- response = requests.post(
- f"{self.base_url}/chat/completions",
- headers=headers,
- json=payload,
- timeout=120
- )
-
- # Try to get response body even on error
- try:
- response_json = response.json()
- except json.JSONDecodeError:
- response_json = {"raw_text": response.text[:500]}
-
- # Check for HTTP errors but include response body in error message
- if response.status_code != 200:
- error_detail = response_json.get("error", response_json)
- self._log(f"HTTP {response.status_code}: {error_detail}")
- raise RuntimeError(f"API request failed (HTTP {response.status_code}): {error_detail}")
-
- return response_json
- except requests.exceptions.Timeout:
- raise RuntimeError("API request timed out after 120 seconds")
- except requests.exceptions.RequestException as e:
- raise RuntimeError(f"API request failed: {str(e)}")
-
- def _extract_image_from_response(self, response: Dict[str, Any]) -> Optional[bytes]:
- """
- Extract base64-encoded image from API response.
-
- For Nano Banana 2, images are returned in the 'images' field of the message,
- not in the 'content' field.
-
- Args:
- response: API response dictionary
-
- Returns:
- Image bytes or None if not found
- """
- try:
- choices = response.get("choices", [])
- if not choices:
- self._log("No choices in response")
- return None
-
- message = choices[0].get("message", {})
-
- # IMPORTANT: Nano Banana 2 returns images in the 'images' field
- images = message.get("images", [])
- if images and len(images) > 0:
- self._log(f"Found {len(images)} image(s) in 'images' field")
-
- # Get first image
- first_image = images[0]
- if isinstance(first_image, dict):
- # Extract image_url
- if first_image.get("type") == "image_url":
- url = first_image.get("image_url", {})
- if isinstance(url, dict):
- url = url.get("url", "")
-
- if url and url.startswith("data:image"):
- # Extract base64 data after comma
- if "," in url:
- base64_str = url.split(",", 1)[1]
- # Clean whitespace
- base64_str = base64_str.replace('\n', '').replace('\r', '').replace(' ', '')
- self._log(f"Extracted base64 data (length: {len(base64_str)})")
- return base64.b64decode(base64_str)
-
- # Fallback: check content field (for other models or future changes)
- content = message.get("content", "")
-
- if self.verbose:
- self._log(f"Content type: {type(content)}, length: {len(str(content))}")
-
- # Handle string content
- if isinstance(content, str) and "data:image" in content:
- import re
- match = re.search(r'data:image/[^;]+;base64,([A-Za-z0-9+/=\n\r]+)', content, re.DOTALL)
- if match:
- base64_str = match.group(1).replace('\n', '').replace('\r', '').replace(' ', '')
- self._log(f"Found image in content field (length: {len(base64_str)})")
- return base64.b64decode(base64_str)
-
- # Handle list content
- if isinstance(content, list):
- for i, block in enumerate(content):
- if isinstance(block, dict) and block.get("type") == "image_url":
- url = block.get("image_url", {})
- if isinstance(url, dict):
- url = url.get("url", "")
- if url and url.startswith("data:image") and "," in url:
- base64_str = url.split(",", 1)[1].replace('\n', '').replace('\r', '').replace(' ', '')
- self._log(f"Found image in content block {i}")
- return base64.b64decode(base64_str)
-
- self._log("No image data found in response")
- return None
-
- except Exception as e:
- self._log(f"Error extracting image: {str(e)}")
- import traceback
- if self.verbose:
- traceback.print_exc()
- return None
-
- def _image_to_base64(self, image_path: str) -> str:
- """
- Convert image file to base64 data URL.
-
- Args:
- image_path: Path to image file
-
- Returns:
- Base64 data URL string
- """
- with open(image_path, "rb") as f:
- image_data = f.read()
-
- # Determine image type from extension
- ext = Path(image_path).suffix.lower()
- mime_type = {
- ".png": "image/png",
- ".jpg": "image/jpeg",
- ".jpeg": "image/jpeg",
- ".gif": "image/gif",
- ".webp": "image/webp"
- }.get(ext, "image/png")
-
- base64_data = base64.b64encode(image_data).decode("utf-8")
- return f"data:{mime_type};base64,{base64_data}"
-
- def generate_image(self, prompt: str) -> Optional[bytes]:
- """
- Generate an image using Nano Banana 2.
-
- Args:
- prompt: Description of the diagram to generate
-
- Returns:
- Image bytes or None if generation failed
- """
- self._last_error = None # Reset error
-
- messages = [
- {
- "role": "user",
- "content": prompt
- }
- ]
-
- try:
- response = self._make_request(
- model=self.image_model,
- messages=messages,
- modalities=["image", "text"]
- )
-
- # Debug: print response structure if verbose
- if self.verbose:
- self._log(f"Response keys: {response.keys()}")
- if "error" in response:
- self._log(f"API Error: {response['error']}")
- if "choices" in response and response["choices"]:
- msg = response["choices"][0].get("message", {})
- self._log(f"Message keys: {msg.keys()}")
- # Show content preview without printing huge base64 data
- content = msg.get("content", "")
- if isinstance(content, str):
- preview = content[:200] + "..." if len(content) > 200 else content
- self._log(f"Content preview: {preview}")
- elif isinstance(content, list):
- self._log(f"Content is list with {len(content)} items")
- for i, item in enumerate(content[:3]):
- if isinstance(item, dict):
- self._log(f" Item {i}: type={item.get('type')}")
-
- # Check for API errors in response
- if "error" in response:
- error_msg = response["error"]
- if isinstance(error_msg, dict):
- error_msg = error_msg.get("message", str(error_msg))
- self._last_error = f"API Error: {error_msg}"
- print(f"✗ {self._last_error}")
- return None
-
- image_data = self._extract_image_from_response(response)
- if image_data:
- self._log(f"✓ Generated image ({len(image_data)} bytes)")
- else:
- self._last_error = "No image data in API response - model may not support image generation"
- self._log(f"✗ {self._last_error}")
- # Additional debug info when image extraction fails
- if self.verbose and "choices" in response:
- msg = response["choices"][0].get("message", {})
- self._log(f"Full message structure: {json.dumps({k: type(v).__name__ for k, v in msg.items()})}")
-
- return image_data
- except RuntimeError as e:
- self._last_error = str(e)
- self._log(f"✗ Generation failed: {self._last_error}")
- return None
- except Exception as e:
- self._last_error = f"Unexpected error: {str(e)}"
- self._log(f"✗ Generation failed: {self._last_error}")
- import traceback
- if self.verbose:
- traceback.print_exc()
- return None
-
- def review_image(self, image_path: str, original_prompt: str,
- iteration: int, doc_type: str = "default",
- max_iterations: int = 2) -> Tuple[str, float, bool]:
- """
- Review generated image using Gemini 3.6 Flash for quality analysis.
-
- Uses Gemini 3.6 Flash's superior vision and reasoning capabilities to
- evaluate the schematic quality and determine if regeneration is needed.
-
- Args:
- image_path: Path to the generated image
- original_prompt: Original user prompt
- iteration: Current iteration number
- doc_type: Document type (journal, poster, presentation, etc.)
- max_iterations: Maximum iterations allowed
-
- Returns:
- Tuple of (critique text, quality score 0-10, needs_improvement bool)
- """
- # Use Gemini 3.6 Flash for review - excellent vision and analysis
- image_data_url = self._image_to_base64(image_path)
-
- # Get quality threshold for this document type
- threshold = self.QUALITY_THRESHOLDS.get(doc_type.lower(),
- self.QUALITY_THRESHOLDS["default"])
-
- review_prompt = f"""You are an expert reviewer evaluating a scientific diagram for publication quality.
-
-ORIGINAL REQUEST: {original_prompt}
-
-DOCUMENT TYPE: {doc_type} (quality threshold: {threshold}/10)
-ITERATION: {iteration}/{max_iterations}
-
-Carefully evaluate this diagram on these criteria:
-
-1. **Scientific Accuracy** (0-2 points)
- - Correct representation of concepts
- - Proper notation and symbols
- - Accurate relationships shown
-
-2. **Clarity and Readability** (0-2 points)
- - Easy to understand at a glance
- - Clear visual hierarchy
- - No ambiguous elements
-
-3. **Label Quality** (0-2 points)
- - All important elements labeled
- - Labels are readable (appropriate font size)
- - Consistent labeling style
-
-4. **Layout and Composition** (0-2 points)
- - Logical flow (top-to-bottom or left-to-right)
- - Balanced use of space
- - No overlapping elements
-
-5. **Professional Appearance** (0-2 points)
- - Publication-ready quality
- - Clean, crisp lines and shapes
- - Appropriate colors/contrast
-
-RESPOND IN THIS EXACT FORMAT:
-SCORE: [total score 0-10]
-
-STRENGTHS:
-- [strength 1]
-- [strength 2]
-
-ISSUES:
-- [issue 1 if any]
-- [issue 2 if any]
-
-VERDICT: [ACCEPTABLE or NEEDS_IMPROVEMENT]
-
-If score >= {threshold}, the diagram is ACCEPTABLE for {doc_type} publication.
-If score < {threshold}, mark as NEEDS_IMPROVEMENT with specific suggestions."""
-
- messages = [
- {
- "role": "user",
- "content": [
- {
- "type": "text",
- "text": review_prompt
- },
- {
- "type": "image_url",
- "image_url": {
- "url": image_data_url
- }
- }
- ]
- }
- ]
-
- try:
- # Use Gemini 3.6 Flash for high-quality review
- response = self._make_request(
- model=self.review_model,
- messages=messages
- )
-
- # Extract text response
- choices = response.get("choices", [])
- if not choices:
- return "Image generated successfully", 8.0
-
- message = choices[0].get("message", {})
- content = message.get("content", "")
-
- # Check reasoning field (Nano Banana 2 puts analysis here)
- reasoning = message.get("reasoning", "")
- if reasoning and not content:
- content = reasoning
-
- if isinstance(content, list):
- # Extract text from content blocks
- text_parts = []
- for block in content:
- if isinstance(block, dict) and block.get("type") == "text":
- text_parts.append(block.get("text", ""))
- content = "\n".join(text_parts)
-
- # Try to extract score
- score = 7.5 # Default score if extraction fails
- import re
-
- # Look for SCORE: X or SCORE: X/10 format
- score_match = re.search(r'SCORE:\s*(\d+(?:\.\d+)?)', content, re.IGNORECASE)
- if score_match:
- score = float(score_match.group(1))
- else:
- # Fallback: look for any score pattern
- score_match = re.search(r'(?:score|rating|quality)[:\s]+(\d+(?:\.\d+)?)\s*(?:/\s*10)?', content, re.IGNORECASE)
- if score_match:
- score = float(score_match.group(1))
-
- # Determine if improvement is needed based on verdict or score
- needs_improvement = False
- if "NEEDS_IMPROVEMENT" in content.upper():
- needs_improvement = True
- elif score < threshold:
- needs_improvement = True
-
- self._log(f"✓ Review complete (Score: {score}/10, Threshold: {threshold}/10)")
- self._log(f" Verdict: {'Needs improvement' if needs_improvement else 'Acceptable'}")
-
- return (content if content else "Image generated successfully",
- score,
- needs_improvement)
- except Exception as e:
- self._log(f"Review skipped: {str(e)}")
- # Don't fail the whole process if review fails - assume acceptable
- return "Image generated successfully (review skipped)", 7.5, False
-
- def improve_prompt(self, original_prompt: str, critique: str,
- iteration: int) -> str:
- """
- Improve the generation prompt based on critique.
-
- Args:
- original_prompt: Original user prompt
- critique: Review critique from previous iteration
- iteration: Current iteration number
-
- Returns:
- Improved prompt for next generation
- """
- improved_prompt = f"""{self.SCIENTIFIC_DIAGRAM_GUIDELINES}
-
-USER REQUEST: {original_prompt}
-
-ITERATION {iteration}: Based on previous feedback, address these specific improvements:
-{critique}
-
-Generate an improved version that addresses all the critique points while maintaining scientific accuracy and professional quality."""
-
- return improved_prompt
-
- def generate_iterative(self, user_prompt: str, output_path: str,
- iterations: int = 2,
- doc_type: str = "default") -> Dict[str, Any]:
- """
- Generate scientific schematic with smart iterative refinement.
-
- Only regenerates if the quality score is below the threshold for the
- specified document type. This saves API calls and time when the first
- generation is already good enough.
-
- Args:
- user_prompt: User's description of desired diagram
- output_path: Path to save final image
- iterations: Maximum refinement iterations (default: 2, max: 2)
- doc_type: Document type for quality threshold (journal, poster, etc.)
-
- Returns:
- Dictionary with generation results and metadata
- """
- output_path = Path(output_path)
- output_dir = output_path.parent
- output_dir.mkdir(parents=True, exist_ok=True)
-
- base_name = output_path.stem
- extension = output_path.suffix or ".png"
-
- # Get quality threshold for this document type
- threshold = self.QUALITY_THRESHOLDS.get(doc_type.lower(),
- self.QUALITY_THRESHOLDS["default"])
-
- results = {
- "user_prompt": user_prompt,
- "doc_type": doc_type,
- "quality_threshold": threshold,
- "iterations": [],
- "final_image": None,
- "final_score": 0.0,
- "success": False,
- "early_stop": False,
- "early_stop_reason": None
- }
-
- current_prompt = f"""{self.SCIENTIFIC_DIAGRAM_GUIDELINES}
-
-USER REQUEST: {user_prompt}
-
-Generate a publication-quality scientific diagram that meets all the guidelines above."""
-
- print(f"\n{'='*60}")
- print(f"Generating Scientific Schematic")
- print(f"{'='*60}")
- print(f"Description: {user_prompt}")
- print(f"Document Type: {doc_type}")
- print(f"Quality Threshold: {threshold}/10")
- print(f"Max Iterations: {iterations}")
- print(f"Output: {output_path}")
- print(f"{'='*60}\n")
-
- for i in range(1, iterations + 1):
- print(f"\n[Iteration {i}/{iterations}]")
- print("-" * 40)
-
- # Generate image
- print(f"Generating image...")
- image_data = self.generate_image(current_prompt)
-
- if not image_data:
- error_msg = getattr(self, '_last_error', 'Image generation failed - no image data returned')
- print(f"✗ Generation failed: {error_msg}")
- results["iterations"].append({
- "iteration": i,
- "success": False,
- "error": error_msg
- })
- continue
-
- # Save iteration image
- iter_path = output_dir / f"{base_name}_v{i}{extension}"
- with open(iter_path, "wb") as f:
- f.write(image_data)
- print(f"✓ Saved: {iter_path}")
-
- # Review image using Gemini 3.6 Flash
- print(f"Reviewing image with Gemini 3.6 Flash...")
- critique, score, needs_improvement = self.review_image(
- str(iter_path), user_prompt, i, doc_type, iterations
- )
- print(f"✓ Score: {score}/10 (threshold: {threshold}/10)")
-
- # Save iteration results
- iteration_result = {
- "iteration": i,
- "image_path": str(iter_path),
- "prompt": current_prompt,
- "critique": critique,
- "score": score,
- "needs_improvement": needs_improvement,
- "success": True
- }
- results["iterations"].append(iteration_result)
-
- # Check if quality is acceptable - STOP EARLY if so
- if not needs_improvement:
- print(f"\n✓ Quality meets {doc_type} threshold ({score} >= {threshold})")
- print(f" No further iterations needed!")
- results["final_image"] = str(iter_path)
- results["final_score"] = score
- results["success"] = True
- results["early_stop"] = True
- results["early_stop_reason"] = f"Quality score {score} meets threshold {threshold} for {doc_type}"
- break
-
- # If this is the last iteration, we're done regardless
- if i == iterations:
- print(f"\n⚠ Maximum iterations reached")
- results["final_image"] = str(iter_path)
- results["final_score"] = score
- results["success"] = True
- break
-
- # Quality below threshold - improve prompt for next iteration
- print(f"\n⚠ Quality below threshold ({score} < {threshold})")
- print(f"Improving prompt based on feedback...")
- current_prompt = self.improve_prompt(user_prompt, critique, i + 1)
-
- # Copy final version to output path
- if results["success"] and results["final_image"]:
- final_iter_path = Path(results["final_image"])
- if final_iter_path != output_path:
- import shutil
- shutil.copy(final_iter_path, output_path)
- print(f"\n✓ Final image: {output_path}")
-
- # Save review log
- log_path = output_dir / f"{base_name}_review_log.json"
- with open(log_path, "w") as f:
- json.dump(results, f, indent=2)
- print(f"✓ Review log: {log_path}")
-
- print(f"\n{'='*60}")
- print(f"Generation Complete!")
- print(f"Final Score: {results['final_score']}/10")
- if results["early_stop"]:
- print(f"Iterations Used: {len([r for r in results['iterations'] if r.get('success')])}/{iterations} (early stop)")
- print(f"{'='*60}\n")
-
- return results
-
-
-def main():
- """Command-line interface."""
- parser = argparse.ArgumentParser(
- description="Generate scientific schematics using AI with smart iterative refinement",
- formatter_class=argparse.RawDescriptionHelpFormatter,
- epilog="""
-Examples:
- # Generate a flowchart for a journal paper
- python generate_schematic_ai.py "CONSORT participant flow diagram" -o flowchart.png --doc-type journal
-
- # Generate neural network architecture for presentation (lower threshold)
- python generate_schematic_ai.py "Transformer encoder-decoder architecture" -o transformer.png --doc-type presentation
-
- # Generate with custom max iterations for poster
- python generate_schematic_ai.py "Biological signaling pathway" -o pathway.png --iterations 2 --doc-type poster
-
- # Verbose output
- python generate_schematic_ai.py "Circuit diagram" -o circuit.png -v
-
-Document Types (quality thresholds):
- journal 8.5/10 - Nature, Science, peer-reviewed journals
- conference 8.0/10 - Conference papers
- thesis 8.0/10 - Dissertations, theses
- grant 8.0/10 - Grant proposals
- preprint 7.5/10 - arXiv, bioRxiv, etc.
- report 7.5/10 - Technical reports
- poster 7.0/10 - Academic posters
- presentation 6.5/10 - Slides, talks
- default 7.5/10 - General purpose
-
-Note: Multiple iterations only occur if quality is BELOW the threshold.
- If the first generation meets the threshold, no extra API calls are made.
-
-Environment:
- OPENROUTER_API_KEY OpenRouter API key (required)
- """
- )
-
- parser.add_argument("prompt", help="Description of the diagram to generate")
- parser.add_argument("-o", "--output", required=True,
- help="Output image path (e.g., diagram.png)")
- parser.add_argument("--iterations", type=int, default=2,
- help="Maximum refinement iterations (default: 2, max: 2)")
- parser.add_argument("--doc-type", default="default",
- choices=["journal", "conference", "poster", "presentation",
- "report", "grant", "thesis", "preprint", "default"],
- help="Document type for quality threshold (default: default)")
- parser.add_argument("--api-key", help="OpenRouter API key (or set OPENROUTER_API_KEY)")
- parser.add_argument("-v", "--verbose", action="store_true",
- help="Verbose output")
-
- args = parser.parse_args()
-
- # Check for API key
- api_key = args.api_key or os.getenv("OPENROUTER_API_KEY")
- if not api_key:
- print("Error: OPENROUTER_API_KEY environment variable not set")
- print("\nSet it with:")
- print(" export OPENROUTER_API_KEY='your_api_key'")
- print("\nOr provide via --api-key flag")
- sys.exit(1)
-
- # Validate iterations - enforce max of 2
- if args.iterations < 1 or args.iterations > 2:
- print("Error: Iterations must be between 1 and 2")
- sys.exit(1)
-
- try:
- generator = ScientificSchematicGenerator(api_key=api_key, verbose=args.verbose)
- results = generator.generate_iterative(
- user_prompt=args.prompt,
- output_path=args.output,
- iterations=args.iterations,
- doc_type=args.doc_type
- )
-
- if results["success"]:
- print(f"\n✓ Success! Image saved to: {args.output}")
- if results.get("early_stop"):
- print(f" (Completed in {len([r for r in results['iterations'] if r.get('success')])} iteration(s) - quality threshold met)")
- sys.exit(0)
- else:
- print(f"\n✗ Generation failed. Check review log for details.")
- sys.exit(1)
- except Exception as e:
- print(f"\n✗ Error: {str(e)}")
- sys.exit(1)
-
-
-if __name__ == "__main__":
- main()
-
diff --git a/skills/pptx-posters/scripts/inspect_pptx.py b/skills/pptx-posters/scripts/inspect_pptx.py
new file mode 100644
index 00000000..376f4c84
--- /dev/null
+++ b/skills/pptx-posters/scripts/inspect_pptx.py
@@ -0,0 +1,40 @@
+#!/usr/bin/env python3
+"""Inspect a PPTX ZIP/XML package without opening or executing it."""
+
+from __future__ import annotations
+
+import argparse
+import sys
+
+from _common import CliError, emit_json
+from _pptx import inspect_pptx
+
+
+def build_parser() -> argparse.ArgumentParser:
+ parser = argparse.ArgumentParser(
+ description=(
+ "Boundedly inspect a local .pptx against the strict one-slide generated "
+ "poster profile: package parts, macros, relationships, linked images, "
+ "OLE/embedded content, ZIP paths/expansion, image signatures, title, "
+ "text language, and picture alt text. Nothing is extracted, opened in "
+ "PowerPoint, or executed."
+ )
+ )
+ parser.add_argument("pptx", help="local .pptx file")
+ parser.add_argument("--output", help="optional new JSON report path")
+ return parser
+
+
+def main(argv: list[str] | None = None) -> int:
+ parser = build_parser()
+ try:
+ args = parser.parse_args(argv)
+ report = inspect_pptx(args.pptx)
+ emit_json(report, output=args.output)
+ return 0 if report["safe"] else 1
+ except CliError as exc:
+ parser.exit(2, f"error: {exc}\n")
+
+
+if __name__ == "__main__":
+ sys.exit(main())
diff --git a/skills/pptx-posters/scripts/inventory_images.py b/skills/pptx-posters/scripts/inventory_images.py
new file mode 100644
index 00000000..afc279d4
--- /dev/null
+++ b/skills/pptx-posters/scripts/inventory_images.py
@@ -0,0 +1,252 @@
+#!/usr/bin/env python3
+"""Build a hashed local-image inventory with final effective DPI."""
+
+from __future__ import annotations
+
+import argparse
+import sys
+import warnings
+from importlib.metadata import PackageNotFoundError, version
+from pathlib import Path
+from typing import Any
+
+from _common import CliError, emit_json, resolve_local_asset
+from _manifest import ASSET_SUFFIXES, load_and_validate_manifest
+
+MAX_IMAGE_PIXELS = 100_000_000
+
+
+def _pillow_version() -> str:
+ try:
+ return version("Pillow")
+ except PackageNotFoundError:
+ return "unknown"
+
+
+def _read_image(path: Path) -> dict[str, Any]:
+ try:
+ from PIL import Image
+ except ImportError as exc:
+ raise CliError(
+ "Pillow is required for image inspection; install the exact pin with "
+ "`uv pip install \"Pillow==12.3.0\"`"
+ ) from exc
+ Image.MAX_IMAGE_PIXELS = MAX_IMAGE_PIXELS
+ try:
+ with warnings.catch_warnings():
+ warnings.simplefilter("error", Image.DecompressionBombWarning)
+ with Image.open(path) as image:
+ image.verify()
+ with Image.open(path) as image:
+ width, height = image.size
+ image_format = image.format
+ mode = image.mode
+ frames = int(getattr(image, "n_frames", 1))
+ image.load()
+ has_icc_profile = bool(image.info.get("icc_profile"))
+ has_alpha = "A" in image.getbands()
+ exif_entry_count = len(image.getexif())
+ text_keys = sorted(
+ str(key) for key in getattr(image, "text", {}).keys()
+ )
+ metadata_keys = sorted(str(key) for key in image.info)
+ except (OSError, SyntaxError, Image.DecompressionBombError) as exc:
+ raise CliError(f"cannot safely decode image {path}: {exc}") from exc
+ except Image.DecompressionBombWarning as exc:
+ raise CliError(f"image exceeds the pixel safety policy: {path}") from exc
+ if image_format not in {"PNG", "JPEG"}:
+ raise CliError(f"image format must be PNG or JPEG: {path}")
+ if frames != 1:
+ raise CliError(f"animated or multi-frame images are forbidden: {path}")
+ if mode not in {"RGB", "RGBA", "L", "LA"}:
+ raise CliError(
+ f"image mode {mode!r} requires conversion and author review: {path}"
+ )
+ return {
+ "format": image_format,
+ "mode": mode,
+ "width_px": width,
+ "height_px": height,
+ "frames": frames,
+ "has_alpha": has_alpha,
+ "has_icc_profile": has_icc_profile,
+ "exif_entry_count": exif_entry_count,
+ "embedded_text_keys": text_keys,
+ "metadata_keys": metadata_keys,
+ }
+
+
+def build_inventory(
+ manifest_path: Path,
+ document: dict[str, Any],
+ validation: dict[str, Any],
+) -> dict[str, Any]:
+ assets = {asset["id"]: asset for asset in document["assets"]}
+ placements: dict[str, list[dict[str, Any]]] = {
+ asset_id: [] for asset_id in assets
+ }
+ scale = float(validation["physical_output"]["print_scale"])
+ minimum_dpi = float(document["quality"]["minimum_raster_dpi_final"])
+ issues: list[dict[str, Any]] = []
+ image_records: list[dict[str, Any]] = []
+
+ for element in document["elements"]:
+ if element["type"] == "image":
+ placements[element["asset_id"]].append(element)
+
+ for asset_id, asset in assets.items():
+ path = resolve_local_asset(
+ manifest_path,
+ asset["path"],
+ suffixes=ASSET_SUFFIXES,
+ )
+ metadata = _read_image(path)
+ suspicious_metadata = sorted(
+ {
+ key
+ for key in metadata["metadata_keys"]
+ if any(
+ marker in key.lower()
+ for marker in (
+ "comment",
+ "description",
+ "exif",
+ "iptc",
+ "photoshop",
+ "software",
+ "xmp",
+ "xml",
+ )
+ )
+ }
+ | set(metadata["embedded_text_keys"])
+ )
+ if metadata["exif_entry_count"] or suspicious_metadata:
+ issues.append(
+ {
+ "code": "HIDDEN_IMAGE_METADATA",
+ "asset_id": asset_id,
+ "message": (
+ "image contains EXIF or textual/application metadata; "
+ "flatten and strip it in an author-reviewed offline workflow, "
+ "then rehash and reapprove the asset"
+ ),
+ "exif_entry_count": metadata["exif_entry_count"],
+ "metadata_keys": suspicious_metadata,
+ }
+ )
+ asset_placements: list[dict[str, Any]] = []
+ for element in placements[asset_id]:
+ box_width = float(element["width_in"])
+ box_height = float(element["height_in"])
+ fit_scale = min(
+ box_width / int(metadata["width_px"]),
+ box_height / int(metadata["height_px"]),
+ )
+ design_width = int(metadata["width_px"]) * fit_scale
+ design_height = int(metadata["height_px"]) * fit_scale
+ final_width = design_width * scale
+ final_height = design_height * scale
+ dpi_x = int(metadata["width_px"]) / final_width
+ dpi_y = int(metadata["height_px"]) / final_height
+ effective_dpi = min(dpi_x, dpi_y)
+ placement = {
+ "element_id": element["id"],
+ "box_width_in_design": box_width,
+ "box_height_in_design": box_height,
+ "placed_width_in_design": design_width,
+ "placed_height_in_design": design_height,
+ "placed_width_in_final": final_width,
+ "placed_height_in_final": final_height,
+ "effective_dpi_x_final": dpi_x,
+ "effective_dpi_y_final": dpi_y,
+ "minimum_effective_dpi_final": effective_dpi,
+ "pass": effective_dpi + 1e-6 >= minimum_dpi,
+ }
+ if not placement["pass"]:
+ issues.append(
+ {
+ "code": "EFFECTIVE_DPI_TOO_LOW",
+ "asset_id": asset_id,
+ "element_id": element["id"],
+ "message": (
+ f"{effective_dpi:.1f} DPI is below the manifest's "
+ f"{minimum_dpi:.1f} DPI final-output requirement"
+ ),
+ }
+ )
+ if asset["role"] == "qr_code":
+ placement["qr_manual_check"] = (
+ "Test this rendered QR code on the final proof with multiple "
+ "devices; the exact fallback URL is separate visible text."
+ )
+ asset_placements.append(placement)
+ image_records.append(
+ {
+ "id": asset_id,
+ "relative_path": asset["path"],
+ "sha256": asset["sha256"],
+ "source_id": asset["source_id"],
+ "license": asset["license"],
+ "provenance": asset["provenance"],
+ "role": asset["role"],
+ "alt_text": asset["alt_text"],
+ "metadata": metadata,
+ "placements": asset_placements,
+ }
+ )
+ return {
+ "schema_version": "1.0",
+ "manifest": {
+ "path": str(manifest_path),
+ "content_sha256": validation["content_sha256"],
+ },
+ "pass": not issues,
+ "pillow_version": _pillow_version(),
+ "pixel_safety_limit": MAX_IMAGE_PIXELS,
+ "minimum_raster_dpi_final": minimum_dpi,
+ "minimum_raster_dpi_basis": {
+ "kind": document["quality"]["raster_dpi_basis"],
+ "source_id": document["quality"]["raster_dpi_source_id"],
+ },
+ "images": image_records,
+ "issues": issues,
+ "notice": (
+ "Effective DPI is pixels divided by placed inches at final physical "
+ "output, not file metadata DPI. Inspect the printer proof for resampling, "
+ "compression, color conversion, and QR reliability."
+ ),
+ }
+
+
+def build_parser() -> argparse.ArgumentParser:
+ parser = argparse.ArgumentParser(
+ description=(
+ "Fully decode approved local PNG/JPEG assets, report hashes, provenance, "
+ "permission, and metadata, and calculate effective DPI at final physical "
+ "placement. No network or image generation is used."
+ )
+ )
+ parser.add_argument("manifest", help="approved local poster manifest JSON")
+ parser.add_argument("--output", help="optional new JSON asset-manifest path")
+ return parser
+
+
+def main(argv: list[str] | None = None) -> int:
+ parser = build_parser()
+ try:
+ args = parser.parse_args(argv)
+ manifest_path, document, validation = load_and_validate_manifest(
+ args.manifest,
+ verify_assets=True,
+ require_approval=True,
+ )
+ report = build_inventory(manifest_path, document, validation)
+ emit_json(report, output=args.output)
+ return 0 if report["pass"] else 1
+ except CliError as exc:
+ parser.exit(2, f"error: {exc}\n")
+
+
+if __name__ == "__main__":
+ sys.exit(main())
diff --git a/skills/pptx-posters/scripts/plan_export.py b/skills/pptx-posters/scripts/plan_export.py
new file mode 100644
index 00000000..4ac89688
--- /dev/null
+++ b/skills/pptx-posters/scripts/plan_export.py
@@ -0,0 +1,201 @@
+#!/usr/bin/env python3
+"""Create a requirement-bound PowerPoint export and print plan."""
+
+from __future__ import annotations
+
+import argparse
+import sys
+from typing import Any
+
+from _common import CliError, emit_json
+from _manifest import load_and_validate_manifest
+
+
+def build_export_plan(
+ document: dict[str, Any],
+ validation: dict[str, Any],
+) -> dict[str, Any]:
+ canvas = validation["canvas"]
+ physical = validation["physical_output"]
+ conference = document["requirements"]["conference"]
+ printer = document["requirements"]["printer"]
+ delivery = conference["required_delivery_format"]
+ color_mode = printer["accepted_color_mode"]
+ print_scale = float(physical["print_scale"])
+ font_faces = sorted(
+ {
+ element["font_face"]
+ for element in document["elements"]
+ if element["type"] == "text"
+ }
+ )
+
+ blockers: list[dict[str, str]] = []
+ manual_actions: list[str] = [
+ "Open only the generated, technically inspected .pptx in a fully patched PowerPoint.",
+ "Run Review > Check Accessibility, inspect the Reading Order pane, and test keyboard/screen-reader navigation.",
+ "Inspect every edge, text box, figure, equation, glyph, and QR fallback at 100% and at final-output scale.",
+ "Confirm every declared font is installed and licensed on the review/export workstation; inspect substitution in PowerPoint and the exported PDF.",
+ ]
+ if color_mode == "CMYK":
+ blockers.append(
+ {
+ "code": "CMYK_CONVERSION_REQUIRED",
+ "message": (
+ "PowerPoint is an RGB authoring workflow. The confirmed printer "
+ "requires CMYK, so obtain a printer-approved conversion/profile "
+ "and proof; this tool cannot claim the PPTX or native PDF is "
+ "CMYK-compliant."
+ ),
+ }
+ )
+ elif color_mode == "PRINTER_MANAGED":
+ manual_actions.append(
+ "Ask the printer to document its RGB-to-output conversion/profile and approve a color proof."
+ )
+ else:
+ manual_actions.append(
+ "Confirm the printer accepts RGB and approve a physical or contract color proof."
+ )
+
+ if delivery in {"PDF", "PDF_AND_PPTX"}:
+ manual_actions.extend(
+ [
+ "In PowerPoint, export a PDF using Standard/high print quality rather than Minimum size.",
+ "Verify the exported PDF page/artboard dimensions, font rendering, tags, links, and image quality independently.",
+ ]
+ )
+ elif delivery == "OTHER":
+ blockers.append(
+ {
+ "code": "DELIVERY_FORMAT_REVIEW",
+ "message": (
+ "The conference requires an OTHER format; obtain and record the "
+ "exact organizer workflow before delivery."
+ ),
+ }
+ )
+
+ if float(physical["bleed_in"]) > 0:
+ manual_actions.append(
+ "The slide maps to the artboard including bleed. Confirm trim/crop handling with the printer; PowerPoint does not make this a press-ready preflight."
+ )
+ if abs(print_scale - 1.0) > 1e-6:
+ manual_actions.append(
+ f"Scale uniformly to {print_scale * 100.0:.4f}% at output; do not use nonuniform fit-to-page scaling."
+ )
+ else:
+ manual_actions.append("Output at 100% with no fit-to-page rescaling.")
+
+ manual_actions.extend(
+ [
+ "Run inspect_pptx.py, check_layout.py, inventory_images.py, and check_palette.py on the final source package.",
+ "Test-print a reduced-scale proof and obtain author sign-off on scientific content, citations, dimensions, color, and accessibility.",
+ "Retain the exact visible URL/text next to each QR code and test the final printed QR code with multiple devices.",
+ ]
+ )
+ return {
+ "schema_version": "1.0",
+ "manifest": {
+ "path": validation["manifest_path"],
+ "content_sha256": validation["content_sha256"],
+ "approval_status": validation["approval_status"],
+ },
+ "ready_for_manual_export": not blockers,
+ "dimensions": {
+ "powerpoint_canvas_width_in": float(canvas["width_in"]),
+ "powerpoint_canvas_height_in": float(canvas["height_in"]),
+ "final_trim_width_in": float(physical["trim_width_in"]),
+ "final_trim_height_in": float(physical["trim_height_in"]),
+ "bleed_in_each_edge": float(physical["bleed_in"]),
+ "final_artboard_width_in": float(physical["artboard_width_in"]),
+ "final_artboard_height_in": float(physical["artboard_height_in"]),
+ "safe_margin_in_inside_trim": float(physical["safe_margin_in"]),
+ "uniform_print_scale": print_scale,
+ "uniform_print_scale_percent": print_scale * 100.0,
+ },
+ "requirements": {
+ "conference_source_id": conference["source_id"],
+ "conference_max_width_in": conference["max_width_in"],
+ "conference_max_height_in": conference["max_height_in"],
+ "conference_orientation": conference["orientation"],
+ "conference_delivery_format": delivery,
+ "printer_source_id": printer["source_id"],
+ "printer_accepted_color_mode": color_mode,
+ "printer_scaling_allowed": printer["scaling_allowed"],
+ },
+ "powerpoint_constraints": {
+ "custom_dimension_range_in": [1.0, 56.0],
+ "all_slides_same_size": True,
+ "color_authoring_mode": "RGB",
+ "notice": (
+ "Physical trim size, PowerPoint canvas size, and output artboard "
+ "size are separate. Conference and printer records in this manifest, "
+ "not a generic poster preset, control delivery."
+ ),
+ },
+ "quality_thresholds": {
+ "minimum_font_pt_final": document["quality"][
+ "minimum_font_pt_final"
+ ],
+ "font_guidance_basis": document["quality"]["font_guidance_basis"],
+ "font_guidance_source_id": document["quality"][
+ "font_guidance_source_id"
+ ],
+ "minimum_raster_dpi_final": document["quality"][
+ "minimum_raster_dpi_final"
+ ],
+ "raster_dpi_basis": document["quality"]["raster_dpi_basis"],
+ "raster_dpi_source_id": document["quality"][
+ "raster_dpi_source_id"
+ ],
+ },
+ "font_preflight": {
+ "declared_font_faces": font_faces,
+ "fonts_embedded_by_generator": False,
+ "notice": (
+ "A font name in PresentationML does not prove availability, "
+ "embeddability, or correct rendering. PowerPoint and PDF review "
+ "remain required."
+ ),
+ },
+ "media_profile": {
+ "accepted_manifest_assets": ["PNG", "JPEG"],
+ "audio_video_or_linked_media_allowed": False,
+ },
+ "blockers": blockers,
+ "manual_actions": manual_actions,
+ }
+
+
+def build_parser() -> argparse.ArgumentParser:
+ parser = argparse.ArgumentParser(
+ description=(
+ "Create a no-network export/print plan from approved conference and "
+ "printer requirements, explicitly separating canvas, trim, bleed, "
+ "scaling, RGB/CMYK handling, and final-output quality."
+ )
+ )
+ parser.add_argument("manifest", help="approved local poster manifest JSON")
+ parser.add_argument("--output", help="optional new JSON plan path")
+ return parser
+
+
+def main(argv: list[str] | None = None) -> int:
+ parser = build_parser()
+ try:
+ args = parser.parse_args(argv)
+ _, document, validation = load_and_validate_manifest(
+ args.manifest,
+ verify_assets=False,
+ require_approval=True,
+ )
+ report = build_export_plan(document, validation)
+ emit_json(report, output=args.output)
+ return 0 if report["ready_for_manual_export"] else 1
+ except CliError as exc:
+ parser.exit(2, f"error: {exc}\n")
+
+
+if __name__ == "__main__":
+ sys.exit(main())
diff --git a/skills/pptx-posters/scripts/validate_manifest.py b/skills/pptx-posters/scripts/validate_manifest.py
new file mode 100644
index 00000000..2be547b6
--- /dev/null
+++ b/skills/pptx-posters/scripts/validate_manifest.py
@@ -0,0 +1,55 @@
+#!/usr/bin/env python3
+"""Validate a fail-closed, author-approved local poster manifest."""
+
+from __future__ import annotations
+
+import argparse
+import sys
+
+from _common import CliError, emit_json
+from _manifest import load_and_validate_manifest
+
+
+def build_parser() -> argparse.ArgumentParser:
+ parser = argparse.ArgumentParser(
+ description=(
+ "Validate strict poster JSON, exact source IDs, local asset hashes, "
+ "layout bounds, output requirements, and approval binding. No network "
+ "is used."
+ )
+ )
+ parser.add_argument("manifest", help="local poster manifest JSON")
+ parser.add_argument(
+ "--structure-only",
+ action="store_true",
+ help="validate asset paths syntactically without reading or hashing assets",
+ )
+ parser.add_argument(
+ "--print-content-hash",
+ action="store_true",
+ help=(
+ "allow draft approval and report the hash an author must approve; "
+ "all other validation still runs"
+ ),
+ )
+ parser.add_argument("--output", help="optional new JSON report path")
+ return parser
+
+
+def main(argv: list[str] | None = None) -> int:
+ parser = build_parser()
+ try:
+ args = parser.parse_args(argv)
+ _, _, report = load_and_validate_manifest(
+ args.manifest,
+ verify_assets=not args.structure_only,
+ require_approval=not args.print_content_hash,
+ )
+ emit_json(report, output=args.output)
+ return 0
+ except CliError as exc:
+ parser.exit(2, f"error: {exc}\n")
+
+
+if __name__ == "__main__":
+ sys.exit(main())
diff --git a/skills/pptx-posters/tests/synthetic.py b/skills/pptx-posters/tests/synthetic.py
new file mode 100644
index 00000000..29d508cc
--- /dev/null
+++ b/skills/pptx-posters/tests/synthetic.py
@@ -0,0 +1,211 @@
+"""Synthetic manifest builders for local, claim-free tests."""
+
+from __future__ import annotations
+
+from typing import Any
+
+
+def build_manifest(
+ manifest_content_hash: Any,
+ *,
+ include_image: bool = False,
+ image_sha256: str = "0" * 64,
+ image_path: str = "synthetic.png",
+ printer_color_mode: str = "RGB",
+) -> dict[str, Any]:
+ """Return a complete synthetic manifest and bind its approval hash."""
+ sources: list[dict[str, Any]] = [
+ {
+ "id": "SRC-CONFERENCE",
+ "kind": "conference_rule",
+ "citation": "Synthetic test conference rule; no external claim.",
+ "locator": "local-test-conference-record",
+ "author_verified": True,
+ },
+ {
+ "id": "SRC-PRINTER",
+ "kind": "printer_rule",
+ "citation": "Synthetic test printer rule; no external claim.",
+ "locator": "local-test-printer-record",
+ "author_verified": True,
+ },
+ {
+ "id": "SRC-CONTENT",
+ "kind": "author_content",
+ "citation": "Synthetic test content; no scientific claim.",
+ "locator": "local-test-content-record",
+ "author_verified": True,
+ },
+ ]
+ assets: list[dict[str, Any]] = []
+ elements: list[dict[str, Any]] = [
+ {
+ "id": "title",
+ "type": "text",
+ "reading_order": 1,
+ "x_in": 0.5,
+ "y_in": 0.5,
+ "width_in": 9.0,
+ "height_in": 1.0,
+ "source_ids": ["SRC-CONTENT"],
+ "author_approved": True,
+ "allow_in_bleed": False,
+ "role": "title",
+ "text": "Synthetic layout test",
+ "font_size_pt_design": 28.0,
+ "font_face": "Arial",
+ "bold": True,
+ "align": "left",
+ "vertical_align": "middle",
+ "contrast_pair_id": "black_on_white",
+ "line_color_id": None,
+ "line_width_pt": 0,
+ "margin_in": 0.1,
+ },
+ {
+ "id": "body",
+ "type": "text",
+ "reading_order": 2,
+ "x_in": 0.5,
+ "y_in": 1.5,
+ "width_in": 9.0 if not include_image else 4.0,
+ "height_in": 6.0,
+ "source_ids": ["SRC-CONTENT"],
+ "author_approved": True,
+ "allow_in_bleed": False,
+ "role": "body",
+ "text": "Synthetic text used only to test deterministic local generation.",
+ "font_size_pt_design": 18.0,
+ "font_face": "Arial",
+ "bold": False,
+ "align": "left",
+ "vertical_align": "top",
+ "contrast_pair_id": "black_on_white",
+ "line_color_id": None,
+ "line_width_pt": 0,
+ "margin_in": 0.1,
+ },
+ ]
+ if include_image:
+ sources.append(
+ {
+ "id": "SRC-ASSET",
+ "kind": "asset_license",
+ "citation": "Synthetic test image generated locally by the test.",
+ "locator": "local-test-image",
+ "author_verified": True,
+ }
+ )
+ assets.append(
+ {
+ "id": "ASSET-IMAGE",
+ "path": image_path,
+ "role": "figure",
+ "sha256": image_sha256,
+ "source_id": "SRC-ASSET",
+ "license": "Synthetic test fixture only.",
+ "provenance": (
+ "Created locally by the synthetic test from fixed drawing commands."
+ ),
+ "alt_text": (
+ "Blue rectangle on white used only to verify local image placement."
+ ),
+ "author_approved": True,
+ "qr_target": None,
+ }
+ )
+ elements.append(
+ {
+ "id": "image",
+ "type": "image",
+ "reading_order": 3,
+ "x_in": 4.5,
+ "y_in": 1.5,
+ "width_in": 5.0,
+ "height_in": 6.0,
+ "source_ids": ["SRC-ASSET"],
+ "author_approved": True,
+ "allow_in_bleed": False,
+ "asset_id": "ASSET-IMAGE",
+ "fit": "contain",
+ "fallback_text_element_id": None,
+ "long_description_element_id": None,
+ }
+ )
+
+ manifest: dict[str, Any] = {
+ "schema_version": "2.0",
+ "document": {
+ "id": "synthetic-test",
+ "title": "Synthetic layout test",
+ "subject": "Synthetic test input with no scientific claim.",
+ "language": "en-US",
+ "authors": ["Test Author"],
+ "source_ids": ["SRC-CONTENT"],
+ },
+ "canvas": {
+ "width_in": 10.0,
+ "height_in": 8.0,
+ "background_color": "#FFFFFF",
+ },
+ "physical_output": {
+ "trim_width_in": 10.0,
+ "trim_height_in": 8.0,
+ "bleed_in": 0.0,
+ "safe_margin_in": 0.5,
+ "orientation": "landscape",
+ },
+ "requirements": {
+ "conference": {
+ "confirmed": True,
+ "source_id": "SRC-CONFERENCE",
+ "max_width_in": 10.0,
+ "max_height_in": 8.0,
+ "orientation": "landscape",
+ "required_delivery_format": "PPTX",
+ "notes": "Synthetic local requirement used only by tests.",
+ },
+ "printer": {
+ "confirmed": True,
+ "source_id": "SRC-PRINTER",
+ "trim_width_in": 10.0,
+ "trim_height_in": 8.0,
+ "bleed_in": 0.0,
+ "safe_margin_in": 0.5,
+ "accepted_color_mode": printer_color_mode,
+ "scaling_allowed": False,
+ "notes": "Synthetic local printer record used only by tests.",
+ },
+ },
+ "quality": {
+ "minimum_font_pt_final": 18.0,
+ "font_guidance_basis": "heuristic",
+ "font_guidance_source_id": None,
+ "minimum_raster_dpi_final": 100.0,
+ "raster_dpi_basis": "heuristic",
+ "raster_dpi_source_id": None,
+ },
+ "palette": {
+ "colors": {"black": "#000000", "white": "#FFFFFF"},
+ "contrast_pairs": [
+ {
+ "id": "black_on_white",
+ "foreground_color_id": "black",
+ "background_color_id": "white",
+ "usage": "normal_text",
+ }
+ ],
+ "data_series_redundant_encoding": True,
+ },
+ "sources": sources,
+ "assets": assets,
+ "elements": elements,
+ "approval": {
+ "status": "approved",
+ "approved_by": "Test Author",
+ "approved_at": "2026-07-23T12:00:00+00:00",
+ "content_sha256": "",
+ },
+ }
+ manifest["approval"]["content_sha256"] = manifest_content_hash(manifest)
+ return manifest
diff --git a/skills/pptx-posters/tests/test_generation_smoke.py b/skills/pptx-posters/tests/test_generation_smoke.py
new file mode 100644
index 00000000..818c2f21
--- /dev/null
+++ b/skills/pptx-posters/tests/test_generation_smoke.py
@@ -0,0 +1,204 @@
+"""Exact-pinned synthetic PPTX generation and audit smoke test."""
+
+from __future__ import annotations
+
+import hashlib
+import json
+import stat
+import sys
+import tempfile
+import unittest
+import xml.etree.ElementTree as ET
+import zipfile
+from importlib.metadata import PackageNotFoundError, version
+from pathlib import Path
+
+SKILL_ROOT = Path(__file__).resolve().parents[1]
+SCRIPTS = SKILL_ROOT / "scripts"
+TESTS = SKILL_ROOT / "tests"
+sys.path.insert(0, str(SCRIPTS))
+sys.path.insert(0, str(TESTS))
+
+from _common import CliError # noqa: E402
+from _manifest import load_and_validate_manifest, manifest_content_hash # noqa: E402
+from _pptx import P_NS, analyze_layout, inspect_pptx # noqa: E402
+from check_layout import apply_manifest_checks # noqa: E402
+from generate_poster import generate_poster # noqa: E402
+from inventory_images import build_inventory # noqa: E402
+from synthetic import build_manifest # noqa: E402
+
+EXPECTED = {
+ "python-pptx": "1.0.2",
+ "Pillow": "12.3.0",
+ "lxml": "6.1.1",
+}
+
+
+def exact_dependencies_available() -> bool:
+ try:
+ return all(version(name) == expected for name, expected in EXPECTED.items())
+ except PackageNotFoundError:
+ return False
+
+
+ exact_dependencies_available(),
+ "run with the exact pins in assets/generation_dependencies.json",
+)
+class GenerationSmokeTests(unittest.TestCase):
+ def test_hidden_image_metadata_is_a_release_blocker(self) -> None:
+ from PIL import Image, PngImagePlugin
+
+ with tempfile.TemporaryDirectory() as directory:
+ root = Path(directory)
+ image_path = root / "synthetic.png"
+ metadata = PngImagePlugin.PngInfo()
+ metadata.add_text("Comment", "Synthetic hidden metadata")
+ Image.new("RGB", (600, 480), "white").save(
+ image_path,
+ format="PNG",
+ pnginfo=metadata,
+ )
+ digest = hashlib.sha256(image_path.read_bytes()).hexdigest()
+ manifest = build_manifest(
+ manifest_content_hash,
+ include_image=True,
+ image_sha256=digest,
+ )
+ validation = {
+ "manifest_path": str(root / "poster.json"),
+ "content_sha256": manifest["approval"]["content_sha256"],
+ "physical_output": {"print_scale": 1.0},
+ }
+ inventory = build_inventory(
+ root / "poster.json",
+ manifest,
+ validation,
+ )
+ self.assertFalse(inventory["pass"])
+ self.assertIn(
+ "HIDDEN_IMAGE_METADATA",
+ {issue["code"] for issue in inventory["issues"]},
+ )
+
+ def test_generate_inspect_layout_inventory_alt_text_and_no_overwrite(self) -> None:
+ from PIL import Image, ImageDraw
+ from pptx import Presentation
+
+ with tempfile.TemporaryDirectory() as directory:
+ root = Path(directory)
+ image_path = root / "synthetic.png"
+ image = Image.new("RGB", (600, 480), "white")
+ drawing = ImageDraw.Draw(image)
+ drawing.rectangle((60, 60, 540, 420), fill="#4477AA")
+ image.save(image_path, format="PNG")
+ digest = hashlib.sha256(image_path.read_bytes()).hexdigest()
+
+ manifest = build_manifest(
+ manifest_content_hash,
+ include_image=True,
+ image_sha256=digest,
+ )
+ manifest_path = root / "poster.json"
+ manifest_path.write_text(
+ json.dumps(manifest, indent=2) + "\n",
+ encoding="utf-8",
+ )
+ output = root / "poster.pptx"
+ generation = generate_poster(manifest_path, output)
+
+ self.assertTrue(output.is_file())
+ self.assertEqual(
+ stat.S_IMODE(output.stat().st_mode),
+ 0o600,
+ )
+ self.assertEqual(generation["dependencies"], EXPECTED)
+ self.assertEqual(generation["technical_checks"]["picture_count"], 1)
+ self.assertEqual(
+ generation["technical_checks"]["pictures_with_alt_text"],
+ 1,
+ )
+
+ package = inspect_pptx(output)
+ self.assertTrue(package["safe"], package["findings"])
+ self.assertEqual(
+ package["accessibility"]["pictures_missing_alt_text"],
+ [],
+ )
+ self.assertEqual(package["accessibility"]["slide_title_count"], 1)
+ self.assertEqual(
+ package["accessibility"]["text_runs_missing_language"],
+ [],
+ )
+
+ layout = analyze_layout(
+ output,
+ print_scale=1.0,
+ minimum_font_pt_final=18.0,
+ )
+ self.assertTrue(layout["pass"], layout["issues"])
+ self.assertEqual(layout["slide_size"]["width_in"], 10.0)
+ self.assertEqual(layout["slide_size"]["height_in"], 8.0)
+ _, approved_document, approved_validation = load_and_validate_manifest(
+ manifest_path
+ )
+ apply_manifest_checks(
+ layout,
+ approved_document,
+ approved_validation,
+ )
+ self.assertEqual(layout["issues"], [])
+
+ validation = {
+ "manifest_path": str(manifest_path),
+ "content_sha256": manifest["approval"]["content_sha256"],
+ "physical_output": {"print_scale": 1.0},
+ }
+ inventory = build_inventory(manifest_path, manifest, validation)
+ self.assertTrue(inventory["pass"], inventory["issues"])
+ placement = inventory["images"][0]["placements"][0]
+ self.assertGreaterEqual(
+ placement["minimum_effective_dpi_final"],
+ 100.0,
+ )
+
+ with zipfile.ZipFile(output, "r") as archive:
+ self.assertFalse(
+ any(
+ name.startswith("ppt/printerSettings/")
+ for name in archive.namelist()
+ )
+ )
+ slide = ET.fromstring(archive.read("ppt/slides/slide1.xml"))
+ descriptions = [
+ node.attrib.get("descr")
+ for node in slide.findall(f".//{{{P_NS}}}cNvPr")
+ if node.attrib.get("name", "").endswith("_IMAGE_image")
+ ]
+ self.assertEqual(
+ descriptions,
+ [
+ "Blue rectangle on white used only to verify local image placement."
+ ],
+ )
+ reopened = Presentation(output)
+ self.assertEqual(len(reopened.slides), 1)
+ self.assertEqual(len(reopened.slides[0].shapes), 3)
+ self.assertEqual(
+ reopened.slides[0].shapes.title.text,
+ "Synthetic layout test",
+ )
+
+ second_output = root / "poster-second.pptx"
+ second_generation = generate_poster(manifest_path, second_output)
+ self.assertEqual(
+ generation["output"]["sha256"],
+ second_generation["output"]["sha256"],
+ )
+
+ with self.assertRaisesRegex(CliError, "overwrite"):
+ generate_poster(manifest_path, output)
+
+
+if __name__ == "__main__":
+ unittest.main()
diff --git a/skills/pptx-posters/tests/test_scripts.py b/skills/pptx-posters/tests/test_scripts.py
new file mode 100644
index 00000000..bae97ba4
--- /dev/null
+++ b/skills/pptx-posters/tests/test_scripts.py
@@ -0,0 +1,669 @@
+"""Dependency-free synthetic tests for manifest and PPTX security helpers."""
+
+from __future__ import annotations
+
+import contextlib
+import io
+import json
+import sys
+import tempfile
+import unittest
+import zipfile
+from pathlib import Path
+
+SKILL_ROOT = Path(__file__).resolve().parents[1]
+SCRIPTS = SKILL_ROOT / "scripts"
+TESTS = SKILL_ROOT / "tests"
+sys.path.insert(0, str(SCRIPTS))
+sys.path.insert(0, str(TESTS))
+
+from _common import CliError, atomic_write_bytes, load_json_file # noqa: E402
+from _manifest import ( # noqa: E402
+ manifest_content_hash,
+ validate_manifest_document,
+)
+from _pptx import MAX_MEMBERS, inspect_pptx, require_safe_pptx # noqa: E402
+from check_palette import audit_palette, main as palette_main # noqa: E402
+from plan_export import build_export_plan # noqa: E402
+from synthetic import build_manifest # noqa: E402
+
+CONTENT_TYPES = """<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
+<Types xmlns="http://schemas.openxmlformats.org/package/2006/content-types">
+ <Default Extension="rels" ContentType="application/vnd.openxmlformats-package.relationships+xml"/>
+ <Default Extension="xml" ContentType="application/xml"/>
+ <Override PartName="/ppt/presentation.xml" ContentType="application/vnd.openxmlformats-officedocument.presentationml.presentation.main+xml"/>
+ <Override PartName="/ppt/slides/slide1.xml" ContentType="application/vnd.openxmlformats-officedocument.presentationml.slide+xml"/>
+</Types>
+"""
+ROOT_RELS = """<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
+<Relationships xmlns="http://schemas.openxmlformats.org/package/2006/relationships">
+ <Relationship Id="rId1" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/officeDocument" Target="ppt/presentation.xml"/>
+</Relationships>
+"""
+PRESENTATION = """<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
+<p:presentation xmlns:p="http://schemas.openxmlformats.org/presentationml/2006/main"
+ xmlns:r="http://schemas.openxmlformats.org/officeDocument/2006/relationships">
+ <p:sldIdLst><p:sldId id="256" r:id="rId1"/></p:sldIdLst>
+ <p:sldSz cx="9144000" cy="7315200"/>
+ <p:notesSz cx="6858000" cy="9144000"/>
+</p:presentation>
+"""
+PRESENTATION_RELS = """<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
+<Relationships xmlns="http://schemas.openxmlformats.org/package/2006/relationships">
+ <Relationship Id="rId1" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/slide" Target="slides/slide1.xml"/>
+</Relationships>
+"""
+SLIDE = """<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
+<p:sld xmlns:p="http://schemas.openxmlformats.org/presentationml/2006/main"
+ xmlns:a="http://schemas.openxmlformats.org/drawingml/2006/main">
+ <p:cSld><p:spTree>
+ <p:nvGrpSpPr><p:cNvPr id="1" name=""/><p:cNvGrpSpPr/><p:nvPr/></p:nvGrpSpPr>
+ <p:grpSpPr/>
+ <p:sp>
+ <p:nvSpPr><p:cNvPr id="2" name="Title 1"/><p:cNvSpPr/><p:nvPr><p:ph type="title"/></p:nvPr></p:nvSpPr>
+ <p:spPr><a:xfrm><a:off x="0" y="0"/><a:ext cx="9144000" cy="914400"/></a:xfrm></p:spPr>
+ <p:txBody><a:bodyPr/><a:lstStyle/><a:p><a:r><a:rPr lang="en-US" sz="1800"/><a:t>Synthetic title</a:t></a:r></a:p></p:txBody>
+ </p:sp>
+ </p:spTree></p:cSld>
+</p:sld>
+"""
+
+
+def write_minimal_pptx(
+ path: Path,
+ *,
+ content_types: str = CONTENT_TYPES,
+ root_relationships: str = ROOT_RELS,
+ extras: dict[str, bytes] | None = None,
+) -> None:
+ members = {
+ "[Content_Types].xml": content_types.encode("utf-8"),
+ "_rels/.rels": root_relationships.encode("utf-8"),
+ "ppt/presentation.xml": PRESENTATION.encode("utf-8"),
+ "ppt/_rels/presentation.xml.rels": PRESENTATION_RELS.encode("utf-8"),
+ "ppt/slides/slide1.xml": SLIDE.encode("utf-8"),
+ }
+ members.update(extras or {})
+ with zipfile.ZipFile(
+ path, "w", compression=zipfile.ZIP_DEFLATED, compresslevel=6
+ ) as archive:
+ for name, payload in members.items():
+ archive.writestr(name, payload)
+
+
+class ManifestTests(unittest.TestCase):
+ def test_complete_synthetic_manifest_passes(self) -> None:
+ with tempfile.TemporaryDirectory() as directory:
+ path = Path(directory) / "poster.json"
+ manifest = build_manifest(manifest_content_hash)
+ report = validate_manifest_document(
+ manifest,
+ manifest_path=path,
+ verify_assets=False,
+ require_approval=True,
+ )
+ self.assertTrue(report["valid"])
+ self.assertEqual(report["approval_status"], "approved")
+ self.assertEqual(report["counts"]["elements"], 2)
+
+ def test_placeholder_fails_closed(self) -> None:
+ manifest = build_manifest(manifest_content_hash)
+ manifest["document"]["title"] = "REPLACE_ME_TITLE"
+ with tempfile.TemporaryDirectory() as directory:
+ with self.assertRaisesRegex(CliError, "placeholder"):
+ validate_manifest_document(
+ manifest,
+ manifest_path=Path(directory) / "poster.json",
+ verify_assets=False,
+ )
+
+ def test_unknown_exact_source_id_is_rejected(self) -> None:
+ manifest = build_manifest(manifest_content_hash)
+ manifest["elements"][1]["source_ids"] = ["SRC-MISSING"]
+ with tempfile.TemporaryDirectory() as directory:
+ with self.assertRaisesRegex(CliError, "unknown exact source"):
+ validate_manifest_document(
+ manifest,
+ manifest_path=Path(directory) / "poster.json",
+ verify_assets=False,
+ )
+
+ def test_title_must_be_first_in_reading_order(self) -> None:
+ manifest = build_manifest(manifest_content_hash)
+ manifest["elements"][0]["reading_order"] = 2
+ manifest["elements"][1]["reading_order"] = 1
+ manifest["elements"].reverse()
+ manifest["approval"]["content_sha256"] = manifest_content_hash(manifest)
+ with tempfile.TemporaryDirectory() as directory:
+ with self.assertRaisesRegex(CliError, "title element"):
+ validate_manifest_document(
+ manifest,
+ manifest_path=Path(directory) / "poster.json",
+ verify_assets=False,
+ )
+
+ def test_asset_requires_explicit_provenance(self) -> None:
+ manifest = build_manifest(
+ manifest_content_hash,
+ include_image=True,
+ )
+ del manifest["assets"][0]["provenance"]
+ with tempfile.TemporaryDirectory() as directory:
+ with self.assertRaisesRegex(CliError, "provenance"):
+ validate_manifest_document(
+ manifest,
+ manifest_path=Path(directory) / "poster.json",
+ verify_assets=False,
+ )
+
+ def test_long_description_is_source_bound_and_follows_image(self) -> None:
+ manifest = build_manifest(
+ manifest_content_hash,
+ include_image=True,
+ )
+ manifest["elements"][2]["height_in"] = 4.5
+ manifest["elements"][2]["long_description_element_id"] = "image-description"
+ manifest["elements"].append(
+ {
+ "id": "image-description",
+ "type": "text",
+ "reading_order": 4,
+ "x_in": 4.5,
+ "y_in": 6.25,
+ "width_in": 5.0,
+ "height_in": 1.25,
+ "source_ids": ["SRC-ASSET"],
+ "author_approved": True,
+ "allow_in_bleed": False,
+ "role": "caption",
+ "text": (
+ "Synthetic long description bound to the local test-image source."
+ ),
+ "font_size_pt_design": 18.0,
+ "font_face": "Arial",
+ "bold": False,
+ "align": "left",
+ "vertical_align": "top",
+ "contrast_pair_id": "black_on_white",
+ "line_color_id": None,
+ "line_width_pt": 0,
+ "margin_in": 0.1,
+ }
+ )
+ manifest["approval"]["content_sha256"] = manifest_content_hash(manifest)
+ with tempfile.TemporaryDirectory() as directory:
+ path = Path(directory) / "poster.json"
+ report = validate_manifest_document(
+ manifest,
+ manifest_path=path,
+ verify_assets=False,
+ )
+ self.assertTrue(report["valid"])
+ manifest["elements"][3]["source_ids"] = ["SRC-CONTENT"]
+ manifest["approval"]["content_sha256"] = manifest_content_hash(manifest)
+ with self.assertRaisesRegex(CliError, "every source_id"):
+ validate_manifest_document(
+ manifest,
+ manifest_path=path,
+ verify_assets=False,
+ )
+
+ def test_content_change_invalidates_author_approval(self) -> None:
+ manifest = build_manifest(manifest_content_hash)
+ manifest["elements"][1]["text"] += " Changed."
+ with tempfile.TemporaryDirectory() as directory:
+ with self.assertRaisesRegex(CliError, "approval.content_sha256"):
+ validate_manifest_document(
+ manifest,
+ manifest_path=Path(directory) / "poster.json",
+ verify_assets=False,
+ )
+
+ def test_control_characters_are_rejected_before_generation(self) -> None:
+ manifest = build_manifest(manifest_content_hash)
+ manifest["document"]["title"] = "Unsafe\u0001title"
+ manifest["elements"][0]["text"] = "Unsafe\u0001title"
+ with tempfile.TemporaryDirectory() as directory:
+ with self.assertRaisesRegex(CliError, "control character"):
+ validate_manifest_document(
+ manifest,
+ manifest_path=Path(directory) / "poster.json",
+ verify_assets=False,
+ )
+
+ def test_remote_asset_path_is_rejected(self) -> None:
+ manifest = build_manifest(
+ manifest_content_hash,
+ include_image=True,
+ image_path="https://invalid.example/image.png",
+ )
+ with tempfile.TemporaryDirectory() as directory:
+ with self.assertRaisesRegex(CliError, "relative local path"):
+ validate_manifest_document(
+ manifest,
+ manifest_path=Path(directory) / "poster.json",
+ verify_assets=False,
+ )
+
+ def test_qr_requires_exact_visible_fallback_url(self) -> None:
+ manifest = build_manifest(
+ manifest_content_hash,
+ include_image=True,
+ )
+ asset = manifest["assets"][0]
+ asset["role"] = "qr_code"
+ asset["qr_target"] = "https://example.invalid/exact"
+ image = manifest["elements"][2]
+ image["height_in"] = 5.0
+ image["fallback_text_element_id"] = "qr-fallback"
+ manifest["elements"].append(
+ {
+ "id": "qr-fallback",
+ "type": "text",
+ "reading_order": 4,
+ "x_in": 4.5,
+ "y_in": 6.5,
+ "width_in": 5.0,
+ "height_in": 1.0,
+ "source_ids": ["SRC-ASSET"],
+ "author_approved": True,
+ "allow_in_bleed": False,
+ "role": "qr_fallback",
+ "text": "Destination: https://example.invalid/exact",
+ "font_size_pt_design": 18.0,
+ "font_face": "Arial",
+ "bold": False,
+ "align": "left",
+ "vertical_align": "middle",
+ "contrast_pair_id": "black_on_white",
+ "line_color_id": None,
+ "line_width_pt": 0,
+ "margin_in": 0.1,
+ }
+ )
+ manifest["approval"]["content_sha256"] = manifest_content_hash(manifest)
+ with tempfile.TemporaryDirectory() as directory:
+ path = Path(directory) / "poster.json"
+ report = validate_manifest_document(
+ manifest,
+ manifest_path=path,
+ verify_assets=False,
+ )
+ self.assertTrue(report["valid"])
+ manifest["elements"][3]["text"] = "Destination omitted"
+ manifest["approval"]["content_sha256"] = manifest_content_hash(manifest)
+ with self.assertRaisesRegex(CliError, "exact QR target"):
+ validate_manifest_document(
+ manifest,
+ manifest_path=path,
+ verify_assets=False,
+ )
+
+ def test_bad_declared_contrast_is_rejected(self) -> None:
+ manifest = build_manifest(manifest_content_hash)
+ manifest["palette"]["colors"]["black"] = "#777777"
+ with tempfile.TemporaryDirectory() as directory:
+ with self.assertRaisesRegex(CliError, "below"):
+ validate_manifest_document(
+ manifest,
+ manifest_path=Path(directory) / "poster.json",
+ verify_assets=False,
+ )
+
+ def test_bad_contrast_can_be_reported_by_palette_audit(self) -> None:
+ manifest = build_manifest(manifest_content_hash)
+ manifest["palette"]["colors"]["black"] = "#777777"
+ manifest["approval"]["content_sha256"] = manifest_content_hash(manifest)
+ with tempfile.TemporaryDirectory() as directory:
+ validation = validate_manifest_document(
+ manifest,
+ manifest_path=Path(directory) / "poster.json",
+ verify_assets=False,
+ enforce_contrast=False,
+ )
+ self.assertTrue(validation["valid"])
+ report = audit_palette(manifest)
+ self.assertFalse(report["pass"])
+
+ def test_palette_cli_uses_finding_exit_code(self) -> None:
+ manifest = build_manifest(manifest_content_hash)
+ manifest["palette"]["colors"]["black"] = "#777777"
+ manifest["approval"]["content_sha256"] = manifest_content_hash(manifest)
+ with tempfile.TemporaryDirectory() as directory:
+ path = Path(directory) / "poster.json"
+ path.write_text(json.dumps(manifest), encoding="utf-8")
+ with contextlib.redirect_stdout(io.StringIO()):
+ result = palette_main([str(path)])
+ self.assertEqual(result, 1)
+
+ def test_template_is_not_valid_content(self) -> None:
+ template_path = SKILL_ROOT / "assets" / "poster_manifest_template.json"
+ _, template = load_json_file(template_path)
+ with self.assertRaises(CliError):
+ validate_manifest_document(
+ template,
+ manifest_path=template_path,
+ verify_assets=False,
+ require_approval=False,
+ )
+
+ def test_uniform_physical_scaling_is_explicit(self) -> None:
+ manifest = build_manifest(manifest_content_hash)
+ manifest["physical_output"]["trim_width_in"] = 20.0
+ manifest["physical_output"]["trim_height_in"] = 16.0
+ manifest["requirements"]["conference"]["max_width_in"] = 20.0
+ manifest["requirements"]["conference"]["max_height_in"] = 16.0
+ manifest["requirements"]["printer"]["trim_width_in"] = 20.0
+ manifest["requirements"]["printer"]["trim_height_in"] = 16.0
+ manifest["requirements"]["printer"]["scaling_allowed"] = True
+ manifest["approval"]["content_sha256"] = manifest_content_hash(manifest)
+ with tempfile.TemporaryDirectory() as directory:
+ report = validate_manifest_document(
+ manifest,
+ manifest_path=Path(directory) / "poster.json",
+ verify_assets=False,
+ )
+ self.assertEqual(report["physical_output"]["print_scale"], 2.0)
+
+ def test_nonuniform_physical_scaling_is_rejected(self) -> None:
+ manifest = build_manifest(manifest_content_hash)
+ manifest["physical_output"]["trim_width_in"] = 20.0
+ manifest["physical_output"]["trim_height_in"] = 15.0
+ manifest["requirements"]["conference"]["max_width_in"] = 20.0
+ manifest["requirements"]["conference"]["max_height_in"] = 15.0
+ manifest["requirements"]["printer"]["trim_width_in"] = 20.0
+ manifest["requirements"]["printer"]["trim_height_in"] = 15.0
+ manifest["requirements"]["printer"]["scaling_allowed"] = True
+ manifest["approval"]["content_sha256"] = manifest_content_hash(manifest)
+ with tempfile.TemporaryDirectory() as directory:
+ with self.assertRaisesRegex(CliError, "aspect ratios"):
+ validate_manifest_document(
+ manifest,
+ manifest_path=Path(directory) / "poster.json",
+ verify_assets=False,
+ )
+
+ def test_duplicate_json_key_is_rejected(self) -> None:
+ with tempfile.TemporaryDirectory() as directory:
+ path = Path(directory) / "duplicate.json"
+ path.write_text('{"key": 1, "key": 2}', encoding="utf-8")
+ with self.assertRaisesRegex(CliError, "duplicate JSON key"):
+ load_json_file(path)
+
+
+class OutputSafetyTests(unittest.TestCase):
+ def test_output_never_overwrites(self) -> None:
+ with tempfile.TemporaryDirectory() as directory:
+ path = Path(directory) / "report.json"
+ atomic_write_bytes(path, b"first")
+ with self.assertRaisesRegex(CliError, "overwrite"):
+ atomic_write_bytes(path, b"second")
+ self.assertEqual(path.read_bytes(), b"first")
+
+
+class PaletteAndPlanTests(unittest.TestCase):
+ def test_palette_reports_reference_contrast(self) -> None:
+ manifest = build_manifest(manifest_content_hash)
+ report = audit_palette(manifest)
+ self.assertTrue(report["pass"])
+ self.assertEqual(
+ report["declared_contrast_pairs"][0]["ratio"],
+ 21.0,
+ )
+
+ def test_cmyk_requirement_blocks_readiness(self) -> None:
+ manifest = build_manifest(
+ manifest_content_hash,
+ printer_color_mode="CMYK",
+ )
+ with tempfile.TemporaryDirectory() as directory:
+ validation = validate_manifest_document(
+ manifest,
+ manifest_path=Path(directory) / "poster.json",
+ verify_assets=False,
+ )
+ plan = build_export_plan(manifest, validation)
+ self.assertFalse(plan["ready_for_manual_export"])
+ self.assertEqual(plan["blockers"][0]["code"], "CMYK_CONVERSION_REQUIRED")
+ self.assertEqual(plan["font_preflight"]["declared_font_faces"], ["Arial"])
+ self.assertFalse(plan["font_preflight"]["fonts_embedded_by_generator"])
+ self.assertFalse(
+ plan["media_profile"]["audio_video_or_linked_media_allowed"]
+ )
+
+
+class PptxSecurityTests(unittest.TestCase):
+ def test_minimal_macro_free_package_passes(self) -> None:
+ with tempfile.TemporaryDirectory() as directory:
+ path = Path(directory) / "safe.pptx"
+ write_minimal_pptx(path)
+ report = inspect_pptx(path)
+ self.assertTrue(report["safe"], report["findings"])
+ self.assertEqual(report["accessibility"]["slide_title_count"], 1)
+ self.assertEqual(
+ report["accessibility"]["text_runs_missing_language"],
+ [],
+ )
+ require_safe_pptx(path)
+
+ def test_pptm_extension_is_rejected_without_opening(self) -> None:
+ with tempfile.TemporaryDirectory() as directory:
+ path = Path(directory) / "unsafe.pptm"
+ write_minimal_pptx(path)
+ report = inspect_pptx(path)
+ self.assertFalse(report["safe"])
+ self.assertEqual(report["findings"][0]["code"], "FILE_EXTENSION")
+
+ def test_external_relationship_is_rejected(self) -> None:
+ relationships = ROOT_RELS.replace(
+ "</Relationships>",
+ (
+ '<Relationship Id="rId2" '
+ 'Type="http://schemas.openxmlformats.org/officeDocument/2006/'
+ 'relationships/hyperlink" Target="https://invalid.example/" '
+ 'TargetMode="External"/></Relationships>'
+ ),
+ )
+ with tempfile.TemporaryDirectory() as directory:
+ path = Path(directory) / "external.pptx"
+ write_minimal_pptx(path, root_relationships=relationships)
+ report = inspect_pptx(path)
+ self.assertFalse(report["safe"])
+ self.assertIn(
+ "EXTERNAL_RELATIONSHIP",
+ {finding["code"] for finding in report["findings"]},
+ )
+
+ def test_invalid_relationship_target_mode_is_rejected(self) -> None:
+ relationships = ROOT_RELS.replace(
+ "</Relationships>",
+ (
+ '<Relationship Id="rId2" '
+ 'Type="http://schemas.openxmlformats.org/officeDocument/2006/'
+ 'relationships/image" Target="ppt/media/image1.png" '
+ 'TargetMode="Unknown"/></Relationships>'
+ ),
+ )
+ with tempfile.TemporaryDirectory() as directory:
+ path = Path(directory) / "target-mode.pptx"
+ write_minimal_pptx(path, root_relationships=relationships)
+ report = inspect_pptx(path)
+ self.assertFalse(report["safe"])
+ self.assertIn(
+ "RELATIONSHIP_TARGET_MODE_INVALID",
+ {finding["code"] for finding in report["findings"]},
+ )
+
+ def test_remote_linked_image_is_rejected(self) -> None:
+ relationships = ROOT_RELS.replace(
+ "</Relationships>",
+ (
+ '<Relationship Id="rId2" '
+ 'Type="http://schemas.openxmlformats.org/officeDocument/2006/'
+ 'relationships/image" Target="https://invalid.example/image.png" '
+ 'TargetMode="External"/></Relationships>'
+ ),
+ )
+ with tempfile.TemporaryDirectory() as directory:
+ path = Path(directory) / "linked-image.pptx"
+ write_minimal_pptx(path, root_relationships=relationships)
+ report = inspect_pptx(path)
+ self.assertFalse(report["safe"])
+ self.assertIn(
+ "REMOTE_LINKED_IMAGE",
+ {finding["code"] for finding in report["findings"]},
+ )
+
+ def test_macro_content_hidden_in_pptx_is_rejected(self) -> None:
+ macro_types = CONTENT_TYPES.replace(
+ "</Types>",
+ (
+ '<Override PartName="/ppt/vbaProject.bin" '
+ 'ContentType="application/vnd.ms-office.vbaProject"/></Types>'
+ ),
+ )
+ with tempfile.TemporaryDirectory() as directory:
+ path = Path(directory) / "macro-disguised.pptx"
+ write_minimal_pptx(
+ path,
+ content_types=macro_types,
+ )
+ report = inspect_pptx(path)
+ self.assertFalse(report["safe"])
+ codes = {finding["code"] for finding in report["findings"]}
+ self.assertIn("FORBIDDEN_CONTENT_TYPE", codes)
+
+ def test_ole_markup_without_payload_is_rejected(self) -> None:
+ slide = (
+ b'<?xml version="1.0" encoding="UTF-8"?>'
+ b'<p:sld xmlns:p="http://schemas.openxmlformats.org/'
+ b'presentationml/2006/main"><p:oleObj/></p:sld>'
+ )
+ with tempfile.TemporaryDirectory() as directory:
+ path = Path(directory) / "ole-markup.pptx"
+ write_minimal_pptx(
+ path,
+ extras={"ppt/slides/slide1.xml": slide},
+ )
+ report = inspect_pptx(path)
+ self.assertFalse(report["safe"])
+ self.assertIn(
+ "FORBIDDEN_PRESENTATION_MARKUP",
+ {finding["code"] for finding in report["findings"]},
+ )
+
+ def test_non_utf8_entity_bearing_xml_is_rejected(self) -> None:
+ unsafe_slide = (
+ '<?xml version="1.0" encoding="UTF-16"?>'
+ '<!DOCTYPE p:sld [<!ENTITY x "unsafe">]>'
+ '<p:sld xmlns:p="http://schemas.openxmlformats.org/'
+ 'presentationml/2006/main">&x;</p:sld>'
+ ).encode("utf-16")
+ with tempfile.TemporaryDirectory() as directory:
+ path = Path(directory) / "utf16-entity.pptx"
+ write_minimal_pptx(
+ path,
+ extras={"ppt/slides/slide1.xml": unsafe_slide},
+ )
+ report = inspect_pptx(path)
+ self.assertFalse(report["safe"])
+ self.assertIn(
+ "XML_PART_INVALID",
+ {finding["code"] for finding in report["findings"]},
+ )
+
+ def test_traversal_member_is_rejected(self) -> None:
+ with tempfile.TemporaryDirectory() as directory:
+ path = Path(directory) / "traversal.pptx"
+ write_minimal_pptx(path, extras={"../escape.txt": b"unsafe"})
+ report = inspect_pptx(path)
+ self.assertFalse(report["safe"])
+ self.assertIn(
+ "ZIP_TRAVERSAL",
+ {finding["code"] for finding in report["findings"]},
+ )
+
+ def test_unknown_package_part_is_rejected(self) -> None:
+ with tempfile.TemporaryDirectory() as directory:
+ path = Path(directory) / "unknown-part.pptx"
+ write_minimal_pptx(path, extras={"ppt/unknown.dat": b"opaque"})
+ report = inspect_pptx(path)
+ self.assertFalse(report["safe"])
+ self.assertIn(
+ "UNKNOWN_PACKAGE_PART",
+ {finding["code"] for finding in report["findings"]},
+ )
+
+ def test_strict_profile_requires_exactly_one_slide(self) -> None:
+ with tempfile.TemporaryDirectory() as directory:
+ path = Path(directory) / "two-slides.pptx"
+ write_minimal_pptx(
+ path,
+ extras={"ppt/slides/slide2.xml": SLIDE.encode("utf-8")},
+ )
+ report = inspect_pptx(path)
+ self.assertFalse(report["safe"])
+ self.assertIn(
+ "SLIDE_COUNT",
+ {finding["code"] for finding in report["findings"]},
+ )
+
+ def test_image_signature_must_match_suffix(self) -> None:
+ with tempfile.TemporaryDirectory() as directory:
+ path = Path(directory) / "bad-image.pptx"
+ write_minimal_pptx(
+ path,
+ extras={"ppt/media/image1.png": b"not-a-png"},
+ )
+ report = inspect_pptx(path)
+ self.assertFalse(report["safe"])
+ self.assertIn(
+ "IMAGE_SIGNATURE",
+ {finding["code"] for finding in report["findings"]},
+ )
+
+ def test_embedded_binary_is_rejected(self) -> None:
+ with tempfile.TemporaryDirectory() as directory:
+ path = Path(directory) / "embedded.pptx"
+ write_minimal_pptx(
+ path,
+ extras={"ppt/embeddings/embeddedObject1.bin": b"unsafe"},
+ )
+ report = inspect_pptx(path)
+ self.assertFalse(report["safe"])
+ codes = {finding["code"] for finding in report["findings"]}
+ self.assertIn("FORBIDDEN_PACKAGE_PART", codes)
+ self.assertIn("FORBIDDEN_BINARY_PART", codes)
+
+ def test_excessive_compression_ratio_is_rejected(self) -> None:
+ with tempfile.TemporaryDirectory() as directory:
+ path = Path(directory) / "bomb.pptx"
+ write_minimal_pptx(
+ path,
+ extras={"ppt/media/repetitive.txt": b"0" * (1024 * 1024)},
+ )
+ report = inspect_pptx(path)
+ self.assertFalse(report["safe"])
+ self.assertIn(
+ "ZIP_COMPRESSION_RATIO",
+ {finding["code"] for finding in report["findings"]},
+ )
+
+ def test_declared_member_count_is_bounded_before_materialization(self) -> None:
+ extras = {
+ f"ppt/media/empty-{index}.png": b""
+ for index in range(MAX_MEMBERS)
+ }
+ with tempfile.TemporaryDirectory() as directory:
+ path = Path(directory) / "too-many-members.pptx"
+ write_minimal_pptx(path, extras=extras)
+ report = inspect_pptx(path)
+ self.assertFalse(report["safe"])
+ self.assertIn(
+ "ZIP_MEMBER_LIMIT",
+ {finding["code"] for finding in report["findings"]},
+ )
+
+
+if __name__ == "__main__":
+ unittest.main()
diff --git a/skills/pptx-posters/tests/test_static.py b/skills/pptx-posters/tests/test_static.py
new file mode 100644
index 00000000..5e4fd81c
--- /dev/null
+++ b/skills/pptx-posters/tests/test_static.py
@@ -0,0 +1,235 @@
+"""Static policy tests for the PPTX poster skill."""
+
+from __future__ import annotations
+
+import ast
+import contextlib
+import importlib
+import io
+import json
+import re
+import sys
+import unittest
+from pathlib import Path
+
+SKILL_ROOT = Path(__file__).resolve().parents[1]
+SCRIPTS = SKILL_ROOT / "scripts"
+sys.path.insert(0, str(SCRIPTS))
+
+CLI_MODULES = [
+ "validate_manifest",
+ "generate_poster",
+ "inspect_pptx",
+ "check_layout",
+ "inventory_images",
+ "check_palette",
+ "plan_export",
+]
+REQUIRED_REFERENCES = {
+ "manifest_spec.md",
+ "poster_content_guide.md",
+ "poster_design_principles.md",
+ "poster_layout_design.md",
+ "pptx_security.md",
+ "security_validation.md",
+ "source_ledger.md",
+}
+BANNED_IMPORT_ROOTS = {
+ "dot" + "env",
+ "ht" + "tp",
+ "pick" + "le",
+ "requ" + "ests",
+ "sock" + "et",
+ "sub" + "process",
+ "url" + "lib",
+}
+BANNED_CALLS = {"ev" + "al", "ex" + "ec", "com" + "pile"}
+
+
+class FrontmatterTests(unittest.TestCase):
+ def test_skill_version_license_compatibility_and_length(self) -> None:
+ text = (SKILL_ROOT / "SKILL.md").read_text(encoding="utf-8")
+ self.assertLess(len(text.splitlines()), 500)
+ self.assertRegex(text, r"(?m)^name: pptx-posters$")
+ self.assertRegex(text, r"(?m)^license: MIT$")
+ self.assertRegex(text, r"(?m)^compatibility: .+")
+ self.assertRegex(text, r"(?ms)^metadata:\n version: \"2\.0\"\n")
+ self.assertNotRegex(text, r"(?m)^metadata:\s*\{")
+ self.assertNotIn("required_environment_variables", text)
+ self.assertRegex(
+ text,
+ r"(?ms)^allowed-tools:\n - Read\n - Write\n - Bash\n"
+ r" - Glob\n - Grep\n - Python\n",
+ )
+
+ def test_expected_files_and_deletions(self) -> None:
+ for name in (
+ "generate_" + "schematic.py",
+ "generate_" + "schematic_ai.py",
+ ):
+ self.assertFalse((SCRIPTS / name).exists())
+ self.assertFalse((SKILL_ROOT / "assets" / "poster_html_template.html").exists())
+ self.assertEqual(
+ {path.name for path in (SKILL_ROOT / "references").glob("*.md")},
+ REQUIRED_REFERENCES,
+ )
+ for name in CLI_MODULES:
+ self.assertTrue((SCRIPTS / f"{name}.py").is_file())
+
+ def test_exact_generation_pins(self) -> None:
+ requirements = json.loads(
+ (
+ SKILL_ROOT / "assets" / "generation_dependencies.json"
+ ).read_text(encoding="utf-8")
+ )
+ self.assertEqual(
+ requirements,
+ {
+ "python-pptx": "1.0.2",
+ "Pillow": "12.3.0",
+ "lxml": "6.1.1",
+ },
+ )
+ generator = importlib.import_module("generate_poster")
+ self.assertEqual(generator.EXPECTED_VERSIONS, requirements)
+
+ def test_template_is_deliberately_fail_closed(self) -> None:
+ text = (
+ SKILL_ROOT / "assets" / "poster_manifest_template.json"
+ ).read_text(encoding="utf-8")
+ self.assertIn('"status": "draft"', text)
+ self.assertIn("REPLACE_ME", text)
+ self.assertIn('"confirmed": false', text)
+ self.assertIn('"author_verified": false', text)
+ self.assertIn('"author_approved": false', text)
+
+ def test_text_files_have_clean_line_endings(self) -> None:
+ for path in SKILL_ROOT.rglob("*"):
+ if not path.is_file() or path.suffix not in {".md", ".py", ".json"}:
+ continue
+ with self.subTest(path=path.relative_to(SKILL_ROOT)):
+ text = path.read_text(encoding="utf-8")
+ self.assertTrue(text.endswith("\n"))
+ self.assertFalse(
+ any(line.endswith((" ", "\t")) for line in text.splitlines())
+ )
+
+
+class PythonPolicyTests(unittest.TestCase):
+ def _trees(self) -> list[tuple[Path, ast.Module]]:
+ trees: list[tuple[Path, ast.Module]] = []
+ for path in sorted(SCRIPTS.glob("*.py")):
+ trees.append(
+ (
+ path,
+ ast.parse(path.read_text(encoding="utf-8"), filename=str(path)),
+ )
+ )
+ return trees
+
+ def test_scripts_parse_and_avoid_network_shell_dynamic_code_and_objects(self) -> None:
+ for path, tree in self._trees():
+ with self.subTest(path=path.name):
+ for node in ast.walk(tree):
+ if isinstance(node, ast.Import):
+ for alias in node.names:
+ self.assertNotIn(
+ alias.name.split(".", 1)[0],
+ BANNED_IMPORT_ROOTS,
+ )
+ elif isinstance(node, ast.ImportFrom) and node.module:
+ self.assertNotIn(
+ node.module.split(".", 1)[0],
+ BANNED_IMPORT_ROOTS,
+ )
+ elif isinstance(node, ast.Call):
+ if isinstance(node.func, ast.Name):
+ self.assertNotIn(node.func.id, BANNED_CALLS)
+ elif isinstance(node, ast.Attribute):
+ self.assertNotIn(node.attr, {"environ", "getenv"})
+
+ def test_optional_generation_imports_are_lazy(self) -> None:
+ for path, tree in self._trees():
+ for node in tree.body:
+ if isinstance(node, ast.Import):
+ roots = {alias.name.split(".", 1)[0] for alias in node.names}
+ elif isinstance(node, ast.ImportFrom) and node.module:
+ roots = {node.module.split(".", 1)[0]}
+ else:
+ continue
+ self.assertFalse(
+ roots & {"PIL", "pptx"},
+ f"{path.name} imports optional dependency at module scope",
+ )
+
+ def test_cli_help_is_dependency_free(self) -> None:
+ for module_name in CLI_MODULES:
+ with self.subTest(module=module_name):
+ module = importlib.import_module(module_name)
+ with contextlib.redirect_stdout(io.StringIO()):
+ with contextlib.redirect_stderr(io.StringIO()):
+ with self.assertRaises(SystemExit) as caught:
+ module.main(["--help"])
+ self.assertEqual(caught.exception.code, 0)
+
+ def test_no_bytecode_artifacts(self) -> None:
+ self.assertEqual(list(SKILL_ROOT.rglob("*.pyc")), [])
+
+
+class DocumentationPolicyTests(unittest.TestCase):
+ def test_no_retired_service_or_script_names(self) -> None:
+ combined = "\n".join(
+ path.read_text(encoding="utf-8")
+ for path in SKILL_ROOT.rglob("*")
+ if path.is_file()
+ and "tests" not in path.parts
+ and path.suffix in {".md", ".py", ".json", ".txt"}
+ )
+ for token in (
+ "OPEN" + "ROUTER",
+ "Nano " + "Banana",
+ "generate_" + "schematic",
+ "generate_" + "schematic_ai",
+ ):
+ self.assertNotIn(token, combined)
+ self.assertIsNone(re.search(r"(?m)^\s*(?:pip|pip3) install\b", combined))
+
+ def test_source_ledger_is_dated_and_covers_required_authorities(self) -> None:
+ ledger = (SKILL_ROOT / "references" / "source_ledger.md").read_text(
+ encoding="utf-8"
+ )
+ self.assertIn("2026-07-24", ledger)
+ for token in (
+ "Microsoft PowerPoint",
+ "Microsoft Create",
+ "font",
+ "media",
+ "ECMA-376",
+ "ISO/IEC 29500",
+ "python-pptx",
+ "Pillow",
+ "lxml",
+ "WCAG",
+ "ColorBrewer",
+ "Paul Tol",
+ "CSCW 2026",
+ "IEEE DSC 2025",
+ ):
+ self.assertIn(token, ledger)
+
+ def test_documented_local_paths_exist(self) -> None:
+ pattern = re.compile(
+ r"`((?:assets|references|scripts)/[A-Za-z0-9_./-]*)`"
+ )
+ for markdown in sorted(SKILL_ROOT.rglob("*.md")):
+ text = markdown.read_text(encoding="utf-8")
+ for relative in pattern.findall(text):
+ with self.subTest(
+ markdown=markdown.relative_to(SKILL_ROOT),
+ relative=relative,
+ ):
+ self.assertTrue((SKILL_ROOT / relative).exists())
+
+
+if __name__ == "__main__":
+ unittest.main()