ai_generation
Generate Drupal modules, themes, configuration (content types, views, vocabularies, webforms, etc.) and recipes using AI. ⚠️ Development-only, do not use in production.
Features
- AI-assisted scaffolding for modules and themes (from minimal starters to complex custom implementations).
- Generates configuration: content types, fields, displays, views, vocabularies, webforms, Search API/Solr, permissions, roles, and other config entities.
- Generates recipes (drupal-recipe packages) that bundle configuration, module installs, and optional actions.
- Writes Drupal-ready files so you can enable modules, import config with
drush cim, or apply recipes. - Includes a Drush command to run prompts from the CLI (
drush aigen).
Note: This module is experimental, intended for local development only. Review all generated code before enabling or importing, especially configuration files.
Post-Installation
- Configure the AI module first:
- Install and enable the AI module.
- Create an API Key using the Key module.
- Configure your authentication with your AI provider module (e.g., OpenAI).
- Select your preferred model in the "Chat" feature in AI Settings. Note: Results depend on the chosen model — more powerful models generally produce more accurate code.
- Once the AI provider is configured, go to Configuration → AI → AI Generation (
/admin/config/ai/ai-generation). - Enter a prompt (e.g., “Create a content type called Event with a date field”).
- The module calls your configured AI provider and generates files.
- Configuration is written to your
config/syncdirectory → import withdrush cim. - Modules and themes are written under
modules/customorthemes/custom. - Recipes are written under
recipes/{package}. - Alternatively, use
drush aigen "{prompt}"from the CLI. - ⚠️ AI makes mistakes: always review the generated code before enabling or importing.
Additional Requirements
- Drupal Core 10 or 11
- drupal/ai (AI provider integration)
- drupal/key (store API keys)
- An AI provider account (e.g., OpenAI)
Recommended modules/libraries
- Drush – recommended for CLI usage.
Similar projects
Related modules include:
- AI module – provides the base API and connection to AI providers.
- AI Agents – allows building agents that interact with AI.
What makes AI Generation different?
While AI and AI Agents focus on providing an API and orchestration layer for prompts and agents,
AI Generation not only asks the AI what code or configuration should look like, but also creates the actual files on disk with a simple prompt, ready to be enabled, imported, or applied in your Drupal site.
Supporting this Module
This project is experimental and intended only for local development. Do not use on production sites.
Contributions are welcome! Please open issues, provide feedback, or contribute code/tests.
Community Documentation
- AI module project page
- Demo videos and walkthroughs will be added as the project matures.
Warning: This module is experimental and should never be used on production environments. It is designed exclusively for development and prototyping.