Working with AI assistants
The editor has no AI inside it. These docs are made to be read by coding assistants (Claude Code, Cursor, Copilot and others), so that the code they write for you uses the real API.
Docs in plain text
| File | What it is |
|---|---|
/llms.txt | An index of every page, with a one-line summary each (llmstxt.org format) |
/llms-full.txt | The whole guide, the recipes and the full API reference in one file, with all code examples inlined |
node_modules/@writeon/core/llms-full.txt | The same file, installed with the package: always the docs of the version you use, no site needed |
/<page>.md | Any page as clean Markdown: add .md to its address, e.g. /guide/kit.md |
They are generated from the same sources as this site on every build (pnpm docs:build; not in docs:dev), so they never fall behind it. They are in English only.
Assistants that read node_modules find the installed copy on their own (every package's README points to it). Otherwise give your assistant llms-full.txt, or llms.txt when it can fetch pages itself.
Error messages are written for the same readers: each one says what to change, e.g. which extension to add or how to call a command.
AGENTS.md
Assistants read a project file of standing instructions: AGENTS.md, CLAUDE.md or the equivalent of your tool. Copy this block into it, so every session starts with the rules that matter most:
## Rich text editor: Writeon
This project uses Writeon (`@writeon/*`), a headless rich text editor on ProseMirror.
Full documentation for the installed version: `node_modules/@writeon/core/llms-full.txt`
(index: `llms.txt` next to it; also on the docs site). Read it before writing editor code;
do not guess the API. Error messages say how to fix the mistake: follow them.
Packages: `@writeon/core` (editor, `/presets`, `/commands`, `/extension`),
`@writeon/react`, `@writeon/vue`, `@writeon/ui` (headless controllers),
`@writeon/kit` (ready-made UI, `/react`, `/vue`, `/advanced`),
`@writeon/advanced` (+ `/schema`), `@writeon/html`, `@writeon/markdown`,
`@writeon/server`.
Rules:
- Store the document as JSON: `editor.getJSON()` (`DocJSON`). HTML and Markdown are
derived from it (`toHTML`, `toMarkdown`), never the other way round.
- Define the extensions once, in one shared array, and use the same array in the
editor, in `@writeon/server` and in `@writeon/html` / `@writeon/markdown`.
- Never trust what the browser sends: on the server, `validate(body, { extensions })`
first, save `result.doc`, render with `toSafeHTML(result.doc, { extensions })`.
- Every editor needs `label` (a string or `{ labelledBy }`): it names the field for
screen readers.
- Commands are factories: `editor.run(toggleBold())`, `editor.can(toggleBold())`;
several in one undo step with `editor.transaction((tx) => { … })`.
- Advanced features: include `advancedSchema()` in the extensions from the start;
load the behaviour later with `editor.enable(() => import('@writeon/advanced'))`,
or use the kit's `<Advanced>` / `mountAdvanced()`.
- `editor.pm` (raw ProseMirror) is not a stable API; prefer commands, snapshots
(`getSnapshot()`, `subscribe()`) and extensions (`defineExtension`).
- Save with `debounce()` from `@writeon/core` and call `.flush()` on `pagehide`.Every rule in it is explained in this guide: saving, security, core concepts, basic and advanced.
Types and JSDoc
Every public function, type and option has JSDoc, often with an example. Assistants that read your node_modules or use your editor's language server see it too, for the exact version you installed.