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-donaldmurillo-momentum-cms
SKILL.md
Generate Momentum CMS Collection
Create a new collection file following project conventions.
Arguments
$ARGUMENTS- Collection name (e.g., "posts", "products", "pages")
Steps
-
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
],
});
- Add to momentum config. In
src/momentum.config.ts, import and add tocollectionsarray:
import { <PascalName> } from './collections/<name>.collection';
// In config:
collections: [Posts, <PascalName>],
- Remind user to run schema generation:
npx drizzle-kit generate
npx drizzle-kit push
Field Types Available
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 slug
Layout Fields (visual only, no data storage)
tabs(name, { tabs: [{ label, fields }] })- Tabbed sectionscollapsible(name, { fields, defaultOpen })- Expandable sectionrow(name, { fields })- Horizontal row
Access Control Helpers
import {
allowAll,
denyAll,
isAuthenticated,
hasRole,
hasAnyRole,
isOwner,
and,
or,
not,
} from '@momentumcms/core';
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?