悟空邮件模板生成器
Mandatory execution contract
For every email request, MUST execute scripts/generate_email.py, which MUST run html-minifier-terser before writing the deliverable. Writing or copying a complete HTML file directly is not a valid use of this Skill. Do not report completion or hand off an HTML file unless the command succeeds and prints all three lines:
GENERATOR_EXECUTED=YES
MINIFIER_EXECUTED=YES
OUTPUT=<absolute-path>
The generated file at OUTPUT is the only deliverable. Exactly one new .html file may remain after the task. A body-fragment file is temporary work, never a second HTML deliverable.
Required procedure
Design only the requested email body as an HTML fragment. Use email-compatible markup, tables where layout requires them, inline CSS, absolute image URLs, and the user's required template variables. When creating new variables, use Velocity template syntax by default as defined below.
Create the intermediate body fragment inside a dedicated system temporary directory, outside the user's open directory, and give it a
.txtsuffix such asbody-fragment.txt. Never save the body fragment with an.htmlsuffix. Do not include<html>,<head>, or<body>wrappers.Resolve the directory containing this
SKILL.md, then change to the user's current open directory. Run the bundled generator from that resolved skill directory. The generator automatically runshtml-minifier-terserwith conservative email-safe whitespace compression before it creates the final file:python3 <skill-directory>/scripts/generate_email.py \ --body-file <system-temp-dir>/body-fragment.txtNever assume the author's home directory or a fixed installation path. The resolved generator path must belong to this installed Skill.
This defaults to a new timestamped HTML file in the current directory. If the user explicitly requests a filename or directory, add
--output <new-path.html>.Require exit code
0,GENERATOR_EXECUTED=YES,MINIFIER_EXECUTED=YES, and anOUTPUT=path. Ifhtml-minifier-terseris unavailable or fails, treat the request as failed and do not deliver an unminified fallback.Verify that the
OUTPUTfile exists and that it is the only new HTML file created by the task. Remove the dedicated system temporary directory, then return the exactOUTPUTpath.
Template boundary
Treat assets/template.html as immutable. Before minification, the generator replaces only its single 邮件正文 placeholder. The required html-minifier-terser pass may collapse whitespace in the assembled deliverable, but it must not alter the fixed header, footer, shell semantics, global styles, links, attributes, or recipient-facing text.
Email body markup
Do not add width to <td> elements by default. This applies to both the width attribute and inline style="width:…". Allow a <td> width only when the layout genuinely requires fixed columns, image placeholders, or email-client compatibility. Prefer natural table sizing when none of those conditions applies.
Content language
Write newly generated recipient-facing email copy in English by default, including headings, paragraphs, labels, and calls to action. Treat English as a preference, not an override: use another language when the user explicitly requests it, and preserve user-supplied copy in its original language unless the user asks for translation or rewriting. Do not translate or otherwise alter fixed text in the WuKong template shell.
Template variables
Use Velocity Template Language (VTL) syntax by default whenever creating new template variables. Always wrap every newly generated variable reference in braces, including standalone references: write ${name} and ${enterClassLink}, never $name or $enterClassLink. Use the same braced reference form inside Velocity directives such as #if, #foreach, and #set for conditional, repeated, or derived content.
Do not invent Mustache, Handlebars, Jinja, or other placeholder forms such as {{name}} unless the user explicitly requests that syntax. Preserve variables supplied by the user exactly as written; the Velocity default applies only when the Skill creates a new variable or the user has not specified a template engine.
Non-negotiable rules
- Never substitute another script, direct file write, copy command, heredoc, formatter, or DOM serializer for
generate_email.py. - Never substitute another minifier for
html-minifier-terser, skip its failure, or deliver an unminified fallback. - Never return the body fragment as though it were the completed email.
- Never create a body-fragment
.htmlfile in the user's directory. - Never edit or overwrite
assets/template.html. - Never modify any template content outside the exact
邮件正文placeholder. - Never overwrite an existing output file; choose a new filename.
- Keep the generated body suitable for email clients: inline styles, conservative HTML, explicit dimensions where useful, and no JavaScript.
- If the request requires changing the fixed header, footer, shell, or global metadata, stop and explain that this skill permits body-only changes.
Red flags
Stop before delivery if any is true:
generate_email.pywas not executed.- The command output lacks
GENERATOR_EXECUTED=YES. - The command output lacks
MINIFIER_EXECUTED=YES. - The proposed deliverable is the body fragment.
- More than one new
.htmlfile was created. - The final HTML lacks the fixed WuKong header or footer.
Fix the workflow and rerun the generator; do not waive the gate.