craft-content-modeling — independently scanned and version-tracked by SaferSkills.
SaferSkills independently audited craft-content-modeling (Agent Skill) and scored it 96/100 (green). The audit ran 55 deterministic rules across Security, Supply Chain, Maintenance, Transparency, and Community; it found 0 high-severity and 1 lower-severity findings. The full rule-by-rule trace and per-finding evidence are below. Free, methodology-open.
Findings & checks · 1 flagged
The text {match} tells the agent to skip the normal "ask the user first" gate. Used adversarially it removes the human-in-the-loop check before destructive or sensitive actions, turning a normally-gated agent into a fire-and-forget executor.
Every scanned point with the score it earned and what moved between them.
First recorded scan — no prior version to compare against.
The primary manifest — the file an agent reads to learn what this artifact does.
How to structure content in Craft CMS 5. Sections, entry types, fields, Matrix, relations, asset management, and strategic patterns for real projects.
This skill covers content architecture — what goes in the CP, how it's organized, and how templates access it. For extending Craft with PHP (plugins, modules, custom element types), see the craftcms skill.
When this skill triggers, also load:
Use WebFetch on specific doc pages when a reference file doesn't cover enough detail.
Everything is becoming an entry. Entry types are global (shared across sections and Matrix fields). Fields come from a global pool. This is the "entrification" of Craft — categories, tags, and globals are being unified into entries over a three-version arc:
entrify CLI commands added to convert categories, tags, and globals to entriesallowAdminChanges), and existing ones continue to work. A unified "Content" section replaces the fragmented entries view. Custom entry index pages (5.9.0) solve the sidebar organization concern.For new projects, always use entries: Structure sections for hierarchical taxonomy, Channel sections for flat taxonomy, Singles for site-wide settings. For existing projects, migrate at your own pace using the entrify commands.
Three decisions define your content architecture:
Craft CMS has four editions (Solo, Team, Pro, Enterprise) that affect content modeling. The key distinction: if any section needs multiple custom user groups with per-group edit/view restrictions, you need Pro or Enterprise (multiple custom user groups are Pro+ only). Team includes one fixed "Team" group whose permissions are customizable for non-admins, plus a 5-user cap. See references/users-and-permissions.md for the full editions table and permissions architecture.
Choose the edition before modeling — it determines whether you can scope content access by user group, which affects section and field architecture.
| Need | Section Type | URI Example |
|---|---|---|
| One-off page (homepage, about, contact) | Single | __home__, about |
| Site-wide settings (footer, header config) | Single (no URI, preloadSingles) | — |
| Flat collection (blog, news, events) | Channel | blog/{slug} |
| Hierarchical pages (docs, services) | Structure | {parent.uri}/{slug} |
| Taxonomy (topics, categories) | Structure (replaces categories) | topics/{slug} |
| Flat tags | Channel (replaces tags) | — |
Beyond the type, sections have settings that matter for content architecture:
1 to enforce that every entry has at least one author. Validated on save; setting minAuthors > maxAuthors is rejected by Craft's section validator. Combine with maxAuthors to define an exact range (min: 1, max: 3 = "1 to 3 authors required").'beginning' or 'end' for new entries in structures{label, urlFormat} objects defining where entries can be previewed. Default: primary entry page. Add custom targets for headless frontends, staging URLs, or PDF previews.Set preloadSingles => true in config/general.php to access singles as global Twig variables by handle — identical to the old globals behavior but with drafts, revisions, live preview, and scheduling.
{# With preloadSingles enabled #}
{{ siteSettings.footerText }}
{{ siteSettings.socialLinks.all() }}Caveat: Singles always propagate to all sites. This is hard-coded.
{% set topLevel = craft.entries.section('pages').level(1).all() %}
{% set children = craft.entries.descendantOf(entry).descendantDist(1).all() %}
{% set breadcrumbs = craft.entries.ancestorOf(entry).all() %}
{% set siblings = craft.entries.siblingOf(entry).all() %}Entry types are defined globally (Settings → Entry Types), then attached to sections and Matrix fields. One entry type can serve multiple contexts.
Key implications:
Entry types have visual properties that improve the editorial experience:
'{title}')These settings are configured in Settings → Entry Types and affect all contexts where the entry type is used.
Craft has 83+ reserved handles across all element types via Field::RESERVED_HANDLES. Validation is case-insensitive. Using any of these as a custom field handle will cause a validation error or silent template collision where the native attribute shadows the custom field.
Before proposing any field handle in a content model, check it against the lists below. When a user asks for a field that matches a native attribute name, always use a domain-specific synonym. For example: user says "I need a title field" — the entry already has a native title, so use heading, headline, or pageTitle depending on context.
Most commonly collided (the ones you'll actually try to use):
| Reserved | Use Instead | Why |
|---|---|---|
title | heading, headline, label, pageTitle | Native element title |
slug | urlSlug, handle | Native URL slug |
status | state, phase, condition | Native element status |
url | externalUrl, targetUrl, websiteUrl | Native element URL |
link | targetLink, ctaLink, primaryLink | Native getLink() method |
icon | entryIcon, menuIcon, featureIcon | Native element icon (5.0.0) |
parent | parentEntry, parentItem, belongsTo | Native structure parent |
children | childEntries, subItems, nestedItems | Native structure children |
owner | entryOwner, ownerElement | Native nested entry owner |
site | location, branch, region | Native site object |
level | depth, tier, nestingLevel | Native structure level |
ancestors | parentChain, breadcrumbEntries | Native structure ancestors |
siblings | peerEntries, relatedSiblings | Native structure siblings |
enabled | isActive, isPublished, isVisible | Native enabled/disabled state |
language | locale, contentLanguage | Native site language |
localized | translations, localizedVersions | Native localized entries query |
next / prev | nextEntry / prevEntry | Native structure navigation |
ref | reference, referenceCode | Native reference tag |
type | entryType, category, variant | Native entry type |
author / authors | writer, creator, contributor | Native entry author(s) |
postDate | publishDate, releaseDate, goLiveDate | Native entry post date |
Full list of reserved handles shared across ALL element types (from Field::RESERVED_HANDLES):
ancestors, archived, attributes, behaviors, canonical, children, contentTable, dateCreated, dateDeleted, dateLastMerged, dateUpdated, descendants, draftId, enabled, enabledForSite, error, errors, fieldLayoutId, fieldValue, fieldValues, firstSave, icon, id, language, level, lft, link, localized, next, nextSibling, owner, parent, parents, prev, prevSibling, ref, revisionId, rgt, root, searchScore, siblings, site, siteId, siteSettingsId, slug, sortOrder, status, structureId, title, trashed, uid, uri, url, viewMode
Additional per-element-type reserved handles:
| Element Type | Additional Reserved |
|---|---|
| Entries | author, authorId, authorIds, authors, section, sectionId, type, postDate |
| Assets | alt, extension, filename, folder, height, kind, size, volume, width |
| Users | active, addresses, admin, affiliatedSiteId, email, firstName, friendlyName, fullName, groups, lastName, locked, name, password, pending, photo, suspended, username |
| Categories | group |
| Tags | group |
| Addresses | address, countryCode, fullName, latLong, organization, organizationTaxId |
Also globally reserved (from HandleValidator::$baseReservedWords, applies to ALL handles): attribute, attributeLabels, attributeNames, attributes, dateCreated, dateUpdated, errors, false, fields, handle, id, n, name, no, rules, this, true, uid, y, yes
Fields are defined once globally, then instanced into field layouts. Each instance can override four properties without affecting the global definition:
This means a single heroImage Assets field can be placed in a Blog Post, a Service Page, and a Project entry type — each with different labels ("Hero Image", "Banner", "Cover Photo") and different required settings. The field definition, type, and settings are shared.
The rule: reuse field definitions via instances. Only create a new field when the type or settings differ (e.g., different allowed volumes, different source restrictions, different character limits). Don't create blogHeroImage, serviceHeroImage, projectHeroImage — create one heroImage and instance it.
But don't reuse just because two fields look alike today. Apply the single-responsibility test (SRP): is there a reasonable scenario where one instance would need different settings — a different character limit, translation method, or allowed volumes? If yes, the similarity is incidental, not essential — make them separate fields. Over-reuse has costs that are hard to reverse later:
summary::daisy may match a byline instance of the same field (documented). If you rely on distinct field-scoped search, the fields must be separate. (Element-query filtering by the overridden handle — .summary(x).byline(y) — does work; only the search index is instance-blind.)A field's isMultiInstance() method controls whether it can appear multiple times in the same layout with different handles. This is determined by dbType() — fields that return null are single-instance.
| Category | Field Types | Multi-Instance | Reusable Across Layouts |
|---|---|---|---|
| Relational | Entries, Assets, Categories, Tags, Users | Yes | Yes |
| Simple | Plain Text, Number, Email, URL, Color, Lightswitch, Money, Range, Time, Date/Time | Yes | Yes |
| Option | Dropdown, Checkboxes, Multi-Select, Radio Buttons, Button Group | Yes | Yes |
| Structured | Table, Link, Icon, Country | Yes | Yes |
| Nested element | Matrix, Content Block, Addresses | No | Yes (with caveats) |
Single-instance caveats: Matrix, Content Block, and Addresses fields CAN be reused across different entry types (placed in multiple field layouts), but they can only appear once per layout and their configuration is fully shared — changing the entry types or settings on a Matrix field affects every entry type using it. Reuse these when contexts genuinely share the same structure. Create separate fields when different contexts need different nested entry types or settings.
Before proposing any field in a content model change, you MUST:
config/project/fields/ (or CP Settings → Fields). List every field with its type, handle, and key settings.Creating a field that duplicates an existing field's functionality is the most common content modeling mistake — it pollutes the global pool, confuses editors, and makes future refactoring harder.
ddev craft entrify/categories <categoryGroupHandle> # → Structure section
ddev craft entrify/tags <tagGroupHandle> # → Channel section
ddev craft entrify/global-set <globalSetHandle> # → Single sectionAll three accept --section to target an existing section instead of creating a new one. entrify/categories and entrify/tags additionally accept --entry-type and --author; entrify/global-set does not.
As of 5.9.0, these commands are interactive — the handle argument is optional.
When replacing a Categories field with an Entries field, enable Maintain Hierarchy on the Entries field. This auto-selects ancestors when a nested entry is chosen — replicating the category field behavior.
For flat taxonomies where editors created terms on-the-fly, the on-the-fly creation UX is not yet available for Entries fields. This is the one area where the legacy Tags field still has a UX advantage. Use a Channel section and accept the two-step workflow (create entry separately, then relate it).
Three tools for structured content within an entry — choose based on editing experience:
For the full decision table, nested entry type patterns, and the CKEditor chunks rendering pattern, read references/content-patterns.md.
config/project/fields/ and default to reusing via instance. The only justification for a new field is a different type or genuinely incompatible settings.summary::daisy may match a byline instance — docs), and a few relatedTo cases need the original handle. Reuse only when the instances are genuinely the same field; if one could reasonably need different settings (single-responsibility), split it. Reuse-first, not reuse-always.image, text, link are too generic (and link is actually reserved). For every field handle in a content model, follow this check: (1) is the handle in the reserved list? If yes, use a synonym from the table. (2) Is the handle too generic for the global field pool? If yes, add domain context: featuredImage, bodyContent, primaryLink. (3) Don't over-specify — blogFeaturedImage creates a new field when you could instance featuredImage with a label override.max_input_vars limits and degrades CP performance..eagerly() to prevent N+1 queries.config/project/. Use ddev craft project-config/rebuild to regenerate from DB if needed.{slug}, {canonicalUid}, or custom fields.@web is auto-detected from the HTTP request and can be spoofed or empty in console/queue contexts. Use environment variables ($ASSETS_URL) for filesystem URLs. @webroot for paths is less risky but env vars are still preferred.Read the relevant reference file(s) for your task.
Task examples:
content-patterns.mdfield-types.mdrelations-and-eager-loading.mdfield-types.md (Matrix section)content-patterns.md + infrastructure.md (propagation)users-and-permissions.mdinfrastructure.md (Project Config Essentials)infrastructure.md (Storage Model)infrastructure.md (Assets section)object-templates.md (Structure URI Patterns)object-templates.md (Asset Subpath Patterns)object-templates.md (The Matrix Gotcha)| Reference | Scope |
|---|---|
references/field-types.md | All built-in field types: settings, Twig access patterns, query syntax, gotchas. Matrix configuration, view modes, nesting. |
references/relations-and-eager-loading.md | relatedTo() shapes (4 forms), .with() eager loading, .eagerly() lazy eager loading, nested eager loading, native eager-loadable attributes. |
references/content-patterns.md | Strategic patterns for blog, portfolio, multi-site corporate. Section/field/relation architecture per pattern. Entrification migration. CKEditor vs Matrix decisions. |
references/users-and-permissions.md | Users, user groups, CMS editions, addresses, permissions architecture, field layout UI elements. |
references/infrastructure.md | Multi-site propagation methods, field translation methods, project config workflow, how Craft stores content (five-table model, JSON field values, relations, nested sets), asset volumes/filesystems/transforms. |
references/object-templates.md | Object template syntax: {attribute} vs {{ twig }}, URI formats, asset subpaths, preview targets, owner/rootOwner nesting, structure patterns, the Matrix gotcha. |
~30 seconds. Free. No account. Every finding cites a rule and a line of evidence.