一键导入
flow-convert-handlebars-to-liquid
Convert Handlebars template syntax to Liquid.js in prompts. Use when migrating prompt templates from Flow SDK to Output SDK.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
Convert Handlebars template syntax to Liquid.js in prompts. Use when migrating prompt templates from Flow SDK to Output SDK.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
基于 SOC 职业分类
| name | flow-convert-handlebars-to-liquid |
| description | Convert Handlebars template syntax to Liquid.js in prompts. Use when migrating prompt templates from Flow SDK to Output SDK. |
| allowed-tools | ["Bash","Read","Write","Grep","Edit"] |
This skill guides the conversion of Handlebars template syntax (used in Flow SDK) to Liquid.js syntax (required by Output SDK). This is critical for prompt template migration.
During Migration:
Error Symptoms:
| Handlebars | Liquid.js |
|---|---|
{{variable}} | {{ variable }} |
{{user.name}} | {{ user.name }} |
{{items.[0]}} | {{ items[0] }} |
Key Rule: Always include spaces inside braces: {{ variable }} not {{variable}}
| Handlebars | Liquid.js |
|---|---|
{{#if condition}} | {% if condition %} |
{{else}} | {% else %} |
{{/if}} | {% endif %} |
{{#unless condition}} | {% unless condition %} |
{{/unless}} | {% endunless %} |
| Handlebars | Liquid.js |
|---|---|
{{#if (eq a b)}} | {% if a == b %} |
{{#if (ne a b)}} | {% if a != b %} |
{{#if (gt a b)}} | {% if a > b %} |
{{#if (lt a b)}} | {% if a < b %} |
{{#if (and a b)}} | {% if a and b %} |
{{#if (or a b)}} | {% if a or b %} |
| Handlebars | Liquid.js |
|---|---|
{{#each items}} | {% for item in items %} |
{{this}} | {{ item }} |
{{@index}} | {{ forloop.index0 }} |
{{@first}} | {{ forloop.first }} |
{{@last}} | {{ forloop.last }} |
{{/each}} | {% endfor %} |
| Handlebars | Liquid.js |
|---|---|
{{variable}} (with default helper) | {{ variable | default: "fallback" }} |
| Handlebars | Liquid.js |
|---|---|
{{! comment }} | {% comment %} comment {% endcomment %} |
{{!-- comment --}} | {% comment %} comment {% endcomment %} |
<!-- Handlebars -->
Hello, {{userName}}! Your order {{orderId}} is ready.
<!-- Liquid.js -->
Hello, {{ userName }}! Your order {{ orderId }} is ready.
<!-- Handlebars -->
{{#if includeDetails}}
Here are the details:
{{details}}
{{else}}
No details available.
{{/if}}
<!-- Liquid.js -->
{% if includeDetails %}
Here are the details:
{{ details }}
{% else %}
No details available.
{% endif %}
<!-- Handlebars -->
{{#if isPremium}}
Premium content:
{{#if hasAccess}}
{{premiumContent}}
{{else}}
Please upgrade to access.
{{/if}}
{{else}}
Basic content: {{basicContent}}
{{/if}}
<!-- Liquid.js -->
{% if isPremium %}
Premium content:
{% if hasAccess %}
{{ premiumContent }}
{% else %}
Please upgrade to access.
{% endif %}
{% else %}
Basic content: {{ basicContent }}
{% endif %}
<!-- Handlebars -->
Items to process:
{{#each items}}
- {{this.name}}: {{this.value}}
{{/each}}
<!-- Liquid.js -->
Items to process:
{% for item in items %}
- {{ item.name }}: {{ item.value }}
{% endfor %}
<!-- Handlebars -->
{{#each steps}}
Step {{@index}}: {{this.description}}
{{/each}}
<!-- Liquid.js -->
{% for step in steps %}
Step {{ forloop.index }}: {{ step.description }}
{% endfor %}
<!-- Handlebars -->
{{#if (eq status "active")}}
Active user
{{else if (eq status "pending")}}
Pending approval
{{else}}
Inactive
{{/if}}
<!-- Liquid.js -->
{% if status == "active" %}
Active user
{% elsif status == "pending" %}
Pending approval
{% else %}
Inactive
{% endif %}
Important: Booleans in Liquid.js templates can be tricky. Convert to strings for reliable comparisons.
// In step code, convert boolean to string
variables: {
hasData: data ? 'yes' : 'no',
isEnabled: enabled ? 'true' : 'false'
}
<!-- In prompt -->
{% if hasData == 'yes' %}
Data is available: {{ data }}
{% endif %}
{% if isEnabled == 'true' %}
Feature is enabled.
{% endif %}
<!-- Handlebars (with helper) -->
Language: {{language}}
<!-- Liquid.js -->
Language: {{ language | default: "English" }}
// prompts.ts
export const analyzePrompt = `
You are an AI assistant.
{{#if systemContext}}
Context: {{systemContext}}
{{/if}}
User Query: {{query}}
{{#if examples}}
Examples:
{{#each examples}}
{{@index}}. Input: {{this.input}}
Output: {{this.output}}
{{/each}}
{{/if}}
{{#if (eq mode "detailed")}}
Provide a detailed analysis with explanations.
{{else if (eq mode "brief")}}
Provide a brief summary.
{{else}}
Provide a standard response.
{{/if}}
`;
---
provider: openai
model: gpt-4o
temperature: 0.5
---
<system>
You are an AI assistant.
{% if systemContext %}
Context: {{ systemContext }}
{% endif %}
</system>
<user>
User Query: {{ query }}
{% if examples %}
Examples:
{% for example in examples %}
{{ forloop.index }}. Input: {{ example.input }}
Output: {{ example.output }}
{% endfor %}
{% endif %}
{% if mode == "detailed" %}
Provide a detailed analysis with explanations.
{% elsif mode == "brief" %}
Provide a brief summary.
{% else %}
Provide a standard response.
{% endif %}
</user>
Search for patterns that need conversion:
# Find Handlebars conditionals
grep -r "{{#if" src/workflows/
grep -r "{{/if}}" src/workflows/
grep -r "{{#each" src/workflows/
grep -r "{{#unless" src/workflows/
# Find variables without spaces
grep -r "{{[^#/!]" src/workflows/ | grep -v "{{ "
{{#if ...}} converted to {% if ... %}{{/if}} converted to {% endif %}{{#each ...}} converted to {% for ... in ... %}{{/each}} converted to {% endfor %}{{else}} converted to {% else %}{{ var }} not {{var}}==, !=, >, <forloop.index instead of @indexflow-convert-prompts-to-files - Full prompt conversionflow-analyze-prompts - Identifying prompts to convertflow-validation-checklist - Migration validationValidate and fix folder structure for Output SDK workflows. Use to ensure migrated workflows follow the correct structure conventions.
Convert Flow SDK activities.ts to Output SDK steps.ts. Use when migrating activity functions to step definitions with typed parameters.
Convert inline prompts and prompt arrays to .prompt files with YAML frontmatter. Use when migrating prompts from Flow SDK format to Output SDK prompt files.
Convert Flow SDK workflow class to Output SDK workflow() function. Use when migrating workflow.ts files from class-based to functional definitions.
Create scenario files for testing migrated Output SDK workflows. Use to set up test inputs in the scenarios/ subfolder.
Fix ESLint issues in migrated Output SDK code. Use when seeing lint errors after migration, or when writing new Output SDK code that needs to follow project conventions.