Help us improve
Share bugs, ideas, or general feedback.
From rust
Write Tera templates for Rust applications. Use when creating Jinja2/Django-style templates, using template inheritance, writing macros, applying filters, or generating HTML/text with Tera.
npx claudepluginhub tarqd/skills --plugin rustHow this skill is triggered — by the user, by Claude, or both
Slash command
/rust:tera-templatesThis skill is limited to the following tools:
The summary Claude sees in its skill listing — used to decide when to auto-load this skill
Tera is a powerful template engine for Rust inspired by Jinja2 and Django templates. Use this skill when writing `.html`, `.tera`, or other template files for Rust applications using the Tera crate.
Searches, retrieves, and installs Agent Skills from prompts.chat registry using MCP tools like search_skills and get_skill. Activates for finding skills, browsing catalogs, or extending Claude.
Provides behavioral guidelines to reduce common LLM coding mistakes, focusing on simplicity, surgical changes, assumption surfacing, and verifiable success criteria.
Fetches up-to-date documentation from Context7 for libraries and frameworks like React, Next.js, Prisma. Use for setup questions, API references, and code examples.
Share bugs, ideas, or general feedback.
Tera is a powerful template engine for Rust inspired by Jinja2 and Django templates. Use this skill when writing .html, .tera, or other template files for Rust applications using the Tera crate.
extends and block{# This is a comment #}
{# Variable output #}
Hello, {{ name }}!
{# Expressions #}
{{ price * quantity }}
{# Filters #}
{{ name | upper }}
{{ text | truncate(length=50) }}
| Delimiter | Purpose |
|---|---|
{{ }} | Expressions - output values |
{% %} | Statements - control flow |
{# #} | Comments - not rendered |
Add - to trim whitespace:
{%- removes whitespace before-%} removes whitespace after{{-, -}}, {#-, -#}{% set my_var = 2 -%}
{{ my_var }}
base.html)<!DOCTYPE html>
<html>
<head>
{% block head %}
<title>{% block title %}{% endblock title %} - My Site</title>
{% endblock head %}
</head>
<body>
{% block content %}{% endblock content %}
{% block footer %}
<footer>© 2024</footer>
{% endblock footer %}
</body>
</html>
{% extends "base.html" %}
{% block title %}Home{% endblock title %}
{% block head %}
{{ super() }}
<link rel="stylesheet" href="home.css">
{% endblock head %}
{% block content %}
<h1>Welcome!</h1>
{% endblock content %}
Use {{ super() }} to include parent block content.
{% if price < 10 %}
Cheap!
{% elif price > 100 %}
Expensive!
{% else %}
Reasonable.
{% endif %}
{# Negation #}
{% if not logged_in %}
Please log in.
{% endif %}
{# Combine with and/or #}
{% if user and user.is_admin %}
Admin panel
{% endif %}
{% for item in items %}
{{ loop.index }}. {{ item.name }}
{% endfor %}
{# Key-value iteration #}
{% for key, value in my_map %}
{{ key }}: {{ value }}
{% endfor %}
{# Empty fallback #}
{% for item in items %}
{{ item }}
{% else %}
No items found.
{% endfor %}
Loop variables:
loop.index - 1-indexed positionloop.index0 - 0-indexed positionloop.first - true on first iterationloop.last - true on last iterationLoop controls:
{% for item in items %}
{% if item.skip %}{% continue %}{% endif %}
{% if item.stop %}{% break %}{% endif %}
{{ item.name }}
{% endfor %}
Define reusable template components:
{# In macros.html #}
{% macro input(label, type="text", name="") %}
<label>
{{ label }}
<input type="{{ type }}" name="{{ name }}">
</label>
{% endmacro input %}
{% macro button(text, class="btn") %}
<button class="{{ class }}">{{ text }}</button>
{% endmacro button %}
Use macros:
{% import "macros.html" as forms %}
{{ forms::input(label="Username", name="user") }}
{{ forms::button(text="Submit", class="btn-primary") }}
{# Call macro in same file with self:: #}
{{ self::my_macro(arg="value") }}
{% include "header.html" %}
{# Ignore if missing #}
{% include "optional.html" ignore missing %}
{# Try multiple files #}
{% include ["custom/nav.html", "nav.html"] %}
{% set name = "Alice" %}
{% set total = price * quantity %}
{% set items = [1, 2, 3] %}
{# Global assignment (escapes loop scope) #}
{% for item in items %}
{% set_global count = loop.index %}
{% endfor %}
See filters.md for the complete list.
Common filters:
{{ name | lower }} {# lowercase #}
{{ name | upper }} {# uppercase #}
{{ name | capitalize }} {# First letter upper #}
{{ name | title }} {# Title Case #}
{{ text | truncate(length=50) }} {# truncate with ellipsis #}
{{ text | wordcount }} {# count words #}
{{ text | replace(from="a", to="b") }}
{{ text | trim }} {# remove whitespace #}
{{ items | length }} {# array/string length #}
{{ items | first }} {# first element #}
{{ items | last }} {# last element #}
{{ items | reverse }} {# reverse array #}
{{ items | sort }} {# sort array #}
{{ items | join(sep=", ") }} {# join array to string #}
{{ num | round }} {# round number #}
{{ num | abs }} {# absolute value #}
{{ content | safe }} {# disable escaping #}
{{ value | default(value="N/A") }} {# default if undefined #}
{{ data | json_encode(pretty=true) }} {# to JSON #}
{% if num is odd %}
{% if num is even %}
{% if num is divisibleby(3) %}
{% if var is defined %}
{% if var is undefined %}
{% if val is string %}
{% if val is number %}
{% if val is iterable %}
{% if name is starting_with("Dr.") %}
{% if name is ending_with("Jr.") %}
{% if list is containing("item") %}
{% if name is matching("^[A-Z]") %}
{# Generate range #}
{% for i in range(end=5) %}
{% for i in range(start=1, end=10, step_by=2) %}
{# Current time (requires builtins feature) #}
{{ now() }}
{{ now() | date(format="%Y-%m-%d") }}
{{ now(timestamp=true) }}
{# Random number #}
{{ get_random(end=100) }}
{{ get_random(start=10, end=20) }}
{# Environment variable #}
{{ get_env(name="HOME") }}
{{ get_env(name="MISSING", default="fallback") }}
{# Throw error #}
{% if not valid %}
{{ throw(message="Validation failed!") }}
{% endif %}
Prevent Tera from processing content:
{% raw %}
This {{ will_not }} be processed.
Useful for JavaScript templates or documentation.
{% endraw %}
{# Debug: print entire context #}
{{ __tera_context }}
base.html and extend itmacros.html{%- and -%} to keep output clean{{ content | other_filter | safe }}