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