Slide editing

From BuilderIO/agent-native · View interactive version

Slide editing is an AI agent skill from the GitHub repository BuilderIO/agent-native. Edit individual slides, including content formatting, HTML styling, and bounded source and visual-fidelity checks. Use when changing an existing slide rather than creating a new deck.

How to use this skill

Skill file

Slide Editing

A slide's content is a self-contained HTML string rendered at its aspect

ratio's intrinsic size: 16:9 is 960x540, 1:1 is 1080x1080, 9:16 is 540x960,

and 4:5 is 864x1080. Never assume a 1920x1080 canvas.

Read before

Read a reference with docs-search --slug "skill-slide-editing--references-<file>",

for example skill-slide-editing--references-animations.

| Situation | Read |

| --- | --- |

| Changing only colors, borders, shadows, or backgrounds, or matching every slide to one slide's look | references/restyling.md |

| Adding, changing, or removing click-to-reveal animations | references/animations.md |

| Adding, moving, duplicating, or restyling hand-placed text boxes and other freeform objects | references/freeform-objects.md |

| Adding or editing a video | references/video.md |

Wrapper and styling

Every slide's outer .fmd-slide div carries the semantic --deck-* contract;

create-deck (Slide Wrapper) shows both forms. With a design system linked,

map --deck-* to --ds-*. Without one, write literal values: the renderer

publishes only --ds-bg for unlinked decks, so any other var(--ds-*, ...)

resolves to its fallback and the slide renders unstyled.

Keep one deck-level contract: the same canvas, type pairing, palette, and

accent on every slide, varying composition rather than theme. Never alternate

light and dark slides or add a one-off font or palette unless asked. For polish

or "make it beautiful", read slide-design; a linked system's tokens still win.

Updating a slide

A small edit is a same-or-shorter text replacement, a selected-object or

selectedText edit, or a single style tweak. It is one update-slide call:

skip steps 2, 4, and 5 and the fit and contrast checks below.

  1. Take the deck, slide ID, and selection from this turn's context block; call

view-screen only when they are missing. The user navigates and reselects

between turns, so never reuse a previous turn's slide ID or selection.

This, here, or this slide with nothing selected means the current slide;

ask which slide only when there is no current slide.

  1. When the edit changes facts, brand language, or layout, follow

creative-context first. If retrieval yields a new context pack, keep its

contextPackId with the deck provenance; existing HTML is not proof of

which source version shaped it. Keep an approved native template or

component when it fits; generate new structure only when the corpus is

empty.

  1. Write with update-slide: deckId, slideId, and ordered edits (exact

replace, insert before/after, replace between markers, regex). Edits apply

atomically under the deck lock, so one failed edit writes nothing.

its returned HTTPS URL as an <img src="..."> in the slide HTML and write

that markup with update-slide using the same targeted edit or

fullContent flow above. Keep it within the slide's existing layout and

give it useful alt text. Do not add a separate image action: the slide

sanitizer permits HTTPS image sources.

selectedText range,

send one literal replace with the selected text as find and

expectedMatches: 1. Use selectionSlideId and

selectionSlideContentHash when present (the selection can be on another

slide); otherwise currentSlideId and currentSlideContentHash. Never

pair a selectionSlideId with the current slide's hash. Skip get-deck, fullContent, and layout-fit waits.

edits directly (one patch-deck with patch-slide edits for several

slides) without re-reading. Read with get-deck only if an edit fails to

match or the write is rejected as stale; someone may have edited it since.

get-deck with that slideId (compact=false for full HTML) and use its

contentHash as baseContentHash. Quote find text from that

unformatted HTML: format=true is for reading only and rewrites spacing

(padding: 4px vs stored padding:4px), so its text can miss.

element, set its --trend to var(--trend-up) for a leading "+" or

positive value, var(--trend-down) for "-" or "−", and

var(--trend-flat) for an unsigned zero when the element defines

--trend-flat.

small change. format=true on update-slide applies to edits and

objectId only, not fullContent: it formats the stored HTML before

matching find and persists readable line breaks, so use it only when

