/cms-cultivator:dependabot-branch-validationfrom cms-cultivator
Combines all open Dependabot PRs into one consolidated branch with lock file validation, database snapshots, and Drupal config drift checks. Use when reviewing or rolling up automated dependency updates.
Ships in cms-cultivator. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them.
Combine every open Dependabot branch into a single consolidated branch, validate the whole set together, and open one pull request for it. Dependabot edits lock files directly rather than running the package manager the way a developer would, so two classes of problem show up: a lock file that does not match what the resolver actually produces, and tracked generated files that were never regenerated alongside the lock. Reviewing fifteen separate PRs also costs fifteen review cycles for what is usually one decision.
The consolidated branch carries one commit per original Dependabot PR, each referencing that PR number, so the history stays auditable and any single bump can be reverted on its own.
main, dev, or any other base branch.ddev refresh and drush updatedb both mutate the local database,
so the snapshot is what makes this workflow non-destructive.config:export to "fix" it, and do not
commit exported config to the consolidated branch unless the user asks.git status --short
git rev-parse --abbrev-ref HEAD
ddev describe
Record the starting branch. It is restored in step 11. If the tree is dirty,
stop and tell the user, starting with the line
WORKING TREE NOT CLEAN: commit or stash before continuing. Do not snapshot,
switch branches, or merge anything until they have. Stop as well if DDEV is not
running.
Take the snapshot first, before anything switches branches or refreshes the database. Use a fixed, recognizable name so the restore and the cleanup in step 12 target exactly this snapshot:
ddev snapshot --name=predependabot-$(date +%Y%m%d-%H%M%S)
Record the exact snapshot name that DDEV reports. Confirm it exists before continuing:
ddev snapshot --list
If the snapshot fails, stop. Do not proceed into ddev refresh without a
restore point.
Do not assume the base is main. Dependabot targets whatever branch the
repository configures, which on Drupal projects with a dev-to-prod flow is
routinely dev. Diffing or branching from the wrong base reports every commit
the base has that the Dependabot branch lacks as if the Dependabot branch had
introduced it, so a lock-file-only branch appears to be rewriting templates and
config.
Ask GitHub, which knows the answer exactly, and capture the PR numbers at the same time. The PR number is required for the commit messages in step 6:
git fetch --prune origin
gh pr list --state open --limit 100 \
--json number,headRefName,baseRefName,title \
--jq '.[] | select(.headRefName|startswith("dependabot/")) | "\(.number)\t\(.baseRefName)\t\(.headRefName)\t\(.title)"'
When gh is unavailable, fall back to comparing candidate bases by how many
files a branch appears to change. The correct base is the one that makes the
branch look like what it is, a lock file update:
for base in main dev master develop; do
git rev-parse --verify --quiet "origin/$base" >/dev/null || continue
echo "$(git diff --name-only origin/$base...origin/<branch> | wc -l) files $base"
done
The lowest count wins. Do not use merge-base distance for this: a base that has moved a few commits since the branch was cut can sit closer to the branch than the true base, so that heuristic picks the wrong answer on exactly the repositories where getting it right matters.
Without gh there is also no PR number. Ask the user for the numbers rather
than committing without them.
If the open PRs target more than one base branch, stop and ask. One consolidated branch cannot serve two bases.
Say in the report which base was used.
git checkout <base>
git pull --ff-only origin <base>
Then refresh the database so the validation runs against production-like data rather than whatever the local database drifted into. Refresh commands are custom, not DDEV builtins, so they exist only on projects that ship them. Check what this project defines before calling anything:
ls .ddev/commands/host .ddev/commands/web
ddev help | grep -iE 'refresh|db-refresh|db-rebuild|pull'
Use whichever the project actually defines, in this order of preference:
ddev refresh, ddev db-refresh, ddev pull <provider>. If the project
defines none of them, say so in the report and continue with the existing
database. Do not invent a refresh out of drush sql:drop and a guessed dump
path.
Install dependencies for the base so the tree matches it before any merging starts:
ddev composer install
git checkout -b dependabot/consolidated/$(date +%Y-%m-%d)
Do not set an upstream tracking reference to the base branch. The branch gets its own remote in step 10.
If a branch by that name already exists from an earlier run today, ask the user whether to reuse it, rename it, or delete it. Do not silently reset it.
Work through the branches one at a time, oldest PR number first, so that later bumps resolve against the earlier ones. Squash each branch into a single commit so the consolidated history reads as one commit per original PR:
git merge --squash origin/<branch>
git commit
Write the message in Conventional Commits style with the original PR number in a footer:
build(deps): bump vendor/package from 1.2.3 to 1.2.4
Squashed from the Dependabot branch dependabot/composer/vendor/package-1.2.4.
Refs: #<pr-number>
Use build(deps) for runtime dependencies and build(deps-dev) for dev
dependencies. Keep one commit per original PR even when two PRs touch the same
lock file.
Conflicts in composer.lock and package-lock.json are expected once the
second branch merges, because every branch was cut from the same base and each
rewrote the same file. Never hand-merge a lock file and never take one side
wholesale. Resolve by discarding the conflicted lock and letting the resolver
recompute it:
git checkout --ours composer.lock # keep the consolidated branch's lock
ddev composer update <vendor/package> --with-all-dependencies
git add composer.lock composer.json
For npm, the same shape:
git checkout --ours <theme-path>/package-lock.json
ddev exec bash -c "cd <theme-path> && npm install --package-lock-only --ignore-scripts"
git add <theme-path>/package-lock.json
composer.json and package.json conflicts are different: those are real
content, one added constraint per branch, and both sides must survive. Merge
them by hand, keeping every bumped constraint.
With every branch merged, install the consolidated result and run the database updates once, rather than after each merge:
ddev composer install
ddev drush updatedb -y
ddev drush cache:rebuild
Use the project's PHP runtime, not the host's. Drupal projects commonly require
a newer PHP than the host has installed, and resolving against the wrong
platform version silently produces a different dependency tree. Running through
DDEV (ddev composer) uses the container's PHP.
--no-install on patched projectsOn projects using cweagans/composer-patches, adding --no-install to a
composer update can leave the tree half-updated: Composer removes a patched
package so it can be re-patched, then skips the reinstall. The package directory
disappears and the site breaks. Either omit --no-install, or follow it with a
plain ddev composer install to restore the tree.
A large composer install can report success while still being partway through
its work. Confirm it landed:
ddev drush status --field=drupal-version
If it disagrees with composer.lock, run ddev composer install again.
Run these only if the consolidated branch changed composer.json or
composer.lock.
Install with no version conflicts. Confirm the lock is internally consistent
with composer.json, then prove a clean resolve:
ddev composer validate --no-check-publish
ddev composer install --dry-run
A stale content hash produces an "out of date" warning from validate. A
conflict surfaces from install as Your requirements could not be resolved to an installable set of packages. Quote the shortest decisive line of that error
in the report and name the two packages that disagree.
Then re-resolve each bumped package and confirm the resolver agrees with what Dependabot wrote:
ddev composer update <vendor/package> --with-all-dependencies
git status --short
Nothing to modify in lock file with an unchanged composer.lock means the
lock is correct. If the lock does change, Dependabot's resolution was incomplete
(usually a missed transitive dependency); commit the regenerated lock as a
separate follow-up commit referencing the same PR number.
Update the Composer manifest if the project has one. Dependabot updates
composer.lock but not files produced by Composer plugins. The recurring one is
composer-manifest.yaml from joachim-n/composer-manifest, which is tracked in
git and drifts on every single Composer PR. Check whether the project uses it,
then check the file:
grep -n 'composer-manifest' composer.json
git status --short
git diff composer-manifest.yaml
The diff should show only the bumped packages and their transitive dependencies.
If it shows unrelated packages, the local install state is out of sync: run
ddev composer install and re-check before committing.
Commit it as its own commit that explains the gap:
chore(deps): regenerate composer-manifest.yaml
Dependabot updates composer.lock but never the generated
composer-manifest.yaml. Regenerated via composer install.
Refs: #<pr-number>, #<pr-number>
Check for Drupal config drift. A Composer update can ship new or changed
default config that updatedb imports, which leaves the site's active config
ahead of what is exported in the repository:
ddev drush config:status
No differences between DB and sync directory is the clean result, meaning no
drush cex is needed; record that for the PR description in step 10. Anything
else is drift caused by this set of updates. Report it as a table of config
object and state (Only in DB, Different, Only in sync dir) and let the
user decide. Do not run config:export, and do not commit exported config to
the consolidated branch, unless the user explicitly asks for it. An update hook
that legitimately adds config is a normal outcome that still needs a human to
approve the export.
Finish by verifying an update is really installed, for example
ddev exec vendor/bin/phpcs --version after a PHP_CodeSniffer bump.
Run this only if the consolidated branch changed a package.json or
package-lock.json. Find the affected themes from the diff rather than assuming
one:
git diff --name-only origin/<base>...HEAD | grep -E 'package(-lock)?\.json$'
For each theme path, install from the lock first, then recompute. Order
matters: npm install --package-lock-only still reads the tree on disk, so
recomputing against a stale node_modules can re-resolve a subtree and invent
churn that has nothing to do with Dependabot. Reifying the lock first removes
that variable, and doubles as the installability check because npm ci verifies
every integrity hash:
ddev exec bash -c "cd <theme-path> && npm ci"
ddev exec bash -c "cd <theme-path> && npm install --package-lock-only --ignore-scripts"
git diff --stat -- <theme-path>/package-lock.json
An empty diff means the lock is correct. If there is churn, re-run both commands before concluding anything. Churn that vanishes on a second pass was an artifact of install state, not a Dependabot error, and committing it would bury a real dependency change under an unrelated rewrite.
Then prove the theme still compiles. This is the check that matters most in a consolidated branch, because two individually safe bumps can break a build together:
ddev exec bash -c "cd <theme-path> && npm run build"
Use the project's real script name (build, production, dev) from
package.json. Confirm the compiled assets actually changed on disk or that the
build wrote its output; a build that exits 0 without producing files is not a
pass. If compiled CSS or JS is tracked in git, commit the rebuilt assets as
their own commit.
If the build fails, identify which bump caused it by reverting that single commit on the consolidated branch and rebuilding. Report the culprit PR number and leave that bump out of the consolidated branch rather than shipping a broken build.
Check lockfileVersion at the top of package-lock.json before recomputing.
npm preserves whatever version it finds, so a recompute normally will not
reformat the file on its own. But if the project is mid-migration, or a
recompute has to be forced into a specific format to compare like with like, be
explicit:
npm install --package-lock-only --ignore-scripts --lockfile-version 2
A v2 lock carries a full duplicate of the tree in a legacy dependencies block
alongside the modern packages block. Dependabot's partial edits hide well in
that duplication, so on a v2 project read both blocks when auditing a diff, and
consider proposing a one-time migration to v3 as a separate change rather than
smuggling it into a dependency PR.
Node version still matters for the build even when it does not move the lock.
Prefer the container's Node so results match CI, and check whether the project's
.nvmrc agrees with the DDEV nodejs_version; a mismatch between them is worth
reporting on its own.
Two failures show up on ARM containers and are not lock defects:
Failed to set up Chromium r<build> from Puppeteer. Retry with
PUPPETEER_SKIP_DOWNLOAD=1.autoreconf: not found from imagemin binary builds, which need autotools that
the web container does not ship.When these block npm ci, fall back to
PUPPETEER_SKIP_DOWNLOAD=1 npm ci --ignore-scripts. That still validates
resolution and integrity hashes, which is the point of the check. Say so in the
report rather than presenting it as a full install, and confirm the webpack or
Vite build still runs afterward.
Show the user the full commit list and the diffstat first, under the line
=== CONSOLIDATED BRANCH READY FOR REVIEW ===, together with the validation
results from steps 8 and 9 and any bump left out. Then stop and get explicit
confirmation before pushing:
git log --oneline origin/<base>..HEAD
git diff --stat origin/<base>...HEAD
Silence is not approval, and neither is approval given before this summary existed.
Then push and open the PR:
git push -u origin dependabot/consolidated/<yyyy-mm-dd>
Use the pr-create skill so the PR body follows the project's template. Title it
[TW-{teamwork-task-number}] Consolidated Dependabot updates {yyyy-mm-dd}. A
consolidated dependency roll-up often has no Teamwork task; ask the user for the
number rather than inventing one, and drop the prefix if they say there is none.
The PR body must list every rolled-up PR by number so reviewers can trace each bump back and Dependabot's own PRs are visibly superseded, and must record the validation results:
Refs #<pr-number>config:status ran in step 8 and was clean, add the exact line "No config
changes were needed." here. Omit the line when step 8 was skipped because only
theme or other npm dependencies changed, since no config check ran.Do not merge the PR. Do not close the original Dependabot PRs.
git checkout <original-branch>
ddev composer install
Reinstall for that branch, since the consolidated branch left vendor/ and
every node_modules/ matching the updated set. Confirm Composer landed:
ddev drush status --field=drupal-version
If it disagrees with composer.lock, run ddev composer install again.
node_modules/ is not restored by the database snapshot and is not touched by
git checkout, so it silently keeps the consolidated branch's dependency tree.
The user is then developing against packages their branch never asked for, and
the next theme build produces output that does not match the lock in git. Undo
it explicitly.
Reinstall every theme whose package-lock.json the consolidated branch changed,
which is the same list step 9 built:
git diff --name-only origin/<base>...dependabot/consolidated/<yyyy-mm-dd> \
| grep -E 'package(-lock)?\.json$'
For each of those theme paths, install from the original branch's own lock:
ddev exec bash -c "cd <theme-path> && npm ci"
Use npm ci, not npm install. ci deletes node_modules first and installs
exactly what the lock pins, which is the whole point here; npm install would
reconcile against the tree left behind and can leave the newer packages in
place.
Then rebuild, so the compiled assets on disk match the restored packages:
ddev exec bash -c "cd <theme-path> && npm run build"
Carry over the same environmental fallbacks from step 9 when npm ci fails on
native builds, for example PUPPETEER_SKIP_DOWNLOAD=1 npm ci --ignore-scripts.
Finish by confirming the tree is clean. A dirty package-lock.json or a changed
compiled asset here means the restore did not land:
git status --short
Restore first, confirm second, delete third. Never delete before a confirmed restore.
ddev snapshot restore <snapshot-name>
ddev drush status --field=db-status
Once the restore succeeds, remove that one snapshot by name:
ddev snapshot --cleanup --name=<snapshot-name> -y
Pass --name. Bare ddev snapshot --cleanup -y deletes every snapshot in
.ddev/db_snapshots, including ones the user took for their own work.
If the restore fails, keep the snapshot, stop, and tell the user the snapshot name and the exact error. A failed restore with the snapshot still on disk is recoverable; a deleted snapshot is not.
Give the user a short table with one row per rolled-up PR: PR number, package, version change, and the consolidated commit SHA. Then state:
vendor/, its theme
node_modules/, and the database snapshot were all restored, and that the
snapshot was deletedCall out patterns rather than one-off facts. A generated file that Dependabot never updates affects every future PR and is worth fixing in CI, not by hand each time.
What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
dependabot, dependency-management, lock-file-validation, drupal, composer, npm
cms-cultivator@claude-toolbox is listed by kanopi/claude-toolbox — review the source before installing
npx claudepluginhub kanopi/claude-toolbox --plugin cms-cultivator30 skills in this plugin
/browser-validatorAutomatically validate implementations in real browsers after code is written or when user says "test this", "test what you built in the browser", "check it in a real browser", or "validate at the breakpoints". Uses Chrome DevTools MCP to test responsive breakpoints (320px, 768px, 1024px), check accessibility compliance (WCAG AA contrast, keyboard navigation, ARIA), validate interactions, and generate detailed technical reports with file paths and specific fixes./code-standards-checkerRun the right linting, formatting, and static-analysis commands after changing code, and check it against PHPCS, ESLint, WordPress Coding Standards, or Drupal Coding Standards. Reads the scripts blocks in composer.json and package.json to find the project's own commands, runs auto-fix before check-only and verifies after, and picks the most specific level (theme, plugin, module, or project root) covering the changed files. Invoke when the user mentions "coding standards", "code style", "linting", "lint", "PHPCS", "phpcbf", "PHPStan", "Rector", "ESLint", "stylelint", "twig-lint", asks what to run after editing PHP, Twig, JS, SCSS, or CSS, or asks whether code follows conventions./commit-message-generatorAutomatically generate conventional commit messages when user has staged changes and mentions committing. Analyzes git diff and status to create properly formatted commit messages following conventional commits specification. AI attribution comes from the tool's own trailer (Claude Code's Co-Authored-By); the skill never adds a second one. Invoke when user mentions "commit", "staged", "committing", or asks for help with commit messages./composer-patch-generatorGenerate and maintain patches for Composer-installed packages (Drupal contrib modules, WordPress packages, PHP libraries) using cweagans/composer-patches. Invoke when the user needs to modify a contrib or vendor package, mentions "composer patch", "patch a module", "patch a contrib module", "cweagans", "diff -ruN", "extra.patches", or needs a package change that applies cleanly in CI. Covers generating diff -ruN patches, handling new files, wiring composer.json, and verifying the patch applies./composer-security-updateThis skill should be used when the user asks to "run a Composer security update", "validate the security PR", "check the automated security PR", "run composer audit", "patch the security advisories", "update the vulnerable packages", "fix the CVEs in this project", "apply the Drupal core security release", or hands over a "Security Advisory:" Teamwork task or a `security/tw-*` pull request. Use it whenever a Drupal or WordPress Composer project needs its advisories resolved, even if the user only says "are we vulnerable?" or names a single CVE. It finds the PR the Kanopi security dashboard already opened, validates its branch locally (composer audit before and after, DDEV snapshot and refresh, update hooks, config drift, theme builds), and reports each advisory as cleared or blocked. Fix-ups and the PR update wait for user approval. It never creates a task, branch, or PR. Dependabot bumps belong to dependabot-branch-validation; patching contrib code belongs to composer-patch-generator./coverage-analyzerAutomatically analyze test coverage when user asks which code is tested, mentions coverage gaps, or shows code asking about testing. Identifies untested code paths and suggests test additions. Invoke when user asks "what's not tested?", "coverage", "untested code", or "which tests are missing?".Other plugins' skills for the same job