# Myslide

> Create professional AWS-themed PowerPoint presentations with two theme options: dark (reInvent 2023/2025 with gradient backgrounds) and light (L100/field enablement with white backgrounds and soft gradient accents). Uses AWS brand colors, rich visual elements (SVG diagrams, architecture diagrams, icons), and cross-skill integration (svg-diagram). Supports creating from scratch, editing specific slides conversationally, and embedding SVG visualizations for maximum design impact. Trigger: "myslide", "make slides", "AWS presentation", "create pptx", "slide deck", "AWS slides", "프레젠테이션", "슬라이드 만들어", "발표자료", "L100", "L200", "training deck", "light theme", "밝은 테마", "교육 자료"

- Skill: `kyopark2014/myslide` (Agent Skill, multi-file: 374 files)
- Install (CLI): `npx skillmds@latest add kyopark2014/myslide`
- Raw SKILL.md: https://api.skillmd.com/api/skills/kyopark2014/myslide/raw
- Safety review: pending
- Works with: Claude Code, Claude.ai, OpenAI Codex
- Category: DevOps & Infra
- License: MIT License
- Author: kyopark2014 (https://skillmd.com/u/kyopark2014)
- Updated: 2026-09-17
- Page: https://skillmd.com/skills/kyopark2014/myslide

---


# MySlide - AWS-Themed Presentation Generator

Create visually compelling presentations that follow AWS design systems.
Supports **two themes**: dark (reInvent 2023/2025) and light (L100/field enablement).
Every slide should look like it was crafted by the AWS brand team.

## Theme Selection

| Theme | When to Use | Reference |
|-------|------------|-----------|
| **Dark** (reInvent 2023/2025) | reInvent, Summit keynotes, tech demos | [aws-theme.md](references/aws-theme.md) |
| **Light** (L100/Field Enablement) | L100/L200 training, customer-facing, internal workshops, sales enablement | [light-theme.md](references/light-theme.md) |

**Auto-detect**: If the user says "L100", "training deck", "white background", "밝은 테마",
"교육 자료", "customer-facing" → use Light theme. Otherwise default to Dark theme.

## Quick Start

1. **Choose theme**: Dark (default) or Light — read the corresponding theme reference
2. Read [references/aws-theme.md](references/aws-theme.md) for dark theme OR [references/light-theme.md](references/light-theme.md) for light theme
3. Read [references/slide-patterns.md](references/slide-patterns.md) for layout templates
4. Read [references/pptxgenjs.md](references/pptxgenjs.md) for PptxGenJS creation guide
5. Read [references/editing.md](references/editing.md) for editing existing PPTX files
6. Read [references/animations.md](references/animations.md) for animation primitives
7. Use `scripts/create_aws_slide.py` to generate background/SVG assets
8. Official AWS service icons are in `icons/` (304 icons, including 56 Bedrock AgentCore variants)

All references and scripts are self-contained within this skill directory.
No external skill dependencies required.

### Cross-Skill Integration (Design Enhancement)

For richer visual output, leverage these companion skills when available:
- **svg-diagram**: Generate pixel-perfect SVG diagrams, architecture visuals, and flowcharts
  with anti-overlap rules. Use for any slide needing diagrams beyond basic arrow connections.

**Directory Convention** — All generated assets go under `artifacts/` (sibling to the skill directory), never `/tmp`:
```
ASSETS_DIR  = {workspace}/artifacts/myslide-assets/   # backgrounds, SVG/PNG assets, generated images
PARTS_DIR   = {workspace}/artifacts/myslide-parts/    # individual slide JS snippets
QA_DIR      = {workspace}/artifacts/myslide-qa/       # QA render outputs (PDF, JPEG)
```
`{workspace}` is the project root (the directory containing `application/`).

### Skill root (this repo)

The system prompt exposes **`WORKING_DIR`** as the `application/` directory. This skill lives only here:

| Path | Meaning |
|------|---------|
| **`{WORKING_DIR}/skills/myslide`** | Root of this skill (`SKILL.md`, `scripts/`, `icons/`, `references/`) |

- Use **`{WORKING_DIR}/skills/myslide`** for every script path, `read_file`, and `cd`.
- Optional helper skills (`sd35l`, `nova2-omni`, `kiro`, etc.) must be resolved under **`{WORKING_DIR}/skills/<name>`** (same pattern as myslide).

```bash
# Example: locate sd35l under application/skills
SD35L_SCRIPT=$(find "${WORKING_DIR}/skills" -path "*/sd35l/scripts/generate_image.py" 2>/dev/null | head -1)
```

## Default Presenter

When generating title/thank-you slides, use these defaults unless the user specifies otherwise:
- Korean: **발표자**
- English: **Name**
- Title: Solutions Architect
- Company: Amazon Web Services
- Email: email@amazon.com

## Workflow

### A. Creating a New Presentation

1. **Gather requirements**: Ask the user for topic, key messages, and target audience
2. **Write a design spec** (when applicable — see gate below): Produce a markdown
   spec that lists every slide's layout, key message, and visual intent. Save to
   `design-specs/<deck-name>.md`. See [references/design-spec-template.md](references/design-spec-template.md)
   for the table format and approval flow.

   **Spec gate — when to require a spec before any PPTX work:**

   | Scope | Spec? | HTML preview? |
   |-------|-------|---------------|
   | 1-2 slides, single edit | No | No |
   | 3-7 slide deck | Yes (markdown only) | Optional |
   | 8+ slide deck | Yes | Yes |
   | User says "design first" / "디자인 먼저" / "plan first" | Always | Always |

   The reason: structural rework (wrong slide order, monotonous layout, wrong
   theme) is the most expensive kind to fix once PptxGenJS code exists. A
   spec catches it in seconds. For a quick one-pager the gate adds friction
   without the savings, so skip it.

   **Approval is mandatory** for decks where the gate applies. After writing
   the spec (and rendering the preview if applicable), wait for the user to
   say "go" / "승인" / "OK" / "진행" before moving to step 3. If they ask
   for changes, edit the spec, re-render, ask again — don't start building
   from a partially-approved spec.

   **HTML preview** (8+ slides):
   ```bash
   python3 scripts/render_design_preview.py design-specs/<deck-name>.md
   # Opens in browser: theme palette chips + per-slide wireframe thumbnails.
   # Variety warnings (3-streak layouts, no-diagram decks) appear at top.
   ```

3. **Generate background images**: Run the gradient background generator script
4. **Create slides**: Use PptxGenJS (Node.js) with the AWS theme constants
5. **Add SVG visuals**: Generate SVG diagrams for architecture/flow slides and embed as images
6. **Apply animations**: Design contextual animations and apply via `apply_animations.py`
7. **QA (two-phase)**: QA uses two complementary layers — programmatic validation
   catches what rendered images hide (out-of-bounds shapes, font violations),
   then visual inspection catches what code cannot judge (aesthetics, readability).

   **Phase 1 — Programmatic QA** (fast, deterministic, run in main agent):
   ```bash
   python3 scripts/qa_validate.py output.pptx
   ```
   If critical issues are found (exit code 1), fix them before proceeding to Phase 2.

   **Phase 2 — Visual QA** (kiro preferred, subagent fallback): Delegates image-heavy
   inspection to a separate context to protect the main context window. Prefer kiro
   CLI (Opus 4.6) for higher quality analysis with severity classification. If kiro
   is not available, fall back to a subagent (Sonnet 4.6+).

```bash
# Step 1: Generate AWS gradient backgrounds
python3 scripts/create_aws_slide.py backgrounds --output-dir {workspace}/artifacts/myslide-assets/

# Step 2: Run the PptxGenJS creation script (generated per presentation)
node create_presentation.js

# Step 3: Apply animations (design JSON spec per presentation context)
python3 scripts/apply_animations.py output.pptx animations.json -o animated.pptx

# Step 4: Programmatic QA — catches structural issues renderers hide
python3 scripts/qa_validate.py output.pptx

# Step 5: Visual QA — prefer kiro (Opus 4.6), fall back to subagent (see below)
```

### B. Editing an Existing Slide

When the user says "change slide 3" or "update the title slide":
1. Identify which slide(s) to modify
2. Read the current slide content (markitdown + image inspection)
3. Apply targeted changes (text, colors, layout, or visual elements)
4. Re-render and verify only the affected slides

#### B.1 Overlay on a File You Didn't Generate

If the customer (or a teammate) has drawn a slide in PowerPoint and you need
to ADD a few elements to it without redrawing everything, use python-pptx
overlay rather than regenerating from scratch. See
[references/pptx-overlay.md](references/pptx-overlay.md) for the full workflow,
including the `add_connector` endpoint-vs-width trap that is the most common
cause of diagonal arrows piercing the slide title. That reference also has
ready-to-copy helper functions for dashed lines, arrowheads, transparent
container boxes, and zero-margin text labels.

Typical overlay use cases:
- Adding a new external system group (e.g., MCP bridge to on-premises systems)
  to an existing architecture slide
- Inserting a callout or annotation on a partner-provided deck
- Fixing one mispositioned label without touching anything else

For the MCP-specific styling (color, dash pattern, label convention), also
read `references/mcp-external-integration.md` in the `aws-diagram` skill.
Even when overlaying on an existing file, the visual conventions should match
the from-scratch aws-diagram output so diagrams across the deck look consistent.

### C. Sub-Agent Strategy for Large Decks (8+ slides)

For presentations with many slides, use parallel sub-agents to maximize throughput.
Each sub-agent handles an independent group of slides.

**Parallelization pattern:**
- Agent 1: Title + Section Header slides (structural)
- Agent 2: Content slides (odd-numbered)
- Agent 3: Content slides (even-numbered)
- Agent 4: SVG diagram generation for all visual slides

```
# Sub-agent prompt template:
Generate slides [N] through [M] for the AWS presentation.
- Use the AWS theme from references/aws-theme.md
- Background images are at: {workspace}/artifacts/myslide-assets/
- Save individual slide JS snippets to: {workspace}/artifacts/myslide-parts/slide-{N}.js
- Follow the layout pattern specified for each slide type.
```

After all sub-agents complete, combine the JS snippets into one PptxGenJS script and execute.

## Visual Diversity Strategy (CRITICAL)

**Never repeat the same visual pattern more than twice in a deck.** Slides that are all
"dark box + bullet text" create visual fatigue. Use a mix of these patterns:

### Hybrid Approach: SVG Visuals + Native PPTX Text

The most effective method combines SVG diagrams (for gradient shapes, glow effects, icons)
with native PPTX text (for editability). The workflow:

1. **Generate SVG with visuals only** (shapes, gradients, glow, icons — NO text)
2. **Convert to transparent PNG** (remove background `<rect>` fill, set to `fill="none"`)
3. **Embed PNG as slide background image** at the content area position
4. **Overlay native PPTX text** using `slide.addText()` positioned to match SVG element locations

```javascript
// Step 1: SVG visual as background (no text, transparent bg)
slide.addImage({ data: noTextPngBase64, x: 0.15, y: 1.2, w: 13.0, h: 5.4 });

// Step 2: Native PPTX text on top (editable in PowerPoint)
slide.addText('Title', { x: 5.0, y: 3.0, w: 3.5, h: 0.5, fontSize: 24, bold: true, ... });
```

**Benefits:**
- User can edit text directly in PowerPoint
- Gradient/glow effects preserved from SVG
- Transparent PNG works on any slide background color
- Text is searchable and accessible

### SVG Infographic Patterns (use svg-diagram skill)

Generate these via `svg-diagram` skill with transparent backgrounds:

| Pattern | When to Use | Example Slides |
|---------|------------|----------------|
| **Hub-Spoke** | Central concept + related items | "What is X?" with Pain→Hub→Solution |
| **Radial 5-node** | 5 features/capabilities around a center | "Why X?" feature highlights |
| **Horizontal Icon Strip** | Sequential or parallel items | "5 Advantages" with icon+label |
| **Cross Quadrant** | 2x2 categorization | "4 Pain Points" with icons per quadrant |
| **Donut Chart** | Market share, proportions | Statistics with percentage breakdown |
| **Timeline** | Evolution, roadmap | "4 Stages of AI Coding" |
| **Architecture** | System/data flow | "LLM Gateway Architecture" |
| **Process Flow** | Step-by-step | "3-Step Onboarding" |

### Transparent SVG Background Rule

**All SVG infographics MUST have transparent backgrounds** so they work on any template.

When generating SVGs, ensure the first `<rect>` (background) has `fill="none"`:
```xml
<rect width="1200" height="500" fill="none"/>
```

When stripping text from existing SVGs for hybrid approach:
```javascript
svg = svg.replace(/<text[^>]*>[^<]*<\/text>/g, '');  // Remove all text elements
```

### Gradient Shapes in PPTX

PptxGenJS doesn't support native gradient fills. Use pre-rendered gradient PNG images:

```javascript
// Pre-generate gradient card backgrounds
async function createGradCard(w, h, c1, c2) {
  const svg = `<svg ...><linearGradient ...><rect fill="url(#g)"/></svg>`;
  return sharp(Buffer.from(svg)).png().toBuffer();
}
// Embed as image, then overlay transparent ROUNDED_RECTANGLE for border
slide.addImage({ data: gradPng, x, y, w, h });
slide.addShape(pres.shapes.ROUNDED_RECTANGLE, { x, y, w, h, fill: { type: 'none' }, line: { color, width } });
```

### Build-Then-QA Workflow (MANDATORY)

**Every batch of slide changes MUST be followed by visual QA before reporting completion.**

```
1. Edit slide code (JS files)
2. Regenerate PPTX: node create_presentation.js
3. Convert to images: soffice → PDF → pdftoppm (target slides only)
4. Launch QA subagent (background): check alignment, readability, overlap
5. If QA finds issues → fix coordinates → regenerate → re-QA
6. Report completion only after QA PASS
```

**For hybrid slides (SVG image + native text):** QA must specifically check that
PPTX native text aligns precisely with SVG visual elements (circles, boxes, etc).
Coordinate misalignment is the #1 issue — text must be centered inside its target shape.

**Fix workflow for misaligned text:**
1. Open the user-modified PPTX (if available) with python-pptx
2. Extract actual coordinates: `shape.left / 914400` (EMU to inches)
3. Update JS code with corrected coordinates
4. Regenerate and re-verify

### Hybrid Slide Alignment Lessons (from user corrections)

These rules come from analyzing user manual corrections on hybrid slides.
**Apply these BEFORE generating** to minimize manual fixes needed:

**1. SVG Image Vertical Offset**
SVG infographic images should start below the title with extra margin:
- Title ends at ~y=1.0. Image should start at **y=1.5~1.6**, not y=1.2
- This gives breathing room and prevents cramped feeling

**2. Radial/Spoke Layout Text Placement**
For radial (hub + spoke) diagrams:
- **Top spoke**: text goes ABOVE the icon circle (y = icon_top - 0.6)
- **Left spokes**: text goes LEFT of icon (x = icon_left - text_width - 0.1)
- **Right spokes**: text goes RIGHT of icon (x = icon_right + 0.1)
- **Bottom spokes**: text goes BELOW icon (y = icon_bottom + 0.1)
- Allow negative x values (e.g. x=-0.15) for left-edge spokes — PPTX clips gracefully

**3. Horizontal Icon Strip Text Y-Position**
For 5-column horizontal layouts (icon above, text below):
- Icon occupies y=1.5~3.5 area
- Title text starts at **y=3.83** (not 4.0) — tighter to icon bottom
- Korean subtitle at y=4.23, description at y=4.58
- Column spacing: calculate exact x from SVG icon centers, not evenly dividing

**4. Quadrant Layout Text Positioning**
For cross-quadrant (2x2) layouts:
- Text x must be at least **0.15" right of icon right edge** to prevent overlap
- User corrected: Q1/Q3 left columns x=2.67, Q2/Q4 right columns x=9.12~9.18
- Start y slightly below quadrant top: top row y=1.99, bottom row y=4.56~4.6

**5. General SVG-Text Alignment Rule**
Calculate PPTX text positions FROM the SVG source coordinates:
```
pptx_x = (svg_element_cx / svg_viewBox_width) * slide_width
pptx_y = (svg_element_cy / svg_viewBox_height) * (image_h) + image_y_offset
```
Then fine-tune: add 0.1~0.2" margin away from icon edges.

### QA Delegation Rules

**Always delegate QA to subagents or kiro** to protect the main context window:
- Visual QA (image-heavy) → `run_in_background: true` subagent or kiro skill
- Content fact-checking → dedicated subagent with reference MD files
- Alignment QA for hybrid slides → subagent with specific coordinate check instructions
- **Never** read slide images directly in the main agent context
- Main agent only receives QA text summary and applies fixes

## Narrative Flow Patterns (Slide Ordering)

These patterns come from analyzing user reordering of customer case study slides.
**Plan slide order BEFORE generating** based on the narrative pattern that fits.

### Case Studies Pattern: "Specific → General" (Preferred)

When presenting customer case studies followed by a summary:

```
[Case 1] → [Case 2] → [Case 3] → [Section Header: "N 사례"] → [Summary Table]
```

**Why this works:**
- Audience sees concrete examples first (easier to grasp)
- Section header acts as a "conclusion marker" reinforcing the pattern
- Summary table at end provides reference/recap (not an introduction)

**Avoid this order (common mistake):**
```
[Section Header] → [Summary Table] → [Case 1] → [Case 2] → [Case 3]
```
This creates a "abstract first, concrete later" flow which feels academic
and forces the audience to remember the table while watching individual cases.

### Section Header Placement

**Two valid placements:**
1. **Opening** — "Here's what we'll cover" (introduces the section)
2. **Closing/Bridging** — "This is what we just saw" (wraps up the section, bridges to next)

The closing/bridging placement is especially effective when:
- Cases have been shown individually first
- The section serves as a summary or pivot point
- You want the audience to mentally organize what they just saw

### Strength-of-Recommendation Language

User corrections consistently favor **conditional recommendations** over
absolute ones, especially in customer-facing decks:

| Too Strong (Avoid) | Preferred (Conditional) |
|--------------------|-------------------------|
| "Amazon Bedrock 우선 검토 권장" | "엔터프라이즈 거버넌스 상이라면 → Amazon Bedrock 우선 검토 권장" |
| "X is the best choice" | "If your requirement is Y, X is the best choice" |
| "Always use Z" | "For scenarios requiring Z, use Z" |

Frame recommendations with the condition/qualifier FIRST so the customer
feels empowered rather than dictated to. This is especially important for
AWS customer-facing content where neutrality matters.

## Slide Types

Each presentation should use a MIX of these layouts. Never repeat the same layout more than twice in a row.

| Type | When to Use | Reference |
|------|-------------|-----------|
| **Title** | First slide (single speaker) | slide-patterns.md > Title Slide |
| **Title (Two Speakers)** | First slide (co-presentation) | slide-patterns.md > Two-Speaker Title |
| **Agenda** | Second slide, table of contents | slide-patterns.md > Agenda Slide |
| **Section Header** | Chapter dividers (01, 02...) | slide-patterns.md > Section Header |
| **Content Card** | Key points with icon | slide-patterns.md > Content Card |
| **Two Column Card** | Side-by-side options/concepts | slide-patterns.md > Two Column Card |
| **Three Column** | Comparisons, 3 options | slide-patterns.md > Three Column |
| **Process Flow** | User scenarios, step-by-step flows | slide-patterns.md > Process Flow |
| **Comparison Table** | Option comparisons, feature matrices | slide-patterns.md > Comparison Table |
| **Architecture** | System diagrams | slide-patterns.md > Architecture |
| **Venn/Comparison** | Overlapping concepts | slide-patterns.md > Venn Diagram |
| **Screenshot+Text** | Demo/console walkthrough | slide-patterns.md > Screenshot |
| **Summary Grid** | 2x2 key takeaways | slide-patterns.md > Summary Grid |
| **Evolution/Progression** | Maturity stages, AI evolution | slide-patterns.md > Evolution |
| **Multi-Card Grid** | 2x2 or 3x2 feature cards | slide-patterns.md > Multi-Card Grid |
| **Gradient Border Cards** | Light cards with colored borders on dark bg | slide-patterns.md > Gradient Border Cards |
| **Thank You** | Last slide | slide-patterns.md > Thank You |

### Light Theme Additional Patterns

These layouts are specific to the Light theme (L100/field enablement style).
See [references/light-theme.md](references/light-theme.md) for full code examples.

| Type | When to Use | Reference |
|------|-------------|-----------|
| **Section Divider (Light)** | Chapter breaks with gradient blob accents | light-theme.md > Section Divider |
| **Data + Citation** | Market data with bar charts + source quotes | light-theme.md > Data + Citation |
| **Key Points Grid** | 2x3/2x4 grid with purple ALL-CAPS labels | light-theme.md > Key Points Grid |
| **Feature Badges + Screenshot** | Tan pill badges + product screenshot | light-theme.md > Feature List + Screenshot |
| **Full-Color Background** | Bold single-color slide (max 1 per deck) | light-theme.md > Full-Color Background Slide |
| **Step Guide** | Purple numbered badges + screenshots | light-theme.md > Step Guide with Screenshots |
| **Customer Case Study** | Logo + Challenge/Solution/Result + pill tags | light-theme.md > Customer Case Study |
| **Do's vs Don'ts** | Green/red color-coded comparison columns | light-theme.md > Do's vs Don'ts Comparison |
| **CTA Slide** | Orange numbered badges + action items | light-theme.md > Call to Action |
| **Dashboard Evidence** | Product UI screenshot as proof point | light-theme.md > Dashboard Screenshot Slide |

## SVG Visual Elements

For slides that need diagrams, architecture visuals, or flowcharts, generate inline SVG and
convert to PNG for embedding. This dramatically improves visual quality over plain text slides.

**When to generate SVGs:**
- Architecture or system flow explanations
- Process/workflow diagrams
- Comparison charts or feature matrices
- Any slide where the content is inherently visual

**SVG generation approach:**
```bash
# Generate SVG with official AWS service icons, convert to PNG for embedding
python3 scripts/create_aws_slide.py svg-diagram \
  --type architecture \
  --elements "CloudFront,API Gateway,Lambda,Bedrock,S3" \
  --output {workspace}/artifacts/myslide-assets/arch-diagram.png
```

**Available icon names** (use these as element names for automatic icon embedding):
Lambda, EC2, S3, DynamoDB, API Gateway, CloudFront, Bedrock, Bedrock AgentCore, ECS, EKS, RDS,
Aurora, VPC, ELB, Route 53, CloudWatch, IAM, Cognito, SNS, SQS, Step Functions,
EventBridge, Kinesis, SageMaker, Redshift, Athena, Glue, KMS, WAF, Shield,
Fargate, ECR, AppSync, OpenSearch, ElastiCache, Secrets Manager, ACM, and 200+ more.
See `icons/` directory for the full list of available service icons.

**AgentCore component-specific icons**: 56 variants covering 9 AgentCore components
(logo, ai-agent, runtime, gateway, identity, code-interpreter, observability, browser-tool, memory)
across 4 color accents (teal, blue, purple, cyan) and 2 themes (light, dark).
Pattern: `agentcore-{component}-{color}-{theme}.svg` — e.g., `agentcore-runtime-teal-light.svg`.
Use these in slides when highlighting individual AgentCore services with matching color to slide theme:
- Light-theme (L100/field-enablement) slides → `*-light` variants (black outline + accent)
- Dark-theme (reInvent) slides → `*-dark` variants (white outline + accent)
Embed via `<img src="icons/agentcore-{name}.svg">` or place through svg-diagram.

Alternatively, craft SVG inline in the Node.js script and use `sharp` to convert to PNG base64.

### Diagram Type Selection for Presentations

Presentations almost always need **High-Level diagrams** (logical grouping), not Infrastructure diagrams (VPC/Subnet).

| Presentation Context | Diagram Type | Key Characteristics |
|---------------------|-------------|-------------------|
| Executive briefing, sales pitch | **High-Level** | Hub-spoke layout, generic containers, no VPC/Subnet |
| Technical deep-dive, Well-Architected review | **Infrastructure** | VPC/AZ/Subnet nesting, security boundaries |
| Platform overview (e.g., AgentCore, EKS) | **High-Level (Hub-Spoke)** | Central runtime + radiating spoke services |
| Event-driven / microservices overview | **High-Level** | EventBridge as central bus, producers left, consumers right |

### High-Level Architecture Pattern (Hub-Spoke)

For presentation slides, the hub-spoke pattern is most effective:
- **Central service** (Bedrock, EventBridge, EKS) at the center of the diagram
- **Spoke services** radiate outward with clear directional arrows
- **Logical grouping** using `generic` container (dashed border) instead of VPC/Subnet
- **Observability** (CloudWatch, X-Ray) at the bottom, separated from main flow
- **No AWS Cloud outer container** -- cleaner for slides
- **Multi-directional arrows** -- not just left-to-right; use top/bottom/left/right freely
- **Descriptive arrow labels** -- "Streamable HTTP", "IdP integration", "Metrics & logs"

### Arrow-Icon Collision Rules

- **Arrows must NEVER pass through another service box.** This is the #1 architecture
  diagram defect. Before drawing each arrow, trace the path from source to target and
  verify no intermediate box lies in the way. If one does:
  1. **Route around**: Use two LINE segments (L-shape or Z-shape) to go around the box
  2. **Move the blocking box** to a row/column that clears the path
  3. **Connect via the intermediate box** if there's a logical flow through it
- **Arrow segments must maintain >= 10px clearance** from any icon bounding box
- **In hub-spoke layouts, radial arrows must not cross sibling spokes** -- stagger spoke y-positions
- **Validation**: After all elements are placed, mentally trace every arrow and confirm
  it does not cross any box. See `slide-patterns.md > Arrow Routing Rules` for code examples.

### aws-diagram Skill Integration

For **complex architecture diagrams** (VPC nesting, orthogonal arrows, 8+ services), use the
`aws-diagram` skill instead of `create_aws_slide.py`. It produces native PPTX architecture slides
that can be merged into myslide decks:
```bash
# 1. Generate architecture diagram with aws-diagram skill
python3 /path/to/aws-diagram/scripts/generate_diagram.py \
  -i diagram.json -o {workspace}/artifacts/myslide-assets/arch.svg --png --pptx {workspace}/artifacts/myslide-assets/arch-slide.pptx

# 2. Merge into myslide deck using add_slide.py
python3 scripts/add_slide.py --deck output.pptx --insert {workspace}/artifacts/myslide-assets/arch-slide.pptx --position 4
```

For High-Level diagrams in aws-diagram JSON, use `"type": "generic"` containers:
```json
{"id": "platform", "type": "generic", "label": "Amazon Bedrock AgentCore",
 "children": ["runtime", "code-interp", "identity", "memory"]}
```

**SVG layer order rule** (applies to all SVG diagram generation):
Icons must render ABOVE arrows. Render order: background > containers > arrows > callouts > icons.

## Image Generation (Optional)

When a slide needs a **conceptual illustration, hero image, or visual metaphor** that cannot
be expressed with SVG diagrams or AWS icons, use the `sd35l` skill (GA) to generate images
via Amazon Bedrock. `nova2-omni` is also available as an alternative (gated preview).

**Requires**: If used, the `sd35l` skill must exist under `{WORKING_DIR}/skills/sd35l` (or adjust the find path above).

### When to Use Image Generation vs SVG Diagrams

| Content Type | Use SVG/Icons | Use sd35l |
|---|---|---|
| AWS architecture diagrams | Yes | No |
| Process flows, step diagrams | Yes | No |
| Conceptual hero images (AI brain, cloud, etc.) | No | Yes |
| Abstract background visuals | No | Yes |
| Product/scenario illustrations | No | Yes |
| Screenshot placeholders | No | Yes |
| Data flow with service icons | Yes | No |

### Slide-Optimized Aspect Ratios

| Use Case | Aspect Ratio | Slide Coverage |
|---|---|---|
| Full-slide background | `16:9` | Entire slide behind text |
| Hero image (title slide) | `16:9` | Right 60-70% of slide |
| Half-slide illustration | `2:3` or `3:4` | Left/right half |
| Card illustration | `1:1` | Inside a content card |
| Banner (wide strip) | `21:9` | Top or bottom strip |

### Integration Workflow

```bash
# 1. Generate image with sd35l (resolve under application/skills only)
SD35L_SCRIPT=$(find "${WORKING_DIR}/skills" -path "*/sd35l/scripts/generate_image.py" 2>/dev/null | head -1)

python3 "$SD35L_SCRIPT" \
  --prompt "Abstract dark gradient with glowing neural network connections, deep navy and purple tones, futuristic technology atmosphere, minimal clean composition" \
  --negative-prompt "text, watermarks, logos, people, bright colors, white background" \
  --aspect-ratio 16:9 \
  --seed 42 \
  --output-dir {workspace}/artifacts/myslide-assets/

# 2. Result JSON: {"model": "...", "seed": 42, "images": ["{workspace}/artifacts/myslide-assets/sd35l_1.png"]}

# 3. Embed in PptxGenJS using base64
```

### Prompt Guidelines for Presentation Images

**Style keywords to include:**
- "dark background", "deep navy", "dark gradient" (matches AWS theme)
- "minimal", "clean composition" (professional look)
- "glowing", "luminous accents" (matches orange/magenta highlights)
- "futuristic", "technology", "digital" (AWS tech context)

**Standard negative prompt for all slide images:**
```
"text, watermarks, logos, bright white background, oversaturated, cartoon, cluttered, busy composition, blurry"
```

**Prompt templates by slide type:**

| Slide Type | Prompt Pattern |
|---|---|
| Title hero | "[Topic concept] visualization, dark futuristic background, glowing [accent color] accents, cinematic wide shot, professional technology illustration" |
| Content illustration | "[Concept] depicted as [visual metaphor], dark navy background, clean minimal style, soft ambient lighting, 3D render" |
| Background overlay | "Abstract [theme] pattern, dark gradient from deep navy to black, subtle glowing particles, seamless texture, minimal" |
| Card thumbnail | "[Subject icon/symbol], centered on dark background, simple flat design with glow effect, single color accent, square composition" |

### Embedding Generated Images in PptxGenJS

```javascript
const fs = require('fs');

const heroImage = fs.readFileSync('{workspace}/artifacts/myslide-assets/sd35l_1.png');
const heroBase64 = 'image/png;base64,' + heroImage.toString('base64');

// Full-slide background image
slide.background = { data: heroBase64 };

// Or position as a visual element
slide.addImage({
  data: heroBase64,
  x: 5.5, y: 0, w: 7.83, h: 7.5,  // Right 60% of slide
});

// Semi-transparent overlay on top of image (for text readability)
slide.addShape(pres.shapes.RECTANGLE, {
  x: 0, y: 0, w: 13.33, h: 7.5,
  fill: { color: "000000", transparency: 50 }
});
```

### Cost Awareness

- SD3.5 Large: ~$0.04/image regardless of aspect ratio
- A typical 10-slide deck with 3-4 generated images: ~$0.16
- Use `--seed` to reproduce exact images when iterating

See [references/image-generation-integration.md](references/image-generation-integration.md) for detailed
prompt recipes and advanced techniques.

## Rounded Rectangle Default

All card-like shapes (content cards, agenda items, grid cells, tag badges, summary bars)
MUST use `ROUNDED_RECTANGLE` with `rectRadius` instead of plain `RECTANGLE`.
This gives a modern, polished look consistent with contemporary UI design.

### Radius Guidelines

| Element | rectRadius | Notes |
|---------|-----------|-------|
| Large cards (content, 2-col, 3-col) | 0.10 - 0.12 | Main content containers |
| Inner boxes (code blocks, option cards) | 0.06 - 0.08 | Nested within larger cards |
| Tag badges (effort/impact labels) | 0.15 | Pill-shaped badges |
| Progress bars | 0.10 | Pill-shaped bars |
| Summary/footer bars | 0.08 | Horizontal wide bars |

### Accent Styling with Rounded Corners

Do NOT overlay thin rectangular accent bars on ROUNDED_RECTANGLE shapes (they won't
align with corners). Instead, use `line` border property for accent colors:

```javascript
// ✅ CORRECT: Rounded card with colored border accent
slide.addShape(pres.shapes.ROUNDED_RECTANGLE, {
  x: 0.5, y: 1.2, w: 5.8, h: 4.5, rectRadius: 0.12,
  fill: { color: "161E2D" },
  line: { color: "C91F8A", width: 1.5 },  // accent color as border
  shadow: mkShadow()
});

// ❌ WRONG: Overlay accent bar on rounded corners
slide.addShape(pres.shapes.ROUNDED_RECTANGLE, { ... });
slide.addShape(pres.shapes.RECTANGLE, { x: 0.5, y: 1.2, w: 0.08, h: 4.5, fill: { color: "C91F8A" } });
```

### When to Keep RECTANGLE

Only use plain `RECTANGLE` for:
- Full-slide overlays (dark transparency over hero images)
- Table cell backgrounds (must tile without gaps)
- Decorative gradient accent bars at slide edges

### Thin Accent Lines Under Titles (DO NOT USE)

Do NOT add thin orange/pink accent lines (h: 0.04) under slide titles.
This creates visual noise and looks repetitive across slides. The title text
itself is sufficient as the visual anchor. If visual separation is needed
between title and content, use whitespace (0.3"+ gap) instead of a line.

```javascript
// ❌ WRONG: Thin accent line under title
slide.addShape("rect", {
  x: 0.8, y: 1.05, w: 1.5, h: 0.04, fill: { color: C.orange },
});

// ✅ CORRECT: Use whitespace gap between title and content
// Title at y: 0.33, content starts at y: 1.41 (natural 0.3"+ gap)
```

## Color Discipline (CRITICAL)

Slides look more professional with fewer, well-chosen colors. Too many colors
create visual noise and distract from the message. Limit each slide to **5 core
colors** maximum. A restrained palette feels intentional and polished; a rainbow
of colors feels chaotic.

### The 5 Core Colors (Dark Theme)

| Role | Color | HEX | When to use |
|------|-------|-----|-------------|
| **Background** | Deep Purple-Black | `09051B` | Slide background (via gradient image) |
| **Primary Text** | White | `FFFFFF` | All headings, body text, bullets |
| **Emphasis** | Orange | `F66C02` | Key terms, highlights, numbered badges |
| **Container** | Dark Navy | `161E2D` | Card fills, table cells, box backgrounds |
| **Secondary** | Light Slate | `C8D0D8` | Subtitles, descriptions, captions (readable on projectors) |

### The 5 Core Colors (Light Theme)

| Role | Color | HEX | When to use |
|------|-------|-----|-------------|
| **Background** | White | `FFFFFF` | Slide background |
| **Primary Text** | Near Black | `1A1A1A` | All headings, titles |
| **Accent** | Sky Blue | `4FC3F7` | Table headers, bullets, links |
| **Card Fill** | Cream/Beige | `F5F0EB` | Card backgrounds, content areas |
| **Body Text** | Dark Gray | `333333` | Body text, descriptions |

Light theme allows additional accents sparingly: coral (`C96842`) for key stats,
purple (`6B46C1`) for architecture labels/badges, AWS orange (`FF9900`) for
internal badges and CTA numbers. See [light-theme.md](references/light-theme.md) for full palette.

### Allowed Accent (sparingly)

- `C91F8A` (Magenta) — card border lines only, max 1-2 per slide
- `5600C2` (Purple) — already in the gradient background, no need to add separately

### Colors to AVOID in regular slides

These colors exist in the theme file for special cases but should NOT appear in
normal content slides. Using them creates a cluttered, inconsistent look:

- `FF28EF` (Neon Pink) — only for section header numbers
- `ABABE3` (Lavender), `FF9EA2` (Salmon Pink) — only for complex architecture diagrams
- `00A0C8` (Teal), `69AE35` (Green) — only when semantically meaningful (e.g., success/info)
- `010135`, `02043B` — only in multi-layer architecture diagrams

**Rule of thumb**: If you're about to use a 6th color, stop and ask whether one
of the 5 core colors can serve the same purpose.

### Gradient Fills for Cards and Containers

PptxGenJS does not support native gradient fills on shapes. To create gradient
card backgrounds (e.g., a subtle dark-to-darker gradient inside a card), render
an SVG gradient rectangle and convert to PNG:

```javascript
const sharp = require('sharp');

// Create a gradient card background (e.g., darkNavy to bgBase)
async function createGradientCard(w, h, colors = ['161E2D', '09051B'], direction = 'vertical') {
  const pxW = Math.round(w * 96);  // inches to pixels at 96dpi
  const pxH = Math.round(h * 96);
  const [c1, c2] = colors;
  const gradDir = direction === 'vertical'
    ? 'x1="0" y1="0" x2="0" y2="1"'
    : 'x1="0" y1="0" x2="1" y2="0"';

  const svg = `<svg xmlns="http://www.w3.org/2000/svg" width="${pxW}" height="${pxH}">
    <defs>
      <linearGradient id="g" ${gradDir}>
        <stop offset="0%" stop-color="#${c1}"/>
        <stop offset="100%" stop-color="#${c2}"/>
      </linearGradient>
    </defs>
    <rect width="${pxW}" height="${pxH}" rx="12" fill="url(#g)"/>
  </svg>`;

  const png = await sharp(Buffer.from(svg)).png().toBuffer();
  return 'image/png;base64,' + png.toString('base64');
}

// Usage: gradient card as image background
const gradBg = await createGradientCard(12.5, 4.84, ['161E2D', '0D1117']);
slide.addImage({ data: gradBg, x: 0.42, y: 1.41, w: 12.5, h: 4.84 });

// Then add text/shapes on top of the gradient card
slide.addText("Title", { x: 0.8, y: 1.8, w: 11.5, h: 0.5, ... });
```

**Gradient presets for common use cases:**

| Use Case | From | To | Direction |
|----------|------|----|-----------|
| Card background | `161E2D` | `0D1117` | vertical (top→bottom) |
| Header bar | `161E2D` | `09051B` | horizontal (left→right) |
| Highlight card | `1A0B3D` | `161E2D` | vertical |
| Summary footer | `0D1117` | `161E2D` | horizontal |

Use gradient fills sparingly — they add visual depth but overuse diminishes the effect.
One or two gradient cards per presentation is ideal.

### Gradient Borders (for any shape)

Gradient borders work on any card — single Content Card, Multi-Card Grid,
or the Gradient Border Cards layout. The technique: render an SVG with a
gradient-filled rectangle and a smaller inner rectangle in the fill color,
creating a border effect.

```javascript
// Reusable gradient border generator — works for any card size
async function createGradientBorder(w, h, borderColors, fillColor = 'F2F4F4', borderWidth = 3) {
  const pxW = Math.round(w * 96);
  const pxH = Math.round(h * 96);
  const [c1, c2] = borderColors;
  const r = 12;  // corner radius

  const svg = `<svg xmlns="http://www.w3.org/2000/svg" width="${pxW}" height="${pxH}">
    <defs>
      <linearGradient id="b" x1="0" y1="0" x2="0" y2="1">
        <stop offset="0%" stop-color="#${c1}"/>
        <stop offset="100%" stop-color="#${c2}"/>
      </linearGradient>
    </defs>
    <rect width="${pxW}" height="${pxH}" rx="${r}" fill="url(#b)"/>
    <rect x="${borderWidth}" y="${borderWidth}"
          width="${pxW - borderWidth * 2}" height="${pxH - borderWidth * 2}"
          rx="${r - 1}" fill="#${fillColor}"/>
  </svg>`;

  const png = await sharp(Buffer.from(svg)).png().toBuffer();
  return 'image/png;base64,' + png.toString('base64');
}

// Example: Single Content Card with orange→magenta gradient border
const cardFrame = await createGradientBorder(12.5, 4.84, ['F66C02', 'C91F8A'], '161E2D');
slide.addImage({ data: cardFrame, x: 0.42, y: 1.41, w: 12.5, h: 4.84 });
// Then add text on top...

// Example: Light card with purple→blue gradient border
const lightCard = await createGradientBorder(5.8, 4.5, ['5600C2', '2D7CFB'], 'F2F4F4');
slide.addImage({ data: lightCard, x: 1.0, y: 1.5, w: 5.8, h: 4.5 });
```

**Common gradient border presets:**

| Style | From | To | Fill | Effect |
|-------|------|----|------|--------|
| Warm accent | `F66C02` | `C91F8A` | `161E2D` | Orange→Magenta on dark card |
| Cool accent | `5600C2` | `2D7CFB` | `F2F4F4` | Purple→Blue on light card |
| Brand gradient | `C91F8A` | `5600C2` | `161E2D` | Magenta→Purple on dark card |
| Subtle | `C8D0D8` | `161E2D` | `161E2D` | Gray fade, subtle |

See `slide-patterns.md > Gradient Border Cards` for the full multi-card layout pattern.

## Typography Size Rules (CRITICAL)

Body text must NEVER be smaller than 15pt. This is the #1 visual quality issue.
Table cells, comparison columns, and process flow card text are NOT exceptions —
they must also be 15pt minimum. Only footer copyright and slide-number captions
may go below 15pt.

### Minimum Font Size by Element

| Element | Min Size (pt) | Recommended (pt) | Weight |
|---------|--------------|-------------------|--------|
| Slide title | 36 | 36-44 | Bold/Heavy |
| Section number (01, 02) | 36 | 36 | Bold |
| Card title / Sub-header | 20 | 20-24 | Bold |
| **Body text** | **15** | **16** | Regular |
| **Bullet items** | **15** | **15-16** | Regular |
| **Table cell text** | **15** | **15-16** | Regular |
| **Process flow card text** | **15** | **15-16** | Regular |
| **Three-column body** | **15** | **15-16** | Regular |
| Caption / Footer / Copyright | 8 | 8-10 | Light |

**The only elements allowed below 15pt are:**
- Footer copyright text (8pt)
- Slide number labels

…(truncated)
