add-template
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseAdd Template
添加模板
Always use the skill to retrieve the ***plain syntax rules — but only if you haven't done so yet.
load-plain-referenceTemplates use Liquid syntax () to reuse the same spec content across multiple files. Each inclusion can pass different parameters, producing tailored output from a single source. This is distinct from and — templates are about textual reuse with parameterization, not module dependencies.
{% include %}.plainimportrequires请务必使用技能来获取***plain语法规则——但仅在你尚未获取的情况下使用。
load-plain-reference模板使用Liquid语法()在多个.plain文件中复用相同的规格内容。每次引入都可以传递不同的参数,从单一源生成定制化的输出。这与和不同——模板侧重于带参数化的文本复用,而非模块依赖。
{% include %}importrequiresWhen to Use Templates
何时使用模板
- The exact same spec structure is needed in more than one file.
.plain - 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.
- 多个.plain文件需要完全相同的规格结构时。
- 复用内容仅在特定值(名称、路径、配置)上存在差异,且这些值可参数化时。
- 你希望为出现在多个模块中的模式提供单一事实来源时。
Format
格式
Including a Template
引入模板
Use with the template path and parameters:
{% include %}plain
{% 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 }}使用并指定模板路径和参数:
{% include %}plain
{% include "console_app_template.plain", main_file_name: "app.py", app_name: "MyApp" %}参数以键值对形式传递在模板路径之后。在模板内部,使用Liquid变量语法()访问参数。
{{ main_file_name }}Writing a Template
编写模板
Templates live in the directory. Only variables () are supported — conditionals, loops, and other Liquid features are not available:
template/{{ variable_name }}plain
***definitions***
- :{{ app_name }}MainFile: is the entry point file for :{{ app_name }}:.
***implementation reqs***
- :{{ app_name }}MainFile: should be called "{{ main_file_name }}".模板存储在目录中。仅支持变量()——不支持条件语句、循环及其他Liquid功能:
template/{{ variable_name }}plain
***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 directory to see what templates are available.
template/ - Read the template to understand what parameters it expects and what content it produces.
- Add the statement to the target
{% include %}file with the correct parameters..plain - Verify that the expanded content does not introduce concept name collisions or duplicate sections.
- 检查目录,查看可用的模板。
template/ - 阅读模板,了解它所需的参数以及生成的内容。
- 添加语句到目标.plain文件中,并传入正确的参数。
{% include %} - 验证展开后的内容不会导致概念名称冲突或重复章节。
Workflow: Creating a New Template
工作流程:创建新模板
- Identify the repeated pattern — find spec content that is duplicated (or will be duplicated) across multiple files.
.plain - Extract the common content into a new file in the
.plaindirectory.template/ - Parameterize the differences — replace the varying parts with Liquid variables.
- Update the original files to use instead of the duplicated content.
{% include %}
- 识别重复模式——找出在多个.plain文件中重复(或将要重复)的规格内容。
- 提取通用内容到目录下的新.plain文件中。
template/ - 参数化差异部分——将变化的部分替换为Liquid变量。
- 更新原始文件,使用替代重复的内容。
{% include %}
Validation Checklist
验证检查清单
- Template file is in the directory
template/ - All varying parts are parameterized with Liquid variables
- All required parameters are passed at each call site
{% include %} - Expanded content does not introduce concept name collisions
- Template is used by more than one file (otherwise, inline the content)
.plain
- 模板文件位于目录中
template/ - 所有变化部分均使用Liquid变量进行参数化
- 在每个调用位置都传入了所有必要的参数
{% include %} - 展开后的内容不会导致概念名称冲突
- 模板被多个.plain文件使用(否则,直接将内容内联即可)