drupal-form-api

Automate Drupal form development with FormBase/ConfigFormBase patterns and Drush scaffolding.

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

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Drupal form development in Drupal modules often requires boilerplate, repetitive setup for FormBase/ConfigFormBase, and routing scaffolding, making it time-consuming to implement admin and user-facing forms.

Core Features & Use Cases

  • Patterns for FormBase and ConfigFormBase to build admin settings and content forms
  • Form element definitions, validation, submission handling, and DI via create()
  • Drush-generated scaffolding for routes and quick form prototyping across modules

Quick Start

Run a Drush-generated form scaffold to begin a new Drupal form in your module.

Frequently Asked Questions about drupal-form-api

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

FAQPage Schema
How do I build a Drupal form using FormBase and ConfigFormBase?

Build Drupal forms by extending FormBase or ConfigFormBase, defining form elements, implementing validation and submission handlers, and injecting services via the create() method.

What's the best way to scaffold a Drupal form route with Drush?

Use Drush-generated scaffolding to quickly prototype Drupal forms, automatically generating the required routing configurations and reducing manual boilerplate setup across modules.

How does dependency injection work in Drupal form API classes?

Dependency injection in Drupal form classes uses the create() method to access services, passing them through the constructor to keep FormBase and ConfigFormBase implementations testable and decoupled.

When do I need ConfigFormBase instead of FormBase for a Drupal module?

Use ConfigFormBase when building admin settings forms that store persistent configuration, and use FormBase for general user-facing content forms or transient data submissions.

Does this Drupal form API approach support custom validation and submit handlers?

Yes, the Drupal form API approach supports custom validation and submission handlers, allowing you to process form input, execute business logic, and manage state within your module.

Why does my Drupal form implementation require so much boilerplate code?

Drupal form implementations require boilerplate for FormBase setup, routing scaffolding, and DI patterns, which this approach automates to streamline admin and user-facing form development.