CR

creating-plugins

Build and scaffold custom plugins for the EmDash CMS environment.

Install

mkdir -p .claude/skills/creating-plugins && curl -L -o skill.zip "https://agentskills.codes/api/skills/download/10979" && unzip -o skill.zip -d .claude/skills/creating-plugins && rm skill.zip

Installs to .claude/skills/creating-plugins

Activation

This is the description your AI agent reads to decide when to run this skill — the better it matches your request, the more reliably it fires.

Create EmDash CMS plugins with hooks, storage, settings, admin UI, API routes, and Portable Text block types. Use this skill when asked to build, scaffold, or implement an EmDash plugin, or when creating plugin features like custom block types, admin pages, or content hooks.
275 chars✓ has a “when” triggerlonger than Claude Code's old 250-char listing cap (fine on current versions)
Advanced

Key capabilities

  • Scaffolds EmDash CMS plugins
  • Implements hooks and routes
  • Manages admin UI and block types
  • Supports standard and native plugin formats

How it works

It provides a standardized structure and tools for creating TypeScript-based plugins for EmDash CMS.

Inputs & outputs

You give it
Plugin requirements
You get back
Plugin scaffold and code

When to use creating-plugins

  • Scaffolding a new plugin
  • Implementing custom content hooks
  • Adding admin pages to CMS

About this skill

Creating EmDash Plugins

EmDash plugins extend the CMS with hooks, storage, settings, admin UI, API routes, and custom Portable Text block types. All plugins are TypeScript packages.

Plugin Types

EmDash has two plugin formats:

TypeFormatAdmin UIWhere it runs
StandarddefinePlugin({ hooks, routes })Block KitIsolate on Cloudflare, in-process elsewhere
NativecreatePlugin() / definePlugin() with id+versionReact or Block KitAlways in host isolate

Standard is the default. Most plugins should use it. Standard plugins can be published to the marketplace and work in both trusted and sandboxed modes.

Native is an escape hatch for plugins that need React admin components, direct DB access, or custom Astro components. Native plugins can only run in plugins: [] -- they cannot be sandboxed or published to the marketplace.

Plugin Anatomy

Every plugin has two parts that run in different contexts:

  1. Plugin descriptor (PluginDescriptor) — returned by the factory function in index.ts. Declares metadata (id, version, capabilities, storage). Runs at build time in Vite (imported in astro.config.mjs). Must be side-effect-free.
  2. Plugin definition (definePlugin()) — contains the runtime logic (hooks, routes). Runs at request time on the deployed server. Has access to the full plugin context (ctx). Lives in a separate file (typically sandbox-entry.ts).

These must be in separate entrypoints because they execute in completely different environments:

my-plugin/
├── src/
│   ├── index.ts            # Descriptor factory (runs in Vite at build time)
│   ├── sandbox-entry.ts    # Plugin definition with definePlugin() (runs at deploy time)
│   ├── admin.tsx            # Admin UI exports (React) — optional, native only
│   └── astro/               # Site-side rendering components — optional, native only
│       └── index.ts         # Must export `blockComponents`
├── package.json
└── tsconfig.json

Minimal Plugin (Standard Format)

The simplest possible plugin -- just hooks:

// src/index.ts — descriptor factory, runs in Vite at build time
import type { PluginDescriptor } from "emdash";

export function myPlugin(): PluginDescriptor {
	return {
		id: "my-plugin",
		version: "1.0.0",
		format: "standard",
		entrypoint: "@my-org/my-plugin/sandbox",
		options: {},
	};
}
// src/sandbox-entry.ts — plugin definition, runs at request time
import { definePlugin } from "emdash";
import type { PluginContext } from "emdash";

export default definePlugin({
	hooks: {
		"content:afterSave": {
			handler: async (event: any, ctx: PluginContext) => {
				ctx.log.info(`Saved ${event.collection}/${event.content.id}`);
			},
		},
	},
});

The descriptor is what gets imported in astro.config.mjs. The entrypoint field points to the module containing the definePlugin() default export. For standard plugins, this is the ./sandbox export from package.json.

Key differences from native format:

  • No id, version, or capabilities in definePlugin() -- those live in the descriptor
  • definePlugin() is an identity function providing type inference
  • Hook handlers use (event, ctx) two-arg pattern
  • Route handlers use (routeCtx, ctx) two-arg pattern
  • Exported as default (not a factory function)

Plugin ID Rules

  • Lowercase alphanumeric + hyphens only
  • Simple (my-plugin) or scoped (@my-org/my-plugin)
  • Unique across all installed plugins

Registration

The descriptor is imported in astro.config.mjs (Vite context):

import { myPlugin } from "@my-org/my-plugin";

export default defineConfig({
	integrations: [
		emdash({
			plugins: [myPlugin()], // runs in-process
			// OR
			sandboxed: [myPlugin()], // runs in isolate on Cloudflare
		}),
	],
});

Standard plugins work in either array. Native plugins only work in plugins: [].

Trusted vs Sandboxed Plugins

EmDash has two execution modes. Plugin code is identical in both — only the enforcement changes.

TrustedSandboxed
Runs inMain processIsolated V8 isolate (Dynamic Worker Loader)
Install methodastro.config.mjs (code change + deploy)Admin UI (one-click from marketplace)
CapabilitiesAdvisory (not enforced)Enforced at runtime via RPC bridge
Resource limitsNoneCPU 50ms, 10 subrequests, 30s wall-time, ~128MB memory
Network accessUnrestrictedBlocked; only via ctx.http with allowedHosts
Data accessFull database accessScoped to declared capabilities
Node.js APIsFull accessNot available (V8 isolate only)
Available onAll platformsCloudflare Workers only
Best forFirst-party code, reviewed npm packagesThird-party extensions, marketplace plugins

