craft-twig-guidelines

craft-twig-guidelines is a skill for Claude Code from michtio/craftcms-claude-skills. It costs 151 tokens per session (4,696 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: when-to-use in frontmatter.

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 151 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 4,696 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.00151 $0.04696
Opus 5.5 $0.00060 $0.01878
Sonnet 5.5 $0.00030 $0.00939
Haiku 4.5 $0.00015 $0.00470

Measured 19d ago against content hash 08f61f7e9eb9, method: parsed. Prices are Anthropic first-party input rates as of 2026-10-07, 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 19d 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 · 391 lines

How it starts

The opening of the file, as written. The whole thing — 391 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 · 391 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. 19d ago Changed · +1 lines · -179 tokens per session 08f61f7e9eb9
  2. 21d ago Changed · +330 tokens per session e95d7d1fcb1a
  3. 1mo ago Changed · +17 lines 6fa8ebe5a02d
  4. 1mo 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 (86 stars, last pushed 12d ago), licensed MIT. It adds 151 tokens to every session and 4,696 once invoked, about $0.0006 per session on Opus 5.5. 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

analyze

Analyze a legacy app in any language before rewriting it in Elixir: inventory, features as goals, why each mechanism exists, runtime topology, external contracts. Use to start or refresh a rewrite.

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

skill-monitor

Analyze skill effectiveness across sessions. Computes per-skill metrics (action rate, friction, outcomes), identifies degrading skills, and generates improvement recommendations. Requires session-scan data in metrics.jsonl.

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

watch-pr

Watch an Elixir/Phoenix PR for new review comments (bot + human) and CI results via a background watcher that wakes Claude only on real events. Use after opening a PR or pushing, while waiting on CI or reviewers.

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

audit

Project health audit and health check — architecture, performance, tests, dependencies, code quality. Use when assessing overall project health, before releases, or after refactors.

oliver-kriska/claude-elixir-phoenix · 35 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

architect

Design the idiomatic Elixir architecture for a rewrite: set the compatibility bar (ADR-000), consult phx specialists on open questions, then build contexts, ledger and ADRs. Use after /rewrite:analyze.

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