---
name: livefolio-publish
description: Publish a new AI-generated HTML document (folio) to LiveFolio and hand the user a shareable URL. Use when the user asks to publish, host, ship, or share an HTML page, slide deck, spreadsheet, dashboard, report, or infographic — or says "put this on LiveFolio", "give me a link", "publish this deck". Always read this skill before calling create_project.
---

# livefolio-publish

Goal: a finished folio at a shareable URL. Once the HTML exists, the first publish should take under 60 seconds: one interview, one `create_project`, one `manage_sharing` check, one link back to the user.

## 1. Interview — three questions, then build

Ask before generating HTML:

1. **Type** — `project_mode`: `deck` (slides, arrow-key navigation), `document` (longform reading), `spreadsheet` (live-recalculating tables), `dashboard` (metric card decks and charts), `infography` (continuous-scroll data story).
2. **Folder** — which workspace folder it belongs to (cloud only): run `list_workspaces` and pass the folder's id as `project_id` when creating. Omit if there is no folder.
3. **Sharing afterwards** — publish publicly now, keep it draft for review, or gate it: sharing is configured AFTER creation with `manage_sharing` (publish, privacy, access key), `manage_paid_access` (price gate, cloud only), `manage_listing` (marketplace listing, cloud only).

If the user cannot answer 2 or 3, proceed with defaults — no folder, default sharing — and settle sharing before handing out the link.

## 2. THE HARD RULE — self-contained HTML, zero external resources

LiveFolio's share view enforces a content policy that blocks external scripts, stylesheets, fonts, and CDN payloads. A folio that loads anything from outside its own package renders broken. **This is the loudest rule of LiveFolio publishing: zero external resources.**

Blocked — must never appear in folio HTML:

- `<script src="https://…">` — any CDN script, the Tailwind CDN included
- `<link rel="stylesheet" href="https://…">`
- Remote fonts: `<link href="https://fonts.googleapis.com…">`, `@import url(…)`, `@font-face` with a remote `src`
- Remote images, remote iframes, `fetch()` to third-party hosts

Allowed — the self-contained toolkit:

- All CSS inline in `<style>` blocks (or a `.css` file shipped inside the folio package)
- All JS inline in `<script>` blocks (or a `.js` file shipped inside the package) — vanilla JS, no frameworks
- Fonts: system font stacks — `-apple-system, 'Segoe UI', Inter, sans-serif` style. Never remote font files
- Images: inline SVG, canvas drawings, base64 data URLs, or image files shipped inside the package

Pre-flight before `create_project` — grep your HTML and confirm zero hits: `src="http`, `href="http`, `@import`, `fonts.googleapis`, `cdn.`

## 3. Assemble the package

`create_project` takes ONE file — the full `index.html` in `initial_html`:

```
create_project({
  "title": "…",
  "initial_html": "<!doctype html>…",
  "project_mode": "deck",
  "design_preferences": { "theme": "Editorial", "typography": "Space Grotesk & Inter", "palette": "Cobalt Ocean" },
  "reference_files": [ { "filename": "brief.txt", "size": 1234, "content": "…" } ],
  "project_id": "<workspace folder id, cloud only — omit if none>",
  "thumbnail_url": "<optional public image URL for link previews>"
})
```

- Everything the folio needs beyond `index.html` — stylesheets, scripts, images — is added with `update_project`'s `updated_files` immediately after creation (e.g. `"app.css"`, `"assets/cover.png"`), or kept inline as data URLs inside the HTML. Keep binary assets inline at creation if the folio must render perfectly on the very first load.
- Binary files anywhere are base64 Data URLs (`data:image/png;base64,…`); they are decoded and served at their path.
- An `assets/cover.png` (or the first PNG/JPEG) shipped in the package is used as the thumbnail automatically when `thumbnail_url` is omitted.
- Save the returned `project_id` — every later call needs it.

## 4. Publish and share

Folios are created published by default — but confirm the state and set privacy deliberately before sharing:

```
manage_sharing({ "project_id": "…" })                                  # no args beyond id = read
manage_sharing({ "project_id": "…", "status": "published" })           # or keep draft for review
```

Privacy, access keys, guest comments, and presentation mode live in the same call (see livefolio-permissions).

Close the loop with the user: return the share URL and one line on what you shipped. "Done — <url>. Ask me to change anything; reviewer feedback on the page comes back to me as pins."

## 5. Decision table

| The user wants | Do this |
|---|---|
| A public page right away | `create_project` → `manage_sharing` read (confirm published) → return link |
| A draft to review first | `create_project` → `manage_sharing { "status": "draft" }` |
| A password-protected link | `manage_sharing { "isPrivate": true, "accessKey": "…" }` |
| Guest comments on the page | `manage_sharing { "allowComments": true }` |
| A price gate or marketplace listing | After creation — `manage_paid_access` / `manage_listing` (cloud only) |
| Extra files (CSS/JS/images) | `update_project` `updated_files` right after creation |

## 6. Errors and recovery

| Symptom | Cause | Fix |
|---|---|---|
| Folio renders broken or unstyled in the share view | External scripts/fonts/CDNs blocked by the content policy | Remove every external reference; inline CSS/JS; system fonts |
| `create_project` refused | `title` or `initial_html` missing | Both are required |
| User opened the link and it says draft | Folio was never published (or was unpublished) | `manage_sharing { "status": "published" }` |
| Folder id refused | Wrong id, or the folder is archived | Re-run `list_workspaces`; unarchive the folder first |
| Link 404s even though published | The visibility rule fails somewhere (private, archived folder…) | Read livefolio-permissions §2 and check all five conditions |

Next: reviewer feedback and changes → livefolio-iterate. Who-can-do-what → livefolio-permissions. Look and feel → livefolio-brand.
