drupal-backend
БесплатноБез исполняемых скриптовНе проверенDrupal Back End Specialist skill for custom module development, hooks, APIs, and PHP programming (Drupal 8-11+). Use when building custom modules…
Об этом скилле
Drupal Back End Development
Overview
Enable expert-level Drupal back end development capabilities. Provide comprehensive guidance for custom module development, PHP programming, API usage, hooks, plugins, services, and database operations for Drupal 8, 9, 10, and 11+.
When to Use This Skill
Invoke this skill when working with:
- Custom module development: Creating new Drupal modules
- Hooks: Implementing Drupal hooks to alter system behavior
- Controllers & routing: Building custom pages and routes
- Forms: Creating configuration or custom forms
- Entities: Working with content entities or config entities
- Plugins: Building blocks, field types, formatters, or other plugins
- Services: Creating reusable business logic services
- Database operations: Custom queries and schema definitions
- APIs: Entity API, Form API, Database API, Plugin API
Core Capabilities
1. Custom Module Development
Create complete, standards-compliant Drupal modules:
Quick start workflow:
- Use module template from
assets/module-template/ - Replace
MODULENAMEwith machine name (lowercase, underscores) - Replace
MODULELABELwith human-readable name - Implement functionality using Drupal APIs
- Enable module and test:
ddev drush en mymodule -y
Module structure:
.info.yml- Module metadata and dependencies.module- Hook implementations.routing.yml- Route definitions.services.yml- Service definitions.permissions.yml- Custom permissionssrc/- PHP classes (PSR-4 autoloading)config/- Configuration files
Reference documentation:
references/module_structure.md- Complete module patternsreferences/hooks.md- Hook implementations
2. Hooks System
Implement hooks to alter Drupal behavior:
Common hooks:
hook_entity_presave()- Modify entities before savinghook_entity_insert/update/delete()- React to entity changeshook_form_alter()- Modify any formhook_node_access()- Control node accesshook_cron()- Perform periodic taskshook_install/uninstall()- Module installation tasks
Hook pattern:
function MODULENAME_hook_name($param1, &$param2) {
// Implementation
}
Best practices:
- Implement hooks in
.modulefile only - Use proper type hints
- Document with PHPDoc blocks
- Check for entity types before processing
- Be mindful of performance
3. Controllers & Routing
Create custom pages and endpoints:
Route definition (.routing.yml):
mymodule.example:
path: '/example/{param}'
defaults:
_controller: '\Drupal\mymodule\Controller\ExampleController::content'
_title: 'Example Page'
requirements:
_permission: 'access content'
param: \d+
Controller pattern:
namespace Drupal\mymodule\Controller;
use Drupal\Core\Controller\ControllerBase;
class ExampleController extends ControllerBase {
public function content() {
return ['#markup' => $this->t('Hello!')];
}
}
With dependency injection:
public function __construct(EntityTypeManagerInterface $entity_type_manager) {
$this->entityTypeManager = $entity_type_manager;
}
public static function create(ContainerInterface $container) {
return new static($container->get('entity_type.manager'));
}
4. Forms API
Build configuration and custom forms:
Configuration form:
class SettingsForm extends ConfigFormBase {
protected function getEditableConfigNames() {
return ['mymodule.settings'];
}
public function buildForm(array $form, FormStateInterface $form_state) {
$config = $this->config('mymodule.settings');
$form['api_key'] = [
'#type' => 'textfield',
'#title' => $this->t('API Key'),
'#default_value' => $config->get('api_key'),
];
return parent::buildForm($form, $form_state);
}
public function submitForm(array &$form, FormStateInterface $form_state) {
$this->config('mymodule.settings')
->set('api_key', $form_state->getValue('api_key'))
->save();
parent::submitForm($form, $form_state);
}
}
Form validation:
public function validateForm(array &$form, FormStateInterface $form_state) {
if (strlen($form_state->getValue('field')) < 5) {
$form_state->setErrorByName('field', $this->t('Too short.'));
}
}
5. Entity API
Work with content and configuration entities:
Loading entities:
// Load single entity
$node = \Drupal::entityTypeManager()->getStorage('node')->load($nid);
// Load multiple entities
$nodes = \Drupal::entityTypeManager()->getStorage('node')->loadMultiple([1, 2, 3]);
// Load by properties
$nodes = \Drupal::entityTypeManager()->getStorage('node')->loadByProperties([
'type' => 'article',
'status' => 1,
]);
Creating/saving entities:
$node = \Drupal::entityTypeManager()->getStorage('node')->create([
'type' => 'article',
'title' => 'My Article',
'body' => ['value' => 'Content',
Установить drupal-backend в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
Без ограничений — скилл может использовать любой инструмент.
Вложенные файлы
FAQ
Что делает скилл drupal-backend?
Drupal Back End Specialist skill for custom module development, hooks, APIs, and PHP programming (Drupal 8-11+). Use when building custom modules, implementing hooks, working with entities, forms, plugins, or services.
Как установить скилл drupal-backend?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл drupal-backend запускает скрипты?
Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.
Похожие скиллы
theme-factory
Toolkit for styling artifacts with a theme. These artifacts can be slides, docs, reportings, HTML landing pages, etc. There are 10 pre-set themes with…
от Anthropicaccess
Manage Discord channel access — approve pairings, edit allowlists, set DM/group policy. Use when the user asks to pair, approve someone, check who's allowed…
от Anthropicconfigure
Set up the Discord channel — save the bot token and review access policy. Use when the user pastes a Discord bot token, asks to configure Discord, asks "how…
от Anthropicaccess
Manage iMessage channel access — approve pairings, edit allowlists, set DM/group policy. Use when the user asks to pair, approve someone, check who's allowed…
от Anthropic