This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
Craft CMS 5.x plugin development scaffold using DDEV for the local runtime. The plugin source lives at the repo root; a full Craft CMS installation lives in craft-install/ and loads the plugin via a Composer path repository (symlink).
src/— Plugin source code. PSR-4 namespaceviget\ddev\maps here. Entry point issrc/Plugin.php(extendscraft\base\Plugin).composer.json(root) — Defines the plugin package (viget/ddev-plugin, typecraft-plugin, handleddev-plugin).craft-install/— Full Craft CMS app. Itscomposer.jsonhas atype: pathrepository pointing to../, which symlinks the root plugin intocraft-install/vendor/viget/ddev-plugin. Edits tosrc/are reflected immediately.craft(root) — PHP CLI script that bootstraps viacraft-install/bootstrap.phpand runs Craft's console app. Use this instead ofcraft-install/craft.config/,storage/,tests/— Plugin-level directories (currently empty scaffolds).
All commands run inside DDEV containers:
ddev start # Start the environment
ddev ssh # Shell into the web container
ddev craft <command> # Run Craft CLI (e.g., migrate/all, project-config/apply)
ddev composer install # Installs plugin dependencies (runs at repo root)
ddev composer install --dir craft-install # Installs Craft app dependencies- Project name:
craft-viget-a11y→ https://craft-viget-a11y.ddev.site - Type:
craftcms, docroot:craft-install/web - PHP 8.3, MariaDB 10.11, Nginx
composer_rootis set to.soddev composeroperates on the plugin's rootcomposer.json(overrides thecraftcmstype default ofcraft-install/)
The craft-install/composer.json requires "viget/ddev-plugin": "dev-main" and lists the repo root (../) as a path repository. Composer installs it as a symlink, so craft-install/vendor/viget/ddev-plugin → repo root. This means:
- Plugin code changes in
src/are live immediately - Root
composer.jsondefines the plugin metadata (name, handle, autoload, dependencies) craft-install/composer.jsondefines the Craft app dependencies
When asked to verify your work, use agent-browser for web automation. Run agent-browser --help for all commands.
agent-browser open <url>- Navigate to pageagent-browser snapshot -i- Get interactive elements with refs (@e1, @e2)agent-browser click @e1/fill @e2 "text"- Interact using refs- Re-snapshot after page changes
agent-browser open https://craft-viget-a11y.ddev.site
agent-browser open https://craft-viget-a11y.ddev.site/admin- Use the following credentials for login.
- Username: admin
- Password: password
- You can also navigate to https://craft-viget-a11y.ddev.site/admin/entries/entries to view a list of entries in different states.