Community图像github.com

training-poster

生成竖版培训/课程宣传海报 PNG(培训海报、课程海报、活动海报、promotion poster),或打开海报编辑 Web UI 供人工调整。当用户说“开始生成培训海报 / 做一张培训海报 / 做张海报 / 生成宣传图 / 导出 PNG / 改配色再出一版”,或要求“打开海报编辑器 / 工作台 / 预览界面自己调”时使用。默认打开 Web UI 让用户自己调,只有明确批量/无人值守才直接出图。支持线上与线下培训、北京时间自动换算欧中/美西/美东、按主色自定义配色;输出 750px 宽、默认 2 倍图(1500px 宽)的 PNG。

training-poster 是什么?

training-poster is a Claude Code agent skill that 生成竖版培训/课程宣传海报 PNG(培训海报、课程海报、活动海报、promotion poster),或打开海报编辑 Web UI 供人工调整。当用户说“开始生成培训海报 / 做一张培训海报 / 做张海报 / 生成宣传图 / 导出 PNG / 改配色再出一版”,或要求“打开海报编辑器 / 工作台 / 预览界面自己调”时使用。默认打开 Web UI 让用户自己调,只有明确批量/无人值守才直接出图。支持线上与线下培训、北京时间自动换算欧中/美西/美东、按主色自定义配色;输出 750px 宽、默认 2 倍图(1500px 宽)的 PNG。.

兼容平台✓Claude Code~Codex CLI✓Cursor
npx skills add https://github.com/l1linus/training-poster-creator/tree/HEAD

Installed? Explore more 图像 skills: steipete/songsee, affaan-m/frontend-design, mattpocock/improve-codebase-architecture · View all 6 →

在你喜欢的 AI 中提问

打开一个已预加载此 Agent Skill 的新对话。

文档

Training Poster Generator (Local Render) · 🌐 中文

Renders structured training information into a vertical tech-style poster PNG. Does not rely on Feishu runtime, requires no login, and needs no network interface; it simply starts a temporary static service locally and captures a screenshot using a headless browser.

Default Behavior (Important)

When users say "Generate a training poster," "Make a training poster," or "Open the poster workspace," default to opening the Web UI — do not call render_poster, and do not ask for parameters first.

Startup flow (always use the same entry point; idempotent):

  • Windows: powershell -NoProfile -ExecutionPolicy Bypass -File scripts/bootstrap.ps1
  • macOS / Linux: bash scripts/bootstrap.sh

The script detects Node.js (downloads a portable version to .runtime/ if missing) → starts the workspace → returns { ok, url }. Open the url for the user; if it cannot be opened, send them the link.

Only use render_poster / render.mjs when users explicitly request "batch / no interface needed / give me the image directly / generate N images."

What It Can Do

  • Open full Web UI: npm run ui (or node scripts/open-ui.mjs) starts the service in the background and returns a URL; users can select templates/colors, fill forms, crop photos, preview in real-time, and export PNG. This is the preferred method when manual adjustments are needed.
  • Input JSON → Output PNG: node scripts/render.mjs --data job.json --out poster.png (for batch/headless usage)
  • Instructor photos, QR codes: pass local image paths directly; the script automatically converts them to dataURLs.
  • Automatically convert Beijing time to Europe Central, US West, and US East timezones with DST/Standard time annotations.
  • Three color schemes: built-in deep blue tech (default), color extraction from a reference image, manual primary/accent color specification.
  • Interactive Web UI for humans: node scripts/preview.mjs
  • MCP server: node scripts/mcp.mjs (can be mounted directly by Claude Desktop / Cursor / DSH, etc.)

Integration Methods

  1. Command-capable agents: Run bootstrap.ps1 / bootstrap.sh first and give the workspace URL to the user; only run render.mjs for batch/headless.
  2. MCP-compatible clients: Use open_editor to open the workspace, render_poster for batch output (see end of document).
  3. SKILL.md-compatible runtimes (DSH / Claude Code, etc.): Place the entire directory into the skills directory.

When to Open the Workspace

User IntentAction
Wants to pick templates, change colors, preview, fine-tuneopen_editor / open-ui.mjs, give URL to user
Batch, scheduled, headless outputrender_poster / render.mjs
Only asks "can it be done / how to use"Explain both methods; recommend opening the workspace by default

After opening the workspace, do not call render_poster to generate images on behalf of the user, and do not modify 培训海报生成器 Training Poster Generator.html; wait for the user to export.

