Carousel

From theSamPadilla/montaj · View interactive version

Carousel is an AI agent skill from the GitHub repository theSamPadilla/montaj. Agent-authored workflow task: build slides for a carousel project — pick aspect-aware images via generate_image, position image and overlay elements on each slide, set base colors, and render to PNGs. Load this when you hit montaj/carousel in a workflow.

How to use this skill

Skill file

Carousel Skill

Use this skill whenever you are working on a carousel workflow project in montaj.


1 — What a carousel is

A carousel is N still slides at one fixed aspect ratio, rendered to slide_01.png … slide_NN.png in <project>/render/. There is no time axis, no audio, no video export.

| Aspect | Constant | Resolution | Platform |

|--------|----------|------------|----------|

| square | CAROUSEL_ASPECTS[0] | 1080 × 1080 | Instagram square |

| portrait | CAROUSEL_ASPECTS[1] | 1080 × 1350 | Instagram portrait (dominant in 2026) |

| vertical | CAROUSEL_ASPECTS[2] | 1080 × 1920 | TikTok photo mode, Stories |

The aspect is locked at project creation — Instagram and TikTok enforce uniformity across all slides in a carousel. Read it from project.carousel.aspect; read pixel dimensions from project.settings.resolution ([width, height]). Never attempt to change the aspect after init.


Sub-skills

| Name | Path | When to load |

|------|------|--------------|

| editable-text | skills/editable-text/SKILL.md | Before authoring any text overlay — defines the 9-prop contract the editor toolbar relies on. |


2 — Inputs you have


3 — Slide schema

// project.slides: Slide[]
{
  "id": "uuid",               // crypto.randomUUID() — never positional IDs
  "base_color": "#ffffff",    // background fill shown wherever no image covers
  "elements": [               // z-order: bottom → top
    // Image element
    {
      "id": "uuid",
      "type": "image",
      "src": "assets/<mediaId>.png",  // workspace-relative path; required
      "mediaId": "<uuid>",            // optional metadata, references org Media row
      "x": 0, "y": 0,
      "w": 1080, "h": 1080,
      "rotation": 0
    },
    // Overlay element
    {
      "id": "uuid",
      "type": "overlay",
      "overlay": {
        "template": "<overlay-id>",    // path or name returned by GET /api/overlays
        "props": {
          // overlay-specific knobs (text, color, animation timing, etc.)
          // DO NOT set offsetX / offsetY / scale here — they are forced to
          // identity at render time. Slide-side x/y/w/h/rotation own position.
        }
      },
      "frame": 59,                     // static frame to render; default = overlay's
                                       // staticFrame export, or duration - 1
      "x": 140, "y": 200,
      "w": 800, "h": 300,
      "rotation": 0
    }
  ]
}

src is the workspace-relative path the renderer reads from disk. mediaId is optional metadata — when present, it lets Hub's editor surface the filename, link back to the Media library row, and reason about provenance. The renderer ignores mediaId.

When working from Hub, never write a presigned URL into src. The materialization machinery puts a workspace path there; Hub returns the workspace path from hub.attach_media.

Key rules:


4 — Generating images

Use the existing generate_image step. Always generate at the project's native resolution so the image fills the slide without scaling artifacts.

montaj generate-image \
  --prompt "soft pastel background, skincare product flat lay, minimalist" \
  --out <project_workspace>/assets/slide1_bg.png \
  --provider gemini \
  --aspect-ratio "4:5"       # match the project aspect: square → 1:1, portrait → 4:5, vertical → 9:16

CLI signature summary:

| Param | Required | Notes |

|-------|----------|-------|

| --prompt | yes | Describe the image |

| --out | yes | Absolute path, .png |

| --provider | no | gemini (default), kinovi or openai |

| --ref-image | no, repeatable | Reference images from project.assets for style consistency |

| --aspect-ratio | no | Gemini only. 1:1, 4:5, 9:16 — match the carousel aspect |

| --model | no | Override the connector's default model |

After generation, store the file under the project workspace (e.g. <workspace>/assets/) and set the element's src to the relative path from the workspace root (e.g. "assets/slide1_bg.png").


5 — Overlays

Carousel overlays are custom JSX written per project — there is no built-in template library. Author each overlay you need (headline, subhead, callout, etc.) per the rules below.

Save the JSX under the project workspace (e.g. <workspace>/overlays/headline.jsx) and reference it by absolute path in overlay.template.

