Agent skill
collection
Generate a new Momentum CMS collection with fields, access control, and hooks
Install this agent skill to your Project
npx add-skill https://github.com/majiayu000/claude-skill-registry/tree/main/skills/other/other/collection
SKILL.md
Generate Momentum CMS Collection
Create a new collection file following project conventions.
Arguments
$ARGUMENTS- Collection name (e.g., "posts", "products", "users")
Important: Collection Location
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.
Steps
-
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
},
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
],
});
- Export from
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.
- Remind user: if migration mode is enabled, run
nx run <app>:migrate:generateafter collection changes to create a migration file.
Field Types Available
Text Input Fields
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 length
Numeric & Date Fields
number(name, options)- Numeric value with optional min/max/stepdate(name, options)- Date/datetime picker
Boolean & Selection Fields
checkbox(name, options)- Boolean checkboxselect(name, { options: [...] })- Dropdown select (supportshasMany)radio(name, { options: [...] })- Radio button group
Media & Files
upload(name, options)- File upload with MIME type filtering
Relationship & Data Fields
relationship(name, { collection: () => Ref })- Reference to another collection (supportshasMany, 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 field
Layout Fields (non-data storing)
tabs(tabs: [...])- Tabbed sections for organizationcollapsible(label, { fields: [...] })- Collapsible sectionrow(fields: [...])- Horizontal row layout
Recommended Agent Skills
Expand your agent's capabilities with these related and highly-rated skills.
agent-ops-spec
Manage specification documents in .agent/specs/. Use when user provides requirements, acceptance criteria, or feature descriptions that need to be tracked and validated against implementation.
agent-ops-state
Maintain .agent state files. Use at session start, after meaningful steps, and before concluding: read/update constitution/memory/focus/issues/baseline consistently.
agent-ops-spec
Manage specification documents in .agent/specs/. Use when user provides requirements, acceptance criteria, or feature descriptions that need to be tracked and validated against implementation.
agent-ops-testing
Test strategy, execution, and coverage analysis. Use when designing tests, running test suites, or analyzing test results beyond baseline checks.
agent-ops-testing
Test strategy, execution, and coverage analysis. Use when designing tests, running test suites, or analyzing test results beyond baseline checks.
agent-ops-state
Maintain .agent state files. Use at session start, after meaningful steps, and before concluding: read/update constitution/memory/focus/issues/baseline consistently.
Didn't find tool you were looking for?