drupal-setup
Complete Drupal development lifecycle - setup, onboarding, and maintenance
Install with Codex or Claude Copy this prompt, paste it into Codex, Claude, or another assistant, and let it review the skill page and install it for you.
Menu
Complete Drupal development lifecycle - setup, onboarding, and maintenance
Install with Codex or Claude Copy this prompt, paste it into Codex, Claude, or another assistant, and let it review the skill page and install it for you.
Based on SOC occupation classification
| name | drupal-setup |
| description | Complete Drupal development lifecycle - setup, onboarding, and maintenance |
You are helping with Drupal project setup and ongoing development with best practices and organizational standards.
This skill enables you to:
FIRST STEP: Detect the current scenario
Check the current directory:
# Check for composer.json
if [ -f "composer.json" ]; then
# Check if it's a Drupal project
if grep -q "drupal" composer.json; then
SCENARIO="EXISTING_PROJECT"
else
SCENARIO="NOT_DRUPAL"
fi
else
SCENARIO="NEW_PROJECT"
fi
# Check environment capabilities
if command -v ddev &> /dev/null; then
ENVIRONMENT="LOCAL_CLI"
else
ENVIRONMENT="WEB"
fi
Detected: composer.json with Drupal dependencies exists
Ask the user what they want to do:
This looks like an existing Drupal project!
What would you like to do?
[1] Initial setup (first time working on this project)
[2] Update after pulling changes (composer install, config import, etc.)
[3] Reset local environment (fresh install)
[4] Create new project instead
Choice [1]:
Option 1: Initial Setup โ Go to "Existing Project Setup" section below
Option 2: Update โ Go to "Update Existing Project" section below
Option 3: Reset โ Go to "Reset Local Environment" section below
Option 4: New Project โ Create new project in a different directory
Detected: No composer.json in current directory
Proceed with new project creation. Gather the following information:
Project name (e.g., "my-drupal-site")
Drupal variant (ALWAYS ask the user which variant):
1 - Drupal CMS (Full-featured with recipes) [RECOMMENDED DEFAULT]2 - Drupal 11 Core (Standard)3 - Drupal 11 MinimalSetup mode (default to Quick Mode):
php -r "exit(in_array('sqlite', PDO::getAvailableDrivers()) ? 0 : 1);"GitHub repository:
Common modules (if Drupal 11 Core selected):
Admin credentials (only if Full Mode):
Use this mode for normal project setup. It's FAST (~30 seconds) and creates a production-ready structure.
Create project directory
mkdir <project-name>
cd <project-name>
Initialize Composer project
# For Drupal 11
composer create-project drupal/recommended-project:^11 . --no-interaction
# For Drupal CMS
composer create-project drupal/cms . --no-interaction
Install Drush
composer require drush/drush --no-interaction
Install common modules (if requested)
composer require drupal/admin_toolbar drupal/gin drupal/gin_toolbar \
drupal/pathauto drupal/redirect drupal/simple_sitemap \
drupal/metatag drupal/config_split --no-interaction
Create directory structure
mkdir -p config/sync
mkdir -p private
Create settings.php (use template from templates/settings.php)
Create settings.local.php (empty file for local overrides)
Create .gitignore (use template from templates/gitignore)
Create DDEV config (use template from templates/ddev-config.yaml โ .ddev/config.yaml)
Create documentation
Initialize Git and push
git init
git add .
git commit -m "Initial Drupal project setup via Claude Code"
git remote add origin <github-url>
git branch -M main
git push -u origin main
Report what needs to be done next:
Project structure created! To complete the setup:
1. Clone the repository locally:
git clone <github-url> <project-name>
cd <project-name>
2. Start DDEV:
ddev start
3. Install Drupal:
ddev drush site:install --account-pass=admin -y
4. Export configuration:
ddev drush config:export -y
5. Commit the configuration:
git add config/sync
git commit -m "Add initial configuration export"
git push
Only use this mode when you need to test complex configuration or validate custom modules immediately. Warning: This is SLOW (5-8 minutes) and creates large vendor directory in workspace.
Verify SQLite is available
php -r "exit(in_array('sqlite', PDO::getAvailableDrivers()) ? 0 : 1);"
If this fails, fall back to Quick Mode.
Create project directory
mkdir <project-name>
cd <project-name>
Initialize Composer project
# For Drupal 11
composer create-project drupal/recommended-project:^11 . --no-interaction
# For Drupal CMS
composer create-project drupal/cms . --no-interaction
Install Drush
composer require drush/drush --no-interaction
Install common modules (if requested)
composer require drupal/admin_toolbar drupal/gin drupal/gin_toolbar \
drupal/pathauto drupal/redirect drupal/simple_sitemap \
drupal/metatag drupal/config_split --no-interaction
Create directory structure
mkdir -p config/sync
mkdir -p private
Create settings.php (use template from templates/settings.php)
Create settings.local.php (empty file for local overrides)
Install Drupal with SQLite
./vendor/bin/drush site:install standard \
--db-url=sqlite://sites/default/files/.ht.sqlite \
--site-name="<project-name>" \
--account-name=admin \
--account-pass=admin \
--yes
Enable common modules (if installed)
./vendor/bin/drush en admin_toolbar admin_toolbar_tools gin gin_toolbar \
pathauto redirect simple_sitemap metatag -y
Set Gin as admin theme
./vendor/bin/drush config:set system.theme admin gin -y
./vendor/bin/drush config:set node.settings use_admin_theme true -y
Export initial configuration
./vendor/bin/drush config:export -y
Create .gitignore (use template)
Create DDEV config (use template)
Create documentation
Initialize Git and push
git init
git add .
git commit -m "Initial Drupal project setup via Claude Code (Full Mode)"
git remote add origin <github-url>
git branch -M main
git push -u origin main
Report success
โ Drupal installed successfully!
โ Configuration exported to config/sync/
โ Pushed to GitHub: <github-url>
Your site is ready. To access it locally with DDEV:
git clone <github-url> <project-name>
cd <project-name>
ddev start
ddev launch
Use case: First time working on a project that was created with this skill.
IMPORTANT: This workflow requires manual steps for authentication. Do NOT attempt to run git clone or ddev start automatically.
Step 1: Show upfront summary and manual steps
First, ask the user for the GitHub repository URL and desired project directory. Then immediately display:
Drupal Project Setup Plan
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
๐ MANUAL STEPS (you):
[ ] 1. Clone repository (authentication required)
[ ] 2. Start DDEV (sudo password required)
๐ค AUTOMATED STEPS (me):
[ ] 3. Verify project structure
[ ] 4. Install Composer dependencies (~2-3 min)
[ ] 5. Install Drupal
[ ] 6. Export configuration (if needed)
[ ] 7. Provide access details
Estimated time: ~5 minutes
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ MANUAL STEPS REQUIRED (authentication needed) โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโค
โ โ
โ Please run these commands: โ
โ โ
โ 1. Clone repository: โ
โ cd <parent-directory> โ
โ git clone <github-url> <project-directory> โ
โ cd <project-directory> โ
โ โ
โ 2. Start DDEV (requires sudo): โ
โ ddev start โ
โ โ
โ Type 'done' when complete โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
Step 2: Wait for user confirmation
Wait for the user to type 'done' before proceeding.
Step 3: Verify DDEV is running
# Check if DDEV is running
ddev describe
If this fails, prompt user to run ddev start again.
Step 4: Verify project structure
# Check for required files
ls -la composer.json .ddev/config.yaml config/sync
Step 5: Install dependencies
echo "โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ"
echo "๐ฆ Installing Composer dependencies (~2-3 minutes)..."
echo "โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ"
ddev composer install
Step 6: Install Drupal (with empty config detection)
# Check if config exists and has actual content
if [ -f "config/sync/core.extension.yml" ]; then
echo "โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ"
echo "โ Found existing configuration"
echo "๐ง Installing Drupal from existing config..."
echo "โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ"
ddev drush site:install --existing-config --account-pass=admin -y
else
echo "โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ"
echo "โน No configuration found - performing fresh install"
echo "๐ง Installing Drupal..."
echo "โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ"
ddev drush site:install --account-pass=admin -y
ddev drush config:export -y
echo "Note: Initial config exported. Consider committing config/sync/ directory."
fi
Step 7: Clear cache and get site details
ddev drush cache:rebuild
# Get the site URL
SITE_URL=$(ddev describe | grep -oP 'https://[^ ]+' | head -1)
# Get one-time login link
ULI=$(ddev drush uli)
Step 8: Report success with actionable next steps
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ
Setup Complete!
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
๐ Your Site:
URL: <SITE_URL>
One-time login: <SITE_URL><ULI>
Username: admin
Password: admin
๐ Next Steps:
Development workflow:
โข Make changes in Drupal UI
โข Export config: ddev drush cex -y
โข Commit: git add -A && git commit -m "message"
โข Push: git push
Common commands:
โข ddev drush uli # One-time login
โข ddev drush cr # Clear cache
โข ddev launch # Open in browser
โข ddev drush watchdog:show # View logs
โข ddev drush status # Check Drupal status
๐ See README.md for more details
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
Verify project structure
ls -la composer.json config/sync
Install dependencies
composer install
Report limitations
โ Dependencies installed
โ DDEV not available - cannot install Drupal in this environment
To complete setup:
1. Work on configuration files and custom code here
2. Test locally with DDEV or on a server
When working without DDEV:
- Modify config YAML files in config/sync/
- Create/modify custom modules in web/modules/custom/
- Update composer.json for dependencies
- Push changes to Git
- Pull and test on a DDEV environment
Use case: Pulled latest changes from Git, need to sync local environment.
Update dependencies
ddev composer install
Import configuration
ddev drush config:import -y
Run database updates
ddev drush updb -y
Clear cache
ddev drush cache:rebuild
Report what was updated
# Show config changes
git diff HEAD~1 config/sync/ --name-only
# Show composer changes
git diff HEAD~1 composer.lock --name-only
Report success
โ Environment updated successfully!
Changes applied:
- Dependencies updated (if composer.lock changed)
- Configuration imported (if config/sync/ changed)
- Database updates run
- Cache cleared
Your local environment is now in sync with the repository!
Update dependencies
composer install
Report what changed
git diff HEAD~1 config/sync/ --name-only
git diff HEAD~1 composer.json composer.lock
Report limitations
โ Dependencies updated
โ Configuration and database updates require DDEV
Configuration changes detected:
[List changed config files]
To complete update:
- Import config: ddev drush config:import -y
- Run updates: ddev drush updb -y
- Clear cache: ddev drush cache:rebuild
Use case: Clean slate - reinstall Drupal from scratch with current config.
Stop and remove database
ddev stop
ddev delete -y
Restart DDEV
ddev start
Install dependencies
ddev composer install
Reinstall Drupal (with empty config detection)
# Check if config exists and has actual content
if [ -f "config/sync/core.extension.yml" ]; then
echo "โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ"
echo "โ Found existing configuration"
echo "๐ง Reinstalling Drupal from existing config..."
echo "โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ"
ddev drush site:install --existing-config --account-pass=admin -y
else
echo "โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ"
echo "โน No configuration found - performing fresh install"
echo "๐ง Installing Drupal..."
echo "โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ"
ddev drush site:install --account-pass=admin -y
ddev drush config:export -y
echo "Note: Initial config exported. Consider committing config/sync/ directory."
fi
Clear cache and get site details
ddev drush cache:rebuild
# Get the site URL
SITE_URL=$(ddev describe | grep -oP 'https://[^ ]+' | head -1)
# Get one-time login link
ULI=$(ddev drush uli)
Report success with actionable next steps
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ
Environment Reset Complete!
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
๐ Your Site:
URL: <SITE_URL>
One-time login: <SITE_URL><ULI>
Username: admin
Password: admin
๐ Next Steps:
โข ddev launch # Open in browser
โข ddev drush uli # Get new one-time login
โข ddev drush status # Check Drupal status
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
Report that reset requires DDEV:
โ Environment reset requires DDEV (local development environment)
This operation needs to:
1. Drop and recreate the database
2. Reinstall Drupal
3. Import configuration
Please run this on a local machine with DDEV installed.
All template files are located in the templates/ subdirectory:
settings.php - Organization-specific Drupal settingsgitignore - Comprehensive .gitignore for Drupalddev-config.yaml - DDEV configuration templateREADME.md - Project documentation templateCLAUDE.md - Claude Code guidance templateWhen using templates:
{{PROJECT_NAME}} - Replace with actual project name{{GITHUB_URL}} - Replace with GitHub repository URL{{DRUPAL_VARIANT}} - Replace with selected variant{{CURRENT_DATE}} - Replace with current dateA successful setup includes:
After setup, inform the user: