validate-patch

Validate Drupal patches with PHPCS, PHPStan, and PHPUnit in DDEV.

Updated Feb 28, 2026
One-click install
npx skills add https://github.com/cosmicdreams/claude-plugins --skill validate-patch
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: validate-patch
Source: https://github.com/cosmicdreams/claude-plugins/tree/main/drupal-lab/skills/validate-patch
Command: npx skills add https://github.com/cosmicdreams/claude-plugins --skill validate-patch

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This Skill helps you determine whether a Drupal patch or merge request is ready to submit by running all relevant quality gates in the same DDEV-based environment used for the project.

Core Features & Use Cases

  • Pre-test design review: Flags brittle or risky test patterns (inheritance issues, assertions that break under normal Drupal behavior) before any containers spin up.
  • Automated quality gate execution: Runs PHPCS, PHPStan, and PHPUnit/coverage checks via DDEV to ensure consistent results.
  • Environment-safe execution: Resolves the project root from ~/.claude/drupal-lab.json, runs inside DDEV containers, and uses a DB snapshot for fast rollback/retries.
  • Use case: Validate a patch right before opening/merging an MR (for example: “check this MR is passing coding standards, static analysis, and the relevant test suites”). Use drupal-lab:analyze-issue for browsing issues or analyzing issue context.

Quick Start

Ask: validate this Drupal patch in the worktree at worktrees/<issue_number> and run the full set of quality gates (PHPCS, PHPStan, PHPUnit, and coverage).

Frequently Asked Questions about validate-patch

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I validate a Drupal patch before submitting a merge request?

To validate a Drupal patch before submitting, run coding standards, static analysis, and test coverage quality gates inside a DDEV-backed project worktree to ensure all checks pass. This process resolves the project root, executes phpcs, phpstan, and phpunit, and reports pass/fail results with actionable failure details.

What quality gates should I run to check if my Drupal code is ready for review?

Drupal code review quality gates include PHPCS for coding standards, PHPStan for static analysis, and PHPUnit for tests and coverage. Running these checks in a DDEV environment ensures consistent results by mirroring the project's actual configuration before opening a merge request.

Does patch validation work with DDEV containers for Drupal development?

Yes, patch validation works with DDEV containers by executing phpcs, phpstan, and phpunit directly inside the DDEV environment. It resolves the project root from a configuration file and uses a database snapshot before running tests for fast rollback and retries.

How do I prevent brittle tests from failing during Drupal patch validation?

To prevent brittle tests during Drupal patch validation, perform a pre-test design review that flags risky test patterns and inheritance issues before containers spin up. This review identifies assertions that break under normal Drupal behavior prior to executing the test suite.

Can I target specific files for static analysis and coding standards checks in a Drupal worktree?

Yes, you can target specific files for static analysis and coding standards checks in a Drupal worktree using optional targeted file validation. This allows you to run phpcs and phpstan on individual changed files rather than the entire project codebase.

Why does my Drupal patch fail PHPUnit tests after applying changes?

Drupal patch validation fails PHPUnit tests by design when code changes introduce regressions, reporting actionable failure details for each broken assertion. The validation process snapshots the database before tests to allow fast rollback and retries without manual environment resets.