一键导入
collection
Generate a new Momentum CMS collection with fields, access control, and hooks
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
Generate a new Momentum CMS collection with fields, access control, and hooks
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
基于 SOC 职业分类
Adversarial 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.
| name | collection |
| description | Generate a new Momentum CMS collection with fields, access control, and hooks |
| argument-hint | <collection-name> |
Create a new collection file following project conventions.
$ARGUMENTS - Collection name (e.g., "posts", "products", "pages")Create the collection file at src/collections/<name>.collection.ts
Use this template:
import {
defineCollection,
text,
richText,
number,
date,
checkbox,
select,
relationship,
} from '@momentumcms/core';
export const <PascalName> = defineCollection({
slug: '<kebab-name>',
admin: {
useAsTitle: 'title', // or 'name' - the field to display as title
defaultColumns: ['title', 'createdAt'],
group: 'Content', // Admin sidebar group
},
access: {
read: () => true,
create: ({ req }) => !!req.user,
update: ({ req }) => req.user?.role === 'admin',
delete: ({ req }) => req.user?.role === 'admin',
},
hooks: {
beforeChange: [],
afterChange: [],
},
fields: [
text('title', { required: true }),
// Add more fields as needed
],
});
src/momentum.config.ts, import and add to collections array:import { <PascalName> } from './collections/<name>.collection';
// In config:
collections: [Posts, <PascalName>],
npm run migrate:generate
npm run migrate:run
text(name, options) - Short text (minLength, maxLength)textarea(name, options) - Multi-line text (rows, minLength, maxLength)richText(name, options) - Rich text editornumber(name, options) - Numeric value (min, max, step)date(name, options) - Date/datetimecheckbox(name, options) - Booleanselect(name, { options: [...] }) - Dropdown (hasMany for multi-select)radio(name, { options: [...] }) - Radio buttonsemail(name, options) - Email with validationupload(name, { relationTo: 'media' }) - File uploadrelationship(name, { collection: () => Ref }) - Reference to another collectionarray(name, { fields: [...] }) - Array of objects (minRows, maxRows)group(name, { fields: [...] }) - Nested objectblocks(name, { blocks: [...] }) - Content blocksjson(name, options) - Raw JSONpoint(name, options) - Geolocation (lat/lng)slug(name, { from: 'title' }) - Auto-generated slugtabs(name, { tabs: [{ label, fields }] }) - Tabbed sectionscollapsible(name, { fields, defaultOpen }) - Expandable sectionrow(name, { fields }) - Horizontal rowimport {
allowAll,
denyAll,
isAuthenticated,
hasRole,
hasAnyRole,
isOwner,
and,
or,
not,
} from '@momentumcms/core';