monaco-editor
БесплатноБез исполняемых скриптовНе проверенMonaco Editor is the code editor that powers VS Code, packaged as a browser component with syntax highlighting, IntelliSense, diagnostics and a diff view. Use…
от TerminalSkills★ 221 звезда на GitHubОб этом скилле
Monaco Editor — the VS Code editor in the browser
Overview
monaco-editor is an npm package that ships the editor core of VS Code: multi-cursor editing, find and replace, minimap, syntax highlighting for dozens of languages, and richer language services for TypeScript/JavaScript, JSON, CSS and HTML (completion, hover, validation). The main objects are:
- model (
ITextModel): the text plus language, identified by aUri. Created withmonaco.editor.createModel. - editor: a view onto one model, created with
monaco.editor.create(domElement, options). - diff editor: two models side by side,
monaco.editor.createDiffEditor. - markers: error and warning squiggles you set yourself with
monaco.editor.setModelMarkers.
@monaco-editor/react is a separate community package (not part of the Microsoft repository) that wraps the editor as <Editor /> and <DiffEditor /> and loads Monaco for you. By default it fetches Monaco files from a CDN at runtime; call loader.config({ monaco }) to use the npm package from your own bundle instead (needed for offline, intranet or strict CSP deployments).
Monaco is a desktop-browser editor. It does not support mobile browsers well. For a terminal-like or plain textarea need, it is overkill.
Instructions
Installation
npm install monaco-editor
React wrapper (optional, separate package; it accepts React 16.8 to 19):
npm install @monaco-editor/react
Web workers
Language features (JSON, CSS/SCSS/Less, HTML, TypeScript/JavaScript) and the editor core run in web workers. You must tell Monaco how to start them through self.MonacoEnvironment. Without it the editor still opens but logs Could not create web worker(s) and falls back to the main thread. Workers cannot start from a file:// page, so always serve over http:// or https://.
With Vite, import each worker with the ?worker suffix and pick one by label:
import * as monaco from 'monaco-editor';
import editorWorker from 'monaco-editor/editor/editor.worker?worker';
import jsonWorker from 'monaco-editor/language/json/json.worker?worker';
import cssWorker from 'monaco-editor/language/css/css.worker?worker';
import htmlWorker from 'monaco-editor/language/html/html.worker?worker';
import tsWorker from 'monaco-editor/language/typescript/ts.worker?worker';
self.MonacoEnvironment = {
getWorker(_workerId: string, label: string) {
if (label === 'json') return new jsonWorker();
if (label === 'css' || label === 'scss' || label === 'less') return new cssWorker();
if (label === 'html' || label === 'handlebars' || label === 'razor') return new htmlWorker();
if (label === 'typescript' || label === 'javascript') return new tsWorker();
return new editorWorker();
},
};
These short paths come from the package exports map and built successfully with Vite 8 and monaco-editor 0.57. Older guides (including the @monaco-editor/react README) use monaco-editor/esm/vs/...; with 0.57 the editor.worker import written that way failed to resolve, so prefer the paths above.
Put this in a module that runs once before the first editor is created (for example src/monaco-setup.ts imported from main.tsx). Include only the workers for languages you ship; other languages (Python, Go, YAML, Markdown, and so on) get highlighting from the main thread and need no worker.
With webpack, either use the community monaco-editor-webpack-plugin (new MonacoWebpackPlugin() in plugins, with style-loader/css-loader for .css and file-loader for .ttf), or list each worker as a separate webpack entry and return its bundle URL from getWorkerUrl; both are described in the repository's docs/integrate-esm.md.
Versions from 0.56 also expose smaller entry points (monaco-editor/editor, then opt-in monaco-editor/features/... and monaco-editor/languages/... registrations) for custom bundles; the default import * as monaco from 'monaco-editor' loads everything. See the package CHANGELOG before slimming a bundle.
Creating an editor and models
import * as monaco from 'monaco-editor';
const model = monaco.editor.createModel(
'{\n "name": "billing-api",\n "port": 8443\n}\n',
'json',
monaco.Uri.parse('file:///config/app.json'),
);
const editor = monaco.editor.create(document.getElementById('editor')!, {
model,
theme: 'vs-dark',
automaticLayout: true,
minimap: { enabled: false },
fontSize: 14,
tabSize: 2,
});
editor.onDidChangeModelContent(() => {
const text = editor.getValue();
console.log(`edited, ${text.length} characters`);
});
editor.addCommand(monaco.KeyMod.CtrlCmd | monaco.KeyCode.KeyS, () => {
console.log('save', model.getValue());
});
The container element must have a height (CSS); the editor does not size itself from its content. automaticLayout: true makes it follow container resizes. A model URI must be unique: creating a second model with the same Uri throws `Cannot
Установить monaco-editor в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
Без ограничений — скилл может использовать любой инструмент.
Вложенные файлы
FAQ
Что делает скилл monaco-editor?
Monaco Editor is the code editor that powers VS Code, packaged as a browser component with syntax highlighting, IntelliSense, diagnostics and a diff view. Use when a user asks to "embed a code editor in the web app", "add Monaco to a React or Vite project", "show a JSON or YAML editor with validation", "build a diff viewer", "set up Monaco web workers", or "use @monaco-editor/react without the CDN". Covers bundler setup, models, languages, markers and the diff editor.
Как установить скилл monaco-editor?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл monaco-editor запускает скрипты?
Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.
Похожие скиллы
mcp-builder
Guide for creating high-quality MCP (Model Context Protocol) servers that enable LLMs to interact with external services through well-designed tools. Use when…
от Anthropicclaude-api
Reference for the Claude API / Anthropic SDK — model ids, pricing, params, streaming, tool use, MCP, agents, caching, token counting, model migration. TRIGGER…
от Anthropicalgorithmic-art
Creating algorithmic art using p5.js with seeded randomness and interactive parameter exploration. Use this when users request creating art using code…
от Anthropicmcp-integration
This skill should be used when the user asks to "add MCP server", "integrate MCP", "configure MCP in plugin", "use .mcp.json", "set up Model Context…
от Anthropic