every find was quoted from a get-deck format=true read.

  1. Read back with get-deck (or a thumbnail's .slide-content

textContent), never document.body.innerText: thumbnails use

content-visibility: auto, so their text is empty in a hidden tab, and the

canvas shows only the selected slide.

  1. For factual edits, check changed text against the source: quote, speaker,

date, metric, and uncertainty status. Visual similarity is not source

fidelity.

Never write deck rows directly or add raw full-deck writes. Browser/editor code enqueues granular

operations through patch-deck / DeckContext.tsx instead of replacing the

whole deck JSON.

Report only what writes returned. patch-deck lists changed slides in

updatedSlideIds and byte-identical ones in unchangedSlideIds; an unchanged

slide was not restyled. update-slide fails with slide_edit_noop, and both

reject a batch where nothing changed, so re-read and send different content

instead of describing changes that did not land.

Fit and layout checks

The create-deck Fit budget applies: on 16:9 with 64px 80px padding the

content area is 800x412px, so use at most two title lines, three short bullets

or cards, and two or three items per column. When an edit adds or lengthens

text, redo the height arithmetic. When the user asks to add content to a named

or current slide, keep it on that slide with a compact layout (columns, a

metric grid, tighter gaps); split only if the user agrees, or if it cannot fit

at 16px, and then say so. Body text stays at least 16px. Never hide overflow

with zoom, transform: scale(), clipping, or scroll; reducing explicit padding

is allowed.

Run the checks below only when an edit changes layout or makes text longer.

After those edits, call get-layout-overflows once, and once more only after

repairing a measured overflow. It reads the open editor's latest measurements

and cannot trigger new ones, so repeating it this turn changes nothing. If

status is unknown, name the unmeasured slide numbers and IDs and never claim

the deck fits.

Contrast

Run audit-contrast as the last step of any turn that created slides or

changed colors, layout, or text length (after layout repairs, right before the

final response), and whenever readability or accessibility comes up. If the deck is not open in the editor,

say contrast was not checked.

Fix failures in one pass by adjusting the role (--deck-muted, --deck-ink, a

surface), not one element's hex. Replacement colors must fit the theme:

(get-design-system). If none passes, keep the token and report it.

while keeping its hue.

Never add an unrelated hue to pass. Audit once more, then report what remains;

re-audit once if slides come back skipped as stale-render. Skipped slides and

unverified text (over images, gradients, or effects) were not checked: name

them, and do not call the deck accessible or those slides fine.

Flow layout and the editor

Keep generated flex and grid content in normal flow; create a deliberate

freeform object instead of absolute-positioning a layout child to make it

draggable. The editor presents flow content as flat objects the way Google

Slides does, so write markup that maps cleanly:

that owns its text. Never stack separately positioned text over a card

background.

(min-height only for a deliberate minimum), so text grows instead of

overflowing.

measuring and the PPTX export.

padding in multiples of 8; borders, radius, and type in whole px. Never write

a fractional px value or one computed with arithmetic that can leave decimals.

columns) are fine; the pointer skips them.

flow region: any id marks an object freeform and export-pptx rejects it.

Preserve existing ids when rewriting a slide, and never save runtime

data-builder-id values.

reserves the flow slot of a hand-moved object. Keep it while its owner

exists and delete both together.

<span data-slide-total></span> tokens when restyling or rewriting a footer.

They are empty in the saved HTML on purpose; never type digits over them.

create-deck references/slide-templates.md) for diagrams, charts, and

photos, then generate real images; never rebuild complex visuals in HTML/CSS.

Slide writes can return hygieneWarnings (inline svg and other markup the

sanitizer strips, typed page numbers, fixed px heights on text, contain,

stacked absolute text, deep nesting, tiny text). Fix them with update-slide

before finishing; a missing field means the lint found nothing.

Skipping slides

A patch-deck patch-slide with skipped: true hides a slide from

Present/Presenter without deleting it; skipped: false restores it. The rail's

right-click Skip slide does the same.

Transitions

Slide transitions (type and speed, Google Slides catalog) are set with the

patch-slide op of patch-deck, or with its add-slide op on creation. Read

references/transitions.md before changing them.

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.