monaco-editor/SKILL.md
Monaco Editor — the code editor that powers VS Code, for the browser. Use when integrating Monaco Editor in React, configuring editor instances, adding custom languages/themes, handling editor events, or troubleshooting Monaco in Vite/bundler setups. Fetch live documentation for up-to-date details.
npx skillsauth add mikkelkrogsholm/dev-skills monaco-editorInstall 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.
CRITICAL: Your training data for Monaco Editor is unreliable. APIs change between versions and memorized patterns may be wrong or deprecated. Before writing any code, you MUST use
WebFetchto read the live docs based on your task:
- API usage and configuration:
WebFetch("https://microsoft.github.io/monaco-editor/docs.html")- TypeScript type signatures:
WebFetch("https://microsoft.github.io/monaco-editor/typedoc/index.html")- React wrapper (
@monaco-editor/react):WebFetch("https://raw.githubusercontent.com/suren-atoyan/monaco-react/master/README.md")Do not proceed without fetching the relevant URL first. Never assume an API exists — verify against current docs.
Monaco Editor is the browser-based code editor that powers VS Code. It provides syntax highlighting, IntelliSense, diff view, minimap, and more for 50+ languages.
The @monaco-editor/react wrapper is the standard way to use Monaco in React. Key points:
import Editor from '@monaco-editor/react'
<Editor
height="100%"
language="markdown"
theme="vs-dark"
value={content}
onChange={(value) => setValue(value ?? '')}
options={{
minimap: { enabled: false },
wordWrap: 'on',
fontSize: 14,
lineNumbers: 'on',
}}
/>
Access the editor instance via onMount:
<Editor
onMount={(editor, monaco) => {
// editor = IStandaloneCodeEditor
// monaco = the monaco namespace
editorRef.current = editor
editor.addCommand(monaco.KeyMod.CtrlCmd | monaco.KeyCode.KeyS, () => {
handleSave()
})
}}
/>
Always lazy-load Monaco. The editor bundle is ~2MB. In Vite/React, use dynamic imports or React.lazy to avoid blocking initial page load:
const Editor = lazy(() => import('@monaco-editor/react'))
Vite requires the monaco-editor package directly. The React wrapper (@monaco-editor/react) has monaco-editor as a peer dependency. Install both: bun add @monaco-editor/react monaco-editor.
Configure Vite worker bundling. Monaco uses Web Workers for language services. In Vite, use the vite-plugin-monaco-editor plugin or configure manually to avoid worker loading failures:
// vite.config.ts — simplest approach
import monacoEditorPlugin from 'vite-plugin-monaco-editor'
export default defineConfig({
plugins: [react(), monacoEditorPlugin({})],
})
Custom themes use the VS Code format. Define themes via monaco.editor.defineTheme() — the format matches VS Code's tokenColors JSON. Apply with the theme prop.
Dispose editors on unmount. The React wrapper handles this automatically, but if using the raw API (monaco.editor.create()), always call editor.dispose() in cleanup to prevent memory leaks.
Language detection by extension. Use monaco.languages.getLanguages() to find supported language IDs. Common mappings: .md → markdown, .json → json, .ts → typescript, .py → python.
Diff editor is a separate component:
import { DiffEditor } from '@monaco-editor/react'
<DiffEditor original={oldContent} modified={newContent} language="markdown" />
development
Zod — TypeScript-first schema validation with static type inference. Use when building with Zod or asking about schema definitions, type inference, parsing, transformations, refinements, coercion, error handling, or integration with forms, APIs, or tRPC. Fetch live documentation for up-to-date details.
tools
Vite — next-generation frontend build tool with instant dev server and optimized production builds. Use when building with Vite or asking about its APIs, configuration, plugins, SSR, environment variables, or integration with frameworks. Fetch live documentation for up-to-date details.
tools
Upstash — serverless Redis, QStash, and Vector database with per-request pricing optimized for edge and serverless environments. Use when building with Upstash or asking about its Redis client, QStash message queuing, rate limiting, workflows, or vector search. Fetch live documentation for up-to-date details.
tools
Turso — edge-hosted SQLite database built on libSQL with embedded replicas, multi-tenancy, and low-latency global distribution. Use when building with Turso or asking about its libSQL client, embedded replicas, database-per-tenant patterns, auth tokens, sync, or integration with Drizzle or other ORMs. Fetch live documentation for up-to-date details.