Template creator

From ahang1598/doubao-workbuddy-qwenwork-skills · View interactive version

Template creator is an AI agent skill from the GitHub repository ahang1598/doubao-workbuddy-qwenwork-skills. Create or update a reusable personal Codex artifact-template skill. Use when the user invokes $template-creator or asks in natural language to create a reusable template from a reference document, presentation, spreadsheet, Google Docs, Slides, or Sheets link, ImageGen or Product Design image, email

How to use this skill

Skill file

Template Creator

Create or update a reference-backed template. Keep the source file, Site project, or a canonical Google Workspace URL and rendered reference image inside the skill so later use can reproduce its structure, voice, and visual system precisely.

Routing

Create workflow

  1. Require exactly one supported reference unless the user explicitly requests a batch. For a batch, complete this workflow separately for every reference:
  1. Infer a concise display name and intended-use description from the reference and request. Infer document, presentation, spreadsheet, and image from the file extension. For a Site project directory, use site. Infer google-docs, google-slides, or google-sheets from the supplied Workspace URL; for a generic Drive share URL, use Google Drive metadata to identify the native file type and resolve its canonical docs.google.com URL. Ask only when the link is inaccessible or does not identify a supported native Workspace artifact. For an image, set its gallery kind to product-design when the request includes @Product Design; otherwise default to imagegen, including when the user provides only the image and this skill. Ask only when the request explicitly includes both Product Design and ImageGen and the intended target remains unclear. For .txt, determine whether the user requested email or slack; ask if the intended type is ambiguous.
  2. For references other than Site projects, create preview.png before packaging:

Load the workspace dependencies and use the checked-in file bridge for Google Docs and Slides PDF exports and Google Sheets XLSX exports. Run this inside one functions.exec call. The bridge resolves the Google Drive fetch action, requests an authenticated raw export, validates the returned base64 file, and writes it inside the task workspace without exposing it to a shell argument or browser download:

const SKILL_DIR = "<absolute-template-creator-skill-directory>";
const WORKSPACE = "<absolute-task-workspace>";
const NODE_BIN = "<absolute-node-path-from-workspace-dependency-loader>";
const usesPowerShell = /^(?:[A-Za-z]:[\\/]|\\\\)/.test(SKILL_DIR);
const loadCommand = usesPowerShell
  ? "Get-Content -Raw -LiteralPath '.\\host\\export-google-workspace-file.mjs'"
  : "/bin/cat -- ./host/export-google-workspace-file.mjs";
const loaded = await tools.exec_command({
  cmd: loadCommand,
  shell: usesPowerShell ? "powershell.exe" : "/bin/sh",
  workdir: SKILL_DIR,
  login: false,
  yield_time_ms: 30000,
  max_output_tokens: 30000,
});
if (loaded.exit_code !== 0)
  throw new Error("Could not load the Google Workspace exporter");
const exportGoogleWorkspaceFile = new Function(
  `${loaded.output}\nreturn exportGoogleWorkspaceFile;`,
)();
const result = await exportGoogleWorkspaceFile({
  sourceUrl: "<canonical-google-workspace-url>",
  mimeType: "<application/pdf-or-xlsx-mime-type>",
  nodePath: NODE_BIN,
  receiverPath: `${SKILL_DIR}/host/google-workspace-export-stdin-receiver.mjs`,
  outputPath: `${WORKSPACE}/<reference.pdf-or-reference.xlsx>`,
  workspaceRoot: WORKSPACE,
  tools,
});
text(JSON.stringify(result));

Use the canonical docs.google.com URL, including any resourcekey query parameter required for link access. Use application/pdf and an output ending in .pdf for Google Docs and Slides. Use application/vnd.openxmlformats-officedocument.spreadsheetml.sheet and an output ending in .xlsx for Google Sheets. Do not manually copy base64 export content into a command or file-editing tool.

  1. Visually inspect the PNG when one was created. Stop if it is blank, clipped, corrupted, or not representative of the reference. Site templates use a bundled generic Sites PNG preview and do not require a screenshot.
  2. Do not create an intermediary request file or use a file-editing tool for script inputs. Set SKILL_DIR to the directory containing this SKILL.md, load the workspace dependency runtime, and pass the values directly. Before substituting real values into the command, shell-escape each value as one argument for the active shell. Never interpolate a raw path, display name, description, or skill name.
"$NODE_BIN" "$SKILL_DIR/scripts/create-template-skill.mjs" \
  --reference-path "/absolute/path/reference.docx" \
  --preview-path "/absolute/path/preview.png" \
  --display-name "Standup" \
  --description "Run a structured daily standup with updates, blockers, and owners."

Use the Node path returned by the dependency loader for NODE_BIN. Do not use a system Node installation.

