drupal-render

Build secure, cache-aware render arrays in Drupal 11.

67|13|Updated Apr 15, 2026
One-click install
npx skills add https://github.com/edutrul/drupal-ai --skill drupal-render
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: drupal-render
Source: https://github.com/edutrul/drupal-ai/tree/main/.claude/skills/drupal-render
Command: npx skills add https://github.com/edutrul/drupal-ai --skill drupal-render

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Builds secure, cache-aware render arrays and safe markup in Drupal 11 controllers, blocks, and services.

Core Features & Use Cases

  • Structure and render arrays: define #type, #markup, #cache, and #attributes to compose complex UIs.
  • Cache and performance: apply tags, contexts, and max-age correctly to ensure predictable invalidation.
  • Markup safety and render elements: use Markup::create, #plain_text, and render elements like html_tag, link, and inline_template to render safely.
  • Use cases include rendering nodes in teasers, building dynamic blocks, and server-side rendering with lazy builders.

Quick Start

Create a render array with proper cache metadata and render it via the RendererInterface.

Frequently Asked Questions about drupal-render

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

FAQPage Schema
How do I build secure Drupal render arrays with proper cache metadata?▼

Secure Drupal render arrays use #type, #markup, and #cache properties to compose UIs while applying cache tags, contexts, and max-age for predictable invalidation and markup safety.

What is the best way to render safe markup in Drupal 11 controllers and blocks?▼

The best way to render safe markup in Drupal is using Markup::create, #plain_text, and render elements like html_tag, link, and inline_template instead of raw HTML strings.

How do cache tags and contexts work in Drupal render arrays?▼

Cache tags and contexts in Drupal render arrays define dependencies and variation criteria, ensuring cached content invalidates predictably when underlying data changes across different user contexts.

Can I use lazy builders for server-side rendering in Drupal blocks?▼

Yes, you can use lazy builders in Drupal blocks for server-side rendering, allowing dynamic content generation within render arrays while maintaining proper cache metadata and markup safety.

Why is my Drupal render array missing cache metadata?▼

Drupal render arrays missing cache metadata lack #cache definitions for tags, contexts, and max-age, causing unpredictable invalidation and potential security issues with improperly escaped markup.

When do I need to specify render context in Drupal services?▼

You need to specify render context in Drupal services when generating markup outside controllers, ensuring collected cache metadata is correctly applied to prevent rendering errors and security vulnerabilities.