craft-content-modeling
Skill2 starsChanged 8 months agoMITView on GitHub
Craft CMS 5 content modeling — sections, entry types, fields, Matrix, relations, project config, and content architecture strategy. Covers everything editors and developers need to structure content in Craft. Triggers on: section types (single, channel, structure), entry types, field types, field layout, Matrix configuration, nested entries, relatedTo, eager loading, .with(), .eagerly(), categories, tags, globals, global sets, preloadSingles, propagation, multi-site content, URI format, project config, YAML, content architecture, content strategy, taxonomy, asset volumes, filesystems, image transforms, user groups, permissions, entries-as-taxonomy, entrify. Always use when planning content architecture, creating sections/fields, configuring Matrix, setting up relations, or making content modeling decisions.
1 other project uses a version of this, 1 of them edited.
Adopted by
Most recently taken up by
- michtio/craftcms-claude-skillsedited, first seen Jul 28, 2026
Other versions1 project uses a version of this.
Word for word · 0
None found.
Edited · 1
- michtio/craftcms-claude-skills★ 8217% same
Wrote their own version · 0
None found.
How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.
In this repository7 other files it gives its agents.
- project-template/CLAUDE.mdCLAUDE.md
- reference/CLAUDE.mdCLAUDE.md
- craftcmsSkill
- craft-php-guidelinesSkill
- craft-siteSkill
- craft-twig-guidelinesSkill
- ddevSkill
The file
We split this skill into the rules it gives an agent
10 rules. About 0 are common, 4 are distinctive, and 6 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈4
Distinctive · estimate
This author's own choices. Worth a look.
6
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 27
Use web_fetch on specific doc pages when a reference file doesn't cover enough detail.
- Distinctive: line 107
Read the relevant reference file(s) for your task.
- Very specific: line 153
All schema changes (sections, entry types, fields, volumes, transforms, sites, plugins, permissions) are stored as YAML in config/project/.
- Very specific: line 162
Run ddev craft up (applies migrations + project config)
- Distinctive: line 166
Never manually edit YAML — let Craft manage it
- Very specific: line 167
Always set allowAdminChanges => false in production
- Distinctive: line 168
Use UIDs (not IDs) — they're stable across environments
- Very specific: line 169
After resolving Git merge conflicts in YAML: ddev craft project-config/touch then ddev craft project-config/apply
- Very specific: line 170
Use $ENV_VAR syntax in YAML for environment-specific values
- Distinctive: line 191
Always add the Alternative Text field layout element to asset volumes for accessibility.
≈ “Common” is an estimate: at least 1 in 5 of the 213,897 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Craft CMS 5 — Content Modeling
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. For Twig
template patterns, see craft-site and craft-twig-guidelines.
Documentation
- Entries: https://craftcms.com/docs/5.x/reference/element-types/entries.html
- Sections: https://craftcms.com/docs/5.x/reference/element-types/entries.html#sections
- Fields: https://craftcms.com/docs/5.x/system/fields.html
- Field types: https://craftcms.com/docs/5.x/reference/field-types/
- Matrix: https://craftcms.com/docs/5.x/reference/field-types/matrix.html
- Relations: https://craftcms.com/docs/5.x/system/relations.html
- Eager loading: https://craftcms.com/docs/5.x/development/eager-loading.html
- Project config: https://craftcms.com/docs/5.x/system/project-config.html
Use web_fetch on specific doc pages when a reference file doesn't cover enough detail.
The Craft 5 Mental Model
Everything is an entry. Entry types are global (shared across sections and Matrix fields). Fields come from a global pool. Categories, tags, and globals are being phased out — use entries instead.
Three decisions define your content architecture:
- Which section type organizes the content (Single, Channel, Structure)
- Which entry types define its shape (global, reusable across contexts)
- Which relation strategy connects content together (Entries fields, Matrix, or both)
Section Type Decision
| 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) | — |
Singles replace globals
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.
Structure queries for navigation
{% 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 in Craft 5
Entry types are defined globally (Settings → Entry Types), then attached to sections and Matrix fields. One entry type can serve multiple contexts.
Key implications:
- Changing an entry type's field layout affects every section and Matrix field using it
- Fields come from the global pool — same field definition reused everywhere
- Local name/handle overrides per context available (5.6.0+)
- The global pool demands careful field naming — use specific handles
Reserved handles (will collide with native attributes)
title, slug, id, uid, dateCreated, dateUpdated, status, url,
uri, enabled, archived, siteId, level, lft, rgt, root,
postDate, expiryDate
Common Pitfalls
- Over-using Matrix — if content needs its own URL, independent querying, or permissions, it should be a separate section with an Entries relation field, not a Matrix block.
- Vague field handles —
image,text,linkcollide fast in the global pool. UseblogFeaturedImage,serviceDescription,ctaLink. - Not planning multi-site from the start — propagation method, field translation methods, and site settings must be configured before content exists. Changing propagation later resaves all entries.
- Using categories/tags in new projects — they're deprecated. Use Structure sections (hierarchical taxonomy) and Channel sections (flat taxonomy) with Entries fields.
- Forgetting
preloadSingles— without it, singles aren't available as global variables and you need explicit queries. - Matrix for everything — 15+ entry types in one Matrix field is a red flag. Deeply nested Matrix hits
max_input_varslimits and degrades CP performance. - Not using
.eagerly()— every relational field access inside a loop should use.eagerly()to prevent N+1 queries. - Editing project config YAML manually — let Craft manage
config/project/. Usephp craft project-config/rebuildto regenerate from DB if needed. - Using database IDs in URI formats — IDs differ across environments. Use
{slug},{canonicalUid}, or custom fields. - Not setting
allowAdminChanges => falsein production — without this, production schema changes won't sync back to dev.
Reference Files
Read the relevant reference file(s) for your task.
Task examples:
- "Plan a blog content architecture" → read
content-patterns.md - "Which field type should I use for X?" → read
field-types.md - "Set up relatedTo queries" → read
relations-and-eager-loading.md - "Configure Matrix with nested entries" → read
field-types.md(Matrix section) - "Plan a multi-site content model" → read
content-patterns.md+ propagation in SKILL.md - "Understand project config workflow" → this SKILL.md covers the essentials
| Reference | Scope |
references/field-types.md | All 26 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, e-commerce. Section/field/relation architecture per pattern. Categories-to-entries migration. |
Propagation Methods (Multi-Site)
Available for channels and structures. Singles always propagate to all sites.
| Method | Behavior |
| Only save to site created in | Entries exist in one site only |
| Same site group | Entries propagate within the same site group |
| Same language | Entries propagate to sites sharing the same language |
| All enabled sites | Entries exist in all enabled sites (default) |
| Let each entry choose | Per-entry control via Status sidebar |
Matrix fields have their own propagation method, independent of the section's.
Field Translation Methods
Per-field setting controlling how values behave across sites:
| Method | Behavior |
| Not translatable | Same value across all sites |
| Per site | Independent value per site |
| Per site group | Shared within site group, independent across groups |
| Per language | Shared across sites with same language |
| Custom | User-defined grouping key |
Configure translation methods before populating content.
Project Config Essentials
All schema changes (sections, entry types, fields, volumes, transforms, sites,
plugins, permissions) are stored as YAML in config/project/.
Workflow
- Make CP changes in development environment
- YAML auto-updates in
config/project/ - Commit to Git
- Deploy to staging/production
- Run
ddev craft up(applies migrations + project config)
Rules
- Never manually edit YAML — let Craft manage it
- Always set
allowAdminChanges => falsein production - Use UIDs (not IDs) — they're stable across environments
- After resolving Git merge conflicts in YAML:
ddev craft project-config/touchthenddev craft project-config/apply - Use
$ENV_VARsyntax in YAML for environment-specific values
Asset Volumes and Transforms
Volumes define content organization. Filesystems define storage (local, S3, Google Cloud, Azure). Multiple volumes can share one filesystem.
Image Transforms
{# Named transform (defined in Settings → Assets → Image Transforms) #}
<img src="{{ asset.getUrl('thumb') }}" alt="{{ asset.alt }}">
{# Ad-hoc transform #}
{% set transform = { width: 300, height: 200, mode: 'crop', format: 'webp' } %}
<img src="{{ asset.getUrl(transform) }}" alt="{{ asset.alt }}">
{# Srcset #}
{{ asset.getImg({ width: 300 }, ['1.5x', '2x', '3x']) }}Always add the Alternative Text field layout element to asset volumes for accessibility.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

