Imported from AlexSkrypnyk/generated_content (
AGENTS.md). Install upstream withnpx skills add AlexSkrypnyk/generated_content. Copyright stays with the author.
AGENTS.md
This file provides guidance to AI agents when working with code in this repository.
Overview
This is a Generated Content template for creating contributed modules or themes. The project provides a complete development environment with CI configuration, testing setup, and deployment automation for publishing to Drupal.org.
Development Commands
HARD RULE - use the provided command wrappers, never the tool binaries directly. When make or ahoy exposes a command for a task, use that command; do not call the underlying binary directly. Each wrapper chdirs into build/ and runs the tool with the config, plugins, and environment that CI uses, so a raw invocation from the repository root silently diverges from CI - it can pass locally while CI fails (or vice versa), or crash outright when a relative path resolves against the wrong directory. If no wrapped command covers what you need, extend the make / ahoy target rather than making a one-off raw call; if that is not feasible, stop and ask.
Run each tool through its ahoy wrapper, never the binary directly:
- PHPCS / PHPCBF:
ahoy lint/ahoy lint-fix- nevervendor/bin/phpcsorvendor/bin/phpcbf. - PHPStan:
ahoy lint- nevervendor/bin/phpstan. - Rector:
ahoy lint(dry-run) /ahoy lint-fix- nevervendor/bin/rector. - Twig CS Fixer:
ahoy lint/ahoy lint-fix- nevervendor/bin/twig-cs-fixer. - PHPUnit:
ahoy test/ahoy test-unit/ahoy test-kernel/ahoy test-functional- nevervendor/bin/phpunit. - Drush:
ahoy drush <command>- neverbuild/vendor/bin/drushdirectly.
Build and Environment Management
Using Ahoy (alternative):
ahoy build- Complete build processahoy assemble- Assemble codebaseahoy start- Start development serverahoy provision- Provision Drupal site
Code Quality
Linting:
ahoy lint- Run all linting toolsahoy lint-fix- Auto-fix coding standards violations
Testing:
ahoy test- Run all testsahoy test-unit- Run unit tests onlyahoy test-kernel- Run kernel tests onlyahoy test-functional- Run functional tests onlyahoy test-functional-javascript- Run FunctionalJavascript tests (uses the local Chrome by default; setWEBDRIVER_BACKEND=seleniumfor Docker)ahoy browser-start- Start the browser for FunctionalJavascript tests (local Chrome by default; setWEBDRIVER_BACKEND=seleniumfor Docker)ahoy browser-stop- Stop the browser
Drupal Commands
ahoy drush <command>- Run Drush commandsahoy login- Get one-time login link
Diagnostics
ahoy info- Print a read-only summary of PHP/Drupal/Composer/Drush/Node versions, webserver host/port (with source), XDebug state, build directory, database path, and active profile. (alias:ahoy describe)
Project Structure
Key Directories:
src/- Extension source code (services, forms, etc.)tests/src/- PHPUnit tests (Unit/, Kernel/, Functional/)modules/- Example submodules shipped with the extensionbuild/- Assembled Drupal codebase (symlinked extension).devtools/- Build and deployment scripts used by CIscripts/- Custom lifecycle hooks: post-assemble (assemble-*.sh), post-provision (provision-*.sh), post-start (start-*.sh), and pre-stop (stop-*.sh). Run automatically during each phase in lexicographic order; non-zero exit aborts the parent. Excluded from distribution archives via.gitattributes
Architecture
- Service-based architecture: Main functionality in services registered via
*.services.yml - Plugin-based generators: Content generators are plugins discovered from
src/Plugin/GeneratedContent/ - Form integration: Admin forms in
src/Form/for configuration
Environment Variables
DRUPAL_VERSION- Target Drupal version (e.g.,10,11,11@alpha)WEBSERVER_HOST- Development server host (default: localhost)WEBSERVER_PORT- Development server port. Auto-discovered from range 8000-8099 and written to.envif not already setWEBDRIVER_BACKEND- FunctionalJavascript WebDriver backend:chromedriver(default, drives the locally installed Chrome with no Docker) orselenium(Docker container)WEBDRIVER_PORT- Port for the WebDriver endpoint (both backends). Auto-discovered from 4444 and written to.envif not already set, so several projects can run FunctionalJavascript tests simultaneouslyGITHUB_TOKEN- GitHub API token to avoid rate limitsDEBUG- Set to1to stream the full output of the underlying commands (Composer, npm, Drush). By default this output is suppressed and shown only when a command fails
Development Workflow
- Build environment:
ahoy build - Develop Generated Content code in
src/ - Check standards:
ahoy lint - Run tests:
ahoy test - Access the site at the URL reported by
ahoy info(http://localhost:8000 unless the port was auto-discovered)
Code Quality Tools
- PHPCS: Drupal and DrupalPractice standards
- PHPStan: Static analysis with Drupal extensions
- Rector: Automated refactoring and deprecation fixes
- Twig CS Fixer: Twig template formatting
CI/CD Support
- GitHub Actions:
.github/workflows/test.ymland deployment - Matrix testing: PHP 8.3-8.5, Drupal 11
- Automated deployment: Mirror to Drupal.org on release
Important Notes
- The
build/directory contains the assembled Drupal site - Extension files are symlinked from root into
build/web/modules/custom/(module) orbuild/web/themes/custom/(theme) - SQLite database created in
/tmp/site_generated_content.sqlite - All quality tools run from within
build/directory
Updating the scaffold
When the user asks to update this project's scaffold (e.g. "update scaffold"), fetch the update skill from GitHub into the local .claude/skills/ directory, then invoke it:
-
Create the target directory if it does not exist:
mkdir -p .claude/skills/update-consumer-drupal-extension-scaffold -
Download the skill:
curl -sSL https://raw.githubusercontent.com/AlexSkrypnyk/drupal_extension_scaffold/1.x/.scaffold/skills/update-consumer-drupal-extension-scaffold/SKILL.md -o .claude/skills/update-consumer-drupal-extension-scaffold/SKILL.md -
Invoke the
update-consumer-drupal-extension-scaffoldskill and follow its steps.
The skill directory is git-ignored - it is fetched on demand and not committed to the project.