---
name: jolt
description: Build, edit, debug and ship JOLT apps, which are HTML/CSS/JavaScript apps stored inside Excel, Word and PowerPoint documents. Use when a task mentions JOLT, JADE, JET, JUICE, the jolt CLI, jolt.json, the `jolt` global, `@automation` functions, Office.js automations packaged as a JOLT project, or importing a JADE classic project.
---

# JOLT

JOLT (JavaScript Office Language Tools) lets people build small apps that live inside an Excel, Word or PowerPoint file. An app is a tiny static website (HTML, CSS, JavaScript ES modules) saved in the document. It can render a page in a task pane, expose one-click "automations" that change the document through Office.js, or both. Docs: https://jolt.technologylearningcompany.com

## The three tools

| Tool | What it is |
| --- | --- |
| **JADE** | Editor inside Office (Monaco, file tree, Run, Output). Opens inside JET: ☰ → Build or edit apps (JADE). |
| **JET** | Pane that runs the app as end users see it. It is the add-in (Home → Jolt → Run Apps). |
| **JUICE** | VS Code extension. Project lives as local files, each save hot-reloads in JET, can publish to the user's Cloudflare account. |
| **jolt CLI** | The same as JUICE from a terminal, and how you (the agent) drive the running app. Ships with this skill as `scripts/jolt.mjs`. |

Each project has one editor at a time: JADE or VS Code.

## Project layout

```
jolt.json     settings
index.html    entry page (mounted into the pane, not loaded as a page)
styles.css
main.js       ES modules; relative imports work
lib/util.js
```

Text files only. No images or other binaries (use URLs or data URIs). Paths use `/`. Relative imports must include the extension (`./util.js`). Circular imports are unsupported.

```json
{
  "name": "My JOLT App",
  "entry": "index.html",
  "autoRun": "main.js#autoRun",
  "imports": { "lodash/": "https://esm.sh/lodash-es@4/" },
  "launchUrl": "https://my-app.pages.dev/"
}
```

- `entry`: page JET mounts (default `index.html`). If the file is missing, JET lists the project's automations as buttons.
- `autoRun`: `file#function`, called once after mount. One-parameter functions receive the host context.
- `imports`: import map. Keys are names or prefixes ending in `/`.
- `launchUrl`: JET runs the app at this URL instead of the embedded project.

## Writing code

Everything is plain, uncompiled JavaScript. **No JSX, no TypeScript, no build step.** For JSX-like markup use `htm`.

The global `jolt` (or `import { jolt } from "jolt"`) is the API. Essentials:

```js
/** @automation Clean up — Trim spaces in the selected cells. */
export async function cleanUp(context) {          // exactly one parameter => runs inside Excel.run/Word.run/PowerPoint.run
  const r = context.workbook.getSelectedRange().load("values");
  await context.sync();
  // ...
  await context.sync();
  jolt.print("done");
}

export function autoRun() {                       // runs once after index.html is mounted
  jolt.$("#go")?.addEventListener("click", () => jolt.run(cleanUp).then(
    () => jolt.notify("Done", "success"), (e) => jolt.notify(String(e), "error")));
}
```

- JOLT checks the function's declared parameter count (`fn.length`). **Exactly one** means it runs inside the host's `run` and gets the request context. Any other count means it is called with no arguments. A default value (`context = null`) or a rest parameter makes the count 0, so write a plain `context` parameter.
- Only `export function f` / `export async function f` / `export const f = () => …` show up in JADE's function picker and as automations. `export { f }` lists and `export default` do not.
- `@automation Title — description` in a function's JSDoc marks it as an automation (starred in JADE, a button in JET when there is no entry page).
- Use `jolt.$` / `jolt.$$` / `jolt.root` instead of `document.querySelector`; they are the portable way to reach the app's page. `jolt.root` is the `<body>` of the app's own frame (in JET and in JADE's Output View).
- Use `jolt.alert`, `jolt.confirm`, `jolt.prompt`, `jolt.notify`. **Browser `alert`/`confirm`/`prompt` do nothing in Office add-ins.**
- `jolt.storage` is a small JSON key/value store saved in the document; `jolt.files` reads the project's own files.

Full API: [references/api.md](references/api.md).

## Libraries

Bare imports resolve in this order: `imports` in jolt.json → bundled VanJS (`"van"` / `"vanjs-core"`) → esm.sh. **Always pin a version** (`import dayjs from "dayjs@1.11.13"`). Remote code needs the user's one-time per-site trust. For UMD-only libraries use `await jolt.loadScript(url)`. Details in [references/workflow.md](references/workflow.md).

## Picking a workflow

- **User edits inside Office** (JADE): files autosave into the document; the user must still *save the Office document* for anything to persist.
- **User works in VS Code** (JUICE) **or a terminal** (the jolt CLI): the project is local files; JUICE reloads the app in JET on save, and `jolt reload` does it from a terminal. Both need the JET add-in and a Cloudflare account, and share their settings.
- **Shipping**: embed in the document (works offline, update per file), or publish to a URL and set `launchUrl` (one copy, every document updates, needs trust prompt).

See [references/workflow.md](references/workflow.md) for syncing, publishing, auto-open, importing JADE classic projects and troubleshooting.

## Running and checking the app: the jolt CLI

This skill includes the jolt command line, `scripts/jolt.mjs` (Node 22 or later). With it you can send a project to Office, see the running app as text, click and type in it, run functions and read the output. You can also sync, embed and publish. You don't need VS Code.

```sh
node scripts/jolt.mjs status          # set up and connected? (setup and pairing need the user once)
node scripts/jolt.mjs reload          # send the folder, restart the app, show it as Markdown: [`e1` button **Save**] …
node scripts/jolt.mjs click e1        # also: fill, select, check, uncheck, focus, run <file> <fn>, logs
```

Use it to check your changes: edit, `reload`, look, act, read the output. Setup, the full command list and how to read the view are in [references/cli.md](references/cli.md).

## Rules of thumb for agents

1. Without the CLI connected to JET you cannot execute Office.js. Write code defensively, `await context.sync()` after loads and writes, and `load()` every property before reading it.
2. Keep the project to text files, each under 2 MB (bigger ones are silently left out). When JUICE or the CLI sends a folder, they skip dotfiles and dot-folders, top-level `node_modules/` and `dist/`, top-level `package.json`, `package-lock.json`, `jsconfig.json` and `tsconfig.json`, and binary files (images, fonts, PDFs, Office files…).
3. Do not invent `jolt.*` members. If it is not in `references/api.md`, check https://jolt.technologylearningcompany.com/docs/api.html.
4. Never put secrets (API tokens, the VS Code connection code) in project files. They are stored in the document and may be shared.
5. Treat a JOLT document like a macro-enabled file: code embedded in it runs with full document access.
