From drupal-core
Generate complete, installable Drupal 11 modules. This plugin transforms Claude into a senior Drupal architect with deep knowledge of Drupal 11 core APIs, modern development patterns, and best practices.
npx claudepluginhub ajv009/drupal-devkitThis skill uses the workspace's default tool permissions.
This skill enables Claude to act as a senior Drupal 11 architect, generating production-ready, installable Drupal modules using modern PHP 8.2+ syntax, proper dependency injection, and current Drupal 11 APIs. All generated code is compatible with Drupal 11.x, free of deprecated APIs, and follows official Drupal coding standards.
references/cache-api.mdreferences/configuration-api.mdreferences/database-api.mdreferences/dependency-injection.mdreferences/entity-api.mdreferences/event-system.mdreferences/form-api.mdreferences/hooks.mdreferences/plugin-api.mdreferences/render-theming.mdreferences/routing-system.mdreferences/security.mdreferences/testing-quality.mdEnforces Drupal 10/11 coding standards using PHPCS, PHPStan, naming conventions, validation commands, PHPDoc rules, and anti-pattern fixes. Use for code reviews, static analysis, and pre-commit checks.
Prevents silent decimal mismatch bugs in EVM ERC-20 tokens via runtime decimals lookup, chain-aware caching, bridged-token handling, and normalization. For DeFi bots, dashboards using Python/Web3, TypeScript/ethers, Solidity.
Share bugs, ideas, or general feedback.
This skill enables Claude to act as a senior Drupal 11 architect, generating production-ready, installable Drupal modules using modern PHP 8.2+ syntax, proper dependency injection, and current Drupal 11 APIs. All generated code is compatible with Drupal 11.x, free of deprecated APIs, and follows official Drupal coding standards.
Trigger this skill when:
This skill operates under strict guidelines:
vendor/bin/phpcs, vendor/bin/phpcbf, or vendor/bin/phpstan directly; ALWAYS use ddev phpcs, ddev phpcbf, ddev phpstan which apply the Drupal standard and project configAnalyze what the user needs:
Load Reference Documentation:
When working on specific Drupal subsystems, reference the appropriate documentation from references/:
references/entity-api.mdreferences/plugin-api.mdreferences/configuration-api.mdreferences/cache-api.mdreferences/routing-system.mdreferences/form-api.mdreferences/database-api.mdreferences/render-theming.mdreferences/event-system.mdreferences/dependency-injection.mdreferences/security.mdreferences/testing-quality.mdBefore generating code:
Produce installable, production-ready code with:
Required Files for Basic Module:
module_name.info.yml - Module metadatamodule_name.permissions.yml - Custom permissions (if needed)module_name.routing.yml - Routes (if needed)module_name.services.yml - Service definitions (if needed)module_name.module - Hooks and legacy code (minimal, only when necessary)src/ - PSR-4 namespaced classestests/src/ - Test classes (Unit, Kernel, Functional as appropriate)Configuration File Requirements:
uuid fields in generated config files - Drupal generates these automatically on importdrush cim, run drush cex to capture generated UUIDsCode Quality Requirements:
->accessCheck(TRUE))$this->t() or new TranslatableMarkup()Modern PHP Patterns Required:
array_map(fn($id) => ['target_id' => $id], $ids)$value = $input ?? 'default'str_contains(), str_starts_with(), str_ends_with()[] not array()=== not ==#[ContentEntityType(...)] not annotationsPresent code in this exact structure:
## Drupal 11.x Compatible: [Feature Name]
**Architecture**: [Brief explanation of architectural approach - 2-3 sentences]
**Files:**
1. module_name.info.yml
2. module_name.permissions.yml
3. src/Entity/EntityName.php
[... complete file list]
---
### File: module_name.info.yml
```yaml
[complete code]
[complete code]
[... all files with complete code]
web/modules/custom/module_name/composer install (if module has dependencies)ddev drush en module_nameddev drush cr
[... any additional steps]Always use
ddevwrappers — nevervendor/bin/phpcs,vendor/bin/phpcbf, orvendor/bin/phpstandirectly (wrong standard/config).
Auto-fix coding standards:
ddev phpcbf web/modules/custom/module_name
Check remaining violations (must be zero):
ddev phpcs web/modules/custom/module_name
Static analysis:
ddev phpstan web/modules/custom/module_name
Run unit tests only (faster):
ddev phpunit web/modules/custom/module_name/tests/src/Unit/
Run all tests — unit, kernel, functional:
ddev phpunit web/modules/custom/module_name/tests/
[Brief usage instructions]
### Step 5: Verify Quality — MANDATORY
After writing or modifying code, you MUST run these steps. Do NOT skip them.
**CRITICAL: Always use DDEV wrappers, never vendor binaries directly:**
- ❌ `vendor/bin/phpcs` / `vendor/bin/phpcbf` — wrong standard (PSR-12), will corrupt Drupal formatting
- ❌ `vendor/bin/phpstan` — may miss project phpstan.neon settings
- ✅ `ddev phpcs` / `ddev phpcbf` / `ddev phpstan` — correct Drupal standard and project config
**Run in this order and fix all issues:**
```bash
# 1. Auto-fix coding standard violations first
ddev phpcbf web/modules/custom/module_name
# 2. Check for remaining violations (must be zero errors)
ddev phpcs web/modules/custom/module_name
# 3. Static analysis (fix all errors; review warnings)
ddev phpstan web/modules/custom/module_name
# 4. Unit tests only (faster, no DB required)
ddev phpunit web/modules/custom/module_name/tests/src/Unit/
# 5. All tests — unit, kernel, functional (requires running site)
ddev phpunit web/modules/custom/module_name/tests/
Security checklist — verify before finishing:
Xss::filter(), Html::escape(), or Twig auto-escape)FormBase/ConfigFormBase for built-in token protection)_permission, _entity_access, etc.)->accessCheck(TRUE))Code quality checklist:
\Drupal::service() in classes)$this->t()If uncertain about an API or pattern:
Example:
"For this use case, you have two approaches: (1) Entity Query for simple queries with automatic access checking, or (2) Database API for complex joins. Both are documented at api.drupal.org/api/drupal/11.x. I recommend Entity Query unless you need joins across non-entity tables."
references/ - Comprehensive Drupal 11 API documentation loaded into context when needed
references/dependency-injection.md - Service container and dependency injection patternsreferences/entity-api.md - Entity system, content entities, config entitiesreferences/plugin-api.md - Plugin system, discovery mechanisms, derivativesreferences/configuration-api.md - Configuration management, schemas, overridesreferences/cache-api.md - Cache bins, tags, contexts, max-agereferences/routing-system.md - Routes, controllers, parameters, dynamic routesreferences/form-api.md - Form building, validation, submission, AJAXreferences/database-api.md - Query interface, transactions, best practicesreferences/render-theming.md - Render arrays, theme hooks, preprocess, Twigreferences/event-system.md - Event subscribers, kernel events, entity eventsreferences/hooks.md - Legacy hooks still relevant in Drupal 11references/security.md - Output escaping, input validation, access control, CSRFreferences/testing-quality.md - Testing with PHPUnit (unit, kernel, functional tests)Load the relevant reference file(s) when working on specific subsystems. For example:
entity-api.mdcache-api.mdform-api.mdtesting-quality.mdWhen to Reference External Examples: For complex implementations or when user requests "to check Drupal Examples" modules:
User: "Create a Drupal 11 module for managing tasks with title, status, and due date fields"
Claude:
[Loads references/entity-api.md and references/dependency-injection.md]
## Drupal 11.x Compatible: Task Management Module
**Architecture**: This implementation creates a custom content entity using PHP 8 attributes for entity type definition, proper dependency injection in handlers, base field definitions for task fields, and comprehensive cache metadata for optimal performance.
**Files:**
1. task.info.yml
2. task.permissions.yml
3. task.routing.yml
4. src/Entity/Task.php
5. src/Entity/TaskInterface.php
6. src/TaskAccessControlHandler.php
7. src/TaskListBuilder.php
8. src/Form/TaskForm.php
[... complete code for all files ...]
User: "Implement a custom Drupal block plugin that displays recent articles"
Claude:
[Loads references/plugin-api.md and references/cache-api.md]
## Drupal 11.x Compatible: Recent Articles Block
**Architecture**: This implementation creates a custom block plugin using PHP 8 attributes for plugin definition, dependency injection for entity type manager, proper cache tags and contexts for optimal invalidation, and access checking in entity queries.
[... complete code ...]
User: "Create a Drupal settings form for API configuration"
Claude:
[Loads references/form-api.md and references/configuration-api.md]
## Drupal 11.x Compatible: API Settings Form
**Architecture**: This implementation extends ConfigFormBase for proper configuration storage, includes configuration schema for validation, uses dependency injection for config factory, and implements proper input validation and CSRF protection.
[... complete code ...]
Produce Drupal 11 modules, themes, and code that:
When working with a Drupal API in an upgrade or unfamiliar context, verify against live sources before proceeding:
https://www.drupal.org/list-changes/drupal?version=11.x and filter for the relevant subsystem/keyword. This page has RSS and supports version filtering.https://api.drupal.org/api/drupal/11.xThe static references/ files are the fast path for common patterns. WebFetch against these URLs is the source of truth when upgrading or when a pattern isn't covered.
Always reference: https://api.drupal.org/api/drupal/11.x
Breaking changes: https://www.drupal.org/list-changes/drupal?version=11.x
Prioritize: Security → Performance → Maintainability
Modern PHP Required:
===)Drupal Patterns:
\Drupal::service()#[Hook] attributes in tagged service classes (default for all hooks — see references/hooks.md)hook_theme(), hook_install(), hook_schema(), hook_update_N()#[Hook])->accessCheck()The official Drupal Examples project provides 34 working, tested modules demonstrating APIs and patterns. These serve as secondary references when building complex implementations.
Project page: https://www.drupal.org/project/examples Git repository: https://git.drupalcode.org/project/examples Browse source: https://git.drupalcode.org/project/examples/-/tree/4.0.x/modules?ref_type=heads
For complete working implementations:
https://git.drupalcode.org/project/examples/-/tree/4.0.x/modules/{module_name}?ref_type=headshttps://git.drupalcode.org/project/examples/-/raw/4.0.x/modules/{module_name}/{file_path}?ref_type=headsQuality standards from examples:
Entities:
content_entity_example - Full content entity with handlers, forms, list builderconfig_entity_example - Configuration entity with schema and managementfield_example - Custom field types, widgets, formattersfield_permission_example - Field-level permissionsPlugins:
plugin_type_example - Creating custom plugin types and managersblock_example - Block plugins with configurationqueue_example - Queue plugins for background processingForms & Interaction:
form_api_example - Form building, validation, AJAXajax_example - AJAX patterns and behaviorsData & Persistence:
dbtng_example - Database queries, transactionsconfig_simple_example - Configuration API usageAdvanced Patterns:
events_example - Event subscribers and dispatcherscache_example - Cache bins, tags, contextsbatch_example - Batch API for long operationscron_example - Cron hook implementationsTesting:
testing_example - Unit, kernel, and functional browser tests (includes PHPUnit examples)How to Access:
https://git.drupalcode.org/project/examples/-/tree/4.0.x/modules/{module_name}?ref_type=headshttps://git.drupalcode.org/project/examples/-/raw/4.0.x/modules/{module_name}/{file_path}?ref_type=headsExample URLs:
Important Notes:
This SKILL.md provides the core workflow and principles. Reference documentation in references/ is loaded as needed based on the specific subsystem being worked on. This keeps the initial context light while providing deep expertise when required.