craft-twig-guidelines

craft-twig-guidelines is a skill for Claude Code from michtio/craftcms-claude-skills. It costs 0 tokens per session (4,490 once invoked), scanned A, original, MIT.

Coding standards for Twig templates in Craft CMS 5, including naming, null handling, whitespace, and related template practices. Twig is the template language used to build many Craft CMS page views.

In plain words
What is it for?
Use it whenever writing, editing, or reviewing a .twig file, including layouts, views, components, and builders.
Why use it?
It keeps templates consistent and reduces mistakes when handling data, formatting output, or working within Craft CMS conventions.

Skill for Claude Code

Written for Claude Code: shipped in a Claude Code plugin.

Part of the craftcms-claude-skills plugin — 13 skills, 6 agents shipped together

Good fit Use it whenever writing, editing, or reviewing a .twig file, including layouts, views, components, and builders.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/michtio/craftcms-claude-skills/craft-twig-guidelines
Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

Any agent
npx skills add michtio/craftcms-claude-skills --skill craft-twig-guidelines
Clone the repo
git clone --depth 1 https://github.com/michtio/craftcms-claude-skills

Made for: Claude Code.

Or install craftcms-claude-skills, the plugin that ships this one along with the rest of its 13 skills, 6 agents.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for craft-twig-guidelines

README.md
[![agentmods](https://agentmods.dev/badge/skills/michtio/craftcms-claude-skills/craft-twig-guidelines/github.svg)](https://agentmods.dev/skills/michtio/craftcms-claude-skills/craft-twig-guidelines)
Your own site
<a href="https://agentmods.dev/skills/michtio/craftcms-claude-skills/craft-twig-guidelines"><img src="https://agentmods.dev/badge/skills/michtio/craftcms-claude-skills/craft-twig-guidelines/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for craft-twig-guidelines

Your own site · 80×15
<a href="https://agentmods.dev/skills/michtio/craftcms-claude-skills/craft-twig-guidelines"><img src="https://agentmods.dev/badge/skills/michtio/craftcms-claude-skills/craft-twig-guidelines.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 0 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 4,490 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe. Third-party audits
  • NVIDIA SkillSpector pass 7 Sept 2026
How audits are shown
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00000 $0.04490
Opus 5 $0.00000 $0.02245
Sonnet 5 $0.00000 $0.00898
Haiku 4.5 $0.00000 $0.00449

Measured 12d ago against content hash 0b899ba68c38, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-11, from the pricing page.

Security

Grade A, and why

craft-twig-guidelines scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 12d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

skills/craft-twig-guidelines/SKILL.md · 373 lines

How it starts

The opening of the file, as written. The whole thing — 373 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Twig Coding Standards — Craft CMS 5

Coding conventions for Twig templates in Craft CMS 5 projects. These apply to all Twig code — atomic components, views, layouts, builders, partials.

Companion Skills — Always Load Together

When this skill triggers, also load:

  • craft-site — Template architecture and component patterns. Required when creating or editing components, layouts, views, or builders.
  • craft-content-modeling — Content architecture. Required when template code involves element queries, field access, or section decisions.

For Twig architecture patterns (atomic design, routing, builders), see the craft-site skill. For PHP coding standards, see craft-php-guidelines.

Documentation

Use WebFetch on specific doc pages when something isn't covered here.

Variable Naming

Single-word, descriptive, lowercase preferred. When multi-word is needed, use camelCase.

{# Correct #}
{% set heading = entry.title %}
{% set image = entry.heroImage.one() %}
{% set items = navigation.links.all() %}
{% set element = props.get('url') ? 'a' : 'span' %}
{% set buttonText = entry.callToAction %}
{% set containerClass = 'max-w-3xl' %}

{# Wrong — abbreviations #}
{% set el = props.get('url') ? 'a' : 'span' %}
{% set btn = entry.callToAction %}
{% set nav = navigation.links.all() %}

{# Wrong — snake_case #}
{% set button_text = entry.callToAction %}
{% set container_class = 'max-w-3xl' %}

No abbreviations: element not el, button not btn, navigation not nav, description not desc.

Prefer single-word names when context makes the meaning clear (e.g. heading inside a component is better than sectionHeading). But multi-word camelCase is perfectly fine when needed for clarity.

Read the full file on GitHub · 373 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 12d ago First seen · 373 lines · 0 tokens per session scan A 0b899ba68c38

Subscribe to this mod's changes

craft-twig-guidelines is a skill published in the GitHub repository michtio/craftcms-claude-skills (78 stars, last pushed 9d ago), licensed MIT. It costs nothing until one of its globs matches a file; then it loads 4,490 tokens. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.

Related

Other skills, from other repositories

liveview-patterns

Build LiveView: async data (assignasync), PubSub (check connected?), phx-change events, form components/modals/uploads, streams for lists, livepatch. Use when handling interactions, debugging events, or tracking Presence.

oliver-kriska/claude-elixir-phoenix · 51 tokens

fullstack-coder

Full-stack implementation agent that writes complete, production-ready code following an approved architecture and schema. Triggers on: write the code, implement features, build the app, code the MVP, generate codebase.

batterfried-philosophy172/Agent-Startup-Skills · 46 tokens

odoo-js

Use when writing, reviewing, or migrating any JavaScript, OWL component, QWeb/OWL template, or SCSS under static/src in an Odoo module — POS overrides, backend widgets, website/public widgets, services. Carries PSAE review-derived principles for OWL correctness, the patch() discipline, template conventions, frontend…

omas-odoo/odoo-superpowers · 95 tokens

odoo-js

Use when writing, reviewing, or migrating any JavaScript, OWL component, QWeb/OWL template, or SCSS under static/src in an Odoo module — POS overrides, backend widgets, website/public widgets, services. Carries PSAE review-derived principles for OWL correctness, the patch() discipline, template conventions, frontend…

assoumaaa/odoo-superpowers · 95 tokens

genpage

Creates, updates, and deploys Power Apps generative pages for model-driven apps using React v17, TypeScript, and Fluent UI V9. Orchestrates specialist agents for planning, entity creation, and code generation. Use it when user asks to build, retrieve, or update a page in an existing Microsoft Power Apps model-driven…

microsoft/power-platform-skills · 140 tokens

phx-deps-audit

Audit Hex deps for supply-chain security risk — bidi chars, compile-time exec, maintainer changes, typosquats, CVEs. Use after mix deps.update, when checking if a package upgrade is safe, or reviewing mix.lock PR diffs.

oliver-kriska/claude-elixir-phoenix · 58 tokens