Add Template
Always use the skill load-plain-reference to retrieve the ***plain syntax rules — but only if you haven't done so yet.
Templates use Liquid syntax ({% include %}) to reuse the same spec content across multiple .plain files. Each inclusion can pass different parameters, producing tailored output from a single source. This is distinct from import and requires — templates are about textual reuse with parameterization, not module dependencies.
When to Use Templates
- The exact same spec structure is needed in more than one
.plainfile. - The reused content differs only in specific values (names, paths, config) that can be parameterized.
- You want a single source of truth for a pattern that appears in multiple modules.
Format
Including a Template
Use {% include %} with the template path and parameters:
{% include "console_app_template.plain", main_file_name: "app.py", app_name: "MyApp" %}
Parameters are passed as key-value pairs after the template path. Inside the template, parameters are accessed using Liquid variable syntax ({{ main_file_name }}).
Writing a Template
Templates live in the template/ directory. Only variables ({{ variable_name }}) are supported — conditionals, loops, and other Liquid features are not available:
***definitions***
- :{{ app_name }}MainFile: is the entry point file for :{{ app_name }}:.
***implementation reqs***
- :{{ app_name }}MainFile: should be called "{{ main_file_name }}".
Workflow: Including an Existing Template
- Check the
template/directory to see what templates are available. - Read the template to understand what parameters it expects and what content it produces.
- Add the
{% include %}statement to the target.plainfile with the correct parameters. - Verify that the expanded content does not introduce concept name collisions or duplicate sections.
Workflow: Creating a New Template
- Identify the repeated pattern — find spec content that is duplicated (or will be duplicated) across multiple
.plainfiles. - Extract the common content into a new
.plainfile in thetemplate/directory. - Parameterize the differences — replace the varying parts with Liquid variables.
- Update the original files to use
{% include %}instead of the duplicated content.
Validation Checklist
- Template file is in the
template/directory - All varying parts are parameterized with Liquid variables
- All required parameters are passed at each
{% include %}call site - Expanded content does not introduce concept name collisions
- Template is used by more than one
.plainfile (otherwise, inline the content)