Перейти к содержанию
Skillpedia
API и серверы (бэкенд)14k · #11247

creating-plugins

Что он делает

Скилл описывает, как создавать расширения, которые называются плагинами, для системы управления контентом EmDash. Он нужен разработчикам, которые хотят добавить на сайт EmDash свои функции или экраны администрирования.

Когда использовать

  • ✓Когда вы хотите добавить на сайт EmDash новую функцию через плагин.
  • ✓Когда нужен плагин со своим экраном администрирования или API-маршрутами.
  • ✓Когда вы хотите опубликовать плагин, который другие смогут установить из реестра.

Ссылка на скилл

https://github.com/emdash-cms/emdash/blob/main/skills/creating-plugins/SKILL.md

Скопируйте и вставьте её в ваш ИИ (Claude, ChatGPT или Cursor) с просьбой следовать инструкциям.

Как использовать

Самый простой способ: скопируйте сообщение и вставьте его в свой ИИ. Он прочитает скилл и выполнит инструкции.

Готовое сообщение для вставки

Используй этот скилл, чтобы помочь мне: https://github.com/emdash-cms/emdash/blob/main/skills/creating-plugins/SKILL.md Прочитай файл SKILL.md по этой ссылке и следуй его инструкциям в моей задаче.
Хотите, чтобы ваш ИИ сам находил такие скиллы?Установите бесплатный MCP Skillpedia: одна строка, и перед каждой задачей он ищет среди 15 000+ скиллов.Установить за 1 минуту →

Пример запроса к вашему ИИ

“Можешь помочь создать плагин EmDash, который добавляет в админку свою форму?”

5 новых скиллов в неделю. 1 минута чтения.

Как это работает

Агент выбирает между песочничным плагином и доверенным нативным плагином, создаёт каркас проекта и реализует хуки, маршруты и страницы администрирования. Затем он запускает тесты плагина.

Технический текст (оригинальный SKILL.md)

Оригинальный текст автора на английском, прямо с GitHub.

Creating EmDash plugins

Build against the API that reaches the intended execution mode. Source types and production-boundary tests take precedence over examples in this skill when they disagree.

Choose a format

Format Runtime source Admin UI Distribution
Sandboxed src/plugin.ts default-exports a SandboxedPlugin Block Kit pages, widgets, saved-entry panels, and actions Plugin CLI and registry
Native definePlugin() / createPlugin() React, Block Kit, and Astro components Trusted site dependency only

Use a sandboxed plugin unless the feature needs host-process access, React admin code, Astro rendering components, raw page fragments, or custom Portable Text block definitions. Native plugins run with the site's authority and cannot be installed from the registry.

Scaffold a sandboxed plugin

pnpm dlx @emdash-cms/plugin-cli init my-plugin
cd my-plugin
pnpm install
pnpm run test

The manifest is the identity and trust contract. Runtime hooks and routes live in src/plugin.ts; the CLI generates descriptors, manifests, and bundles. Do not create a separate descriptor factory or sandbox-entry.ts.

import type { SandboxedPlugin } from "emdash/plugin";

const plugin: SandboxedPlugin = {
	hooks: {
		"content:afterSave": async (event, ctx) => {
			ctx.log.info("Content saved", { id: event.content.id });
		},
	},
};

export default plugin;

Import authoring types from emdash/plugin with import type. The CLI bundles value imports such as pluginRoute() and pluginResponse() from emdash/plugin and portableTextToMarkdown() from emdash/client. Sandboxed runtime code can use Web APIs but not Node.js built-ins.

Declare access

Declare every host API in emdash-plugin.jsonc. Adding authority, exposing a route publicly, or adding MCP tools requires renewed administrator approval.

Capability Grants
schema:read Public collection and field definitions
admin.editor-draft:read Selected unsaved field values after an explicit editor interaction
admin.editor-draft:patch Host-validated unsaved field changes proposed for editor review
content:read Content identity, translations, and published public URLs
content:revisions:read Retained revision data; implies content read
content:write Create, update, delete, and translation creation; implies read
content:publish Revision-fenced publish, unpublish, schedule, and unschedule; implies read
content:restore Revision-fenced reads and restoration of trashed content
hooks.content-policy:register Pre-publish, pre-schedule, and pre-unpublish policy hooks
taxonomies:read Taxonomy definitions, terms, and entry assignments
taxonomies:write Term creation and assignment deltas; implies read
bylines:read Public byline profiles and single or batched entry credits
redirects:read Versioned redirect inspection
redirects:write Versioned redirect creation, update, and deletion; implies read
comments:read Stored non-trashed comments and their personal data
comments:moderate Expected-status moderation; implies read
media:read Ready-media metadata and authenticated asset URLs
media:bytes:read Bounded media bytes and content hashes
`m
Частые вопросы

В чём разница между песочничными и нативными плагинами?

Песочничные плагины работают с ограниченным доступом и могут устанавливаться из реестра, а нативные работают с полными правами сайта и подходят только для доверенного кода.

Есть ли стартовый проект?

Да. Команда для плагина создаёт начальный проект.

Могут ли плагины добавлять экраны на React?

Нативные плагины могут использовать компоненты React и Astro для страниц администрирования и сайта.

Подробности

Оригинальное описание автора

Create EmDash CMS plugins with sandboxed hooks, routes, storage, content and media APIs, MCP tools, and declarative admin UI, or native React and Astro extensions. Use when scaffolding or implementing an EmDash plugin.

repo: emdash-cms/emdash

Популярность

Звёзды на GitHub
14k
Место в рейтинге
#11247
Лицензия
MIT
Обновлён
02.11.2026

Полезен ли этот скилл?

0

Войдите , чтобы голосовать.

Комментарии

  • …

Другие скиллы из этого репозитория

Похожие скиллы