template.* configuration file defines metadata and variables for a code generation template. This file must exist at the root of each template folder.
Configuration File
Location:<template-folder>/template.yml or <template-folder>/template.json
Type: TemplateConfig
Required: Yes, for each template
Schema
Core Settings
Human-readable title displayed during template generation.
Description of what the template scaffolds and its purpose.
Overrides the template identifier (defaults to folder name).Must be unique across all template locations.Added in v1.23.0
Pre-configured destination path for generation.Added in v1.19.0
- Prefixed with
/: Relative from workspace root - No prefix: Relative from current working directory
One or many templates to extend. Deeply inherits files and variables.Added in v1.19.0
Variables
Map of variable names to variable configurations.Variables are interpolated into template files and paths using Tera syntax.Each variable requires a
type field with additional type-specific configuration.Variable Types
String Variables
String variable type.
Number Variables
Numeric variable type (integers only, no floats).Same properties as string variables with
default: number.Boolean Variables
Boolean variable type.Same properties as string variables with
default: boolean.Array Variables
Array variable type. Values must be JSON-compatible.Same properties as string variables with
default: array.When prompting, users must provide valid JSON:Object Variables
Object variable type. Values must be JSON-compatible.Same properties as string variables with
default: object.Enum Variables
Enumerable string values with single or multiple selection.
Frontmatter
Template files can include frontmatter to control generation behavior:Custom output path relative to destination.Supports variable interpolation and Tera filters:
Conditionally skip generating this file.
Always overwrite existing files without prompting.
Variable Interpolation
Variables are accessible in template files using Tera syntax:Basic Usage
Component.tsx
Conditionals
Loops
Filters
Tera provides built-in filters for transforming variables:{{ name | lower }}- lowercase{{ name | upper }}- UPPERCASE{{ name | capitalize }}- Capitalize{{ name | pascal_case }}- PascalCase{{ name | camel_case }}- camelCase{{ name | snake_case }}- snake_case{{ name | kebab_case }}- kebab-case
Complete Example
templates/react-component/template.yml
templates/react-component/Component.tsx
templates/react-component/Component.test.tsx