/craftcms-claude-skills:ddevfrom craftcms-claude-skills
Manages DDEV local development for Craft CMS projects. Covers PHP/Node versions, database operations, Xdebug, Vite exposure, custom commands, Mailpit, and troubleshooting port conflicts, container restarts, and env var overrides.
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; scripts run unread.
!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+]).
When this skill triggers, also load:
craftcms — Plugin/module development. Required when DDEV commands involve Craft CLI (ddev craft make, ddev craft migrate, ddev craft project-config).craft-php-guidelines — PHP coding standards. Required when DDEV commands involve code quality tooling (ddev composer check-cs, ddev composer phpstan, ddev exec --dir … vendor/bin/pest).When unsure about a DDEV feature, WebFetch the relevant docs page.
ddev exec composer install instead of ddev composer install — DDEV shorthand commands handle path resolution and environment setup. Always use the shorthand.ddev craft up does both migrate/all and project-config/apply — no need to run them separately after pulls or deploys.ports instead of web_extra_exposed_ports — ports causes conflicts when running multiple DDEV projects. web_extra_exposed_ports routes through Traefik and works with HTTPS.ddev composer global require — global packages install inside the container and vanish on restart. Install project-level dependencies only.nodejs_version but running npm install on the host — Node must run inside the container via ddev npm to match the configured version..ddev/config.yaml while containers are running without restarting — changes to config require ddev restart to take effect.ddev import-db without --target-db=db on multi-database setups — the default target is db, but if you've configured additional databases, be explicit.#ddev-generated to custom commands you've customized — DDEV overwrites files with this comment during updates. Only use it for add-on-managed commands. Custom commands you maintain should omit it.composer install on the host then ddev composer check-cs/ddev composer phpstan — if the host PHP version differs from DDEV's (e.g., host PHP 8.4, DDEV PHP 8.3), vendor/composer/platform_check.php fails. Always run ddev composer install so vendor/ matches the container's PHP version.Always prefer Craft CLI commands over raw database queries:
ddev craft users/list-admins # not: ddev mysql -e "SELECT * FROM users WHERE admin=1"
ddev craft project-config/get system # not: reading project.yaml manually
ddev craft resave/entries # not: UPDATE queries on content tables
ddev craft elements/delete # not: DELETE FROM elements
Only fall back to ddev mysql when no CLI equivalent exists (e.g., checking table schemas, debugging specific rows, TRUNCATE cache for stuck mutex locks). Craft CLI commands handle project config, search index updates, and event firing that raw SQL skips.
Always use DDEV shorthand over ddev exec:
ddev composer install # not ddev exec composer install
ddev craft up # not ddev exec php craft up
ddev npm install # not ddev exec npm install
ddev craft make service # scaffolding
# .ddev/config.yaml
name: my-craft-site
type: craftcms
docroot: web
php_version: "8.3"
database:
type: mysql
version: "8.0"
nodejs_version: "20"
DDEV auto-injects: CRAFT_DB_SERVER, CRAFT_DB_USER, CRAFT_DB_PASSWORD, CRAFT_DB_DATABASE, PRIMARY_SITE_URL. These are injected into the container via .ddev/.env.web and can be opted out of with disable_settings_management: true in .ddev/config.yaml.
The canonical flow for a fresh DDEV + Craft project:
mkdir my-craft-site && cd my-craft-site
ddev config --project-type=craftcms --docroot=web # writes .ddev/config.yaml
ddev start
ddev composer create-project craftcms/craft # Craft's setup wizard runs automatically
ddev composer create-project launches Craft's interactive install wizard on completion. If it doesn't run (or you need to re-run it), use ddev craft install. Swap craftcms/craft for a community starter project to bootstrap from one instead.
ddev start # Start the project
ddev stop # Stop the project
ddev restart # Restart containers
ddev ssh # SSH into web container
ddev describe # Show project info and URLs
ddev launch # Open the project in a browser
ddev launch -m # Open Mailpit (also --mailpit)
ddev logs # View container logs
ddev import-db --file=dump.sql # Import database
ddev export-db --file=dump.sql # Export database
ddev xdebug on # Enable Xdebug
ddev craft db/backup # Craft database backup
Composer scripts auto-run craft up after install/update:
{
"scripts": {
"post-craft-update": [
"@php craft install/check && php craft up --interactive=0 || exit 0"
],
"post-update-cmd": "@post-craft-update",
"post-install-cmd": "@post-craft-update"
}
}
So ddev craft up (migrations plus project config) auto-runs after ddev composer install/update.
ddev add-on get ddev/ddev-redis # Install Redis
ddev add-on list # List installed add-ons
ddev add-on remove ddev/ddev-redis # Remove add-on
Redis: the web container reaches it at redis:6379 (no password by default). The add-on does not set REDIS_HOSTNAME for Craft, so add REDIS_HOSTNAME=redis to .env. Cache, session, queue and mutex config: craftcms skill, references/config-app.md.
Mailpit is built into DDEV core — no add-on installation needed. Outgoing mail is captured automatically. Access the web UI with ddev mailpit, or ddev describe shows its URL (e.g. https://{project}.ddev.site:8026).
Sharing a local site (ddev share, ngrok or cloudflared, the Craft MCP caveat): read references/sharing.md; if it is missing, stop and report it.
Place scripts in .ddev/commands/web/ (container) or .ddev/commands/host/ (host):
#!/usr/bin/env bash
## Description: Run ECS code style check
## Usage: check-cs
## Example: ddev check-cs
cd /var/www/html && composer check-cs
url in composer.json is the host path, and .ddev/docker-compose.mounts.yaml mounts that same path at the same location in the container, or the symlink in vendor/ points nowhere. Never set config.platform.php in composer.json; DDEV owns the PHP version.ddev exec --dir /var/www/html/vendor/acme/my-plugin vendor/bin/pest. markhuot/craft-pest-core reads getcwd().'/phpunit.xml(.dist)' only and ignores --configuration=, so ddev craft pest -- --configuration=vendor/acme/my-plugin/phpunit.xml.dist runs the tests against the project's live database. Treat that shared-root form as unsafe.Setup steps, mount example and the full test-suite mechanism: references/plugin-development.md; isolation checklist and CI: the craft-pest skill (references/isolation.md).
Craft 5.12 ships its own MCP server, so an MCP client can read and edit the local site's content as a Craft user. Not the same thing as Chrome DevTools MCP (references/browser-debugging.md). Setup (OAuth keys, Settings → MCP, the claude mcp add --transport http command, the stdio variant ddev craft mcp/serve --user=<username>), mkcert trust for the client and plugin tools live in the craft-mcp skill; load it instead of improvising. Two DDEV-specific facts: the HTTP endpoint only accepts the CP and site hosts (*.ddev.site, localhost), so a ddev share URL is rejected unless it is also a site base URL, and Craft MCP needs Craft 5.12 or later [5.12+] (Before 5.12: nothing to connect to; upgrade first).
ddev poweroff # Stop all DDEV projects
ddev debug router # Debug router configuration
ddev debug capabilities # Check Docker capabilities
ddev delete --omit-snapshot # Remove project without snapshot
DDEV auto-injects Craft env vars into the container via .ddev/.env.web, and on every ddev start/restart rewrites the keys it manages (CRAFT_DB_DRIVER, CRAFT_DB_SERVER, CRAFT_DB_PORT, CRAFT_DB_DATABASE, CRAFT_DB_USER, CRAFT_DB_PASSWORD, CRAFT_WEB_ROOT, MAILPIT_SMTP_HOSTNAME, MAILPIT_SMTP_PORT, PRIMARY_SITE_URL) unless disable_settings_management: true is set in .ddev/config.yaml. Other keys in the file are kept, and a commented-out managed key is uncommented and reset. Because a real container environment variable beats a cms/.env dotenv value, and CRAFT_* env vars beat config/general.php (see the craftcms skill's config-bootstrap.md), a value you edit in .env or general.php can be silently overridden by what ddev injected.
Two symptoms and fixes:
PRIMARY_SITE_URL follows ddev's primary URL, whose scheme is often http; if Craft resolves an unexpected base URL, that injected var is the likely source. Point Craft's site URL at a differently-named env var (e.g. SITE_URL) in your site config so ddev's PRIMARY_SITE_URL doesn't shadow it, or override PRIMARY_SITE_URL deliberately..env change reverts after restart. A hand edit to one of the managed keys in .ddev/.env.web is reset on restart (your own keys survive). To change a managed value durably, set disable_settings_management: true and own the file, or override it in a file applied later, such as .ddev/.env.web.local (DDEV v1.25.4+). web_environment in .ddev/config.yaml does not help here: a key in .env.web beats the same key in web_environment.When a config value "won't change," check the resolved environment (ddev exec printenv | grep CRAFT_, and .ddev/.env.web) before editing PHP again.
| Reference | ~Tokens | Scope |
|---|---|---|
references/plugin-development.md | ~850 | Composer path repos and volume mounts for local plugin development; running a plugin's own Pest suite with ddev exec --dir and why --configuration= is unsafe. |
references/browser-debugging.md | ~680 | Chrome DevTools MCP: installation, capabilities, when to use it, logging into the CP on a DDEV site, project-level setup. |
Task examples: "symlink a local plugin into the project" or "run my plugin's tests" → plugin-development.md; "inspect the CP / check console errors in a browser" → browser-debugging.md.
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.
What SKILL.md sets; muted values are Claude Code's defaults
Triggers on: ddev start/stop/restart, ddev craft, ddev composer, ddev npm, ddev ssh, ddev import-db/export-db, ddev xdebug on/off, ddev share, ddev add-on, ddev poweroff, ddev describe, ddev logs, .ddev/commands/, web_extra_exposed_ports, web_extra_daemons, port conflicts, database backup/restore locally, ran npm/composer on host instead of ddev, wrong node_modules architecture, ddev-injected PRIMARY_SITE_URL, .ddev/.env.web regenerated on restart, CRAFT_ env var overriding config/general.php, general-config edit has no effect, ddev exec --dir, running a plugin's Pest suite inside a host project, tests wrote to the dev database. NOT for production deployment, CI/CD pipelines, GitHub Actions, or server configuration. NOT for Docker/container usage outside of DDEV.
Three short reads, in order
ddev, craft-cms, local-development, container-troubleshooting
16 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./craftcmsCraft CMS 5 plugin and module development in PHP. Covers elements, element queries, services, models, records, controllers, migrations, queue jobs, console commands, field types, events, Twig extensions, widgets, permissions, GraphQL, testing, and debugging./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.npx claudepluginhub michtio/craftcms-claude-skills --plugin craftcms-claude-skillsOther plugins' skills for the same job