Pass --kind "image" and --gallery-kind "imagegen" or --gallery-kind "product-design" for image templates. Pass --kind "email" or --kind "slack" for text templates, and --kind "site" for Site project directories. The script can infer the three Office kinds and image from their extensions, but Template Creator must pass the image gallery kind explicitly so ImageGen and Product Design templates remain separate. .txt always requires --kind "email" or --kind "slack". Site templates never require --preview-path.

For a Google Workspace template, pass its exact kind, resolved docs.google.com link as --source-url, and the rendered PNG as both the reference and preview inputs. The script validates that the link matches the requested kind and stores a canonical file URL without account-routing or deep-link parameters while preserving a resourcekey required for link-based access.

"$NODE_BIN" "$SKILL_DIR/scripts/create-template-skill.mjs" \
  --kind "google-docs" \
  --source-url "https://docs.google.com/document/d/example/edit?usp=sharing" \
  --reference-path "/absolute/path/reference.png" \
  --preview-path "/absolute/path/reference.png" \
  --display-name "Project Brief" \
  --description "Create project briefs with this Google Doc's native structure and visual system."
"$NODE_BIN" "$SKILL_DIR/scripts/create-template-skill.mjs" \
  --kind "image" \
  --gallery-kind "product-design" \
  --reference-path "/absolute/path/reference.png" \
  --preview-path "/absolute/path/preview.png" \
  --display-name "Launch Visual" \
  --description "Create launch visuals with this product-design direction."
"$NODE_BIN" "$SKILL_DIR/scripts/create-template-skill.mjs" \
  --kind "email" \
  --reference-path "/absolute/path/reference.txt" \
  --preview-path "/absolute/path/preview.png" \
  --display-name "Launch Email" \
  --description "Draft launch emails with this structure, voice, and call to action."
"$NODE_BIN" "$SKILL_DIR/scripts/create-template-skill.mjs" \
  --kind "site" \
  --reference-path "/absolute/path/existing-site" \
  --display-name "Marketing Site" \
  --description "Create a marketing site with this layout and component system."
  1. Read the JSON result. Verify that skillName begins with artifact-template- and that the generated directory contains SKILL.md, artifact-template.json, agents/openai.yaml, and assets/preview.png. For Site templates, verify that the project is retained in assets/source with the generic Sites preview. Read the original project's .gitignore when present, inspect assets/source, and remove ignored files, project-specific credentials, customer exports, runtime data, generated archives, and unnecessary large files from the generated copy without modifying the original project before reporting success. For all other templates, verify the retained canonical assets/reference.<ext>. For a Google Workspace template, also verify that the manifest contains the canonical sourceUrl and assets/reference.png. If any check fails, do not claim the template was created or emit an artifact-template card.

Update workflow

  1. Resolve the exact passed artifact-template skill and read its SKILL.md, artifact-template.json, agents/openai.yaml, retained reference, and preview. Stop if it is not a direct child of the personal skills directory or if more than one target was passed.
  2. Preserve the skill folder name. For Sites, rebuild the entire template from the selected source; for other templates, preserve every file or behavior the user did not ask to change.
  3. Apply the requested edit:
  1. When the reference, preview, display name, or description changes, pass the existing kind and values for every unchanged field directly to the script. For an image template, also pass its existing galleryKind as --gallery-kind. For a Google Workspace template, pass its existing or explicitly updated sourceUrl as --source-url. For a Site template, pass the updated project directory or the existing template's assets/source, as selected above, as --reference-path without --preview-path. Do not create or edit a request file:
"$NODE_BIN" "$SKILL_DIR/scripts/create-template-skill.mjs" \
  --mode "update" \
  --skill-name "artifact-template-standup" \
  --kind "document" \
  --reference-path "/absolute/path/updated-reference.docx" \
  --preview-path "/absolute/path/updated-preview.png" \
  --display-name "Standup" \
  --description "Run a structured daily standup with updates, blockers, and owners."
  1. The script validates the existing template kind, preserves additional skill-owned files, and replaces the package atomically without changing its skill name.
  2. Verify every requested change in the target directory and confirm there are no staging or backup directories left behind.

Response

After verification, replace the placeholders with the script result and respond with only the applicable content between the comment markers below. The markers delimit the response template; do not emit them. For templates other than Sites, also include the card directive:

<!-- TEMPLATE CREATOR RESPONSE START -->

Here’s your {displayName} template.

How to find templates

Find it in the Template Gallery when @{kind} is added to the prompt.

How to use a template

Tag ${skillName} and describe what you want to build.

::artifact-template{skill_name="{skillName}" skill_directory="{skillPath}" display_name="{displayName}" artifact_kind="{kind}"}

<!-- TEMPLATE CREATOR RESPONSE END -->

Formatting rules:

Constraints

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.