skills/superdoc-core/SKILL.md
Core SuperDoc usage guidelines for document editing applications. Use when integrating SuperDoc with vanilla JavaScript, Vue, Svelte, or other frameworks. Triggers on tasks involving DOCX editing, document rendering, or SuperDoc configuration.
npx skillsauth add superdoc-dev/agent-skills superdoc-coreInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
SuperDoc is a document editing and rendering library for the web. It provides full DOCX support with real-time collaboration capabilities.
Reference these guidelines when:
npm install superdoc
import { SuperDoc } from 'superdoc';
import 'superdoc/style.css';
const superdoc = new SuperDoc({
selector: '#editor',
document: file, // File, Blob, URL, or config object
documentMode: 'editing',
onReady: ({ superdoc }) => {
console.log('Editor ready!');
}
});
| Option | Type | Description |
|--------|------|-------------|
| selector | string \| HTMLElement | Container element |
| document | File \| Blob \| string \| object | Document to load |
| Option | Type | Default | Description |
|--------|------|---------|-------------|
| documentMode | 'editing' \| 'viewing' \| 'suggesting' | 'editing' | Editing mode |
| role | 'editor' \| 'viewer' \| 'suggester' | 'editor' | User permissions |
| Option | Type | Description |
|--------|------|-------------|
| user | { name, email?, image? } | Current user info |
| users | Array<{ name, email, image? }> | All users (for @-mentions) |
| Option | Type | Default | Description |
|--------|------|---------|-------------|
| toolbar | string \| HTMLElement \| false | auto | Toolbar container |
| rulers | boolean | true | Show rulers |
| pagination | boolean | true | Enable pagination |
| Option | Type | Description |
|--------|------|-------------|
| onReady | ({ superdoc }) => void | Instance initialized |
| onEditorCreate | ({ editor }) => void | ProseMirror editor created |
| onEditorDestroy | () => void | Editor destroyed |
| onEditorUpdate | ({ editor }) => void | Content changed |
| onContentError | (event) => void | Document parsing error |
| onException | ({ error }) => void | Runtime error |
// Change editing mode
superdoc.setDocumentMode('viewing');
superdoc.setDocumentMode('editing');
superdoc.setDocumentMode('suggesting');
// Export as DOCX blob
const blob = await superdoc.export({ triggerDownload: false });
// Export and trigger download
await superdoc.export({ triggerDownload: true });
// Export as HTML
const htmlArray = superdoc.getHTML();
// Focus the editor
superdoc.focus();
// Lock/unlock editing
superdoc.setLocked(true);
superdoc.setLocked(false);
// Toggle rulers
superdoc.toggleRuler();
// High contrast mode
superdoc.setHighContrastMode(true);
// Search for text
const results = superdoc.search('keyword');
const regexResults = superdoc.search(/pattern/gi);
// Navigate to result
superdoc.goToSearchResult(results[0]);
// Set track changes preferences
superdoc.setTrackedChangesPreferences({
mode: 'review', // 'review' | 'original' | 'final'
enabled: true
});
// Destroy instance
superdoc.destroy();
| Mode | Description | Use Case |
|------|-------------|----------|
| editing | Full editing capabilities | Default editing |
| viewing | Read-only presentation | Document preview |
| suggesting | Track changes mode | Collaborative review |
| Role | Can Edit | Can Suggest | Can View |
|------|----------|-------------|----------|
| editor | Yes | Yes | Yes |
| suggester | No | Yes | Yes |
| viewer | No | No | Yes |
<script setup>
import { ref, onMounted, onUnmounted } from 'vue';
import { SuperDoc } from 'superdoc';
import 'superdoc/style.css';
const containerRef = ref(null);
let superdoc = null;
const props = defineProps({
document: { type: [File, String, Object], required: true }
});
onMounted(async () => {
superdoc = new SuperDoc({
selector: containerRef.value,
document: props.document,
documentMode: 'editing'
});
});
onUnmounted(() => {
superdoc?.destroy();
});
</script>
<template>
<div ref="containerRef" style="height: 700px" />
</template>
<script>
import { onMount, onDestroy } from 'svelte';
import { SuperDoc } from 'superdoc';
import 'superdoc/style.css';
export let document;
let container;
let superdoc;
onMount(() => {
superdoc = new SuperDoc({
selector: container,
document,
documentMode: 'editing'
});
});
onDestroy(() => {
superdoc?.destroy();
});
</script>
<div bind:this={container} style="height: 700px" />
async function initEditor(container, document) {
const { SuperDoc } = await import('superdoc');
return new SuperDoc({
selector: container,
document,
documentMode: 'editing',
onReady: ({ superdoc }) => {
console.log('Ready!');
}
});
}
import * as Y from 'yjs';
import { WebsocketProvider } from 'y-websocket';
import { SuperDoc } from 'superdoc';
const ydoc = new Y.Doc();
const provider = new WebsocketProvider(
'wss://your-server.com',
'document-id',
ydoc
);
const superdoc = new SuperDoc({
selector: '#editor',
document: file,
modules: {
collaboration: {
ydoc,
provider
}
}
});
const superdoc = new SuperDoc({
selector: '#editor',
document: file,
modules: {
ai: {
apiKey: 'your-api-key',
endpoint: 'https://api.example.com/ai'
}
}
});
const superdoc = new SuperDoc({
selector: '#editor',
document: file,
user: { name: 'John', email: '[email protected]' },
users: [
{ name: 'Jane', email: '[email protected]' },
{ name: 'Bob', email: '[email protected]' }
],
modules: {
comments: {
enabled: true
}
}
});
const superdoc = new SuperDoc({
selector: '#editor',
document: file,
onContentError: (event) => {
console.error('Failed to parse document:', event);
},
onException: ({ error }) => {
console.error('Runtime error:', error);
}
});
SuperDoc has two rendering systems:
| Mode | System | Description | |------|--------|-------------| | Editing | super-editor | ProseMirror-based rich text editing | | Viewing | layout-engine | Virtualized DOM rendering for presentation |
Both systems work together to provide seamless editing and viewing experiences.
| Requirement | Version | |-------------|---------| | Node.js | 16+ | | Modern browser | ES2020 support |
| Example | Description | |---------|-------------| | React + TypeScript | React wrapper usage | | Next.js SSR | Next.js App Router |
For React/Next.js projects, prefer
@superdoc-dev/reactwrapper over core package.
development
React integration guidelines for SuperDoc document editor. Use when adding document editing capabilities to React or Next.js applications, working with DOCX files, or implementing collaboration features. Triggers on tasks involving document editors, DOCX handling, or SuperDoc integration.
development
Maintainer-only workflow for handling GitHub Secret Scanning alerts on OpenClaw. Use when Codex needs to triage, redact, clean up, and resolve secret leakage found in issue comments, issue bodies, PR comments, or other GitHub content.
development
Maintainer workflow for OpenClaw releases, prereleases, changelog release notes, and publish validation. Use when Codex needs to prepare or verify stable or beta release steps, align version naming, assemble release notes, check release auth requirements, or validate publish-time commands and artifacts.
development
Run, watch, debug, and extend OpenClaw QA testing with qa-lab and qa-channel. Use when Codex needs to execute the repo-backed QA suite, inspect live QA artifacts, debug failing scenarios, add new QA scenarios, or explain the OpenClaw QA workflow. Prefer the live OpenAI lane with regular openai/gpt-5.4 in fast mode; do not use gpt-5.4-pro or gpt-5.4-mini unless the user explicitly overrides that policy.