drupal-blocks

Design portable Drupal block types and plugins with consistent naming and configuration.

34|12|Updated Mar 10, 2019
One-click install
npx skills add https://github.com/theodorosploumis/drupal-best-practices --skill drupal-blocks
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: drupal-blocks
Source: https://github.com/theodorosploumis/drupal-best-practices/tree/main/ai/skills/blocks
Command: npx skills add https://github.com/theodorosploumis/drupal-best-practices --skill drupal-blocks

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes scripts (resource) and references (resource) components.

What problem does it solve?

This Skill helps design reusable Drupal block types and plugins that are portable, reusable, and consistently named across environments.

Core Features & Use Cases

  • Propose machine names and admin labels that omit regions and block_ prefixes.
  • Outline block fields mirroring node/paragraph standards when needed.
  • Suggest view mode reuse and caching considerations for each block display.

Quick Start

Outline a reusable testimonial block type with a concise machine name, fields, recommended view modes, and caching notes.

Frequently Asked Questions about drupal-blocks

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

FAQPage Schema
How do I design reusable Drupal blocks that work across different environments?

Reusable Drupal blocks require region-agnostic machine names, code-based storage, and explicit caching guidance. Design blocks with portable naming conventions that omit region and block_ prefixes, mirror field structures to node/paragraph standards, and document view modes and caching expectations to ensure consistency across environments.

What's the best way to name Drupal block types and plugins for portability?

Use concise, region-independent machine names and admin labels that avoid prefixes tied to deployment context. Omit region and block_ designations in naming to ensure blocks remain portable when moved between sites or environments without requiring reconfiguration.

How should I structure fields and view modes in a custom Drupal block?

Structure block fields to mirror node and paragraph field patterns, maintaining consistency across content types. Define explicit view modes for each block display variant and document which view modes apply to specific contexts, enabling reuse across different page layouts.

What caching strategy should I apply to Drupal blocks?

Define explicit caching expectations for each block type, documenting cache invalidation triggers and lifetimes. Avoid UUID-bound content and region-specific dependencies to ensure caching logic remains valid when blocks are reused or deployed to new environments.

Can I store Drupal blocks in code rather than the database?

Yes. Code-based block storage ensures portability and version control. Store block type definitions, configurations, and plugin code in your codebase to maintain consistency across environments and enable reliable deployment without database synchronization.

Why should Drupal blocks avoid UUID dependencies?

UUID-bound content ties blocks to specific entities or references, breaking reusability when blocks move between sites or environments. Design blocks with content-agnostic references and configuration to remain functional across contexts without external entity dependencies.