/craftcms-claude-skills:craftcmsfrom craftcms-claude-skills
Guides Craft CMS 5 plugin and module development in PHP, covering elements, queries, services, controllers, migrations, queue jobs, field types, Twig extensions, GraphQL, testing, and debugging.
Ships in craftcms-claude-skills. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them.
!sh ${CLAUDE_SKILL_DIR}/scripts/craft-version.sh
If no Craft version line appears above, establish the version before any version-specific advice: craftcms/cms in composer.lock for a site, the lowest version the craftcms/cms constraint in composer.json allows for a plugin, or ask. Then check it against the version tags in this skill ([5.10+], [changed 5.12], [seomatic 5.1+]).
Extending Craft CMS 5 with PHP: plugins, modules, custom element and field types, backend integrations. Site work (content modeling, Twig, plugin selection) belongs to craft-site and craft-content-modeling.
Always load craft-php-guidelines (PHP standards, required for any PHP) and ddev (every command runs through DDEV). Also load: craft-garnish for CP JavaScript, craft-pest for tests (its rollback is opt-in and its env overrides are cwd-bound: both write silently to the dev database), craft-cloud when craft-cloud.yaml or craftcms/cloud is present, craft-mcp for MCP servers, OAuth and personal access tokens [5.12+], craft-plugins for plugin-specific work. Full notes: task-routing.md (Companion skills).
Docs: https://craftcms.com/docs/5.x/extend/ · class reference https://docs.craftcms.com/api/v5/ · generator https://craftcms.com/docs/5.x/extend/generator.html. Use WebFetch when a reference doesn't cover enough.
Before a build: before starting craft-feature-builder, craft-site-builder or a craft-gated-build build, run python3 "${CLAUDE_SKILL_DIR}/../../scripts/pack_status.py"; on stale, run the command it prints and tell the user a restart may be needed, before the build.
addSelect() in beforePrepare(): the Craft convention, additive when several extensions contribute columns.->site('*') for cross-site queries (queue-jobs.md).id in getConfig(): project config uses UIDs.DateTimeHelper in elements/queries, Carbon in services, never mixed in one class.controllerNamespace manually (plugin-vs-module.md)./admin: cpTrigger is configurable. UrlHelper::cpUrl() in PHP, cpUrl() in Twig.savePluginSettings(); passing getBodyParams() straight in drops unsubmitted keys (cp.md).token collides with Craft's tokenParam: 400 before your controller runs (controllers.md, Reserved request params).EVENT_DEFINE_RULES on Entry::class runs for every entry, including nested entries built before fieldId/ownerId exist, where getType() throws Either \sectionId` or `fieldId` + `ownerId` must be set on the entry.Always add the rule, decide in'when'behind anisset($entry->fieldId) || isset($entry->sectionId)guard, validate with aValidator subclass (events.md`, Validation Rules on Core Elements From a Module).project-config/write empties config/project/ and rewrites it from the DB. On a stale local DB it deletes teammates' YAML. Run craft up first, require a clean project-config/diff, and check git diff -- config/project afterwards. Schema saves from PHP belong in a migration or console command, never a bare bootstrap script (YAML is only flushed on EVENT_AFTER_REQUEST). See deployment.md (project-config/write safely) and migrations.md (Project config writes outside a request).templates/ is directly routable in the CP, bypassing beforeAction() gates. Underscore-prefix the rest (cp.md, CP template routing bypasses controllers).Read only what the task needs; multiple files often apply. The full task index (130+ task-to-section mappings) is task-routing.md: grep it for a keyword from the task.
Task examples:
elements.md (Architecture first) + element-index.md + fields.md + migrations.md + cp.mdcontrollers.md + events.mdqueue-jobs.md + elements.md + debugging.mdreferences/task-routing.md (Rarer task examples); stop and grep that file if it is missing.migrations.md; "Upgrade to 5.12" [5.12+] → upgrade-5.12.mdcraft-pest; Cloud compatibility → load craft-cloud (plugin-development.md); headless front ends → craft-site (headless.md)version-table.md for the feature or version (every version tag in the pack, with older-version alternatives); it is large, so don't read it wholeLarge files: read the Contents block, then only the section. architecture.md, config-app.md, config-general.md, controllers.md, cp.md, cp-ui-patterns.md, element-index.md, elements.md, events.md, graphql.md and permissions.md start with a Contents block that gives each section's line range. Read the first 40 lines, then Read only the section you need with offset/limit, never the whole file.
| Task | Read | ~Tokens |
|---|---|---|
| Full task index: task or symptom → file and section; full pitfall and companion notes | references/task-routing.md | 4.9K |
| Elements: lifecycle, queries, status, authorization, drafts, propagation, field layouts, user edit screens, events | references/elements.md | 8.4K |
| Element index: sources, table/card attributes, status pills, sort, conditions, actions, exporters, relation-field display | references/element-index.md | 6.1K |
| Services, models, records, project config, runtime site creation/deletion, MemoizableArray, API clients, validators | references/architecture.md | 7.4K |
| Plugin vs module differences, module template-root/translation/console registration | references/plugin-vs-module.md | 0.6K |
| Controllers: CP CRUD, webhooks, API endpoints, action routing, authorization | references/controllers.md | 3.9K |
| CP templates, form macros, settings pages, navigation, permissions, read-only mode | references/cp.md | 7.2K |
| CP components: widgets, utility pages, slideouts, ajax, editable tables, modals, alerts | references/cp-components.md | 1.8K |
| CP UI patterns: tri-state controls, status indicators, CSS tokens, condition builders, asset bundles, edit-screen sidebar/toolbar | references/cp-ui-patterns.md | 3.4K |
| Migrations, Install.php, foreign keys, indexes, idempotency | references/migrations.md | 3.9K |
| Queue jobs: BaseJob, TTR, retry, progress, batch jobs, site context | references/queue-jobs.md | 4.2K |
| Console commands, options, progress, output helpers, resave actions | references/console-commands.md | 6.0K |
| Debugging, performance, profiling, Xdebug, logging | references/debugging.md | 4.6K |
| PHPStan, ECS, Rector, CI, review checklist | references/quality.md | 3.5K |
Testing: pointer to craft-pest + Codeception basics | references/testing.md | 0.6K |
| Field types, native fields, field layout UI elements, FieldLayoutBehavior | references/fields.md | 3.6K |
| Events: registration, EVENT_DEFINE_RULES, custom events, behaviors, Twig extensions, utilities, widgets, filesystems | references/events.md | 4.4K |
| GraphQL: auth, tokens, types, queries, mutations, directives, resolvers | references/graphql.md | 8.4K |
| Plugin Vite: CP asset bundles, HMR, TypeScript, Vue | references/plugin-vite.md | 2.7K |
| Headless & hybrid: headlessMode, CORS, preview tokens | craft-site skill references/headless.md | 3.4K |
| GeneralConfig (system, routing, security, users, sessions, search, assets, images) | references/config-general.md | 8.4K |
| Craft version table, generated from the pack's version tags | references/version-table.md | 13.3K |
| GeneralConfig (content, templates, performance, GC, localization, headless, GraphQL) | references/config-general-extended.md | 7.2K |
| App config: cache, session, queue, mutex (Redis, one database each), mailer, search, logging, CORS, DB replicas, modules | references/config-app.md | 8.0K |
| Config bootstrap: env vars, aliases, App::parseEnv, custom.php, db.php, routes.php | references/config-bootstrap.md | 3.6K |
| Caching: template cache, data cache, static caching, CDN, invalidation | references/caching.md | 5.2K |
| Permissions: handles, user groups, registration, checking, events | references/permissions.md | 4.7K |
| Element authorization: four-layer defense, can*() methods, query scoping | references/element-authorization.md | 4.6K |
| Sessions & auth: session model, auth tokens, invalidation, elevated sessions | references/sessions-and-auth.md | 3.0K |
| Identity protocols: SSO/OIDC logout, signing algs, issuer vs tenancy, SCIM | references/identity-protocols.md | 1.3K |
| Custom field types: value lifecycle, settings, input HTML, validation, GraphQL | references/field-types-custom.md | 3.5K |
| Conditions framework: custom condition rules, registration | references/conditions.md | 2.3K |
| Email: system messages, programmatic sending, templates, events | references/email.md | 2.4K |
| Deployment: pipeline, project-config/write safely, zero-downtime, CI/CD, rollback | references/deployment.md | 2.5K |
| Drafts & revisions: provisional drafts, autosave, applying, merge | references/drafts-revisions.md | 2.5K |
| Upgrading 5.11 to 5.12.5 [5.12+]: behaviour changes, plugin-code changes, deploy steps | references/upgrade-5.12.md | 2.1K |
House rules: no AI or tool attribution and no co-author trailers in commits, PRs, comments, code or docs; no em dashes in prose; US spelling; no model or vendor names in pack files.
references/architecture.md (opens in a new tab)references/caching.md (opens in a new tab)references/conditions.md (opens in a new tab)references/config-app.md (opens in a new tab)references/config-bootstrap.md (opens in a new tab)references/config-general-extended.md (opens in a new tab)references/config-general.md (opens in a new tab)references/console-commands.md (opens in a new tab)references/controllers.md (opens in a new tab)references/cp-components.md (opens in a new tab)references/cp-ui-patterns.md (opens in a new tab)references/cp.md (opens in a new tab)references/debugging.md (opens in a new tab)references/deployment.md (opens in a new tab)references/drafts-revisions.md (opens in a new tab)references/element-authorization.md (opens in a new tab)references/element-index.md (opens in a new tab)references/elements.md (opens in a new tab)references/email.md (opens in a new tab)references/events.md (opens in a new tab)What SKILL.md sets; muted values are Claude Code's defaults
Triggers on: beforePrepare()/afterSave()/defineSources()/defineTableAttributes()/attributeHtml(), BaseNativeField, EVENT_REGISTER_*/DEFINE_*/BEFORE_*/AFTER_*, CraftVariable, custom element or field type (normalizeValue/inputHtml), webhook, batch job, CP section, dashboard widget, utility page, element action/exporter/condition, registerUserPermissions, requirePermission vs requireAdmin, kebab-case permissions, EVENT_DEFINE_RULES on Entry (fieldId + ownerId must be set), project-config/apply/write, EVENT_DEFINE_SIDEBAR_HTML/toolbar buttons, metaFieldsHtml, VueAdminTable, getIsMultiSite/refreshSites stale after new site, deleteSite phantom sites, siteId filter lost, UTC datetime/strtotime drift, ['like'] tuple matches nothing, configWarning. Always use when writing, editing, or reviewing Craft plugin/module PHP (even when no API is named) or saveField()/saveEntryType() from scripts. Plugin work: also load craft-plugins. Do NOT trigger for front-end Twig (craft-site) or content modeling (craft-content-modeling).
Three short reads, in order
npx claudepluginhub michtio/craftcms-claude-skills --plugin craftcms-claude-skills16 skills in this plugin
/craft-cloudCraft Cloud, Pixel & Tonic's serverless hosting platform for Craft CMS. Covers craft-cloud.yaml, the Build → Migrate → Release deploy pipeline, the craftcms/cloud extension, edge transforms and static caching (cache.rules, ESI), the Cloud S3 filesystem, MySQL 8 / Postgres 15 (no MariaDB, no tablePrefix), the Console command runner and scheduled cron, queue jobs, custom domains, preview environments per branch, limits (ephemeral filesystem, no SSH, no .htaccess, no built-in mail), Cloud-compatible plugins, and self-hosted → Cloud migration./craft-content-modelingCraft CMS 5 content modeling: sections, entry types, fields, Matrix, relations, project config, and content architecture strategy. Covers choosing section types, designing entry types and field layouts, selecting field types, Matrix and nested entries, relations and eager loading, and multi-site propagation./craft-fortrabbitfortrabbit (fortrabbit.com): managed PHP hosting with a Craft CMS software template. Covers git push-to-deploy through the fortrabbit GitHub App, the template's build and post-deploy commands, the merge deployment strategy with the /config/project replace pattern, the deploy file (.fortrabbit/deploy.yml) and its replace-by-default trap, CRAFT_* ENV vars mapped from FORTRABBIT_DB_*, production settings (admin changes and updates off), persistent storage for asset volumes and rsync sync, MySQL over an SSH tunnel, the queue and image transforms in a worker job, crons, platform limits (no root, no sendmail), and DDEV local development./craft-garnishGarnish, Craft CMS's built-in JavaScript UI toolkit for the control panel. ALWAYS load when writing, editing, or reviewing JavaScript that runs in the Craft CP: plugin CP assets, custom field type JS, element index JS, CP webpack config, or code importing garnishjs / referencing window.Garnish. Also for CP accessibility, keyboard interactions, drag-sort, and CP JS memory issues./craft-gated-buildBuilds one approved slice with the outside builders listed in .ai/skills-profile.json (local AI, a script) and keeps the pack's gates: craft-gate-writer locks the gate ahead of any builder, each builder gets a brief and returns a handback, the handback is verified, the lock and craft-review-checker cover the result, at most three rounds, and craft-feature-builder takes over when every outside builder fails, is unavailable or passes its timeout setting./craft-mcpCraft CMS 5.12+ MCP servers, OAuth server and personal access tokens: authenticated, public and stdio (mcp/serve) servers, mcp:read/write/admin levels, Settings → MCP, config/mcp.php and config/oauth.php, oauth/generate-keys and CRAFT_OAUTH_PRIVATE_KEY/PUBLIC_KEY on DDEV, production, Cloud, Servd and fortrabbit, connecting Claude Code or another client, the snake_case tool catalogue, and plugin MCP tools, field interfaces and OAuth resources.Other plugins' skills for the same job