Scaffold a custom Craft CMS module without leaving Claude Code
Когда использовать: You need a new module and don't want to hand-copy another one as a template.
Предварительные требования
- Craft CMS 5 project set up locally — composer create-project craftcms/craft my-project
- Skill cloned — git clone https://github.com/michtio/craftcms-claude-skills ~/.claude/skills/craftcms-claude-skills
Поток
-
Describe the module's jobUse craftcms-claude-skills. Create a new module called 'Inventory' that registers a custom element type for warehouse items.✓ Скопировано→ Claude scaffolds modules/inventory/ with src/Inventory.php, elements/WarehouseItem.php, and a config entry
-
Wire it upRegister the module in config/app.php and add the bootstrap entry.✓ Скопировано→ Config diff shown; module loads without errors on craft setup/check
-
Add an element queryAdd a WarehouseItemQuery class with a custom 'sku' parameter that filters on the content table.✓ Скопировано→ Query class with proper WHERE clauses, not raw SQL soup
Итог: A working Craft module that follows Pixel & Tonic conventions — ready for your first migration.
Подводные камни
- Claude writes Craft 3/4 style code — Explicitly state Craft CMS 5 in every prompt — the API surface changed