Index of every page on this site: llms.txt
All skills
grasmash avatar

/drupal-contrib-mgmt

@19514f4
Run it yourself

Manages Drupal contributed modules via Composer - module updates and major-version upgrades, cweagans/composer-patches v2 (patches.lock.json, composer patches-relock, verifying patches are applied), mglaman/composer-drupal-lenient, Drupal 11 compatibility checks with upgrade_status, committing an optimized vendor/ autoloader, and contributing fixes back to drupal.org via issue forks and merge requests. Use when updating or upgrading contrib modules, applying, finding or creating patches, a patch fails or keeps regressing after composer install, resolving Composer dependency or drupal/core version conflicts, checking Drupal 11 readiness or deprecations, or contributing to a drupal.org issue queue.

Use this Skill: https://skilld.dev/gh/grasmash/drupal-claude-skills/drupal-contrib-mgmt

Nothing lands on disk. Nothing to clean up.

Fork this Skill

Edit a local copy. It keeps the author and licence.

referencesfinding-and-creating-patches.md

≈1.3k tokens on demand. Your agent reads this file only when SKILL.md points to it.

Finding and Creating Patches

Search the issue queue for an existing patch before creating one; when none exists, create it from a clean clone.

Debugging Errors: Find Patches BEFORE Creating

CRITICAL WORKFLOW: When encountering Drupal errors, ALWAYS search for existing patches before creating your own.

Step 1: Extract the Exact Error Signature

From the error message, extract the exact error string:

# Example error:
TypeError: Unsupported operand types: array + null in Drupal\field_ui\Form\EntityViewDisplayEditForm

# Extract this part:
"Unsupported operand types: array + null"

Step 2: Search Drupal.org Issue Queue FIRST

# Method 1: Direct URL search (BEST)
https://www.drupal.org/project/drupal/issues?text=Unsupported+operand+types+array+null

# Method 2: Search with file + line number
https://www.drupal.org/project/drupal/issues?text=EntityViewDisplayEditForm+line+166

What to look for in search results:

  • Issues with status: "Needs review" or "Reviewed & tested by the community" (RTBC)
  • Recent activity (check dates)
  • Patch files in comments (look for .patch attachments)
  • Merge requests (look for !13611 references)

Step 3: Use WebFetch to Get Patch Details

# Once you find the issue, fetch details:
WebFetch(https://www.drupal.org/project/drupal/issues/3552531)

Look for:

  • Patch file URLs: Usually https://www.drupal.org/files/issues/YYYY-MM-DD/filename.patch
  • Merge request numbers: E.g., !13611 → https://git.drupalcode.org/project/drupal/-/merge_requests/13611
  • Issue status: RTBC means ready to use

Step 4: Download and Apply Official Patch

# Download to patches directory
curl -O https://www.drupal.org/files/issues/2025-10-16/field-ui--unsupported-operand-types--3552531-2.patch
mv field-ui--unsupported-operand-types--3552531-2.patch patches/

# Add to composer.json with descriptive name referencing issue
{
  "extra": {
    "patches": {
      "drupal/core": {
        "Fix TypeError: Unsupported operand types array + null in EntityViewDisplayEditForm - Issue #3552531": "patches/field-ui--unsupported-operand-types--3552531-2.patch"
      }
    }
  }
}

# Record it in patches.lock.json, then re-install core so the patch applies
composer patches-relock
composer reinstall drupal/core

Common Search Patterns

Error Type Search Term
TypeError Exact error message in quotes
Deprecated function Function name (e.g., user_roles)
Missing method Class name + method name
Fatal error Exact error text

Why This Matters

  • Saves time: Don't recreate existing solutions
  • Better quality: Community-reviewed patches are more robust
  • Upstream integration: Using official patches means easier upgrades
  • Documentation: Issue threads contain context and discussion

Anti-Pattern Example

❌ What NOT to do:

  1. See error
  2. Read code
  3. Create patch
  4. Apply patch
  5. (Someone points out existing issue)

✅ What TO do:

  1. See error
  2. Extract exact error message
  3. Search drupal.org issue queue
  4. Find existing patch
  5. Apply official patch

Creating Local Patches

IMPORTANT: Always create patches from a separate clone of the contrib module repo, not from the installed version in your project.

# Step 1: Clone the module repo to a separate directory OUTSIDE the project (one-time setup)
cd <workspace-dir>    # e.g. the directory that contains <project-root>
git clone git@git.drupal.org:project/module_name.git module_name-contrib

# Step 2: Checkout the exact version you have installed
cd <workspace-dir>/module_name-contrib
git checkout 1.0.3  # Match your installed version

# Step 3: Make your changes in the contrib repo
# Edit files as needed...

# Step 4: Generate the patch using git diff
git diff > <project-root>/patches/module_name-custom-fix.patch

# Step 5: Add to composer.json
{
  "extra": {
    "patches": {
      "drupal/module_name": {
        "Custom fix description": "patches/module_name-custom-fix.patch"
      }
    }
  }
}

# Step 6: Add the patch to patches.lock.json (composer-patches v2)
cd <project-root>
composer patches-relock
# v2 applies patches from patches.lock.json, NOT from composer.json, on
# install/reinstall — skip this and the patch is silently dropped on every
# clean install (CI, teammates, deploys).

# Step 7: Apply via composer
composer reinstall drupal/module_name

# Step 8: Commit composer.json, patches.lock.json and the .patch file
git add composer.json patches.lock.json patches/module_name-custom-fix.patch

Why use a separate repo?

  • Creates clean patches without local modifications bleeding in
  • Matches the exact file structure composer expects
  • Allows proper version tracking with git tags
  • Enables contributing patches upstream to drupal.org

Patch format: Patches should use git diff format (includes a/ and b/ prefixes):

diff --git a/src/File.php b/src/File.php
index abc123..def456 100644
--- a/src/File.php
+++ b/src/File.php

Source: SKILL.md on GitHub

skilld matched fixed text patterns in SKILL.md and file names. Patterns miss obfuscated code.

skilld run checks every file with the same patterns. It asks for approval before it loads a Skill with a behavior marked Needs approval.

3 warnings1mo5 checks · Risk SAFE
  • Gen Agent Trust Hub1mo

    The skill is a comprehensive guide for managing Drupal contributed modules, focusing on updates, patches, and Drupal 11 compatibility. It provides instructions for using standard tools like Composer, Drush, and Git, and directs the agent to fetch data and patches from official Drupal repositories. While these sources are legitimate and trusted within the Drupal ecosystem, the ingestion of user-contributed content from issue queues presents a minor surface for indirect prompt injection.

  • Socket1mo

    1 alert: gptAnomaly

  • Snyk1mo

    Risk: MEDIUM · 1 issue

  • Runlayer8mo

    5/8 files flagged

  • ZeroLeaks7mo

    Score: 93/100 · 2 sections analyzed

Signed by skilld at 19514f4. This ties the file your Agent reads to that commit on GitHub. It does not review the instructions.

Last checked against GitHub 2 months ago.

Steadyupdated 2 months ago

README badge

README badge for grasmash/drupal-claude-skills/drupal-contrib-mgmt