Using Claude Code to Build a Drupal Site with Custom Twig Templates

A developer shared their experience using Claude Code to build a Drupal website with a custom approach they describe as "headless-ish HTML." They used Claude to create Twig files with raw HTML, preferring this method for greater control over the output.
Technical Approach
The developer had Claude craft Twig files that incorporate raw HTML code while still utilizing Drupal core functions like drupal_view and drupal_block. CSS was mixed directly into these templates for styling. The site structure was organized with many individual Twig files in the themes/custom/THEME/ directory, which the developer compared to their typical PHP application development methods.
Development Workflow
They used a local ddev environment extensively, noting that Claude was able to run ddev drush and other commands directly from the terminal. This setup facilitated configuration of views, taxonomies, content types, and site structures.
The process followed these steps:
- Start with Claude creating the HTML/CSS site first to make changes easier and faster
- Once the design was finalized, have Claude take that and create the Drupal site starting with a sub-theme
- Work with Claude to tackle specific areas rather than requesting broad fixes (e.g., "Let's review the XYZ content type and make sure it matches the HTML templates" instead of "Claude fix all the content types")
Practical Details
The developer left Twig debugging enabled on the Drupal website to see which Twig files were being used. They acknowledged that while some organization would be beneficial, the current structure served as a good starting point for a simple content site.
This approach allowed them to build a Drupal site that wasn't constructed "the Drupal way" but matched their preferred development patterns, making the process smoother than traditional Drupal development.
📖 Read the full source: r/ClaudeAI
👀 See Also

Using Kimi K2.6 to Properly Uninstall macOS Apps by Finding Hidden App Directories
A developer describes using Kimi K2.6 to automatically find and delete macOS app directories, including hidden ~/.appname and ~/Library/Application Support files, with a custom agent that edits its base knowledge to improve the process.

Use OpenClaw to Build a Tank Battle Bot: Try AgenTank.ai
AgenTank.ai is a free browser game where you create a tank, give OpenClaw its API key and docs, and iterate on battle strategies using AI agents. No manual control — your agent keeps making the tank smarter.

OpenClaw Agent Manages Power Outage: Solar, Powerwalls, and Human Coordination
An OpenClaw agent named Sam read a utility outage notice, pre-charged Tesla Powerwalls, monitored solar and battery status, and coordinated with two humans to adjust A/C usage and avoid battery depletion before utility power returned.

3 Real Blockers After Weeks of Testing OpenClaw for Business Automation
A Reddit user reports three blockers after weeks of running OpenClaw on Windows 11 with Claude Haiku 4.5 + DeepSeek: headless execution hides agent actions, CRM integrations break on handoff, and orchestration agent asks for manual execution instead of acting on data.