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.

referencescontributing-upstream.md

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

Developing and Contributing Contrib Modules

Local development of a contrib module and the drupal.org issue-fork workflow for contributing fixes upstream.

Developing Contrib Modules Locally

When actively developing a contrib module for drupal.org, use this workflow to avoid constantly updating via composer:

Symlink Development Workflow

# 1. Set up module repository in temp location
cd /tmp
git clone git@git.drupal.org:project/module_name.git
cd module_name
# Make your changes...

# 2. Remove composer-installed version and symlink your dev copy
cd /path/to/project
rm -rf docroot/modules/contrib/module_name
ln -s /tmp/module_name docroot/modules/contrib/module_name

# 3. Develop and test
# Make changes in /tmp/module_name
# Test immediately in your Drupal site
drush cr  # Clear cache as needed

# 4. When ready to publish
cd /tmp/module_name
git add -A
git commit -m "Your changes"
git push origin 1.0.x

# 5. Clean up: remove symlink and reinstall from composer
cd /path/to/project
rm docroot/modules/contrib/module_name
composer install  # Reinstalls from drupal.org

Benefits:

  • Test changes immediately without composer update cycles
  • Keep git history in the module's own repo
  • Easy to commit and push changes
  • No risk of accidentally committing module code to main project

Important Notes:

  • Don't forget to remove the symlink before committing project changes
  • Clear Drupal cache after changes: drush cr
  • When done developing, always reinstall via composer to ensure clean state
  • Useful for fixing autoloader issues, adding features, or troubleshooting

Example: Fixing an autoloader issue in example_module

# Module needed composer.json autoload section
cd /tmp/example_module
# Edit composer.json to add autoload section
git commit -m "Add PSR-4 autoload configuration"
git push origin 1.0.x

# Back in main project
rm docroot/modules/contrib/example_module
composer install  # Gets latest with fix
drush cr

Contributing Back to drupal.org

When you've developed a fix or feature that should be contributed upstream, use the issue fork workflow.

Step 1: Create Issue on drupal.org

  1. Go to https://www.drupal.org/project/issues/MODULE_NAME
  2. Click "Create a new issue"
  3. Fill in:
    • Title: Descriptive title of the feature/fix
    • Category: Bug report, Feature request, or Task
    • Priority: Normal (unless exceptional)
  4. Note the issue number (e.g., 3569725)

Issue Description Format

Use the standard drupal.org template with HTML formatting:

<h3 id="overview">Overview</h3>

<p>Problem description here.</p>
<ul>
<li>Bullet point one</li>
<li>Bullet point two</li>
</ul>

<h3 id="proposed-resolution">Proposed resolution</h3>

<p><strong>Behavior:</strong></p>
<ul>
<li>Feature behavior one</li>
<li>Feature behavior two</li>
</ul>

<p><strong>Technical implementation:</strong></p>
<ul>
<li><code>SomeClass</code> - description</li>
<li><code>some_function()</code> - description</li>
</ul>

<p><strong>Files changed:</strong></p>
<ul>
<li><code>path/to/file.php</code> - Description of changes</li>
</ul>

<h3 id="ui-changes">User interface changes</h3>

<p>Description of UI changes (or "None" if no UI changes).</p>

<h3 id="steps-to-test">Steps to test</h3>

<ol>
<li>First step</li>
<li>Second step</li>
<li>Expected result</li>
</ol>

Formatting reference: https://www.drupal.org/filter/tips

  • <code>...</code> for inline code
  • <strong>...</strong> for bold
  • <ul><li>...</li></ul> for unordered lists
  • <ol><li>...</li></ol> for ordered lists
  • <h3 id="section-name">...</h3> for section headers
  • <p>...</p> for paragraphs

Step 2: Create Issue Fork on drupal.org

  1. On the issue page, click "Create issue fork"
  2. Copy the Git commands provided

Step 3: Clone Module and Set Up Fork

# Clone the module repo (if not already cloned), outside the project
cd <workspace-dir>
git clone git@git.drupal.org:project/module_name.git module_name-contrib
cd module_name-contrib

# Add the issue fork as a remote (replace XXXXXXX with issue number)
git remote add module_name-XXXXXXX git@git.drupal.org:issue/module_name-XXXXXXX.git
git fetch module_name-XXXXXXX

# Checkout the issue branch
git checkout -b 'XXXXXXX-short-description' --track module_name-XXXXXXX/'XXXXXXX-short-description'

Step 4: Make Changes and Test

# Make your changes
# For PHP modules, ensure code follows Drupal coding standards
# For modules with JS/UI, run linting and build

# Test your changes locally

Step 5: Commit and Push

# Stage changed files
git add path/to/changed/files

# Commit with proper message format
git commit -m "$(cat <<'EOF'
Issue #XXXXXXX: Short description

- Bullet point of change 1
- Bullet point of change 2
- Bullet point of change 3
EOF
)"

# Push to issue fork
git push module_name-XXXXXXX XXXXXXX-short-description

Step 6: Create Merge Request

After pushing, you'll see a URL in the output:

remote: To create a merge request for XXXXXXX-short-description, visit:
remote:   https://git.drupalcode.org/issue/module_name-XXXXXXX/-/merge_requests/new?merge_request%5Bsource_branch%5D=XXXXXXX-short-description
  1. Visit that URL to create the merge request
  2. Return to the issue page on drupal.org
  3. Set issue status to "Needs review"

Commit Message Format

Drupal.org standard format:

Issue #XXXXXXX: Short description (50 chars max)

- Detail about what changed
- Another detail
- Technical implementation note

Two-Repository Workflow

When contributing to a module you also use in your project:

  1. Contrib Repo (<workspace-dir>/module-contrib/) - Clean checkout for developing and contributing
  2. App Repo (<project-root>/) - Uses composer patches to apply changes

Benefits:

  • Clean separation between contribution work and app usage
  • Patches can be applied/removed easily via Composer
  • App stays functional while iterating on the feature

Workflow:

# 1. Develop in contrib repo
cd <workspace-dir>/module-contrib
# Make changes...

# 2. Generate patch
git diff > feature-name.patch

# 3. Copy to app and apply via composer
cp feature-name.patch <project-root>/patches/
# Add to composer.json patches section
cd <project-root>
composer patches-relock   # composer-patches v2 applies from patches.lock.json
composer reinstall drupal/module_name

# 4. Test in app, iterate as needed

# 5. When ready, commit and push from contrib repo
cd <workspace-dir>/module-contrib
git add -A && git commit -m "Issue #XXXXXXX: Description"
git push fork-remote branch-name

Using Remote Patches (After MR Created)

Once a merge request exists, you can use the remote diff URL:

{
  "extra": {
    "patches": {
      "drupal/module_name": {
        "Feature (https://www.drupal.org/project/module_name/issues/XXXXXXX)": "https://git.drupalcode.org/project/module_name/-/merge_requests/XXX.diff"
      }
    }
  }
}

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