drupal-expert — Claude Code skill: what it does, how to install
Guides coding agents through modern Drupal 10 and 11 development, enforcing contrib research, constructor dependency injection, and automated PHPUnit tests.
npx skills add madsnorgaard/drupal-agent-resources --skill drupal-expert -a claude-codeWhat drupal-expert does
This skill enforces modern Drupal 10 and 11 architecture. It adopts a research-first rule: before generating custom code, the agent inspects drupal.org to verify whether an existing contrib module, patch, or Drupal 10.3 recipe already covers the requirement.
In custom development, static service calls via \Drupal::service() are strictly banned. The agent injects dependencies through class constructors, using ContainerInjectionInterface for controllers and ContainerFactoryPluginInterface for plugins. It uses PHP 8 attributes like #[Hook] for Drupal 11 hooks and reserves event subscribers for third-party PSR-14 integration.
Automated testing is treated as mandatory. The skill organizes test suites across Unit, Kernel, Functional, and FunctionalJS classes depending on database or browser needs. Any custom module configuration will fail review without a matching config/schema definition.
What it helps with
- scaffold Drupal 10 or 11 modules following PSR-4 and PHPCS standards
- configure dependency injection in plugins without static service calls
- implement modern OOP hooks using PHP attributes in Drupal 11
- write unit and kernel test suites with PHPUnit base classes
Example prompts for the agent
- Build a custom block plugin in Drupal 11 with constructor dependency injection
- Check drupal.org for an existing module before writing custom order export logic
- Write a KernelTestBase test for my custom entity processing service
How to install drupal-expert
1Skills CLI (Vercel)
npx skills add madsnorgaard/drupal-agent-resources --skill drupal-expert -a claude-code2Manually: put the files in place
~/.claude/skills/drupal-expert/SKILL.mdCopy the whole skill folder; for one project use .claude/skills/drupal-expert/
1Skills CLI (Vercel)
npx skills add madsnorgaard/drupal-agent-resources --skill drupal-expert -a codex2Manually: put the files in place
.agents/skills/drupal-expert/SKILL.mdFor all projects use ~/.agents/skills/
1Skills CLI (Vercel)
npx skills add madsnorgaard/drupal-agent-resources --skill drupal-expert -a cursor2Manually: put the files in place
.cursor/skills/drupal-expert/SKILL.mdCursor also reads .agents/skills/ and .claude/skills/
1GitHub CLI
gh skill install madsnorgaard/drupal-agent-resources drupal-expert2Manually: put the files in place
.github/skills/drupal-expert/SKILL.md1Skills CLI (Vercel)
npx skills add madsnorgaard/drupal-agent-resources --skill drupal-expert -a gemini-cli2Platform CLI
gemini skills install https://github.com/madsnorgaard/drupal-agent-resources --path .claude/skills/drupal-expertManually: put the files in place
.devin/skills/drupal-expert/SKILL.mdThe legacy .windsurf/skills/ path still works
Skills CLI (Vercel)
npx skills add madsnorgaard/drupal-agent-resources --skill drupal-expert -a opencodeClaude.ai
Zip the folder and upload it in Settings → Capabilities → Skills
Step by step, with commands for each platform: How to install skills in Claude Code: five ways
Questions about drupal-expert
How to install drupal-expert in Claude Code?
Run npx skills add madsnorgaard/drupal-agent-resources --skill drupal-expert -a claude-code in your terminal. Alternatively, place the file at ~/.claude/skills/drupal-expert/SKILL.md.
What does drupal-expert do?
It provides architecture patterns for Drupal 10 and 11 code generation. The agent enforces strict dependency injection, config schemas, and module research on drupal.org.
How does drupal-expert decide between hooks and event subscribers?
It uses OOP #[Hook] attributes when altering core or contrib behaviors where module execution order matters. PSR-14 event subscribers are reserved for third-party libraries and event-heavy systems like Commerce.