Trusted Mode

Trusted plugins are npm packages or local files added in astro.config.mjs. They run in-process with your Astro site.

  • Capabilities are documentation only. Declaring ["content:read"] documents intent but isn't enforced — the plugin has full process access.
  • Only install from sources you trust. A malicious trusted plugin has the same access as your application code.

Sandboxed Mode

Sandboxed plugins run in isolated V8 isolates on Cloudflare Workers via Dynamic Worker Loader. Each plugin gets its own isolate.

  • Capabilities are enforced. If a plugin declares ["content:read"], it can only call ctx.content.get() and ctx.content.list(). Attempting ctx.content.create() throws a permission error.
  • Network is blocked by default. Direct fetch() calls fail. Plugins must use ctx.http.fetch(), which validates against allowedHosts.
  • Storage is scoped. A plugin can only access its own KV and storage collections.
  • Admin UI uses Block Kit. Sandboxed plugins describe their UI as JSON blocks -- no plugin JavaScript runs in the browser. See Block Kit reference.
  • No Portable Text block types. PT blocks require Astro components for site-side rendering (componentsEntry), which are loaded at build time from npm. Sandboxed plugins are installed at runtime and can't ship components. PT blocks are a native-plugin-only feature.
  • Routes work. Standard plugin routes are available in both trusted and sandboxed modes via the sandbox runner's invokeRoute() RPC.

Sandboxing is not available on Node.js. All plugins run in trusted mode on non-Cloudflare platforms.

Developing for Both Modes

Write the same code. Develop locally in trusted mode (faster iteration, easier debugging). Deploy to sandboxed mode in production without code changes. With the standard format, the same entrypoint serves both modes -- no separate sandbox entry needed.

// src/sandbox-entry.ts -- works in both trusted and sandboxed modes
import { definePlugin } from "emdash";
import type { PluginContext } from "emdash";

export default definePlugin({
	hooks: {
		"content:afterSave": {
			handler: async (event: any, ctx: PluginContext) => {
				// Trusted: ctx.http present because descriptor declares network:request
				// Sandboxed: ctx.http present and enforced via RPC bridge
				if (!ctx.http) return;
				await ctx.http.fetch("https://api.analytics.example.com/track", {
					method: "POST",
					body: JSON.stringify({ contentId: event.content.id }),
				});
			},
		},
	},
});

Key constraint for sandbox compatibility: no Node.js built-ins (fs, path, child_process, etc.) in backend code. Use Web APIs instead.

Capabilities

Capabilities control what APIs are available on ctx. Always declare what your plugin needs — even in trusted mode, they document intent and are required for sandboxed execution.

CapabilityGrantsctx property
content:readctx.content.get(), ctx.content.list()content
content:writectx.content.create(), ctx.content.update(), ctx.content.delete()content
media:readctx.media.get(), ctx.media.list()media
media:writectx.media.getUploadUrl(), ctx.media.delete()media
network:requestctx.http.fetch() (restricted to allowedHosts)http
network:request:unrestrictedctx.http.fetch() (unrestricted — for user-configured URLs)http
users:readctx.users.get(), ctx.users.list(), ctx.users.getByEmail()users
email:sendctx.email.send() — send email through the pipel

Content truncated.

When not to use it

  • When the project is not an EmDash CMS plugin
  • When the user wants a non-TypeScript plugin

Limitations

  • Specific to EmDash CMS
  • Requires TypeScript knowledge

How it compares

It offers a dedicated, standardized framework for EmDash CMS plugin development.

Compared to similar skills

creating-plugins side by side with the closest alternatives in the catalog.

SkillInstallsUpdatedSafetyDifficulty
creating-plugins (this skill)01moReviewAdvanced
scaffold-feature04moReviewIntermediate
supabase-developer957moReviewIntermediate
payload732moReviewIntermediate

Try saying

Example prompts that trigger this skill in your AI assistant.

You might also like

scaffold-feature

niklasbrandt

Scaffold a complete full-stack feature: FastAPI endpoint, dashboard Web Component, i18n keys, test stubs, and documentation checks.

00

supabase-developer

daffy0208

Build full-stack applications with Supabase (PostgreSQL, Auth, Storage, Real-time, Edge Functions). Use when implementing authentication, database design with RLS, file storage, real-time features, or serverless functions.

95185

payload

payloadcms

Use when working with Payload CMS projects (payload.config.ts, collections, fields, hooks, access control, Payload API). Use when debugging validation errors, security issues, relationship queries, transactions, or hook behavior.

73206

telegram-mini-app

davila7

Expert in building Telegram Mini Apps (TWA) - web apps that run inside Telegram with native-like experience. Covers the TON ecosystem, Telegram Web App API, payments, user authentication, and building viral mini apps that monetize. Use when: telegram mini app, TWA, telegram web app, TON app, mini app.

62163

stripe-integration

wshobson

Implement Stripe payment processing for robust, PCI-compliant payment flows including checkout, subscriptions, and webhooks. Use when integrating Stripe payments, building subscription systems, or implementing secure checkout flows.

48165

deepwiki-rs

sopaco

AI-powered Rust documentation generation engine for comprehensive codebase analysis, C4 architecture diagrams, and automated technical documentation. Use when Claude needs to analyze source code, understand software architecture, generate technical specs, or create professional documentation from any programming language.

25170

Search skills

Search the agent skills registry