$npx -y skills add edutrul/drupal-ai --skill drupal-configDrupal configuration management with Drush — import/export config, preview config changes before applying (e.g., seeing what would change without importing), config splits, and environment syncing.
| 1 | # Drupal Configuration Management |
| 2 | |
| 3 | ## Safety: Avoid Accidental Remote Imports |
| 4 | |
| 5 | Remote drush may default to `--yes` and auto-confirm `cim`. Always use safe patterns: |
| 6 | |
| 7 | ```bash |
| 8 | # SAFE — preview only |
| 9 | ssh user@remote "drush cim --no --diff" |
| 10 | ssh user@remote "drush config:get config.name" |
| 11 | ssh user@remote "drush config:status" |
| 12 | |
| 13 | # DANGEROUS — may auto-import |
| 14 | ssh user@remote "drush cim --diff" |
| 15 | ``` |
| 16 | |
| 17 | ## Import / Export |
| 18 | |
| 19 | ```bash |
| 20 | ddev drush cex # Export active config → YAML files |
| 21 | ddev drush cim # Import YAML files → active config |
| 22 | ddev drush cim --no --diff # Preview only (no import) |
| 23 | ddev drush config:status # Show pending changes (read-only) |
| 24 | ``` |
| 25 | |
| 26 | ## Config Splits |
| 27 | |
| 28 | ### Complete vs Partial — CRITICAL distinction |
| 29 | |
| 30 | | Type | Behavior | Use for | |
| 31 | |---|---|---| |
| 32 | | **Complete** | Config exists ONLY in that environment | Modules on/off (devel, stage_file_proxy) | |
| 33 | | **Partial** | Base config everywhere, different VALUES | API keys, SMTP, search server URLs | |
| 34 | |
| 35 | **Complete split**: config is removed from `config/sync/` and lives only in `config/{split}/`. |
| 36 | **Partial split**: config stays in `config/sync/`, overrides live in `config/{split}/config_split.patch.*.yml`. |
| 37 | |
| 38 | ### Split Commands |
| 39 | |
| 40 | ```bash |
| 41 | ddev drush config-split:status # List splits and active state |
| 42 | ddev drush csex {split-name} # Export specific split |
| 43 | ddev drush csim {split-name} # Import specific split |
| 44 | ddev drush config-split:activate {name} |
| 45 | ddev drush config-split:deactivate {name} |
| 46 | ``` |
| 47 | |
| 48 | ### Updating a Split Definition |
| 49 | |
| 50 | Changes must be in **active config** (DB), not just YAML files: |
| 51 | |
| 52 | ```bash |
| 53 | # Edit YAML, then import to activate |
| 54 | ddev drush config:import --partial |
| 55 | # OR set via PHP eval |
| 56 | ddev drush php:eval "\$c = \Drupal::configFactory()->getEditable('config_split.config_split.local'); \$c->set('partial_list', ['config.name']); \$c->save();" |
| 57 | ddev drush cex |
| 58 | ``` |
| 59 | |
| 60 | ## Troubleshooting |
| 61 | |
| 62 | ### Config deleted from config/sync/ on export |
| 63 | |
| 64 | **Root cause**: Config is in `complete_list` instead of `partial_list`. |
| 65 | |
| 66 | ```bash |
| 67 | # Diagnose |
| 68 | grep -A10 "complete_list:" config/sync/config_split.config_split.local.yml |
| 69 | grep -A10 "partial_list:" config/sync/config_split.config_split.local.yml |
| 70 | ``` |
| 71 | |
| 72 | Fix: move the item from `complete_list` to `partial_list` in the split YAML, then import and re-export. |
| 73 | |
| 74 | ### Config won't import |
| 75 | |
| 76 | ```bash |
| 77 | ddev drush config:import --skip-config=system.site # Skip specific locked config |
| 78 | ddev drush config:import --skip-modules=config_split # Ignore splits |
| 79 | ``` |
| 80 | |
| 81 | ### Split not activating |
| 82 | |
| 83 | ```bash |
| 84 | ddev drush config-split:status |
| 85 | ddev drush config-split:activate {split-name} |
| 86 | ddev drush cex |
| 87 | ``` |
| 88 | |
| 89 | ## Intent → Command Mapping |
| 90 | |
| 91 | | User Intent | Command | |
| 92 | |---|---| |
| 93 | | Preview config changes | `drush cim --no --diff` | |
| 94 | | Import config | `drush cim` | |
| 95 | | Export config | `drush cex` | |
| 96 | |
| 97 | ## Related Commands |
| 98 | |
| 99 | **Read-only**: `config:get`, `config:status` |
| 100 | **Export**: `cex` / `config:export` |
| 101 | **Import**: `cim --no --diff` (preview), `cim` (apply) |
| 102 | **Splits**: `config-split:status`, `csex`, `csim`, `config-split:activate` |
| 103 | |
| 104 | ## Deep Dive |
| 105 | |
| 106 | - **[full-guide.md](references/full-guide.md)** — Extended reference on Config Split 2.0, patch files, export/import internals |