一键导入
add-plugin
Add and configure a Momentum CMS plugin in the monorepo
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
Add and configure a Momentum CMS plugin in the monorepo
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
基于 SOC 职业分类
| name | add-plugin |
| description | Add and configure a Momentum CMS plugin in the monorepo |
| argument-hint | <plugin-name> |
Add and configure a plugin in the Momentum CMS monorepo.
$ARGUMENTS - Plugin name: "analytics", "otel", "event-bus", or a custom plugin pathIn the monorepo, plugins are local packages under libs/plugins/. Collections are defined in libs/example-config/src/collections/. Both example apps (example-angular, example-analog) import from @momentumcms/example-config.
momentum.config.tsplugins arraynx run example-angular:generate (or the relevant app target) to regenerate types and admin config@momentumcms/plugins/analytics)Located at libs/plugins/analytics/. Adds event tracking, dashboards, and block-level analytics.
// In apps/example-angular/src/momentum.config.ts
import { analyticsPlugin } from '@momentumcms/plugins/analytics';
import { eventBusPlugin } from '@momentumcms/plugins/core';
const events = eventBusPlugin();
const analytics = analyticsPlugin({
trackCollections: true,
});
const config = defineMomentumConfig({
// ...existing config
plugins: [authPlugin, events, analytics],
});
What it adds:
TrackingRules collectionmodifyCollections@momentumcms/plugins/analytics/admin-routes, @momentumcms/plugins/analytics/block-fields@momentumcms/plugins/otel)Located at libs/plugins/otel/. Distributed tracing for all collection operations.
import { otelPlugin } from '@momentumcms/plugins/otel';
const tracing = otelPlugin({ serviceName: 'momentum-cms' });
const config = defineMomentumConfig({
plugins: [authPlugin, tracing],
});
@momentumcms/plugins/core)Located at libs/plugins/core/. Pub/sub for collection lifecycle events.
import { eventBusPlugin } from '@momentumcms/plugins/core';
const events = eventBusPlugin();
const config = defineMomentumConfig({
plugins: [authPlugin, events],
});
nx run example-angular:generate # Regenerate types and admin config
nx serve cms-admin # Restart dev server
All heroicons/outline are provided globally at the admin route level (provideAdminIcons() in libs/admin/src/lib/icons/provide-admin-icons.ts). Plugins just set icon: 'heroChartBarSquare' (or any hero* name) in their admin route descriptor — no manual registration needed.
The icon field type is hero${string} for autocomplete. Browse available names at Heroicons. Naming: hero + PascalCase (e.g., heroEnvelopeOpen for envelope-open).
Create a new library under libs/plugins/:
nx generate @nx/js:library --name=my-plugin --directory=libs/plugins/my-plugin --tags="scope:lib,env:server"
Then implement the MomentumPlugin interface:
// libs/plugins/my-plugin/src/lib/my-plugin.ts
import type { MomentumPlugin } from '@momentumcms/core';
export function myPlugin(config: MyConfig): MomentumPlugin {
return {
name: 'my-plugin',
collections: [],
adminRoutes: [],
modifyCollections(collections) {},
async onInit(context) {},
async onReady(context) {},
async onShutdown(context) {},
browserImports: {
// Optional: expose browser-safe imports for admin config generation
adminRoutes: {
path: '@momentumcms/plugins/my-plugin/admin-routes',
exportName: 'myPluginAdminRoutes',
},
},
};
}
Key files to reference:
libs/core/src/lib/plugins.tslibs/plugins/core/src/lib/plugin-runner.tslibs/plugins/analytics/src/lib/analytics-plugin.tsdocs/plugins/writing-a-plugin.mdAdversarial review checklist for stateful Momentum CMS features (workflow, versions, scheduled publish, permissions inheritance, branches, anything that adds writeable state + access control). Use BEFORE merging a feature that introduces new mutating routes, new system-managed columns, new access functions, or new audit trails. Trigger phrases include "red-team this", "adversarial review", "security review of <feature>", "before merging <feature>", "/cms-feature-red-team".
Set up the Momentum CMS MCP server plugin and generate Claude Code MCP config for AI tool integration. Use when connecting Claude Code (or any MCP client) to a Momentum CMS instance.
Generate a new Momentum CMS collection with fields, access control, and hooks
Generate an Angular component with signals, OnPush, and host-based styling following Momentum CMS conventions. Use when creating new UI components in any library.
Write and validate Playwright E2E tests for Momentum CMS features. UI tests ALWAYS start from /admin dashboard and navigate via sidebar/dashboard — never go directly to deep URLs. Always starts the server and inspects the actual UI before writing assertions. Triggers include "write e2e tests for...", "add e2e tests", "test the admin UI for...", or "/e2e-test <feature>".
Run migrations, generate schemas, and manage code generation for Momentum CMS. Use when working with database migrations, Drizzle schema generation, type generation, or Angular schematics.