Privacy

  • No accounts, no databases; form content, photos, and QR codes are processed only in local memory and the temporary 127.0.0.1 service.
  • The build artifact has removed all Feishu-injected Slardar / Tea / performance monitoring scripts and adds CSP headers to block external resources and external connections.
  • No remote fonts are requested; system fonts are used; http(s) external image links are rejected and written into warnings.
  • Opening the workspace does not require internet; only the first bootstrap downloads a portable Node.js version if missing, and npm install downloads playwright-core.

Prerequisites

  • Node.js ≥ 20: Not required to be pre-installed; the first bootstrap run downloads a portable version to .runtime/ if missing.
  • Opening the workspace only needs a system browser (Edge/Chrome/Safari).
  • Batch output / MCP render_poster only requires npm install (playwright-core) and Edge/Chrome.

First Use (Someone Else's Computer)

# Windows
powershell -NoProfile -ExecutionPolicy Bypass -File scripts/bootstrap.ps1
# macOS / Linux
bash scripts/bootstrap.sh

Process: Detect Node → if missing, download portable version (≈ 35 MB, no system installation) → start workspace → output { ok, url, pid }. Give the url to the user's browser / WorkBuddy preview panel.

Self-Check

npm install                        # Only needed for batch output / MCP
node scripts/doctor.mjs            # Environment check: Node / app / playwright-core / browser
node scripts/doctor.mjs --render   # Also renders a real self-check image
node scripts/test.mjs              # End-to-end: render sample + MCP handshake
node scripts/audit.mjs             # Privacy: no monitoring scripts, no successful external network requests

All output JSON; ok: true indicates availability; on failure, checks indicates which item is missing.

Quick Start

# 1. Open workspace (preferred when manual adjustment is needed)
npm run ui

# 2. Render sample (batch/headless)
node scripts/render.mjs --data templates/example.json --out out/poster.png

# 2. Inline JSON (suitable for one-time agent calls)
node scripts/render.mjs --json '{"form":{"topic":"Understand the Customer","trainingDate":"2026-12-16","timeBeijing":"19:00","timeBeijingEnd":"20:00"}}' --out out/poster.png

# 3. 3x resolution
node scripts/render.mjs --data job.json --out poster.png --scale 3

# 4. Open interactive workspace (form on left, preview on right, export PNG)
node scripts/preview.mjs --port 4173

The script outputs JSON to stdout:

{
  "ok": true,
  "out": "E:\\...\\poster.png",
  "width": 1500,
  "height": 2740,
  "cssWidth": 750,
  "cssHeight": 1370,
  "scale": 2,
  "bytes": 1657563,
  "browser": "channel:msedge",
  "warnings": ["No qrcodeImage provided; poster shows \"QR code pending upload\" placeholder at bottom right"]
}

On failure, outputs { "ok": false, "error": "..." } and exits with code 1.

Input Format

{
  "form": {
    "seriesName": "Product Operations Training Camp - Session 18",
    "topic": "Tell the Business Story with Data",
    "courseFormat": "Online Training",
    "instructorName": "Lin Xiao",
    "instructorBio": "Product Operations Department",
    "instructorPhoto": "C:/photos/liming.jpg",
    "highlights": ["Master key methods for client communication", "Streamline cross-department collaboration processes"],
    "targetAudience": "All frontline operations colleagues",
    "trainingDate": "2026-12-16",
    "timeBeijing": "19:00",
    "timeBeijingEnd": "20:00",
    "includeEuropeTime": true,
    "qrcodeImage": "C:/photos/qr.png"
  },
  "template": { "mode": "blue" }
}

form Fields

FieldTypeRequiredDescription
topicstringYesMain title; recommended 10–20 characters; long titles wrap, increasing poster height
seriesNamestringNoSeries name at top, e.g., "Product Operations Training Camp - Session 18"
courseFormatstringNoOnline Training (default) / In-Person Training
trainingLocationstringRequired for in-personDisplayed at bottom right (replaces QR code) for in-person training
instructorNamestringNoInstructor's name
instructorBiostringNoInstructor's bio/department
instructorPhotostringNoLocal path or dataURL (no external links); leave blank for built-in silhouette
highlightsstring[]NoOne card per item; recommended 2–4 items, each ≤ 30 characters
targetAudiencestringNoSuitable audience
trainingDatestringNoYYYY-MM-DD; displayed as "M month D day" and used for timezone conversion
timeBeijingstringNoHH:mm, Beijing start time
timeBeijingEndstringNoHH:mm, Beijing end time
includeEuropeTimebooleanNoDefault true, shows Europe Central time
includeUsWestTimebooleanNoDefault false, shows US West time
includeUsEastTimebooleanNoDefault false, shows US East time
qrcodeImagestringNoLocal path or dataURL (no external links); for online training, leave blank to show placeholder
signupLinkstringNoUsed for promotional copy only, does not appear on poster

template Fields (Optional)

  • {"mode":"blue"}: Built-in deep blue tech color scheme (default)
  • {"mode":"manual","manualStyle":{"primaryColor":"#1A2F4A","secondaryColor":"#45E2EA"}}: Manual color scheme
  • {"mode":"custom","style":{...}}: Color scheme identified from a reference image (style structure same as above)

Relative path resolution for image fields: when using --data job.json, paths are resolved relative to the directory containing job.json; when using --json or inline calls, they are resolved relative to the current working directory. For Windows paths, use forward slashes C:/photos/a.jpg to avoid JSON escaping issues.

Rules & Limitations

  • Maximum 2 additional timezones; priority order: Europe Central → US West → US East
  • When courseFormat=In-Person Training, trainingLocation is required; otherwise, an error is returned.
  • Poster width is fixed at 750px; height varies with content (approximately 1100–1700px), not fixed 9:16; for a fixed aspect ratio, crop or add padding manually.
  • Fonts use system fonts (PingFang SC / Microsoft YaHei); no external font requests are made; font rendering may vary slightly by system.
  • Output is PNG with no transparent background; if the extension is not .png, only a warning is given; the content is still PNG.
  • Images only support local paths or dataURLs; http(s) external links are rejected and written into warnings.
  • If an image path does not exist or the format is unsupported, no error is thrown; it is treated as "not provided" and written into warnings.

Common Errors

ErrorResolution
Missing required field form.topicAdd topic
trainingLocation must be provided when courseFormat is "In-Person Training"Add location, or change to online training
ERR_MODULE_NOT_FOUND: playwright-coreRun npm install in the skill directory
No available browserInstall Edge/Chrome; or set POSTER_BROWSER, pass --browser to specify path
Image becomes text pathPath does not exist, format unsupported, or external link used; check warnings and use local file

MCP (Optional)

node scripts/mcp.mjs

Provides five tools:

  • open_editor({ port?, host? }): Starts the full Web UI, returns url / pid; use this when manual adjustment is needed
  • close_editor(): Closes the workspace
  • editor_status(): Checks if the workspace is running
  • render_poster({ job, out?, scale? }): Batch output; omit out to write to system temp directory
  • describe_poster_fields(): Returns field descriptions

open_editor requires the MCP client and tool to be on the same machine; cloud clients cannot access the returned 127.0.0.1 address.

In MCP-compatible clients, configure as a stdio server (use absolute paths for args):

{
  "mcpServers": {
    "training-poster": {
      "command": "node",
      "args": ["<absolute path to skill directory>/scripts/mcp.mjs"]
    }
  }
}

If the client cannot find node on Windows, replace command with the absolute path of node.exe.

Directory

SKILL.md                                       This documentation
SKILL.en.md                                    English documentation
培训海报生成器 Training Poster Generator.html   Single-file web app (double-click to use; server renders via /#/render)
training-poster-generator-en.html              English interface (also single file)
lib/index-file.mjs                             Locates the Chinese interface file (backward compatibility)
lib/server.mjs                                 Single-file static server (exposes /__job.json, /__health)
lib/open-browser.mjs                           Opens a URL with the system browser
lib/ui.mjs                                     Workspace start/reuse/close
lib/browser.mjs                                Cross-platform Edge/Chrome detection
lib/render-poster.mjs                          Rendering core (validation + screenshot + PNG size check)
scripts/render.mjs                             CLI: JSON -> PNG
scripts/bootstrap.ps1                          Windows one-click first time: detect/download Node + start workspace
scripts/bootstrap.sh                           macOS/Linux one-click first time
scripts/preview.mjs                            Start Web UI in foreground (blocking)
scripts/open-ui.mjs                            Start workspace in background and return URL
scripts/close-ui.mjs                           Close workspace
scripts/status-ui.mjs                          Check workspace status
scripts/mcp.mjs                                MCP stdio server
scripts/doctor.mjs                             Environment self-check
scripts/test.mjs                               End-to-end self-test
scripts/audit.mjs                              Privacy self-check (no external scripts / no successful external requests)
使用说明 Read Me.txt                           Quick start guide for both usage methods
USAGE.md                                       Usage guide (including WorkBuddy integration)
templates/example.json                         Runnable example
templates/fields.json                          Field descriptions

The UI is a single-file build (Vite standalone, hash routing). To change the layout, regenerate 培训海报生成器 Training Poster Generator.html from the original Feishu source code.

相关技能