drupal-theming

Create Drupal front-end output with render arrays, Twig templates, and the Libraries API.

1|Updated Mar 11, 2026
One-click install
npx skills add https://github.com/proofoftom/drupal-skills --skill drupal-theming-proofoftom
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: drupal-theming
Source: https://github.com/proofoftom/drupal-skills/tree/main/skills/drupal-theming
Command: npx skills add https://github.com/proofoftom/drupal-skills --skill drupal-theming-proofoftom

SYSTEM DOCUMENTATION & REQUIREMENTS

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

What problem does it solve?

This Skill streamlines the process of creating visually appealing and functional user interfaces within Drupal, ensuring your module's output integrates seamlessly with the Drupal theme layer.

Core Features & Use Cases

  • Render Array Generation: Build dynamic HTML structures using Drupal's render array system.
  • Twig Templating: Create custom, reusable templates for complex markup.
  • Asset Management: Attach CSS and JavaScript libraries efficiently.
  • Use Case: Develop a custom block that displays a list of recent articles, complete with custom styling and interactive elements, all managed through Drupal's theming APIs.

Quick Start

Use the drupal-theming skill to create a custom block plugin that displays a list of recent articles with custom styling.

Frequently Asked Questions about drupal-theming

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

FAQPage Schema
How do I create custom Twig templates for a Drupal module?

To create custom Twig templates for a Drupal module, you define hook_theme() implementations and preprocess functions to pass dynamic data. This approach lets you build reusable, themed markup that integrates seamlessly with the Drupal theme layer.

How do I attach CSS and JavaScript libraries to a Drupal render array?

You attach CSS and JavaScript libraries to a Drupal render array using the Libraries API. By defining your assets in a libraries.yml file and referencing them in your render array, you ensure assets load efficiently when the element renders.

What is the best way to build dynamic HTML structures in Drupal 10 and 11?

Building dynamic HTML structures in Drupal 10 and 11 is best done using the render array system. Render arrays provide a structured, cacheable way to define page output before it converts into Twig-rendered HTML markup.

Does this Drupal theming approach work with Drupal 11 compatibility?

Yes, this theming approach supports Drupal 11 compatibility. It leverages core API elements like render arrays, Twig templates, and the Libraries API to ensure your front-end output remains compatible with modern Drupal versions.

Why use preprocess functions instead of putting logic directly in Twig templates?

Preprocess functions prepare and sanitize variables before they reach Twig templates. Keeping logic out of Twig templates ensures cleaner separation of concerns and maintains the security and structural integrity of your Drupal theme layer.