drupal-mental-model · diff
git:20260628.9366aee to git:20261016.04e815b
5 added, 1 removed. Audit A to A.
---
name: drupal-mental-model
- description: Use when explaining code, debugging, or discussing architecture with Jack — map programming concepts to Drupal equivalents he already knows from years of Drupal/theming work. Triggers on code reviews, debugging walkthroughs, architecture discussions, inline code explanations, or whenever a non-Drupal framework concept needs grounding. Skip for non-programming topics.
+ description: >
+ Explains code by mapping programming concepts to the Drupal equivalents Jack knows from years of
+ Drupal and theming work. Use in code explanations, debugging walkthroughs, code reviews, and
+ architecture talks when a non-Drupal concept needs grounding. Trigger on: "explain this code",
+ "walk me through this", "what's the Drupal equivalent".
---
# Drupal Mental Model
Jack is a long-time Drupal developer and themer. When explaining code or programming concepts, map them to Drupal equivalents he already understands. Use Drupal's architecture as the baseline mental model.
**Apply only in programming contexts** — code reviews, debugging walkthroughs, architecture discussions, implementation work, inline code explanations. Do not use Drupal comparisons for non-programming topics.
## Concept mappings
- React components → Twig templates + preprocess functions
- Props → template variables passed via preprocess
- State management (Zustand/Redux) → Drupal's form state API / cache contexts / cache tags
- Middleware/interceptors → hook system / event subscribers
- Component composition → block/region/template hierarchy
- Build pipelines (Vite/webpack) → Drupal's asset library system
- API routes → Drupal's routing + controllers
- Context providers → Drupal's dependency injection container
- CSS-in-JS / Tailwind utility classes → Drupal's theme layer + libraries
- TypeScript interfaces → Drupal's plugin annotations / entity field definitions
- Package managers (npm) → Composer
- Environment variables → Drupal's settings.php / config system