| name | drupal-setup |
| description | Complete Drupal development lifecycle - setup, onboarding, and maintenance |
Drupal Project Setup & Development Skill
You are helping with Drupal project setup and ongoing development with best practices and organizational standards.
Capabilities
This skill enables you to:
- Set up NEW Drupal projects - Drupal 11 Core or Drupal CMS (FAST - 30 seconds)
- Set up EXISTING projects - Onboard to projects created with this skill
- Maintain & update - Keep local environment in sync with team changes
- Configure with organizational best practices
- Work in both Claude Code CLI (local) and Web environments
- Generate comprehensive documentation
Scenario Detection
FIRST STEP: Detect the current scenario
Check the current directory:
if [ -f "composer.json" ]; then
if grep -q "drupal" composer.json; then
SCENARIO="EXISTING_PROJECT"
else
SCENARIO="NOT_DRUPAL"
fi
else
SCENARIO="NEW_PROJECT"
fi
if command -v ddev &> /dev/null; then
ENVIRONMENT="LOCAL_CLI"
else
ENVIRONMENT="WEB"
fi
User Interaction Flow
Scenario A: Existing Drupal Project
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
Scenario B: New Drupal Project
Detected: No composer.json in current directory
Proceed with new project creation. Gather the following information:
-
Project name (e.g., "my-drupal-site")
- Must be valid directory name
- Will be used for Git repository name
-
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 Minimal
-
Setup mode (default to Quick Mode):
- Ask: "Setup mode: [1] Quick (recommended, ~30s) or [2] Full (advanced, ~5-8 min)? [1]"
- Default: Quick Mode (template-based)
- If user selects Full Mode:
- Check SQLite availability:
php -r "exit(in_array('sqlite', PDO::getAvailableDrivers()) ? 0 : 1);"
- If SQLite NOT available: "SQLite not available. Falling back to Quick Mode."
- If SQLite available: Proceed with Full Mode
-
GitHub repository:
- Ask if they want to create new repo or use existing
- If new: "Please create the repository on GitHub first, then provide the URL"
- If existing: "Please provide the repository URL"
-
Common modules (if Drupal 11 Core selected):
- Ask: "Include common contributed modules? (Admin Toolbar, Gin, Pathauto, etc.) [Y/n]"
- Default: Yes
-
Admin credentials (only if Full Mode):
- Username: default "admin"
- Password: default "admin" (they can change later)
Installation Process
Quick Mode (Default, Recommended)
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
composer create-project drupal/recommended-project:^11 . --no-interaction
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
- README.md (use template from templates/README.md)
- CLAUDE.md (use template from templates/CLAUDE.md)
-
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
Full Mode (Advanced, Optional)
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
composer create-project drupal/recommended-project:^11 . --no-interaction
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
- README.md (use template)
- CLAUDE.md (use template)
-
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
Existing Project Workflows
Existing Project Setup (Initial)
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.
If DDEV Available (Local CLI - Recommended):
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
ddev describe
If this fails, prompt user to run ddev start again.
Step 4: Verify project structure
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)
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
SITE_URL=$(ddev describe | grep -oP 'https://[^ ]+' | head -1)
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
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
If DDEV NOT Available (Web):
-
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
Update Existing Project
Use case: Pulled latest changes from Git, need to sync local environment.
If DDEV Available (Local CLI):
-
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
git diff HEAD~1 config/sync/ --name-only
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!
If DDEV NOT Available (Web):
-
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
Reset Local Environment
Use case: Clean slate - reinstall Drupal from scratch with current config.
If DDEV Available (Local CLI):
-
Stop and remove database
ddev stop
ddev delete -y
-
Restart DDEV
ddev start
-
Install dependencies
ddev composer install
-
Reinstall Drupal (with empty config detection)
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
SITE_URL=$(ddev describe | grep -oP 'https://[^ ]+' | head -1)
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
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
If DDEV NOT Available (Web):
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.
Templates
All template files are located in the templates/ subdirectory:
settings.php - Organization-specific Drupal settings
gitignore - Comprehensive .gitignore for Drupal
ddev-config.yaml - DDEV configuration template
README.md - Project documentation template
CLAUDE.md - Claude Code guidance template
When using templates:
- Read the template file
- Replace placeholders:
{{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 date
- Write the processed template to the target location
Error Handling
- If Composer fails, check network connectivity and retry
- If Git push fails, use exponential backoff retry (up to 4 times)
- If drush commands fail, provide clear error messages and suggest fixes
- If SQLite installation fails mid-way, fall back to template mode
Success Criteria
A successful setup includes:
- โ All files created without errors
- โ Composer dependencies installed
- โ Configuration files properly structured
- โ Git repository initialized and pushed
- โ Documentation complete and accurate
- โ (If full install) Drupal installed and initial config exported
Post-Setup Guidance
After setup, inform the user:
- How to access their site (if full install)
- Next steps for development
- How to work with configuration management
- Common drush commands (reference CLAUDE.md)
Notes
- This skill creates production-ready projects, not quick demos
- All settings follow organizational best practices from CurrentWorkflow.md
- Config-first approach: changes should be made via config files when possible
- DDEV config is included even for full installs (for team collaboration)