craft-twig-guidelines

Community

Standardize Twig templates for Craft CMS 5.

Authormichtio
Version1.0.0
Installs0

System Documentation

What problem does it solve?

Twig coding standards and conventions to ensure consistent, maintainable Craft CMS 5 templates across teams and projects.

Core Features & Use Cases

  • Enforces consistent variable naming (camelCase, no abbreviations) and robust null handling with ?? (and the optional ??? plugin if present).
  • Guidelines for whitespace control, include isolation (always use 'only'), and usage of Craft Twig helpers (tag, attr, |attr, |parseAttr, |append, svg()).
  • Promotes collect() usage for props and class collections, and requires comment headers in components for clarity and maintainability.
  • Helps avoid common pitfalls like snake_case, macros for components, and hardcoded colors, enabling scalable template development.

Quick Start

Start applying these Twig conventions whenever creating, editing, or reviewing any .twig file in a Craft CMS 5 project to ensure consistent templates.

Dependency Matrix

Required Modules

None required

Components

Standard package

💻 Claude Code Installation

Recommended: Let Claude install automatically. Simply copy and paste the text below to Claude Code.

Please help me install this Skill:
Name: craft-twig-guidelines
Download link: https://github.com/michtio/craftcms-claude-skills/archive/main.zip#craft-twig-guidelines

Please download this .zip file, extract it, and install it in the .claude/skills/ directory.
View Source Repository

Agent Skills Search Helper

Install a tiny helper to your Agent, search and equip skill from 471,000+ vetted skills library on demand.