Carousel-specific rules layered on top of write-overlay:

Typography for carousels

Carousels carry full sentences and paragraphs — the viewer is reading, not glancing past a video frame. Do NOT apply video hook sizing (a 96px floor). That sizing is calibrated for short hooks (3–6 words) on 1080×1920 video with moving footage; it produces unreadable wall-of-text on a 1080×1080 carousel.

Use these defaults instead, sized to the carousel's resolution[0] (1080 for square/portrait, 1080 for vertical):

| Role | Short copy (≤ 40 chars) | Medium (40–80) | Long (80+) |

|------|-------------------------|----------------|------------|

| Hook headline (slide 1) | 64–80px | 44–56px | 32–44px |

| Body / answer text (FAQ, captions in cards) | 28–34px | 24–28px | 22–26px |

| Eyebrows, kickers, all-caps labels | 18–26px | 18–22px | 18–22px |

| Footer / sign-off | 26–32px | 22–26px | 20–24px |

Rules of thumb:

If a slide's text doesn't fit at these sizes, the copy is too long for that slide — split it, don't shrink past the lower bound. The viewer's eye still has to land.

HTTP / sidecar mode

In CLI / headless mode, you author overlays by writing JSX files directly to

<workspace>/overlays/<name>.jsx. In HTTP / sidecar mode, you don't have

filesystem access — use the dedicated write endpoint instead:

PUT /api/projects/{id}/overlays/{name}
Content-Type: text/plain
Body: <JSX source>

Names are slug-only (a-z, A-Z, 0-9, _, -, up to 64 chars); the server

appends .jsx. PUT is idempotent — re-PUTting the same name overwrites. The

written file lands at <workspace>/overlays/{name}.jsx and is referenceable

from slide elements exactly as in CLI mode.


6 — Persisting slide edits

PUT /api/projects/{id} with the entire project body. The server writes project.json and SSE-broadcasts the updated state.

# Example via curl (agent-side calls go through api.saveProject in the UI,
# or direct HTTP from a script)
curl -s -X PUT http://localhost:<port>/api/projects/<id> \
  -H "Content-Type: application/json" \
  -d @project.json

Every save is a whole-project PUT. If streaming live drag/resize updates, debounce at ~100 ms trailing to avoid one PUT per pointer-move frame.


7 — Authoring overlays alongside images

When a slide combines an image element with an overlay element, the overlay's transparent root div sits ON TOP of the image (z-order, bottom→top). The image is visible only where the overlay doesn't paint.

The default hook overlay's text container has no max-width, so a long headline can span the full slide and visually obscure an image element placed on the right. Two rules:

  1. Overlays designed to potentially share a slide with images should accept a textMaxWidth prop (CSS value, default '100%'). The text container applies it as maxWidth. When the agent composes a slide with an image, pass textMaxWidth: '60%' (or similar) on the overlay's props.
  2. Position image elements on the side opposite the overlay's text alignment. For align: 'top' overlays, place images bottom. For left-aligned overlays (the default for hook), place images on the right.

Brand-shipped overlays (hook, faq_card) follow this pattern. Author new overlays with textMaxWidth from day one.


8 — Render

montaj render <project_workspace>/project.json

Output: <project_workspace>/render/slide_01.png … slide_NN.png plus a manifest.json describing the run.

The renderer (render-carousel.js) launches Puppeteer, bundles each slide's JSX via esbuild, screenshots at the project resolution, and writes PNGs. No ffmpeg, no audio, no video encoding. Pass --out <dir> to write PNGs elsewhere; pass --clean to delete only prior slide_*.png + manifest.json without touching any coexisting video renders.


9 — Finish and render

New carousel projects start at status: "pending" — same as video projects. The pending status signals that this carousel is waiting on you (the agent) to do the initial build. Build and populate all slides, then:

  1. PUT /api/projects/{id} with the complete slides array.
  2. montaj render <project_workspace>/project.json. The render marks the project final itself.

The project is complete when render/slide_01.png … slide_NN.png exist.


Notes

The user's own notes on the carousel are in project.notes. Each note has a slideId, the stable id of the slide it is about: find that slide in project.slides by id (its position there is its slide number). A note with x and y points at a spot on the slide, as fractions 0..1 of the slide's width and height; a note without them is about the whole slide. A note whose slide no longer exists stays in the list.

Work through the open notes (no done). Once you have addressed a note, set done: true on it in your next save. Never remove a note or change its text.

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.