원클릭으로
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 직업 분류 기준
| 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", "users")All collections are defined in libs/example-config/src/collections/. Both example apps (example-angular, example-analog) import from @momentumcms/example-config/collections. Never define collections in individual apps.
Create the collection file at libs/example-config/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
icon: 'heroNewspaper', // Sidebar icon (must be registered — see below)
},
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
],
});
libs/example-config/src/collections/index.ts:// Add import at top
import { <PascalName> } from './<name>.collection';
// Add to the collections array
export const collections: CollectionConfig[] = [
// ... existing collections,
<PascalName>,
];
// Add to named exports
export {
// ... existing exports,
<PascalName>,
};
Both example apps automatically pick up changes since they import from @momentumcms/example-config/collections.
nx run <app>:migrate:generate after collection changes to create a migration file.text(name, options) - Short text with optional min/max lengthtextarea(name, options) - Multi-line text with optional rowsrichText(name, options) - Rich text editoremail(name, options) - Email inputpassword(name, options) - Password input with optional min lengthnumber(name, options) - Numeric value with optional min/max/stepdate(name, options) - Date/datetime pickercheckbox(name, options) - Boolean checkboxselect(name, { options: [...] }) - Dropdown select (supports hasMany)radio(name, { options: [...] }) - Radio button groupupload(name, options) - File upload with MIME type filteringrelationship(name, { collection: () => Ref }) - Reference to another collection (supports hasMany, polymorphic)array(name, { fields: [...] }) - Array of nested fieldsgroup(name, { fields: [...] }) - Nested object groupingblocks(name, { blocks: [...] }) - Block-based contentjson(name, options) - Raw JSON fieldpoint(name, options) - Geolocation pointslug(name, { from: 'fieldName' }) - Auto-generated slug from another fieldtabs(tabs: [...]) - Tabbed sections for organizationcollapsible(label, { fields: [...] }) - Collapsible sectionrow(fields: [...]) - Horizontal row layoutAll heroicons/outline (324 icons) are provided globally at the admin route level. Just set admin.icon to any hero* name — no manual registration needed.
The sidebar resolves icons via: collection.admin.icon → collectionIcons[slug] fallback map → 'heroFolder' default. To add a slug-based fallback, update collectionIcons in libs/admin/src/lib/widgets/admin-sidebar/admin-sidebar.component.ts.
Browse available icons at Heroicons. Naming: hero + PascalCase (e.g., heroEnvelopeOpen for envelope-open).
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 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.
Work with Momentum API for data operations in Angular components