بنقرة واحدة
preview-server
Preview server — download, start, stop, and control the design preview with live reload at port 3000
التثبيت باستخدام Codex أو Claude انسخ هذا Prompt والصقه في Codex أو Claude أو مساعد آخر ليراجع صفحة Skill ويثبّتها لك.
القائمة
Preview server — download, start, stop, and control the design preview with live reload at port 3000
التثبيت باستخدام Codex أو Claude انسخ هذا Prompt والصقه في Codex أو Claude أو مساعد آخر ليراجع صفحة Skill ويثبّتها لك.
Color palette management — generate standard YAML palettes from built-in library, external search, URL extraction, or traditional Chinese colors
Manage design-spec.css — match resource library, handle medium differentiation (web/app/poster), auto-learn from completed projects
Font management — list, install, remove, and recommend fonts from 11 seed typefaces + Google Fonts
Manage global design conventions — .conventions.yml for fonts, viewport, CSS rules, HTML rules, images, and typography defaults
Create and manage HTML pages from design templates — web, app, and poster mediums
Create and manage design project structure — project.yml, directory layout, and medium separation (web/app/poster)
استنادا إلى تصنيف SOC المهني
| name | preview-server |
| trigger | When previewing a project, starting the preview server, taking screenshots, or after creating/modifying a design project |
| description | Preview server — download, start, stop, and control the design preview with live reload at port 3000 |
Start and manage the design preview server. The server is hosted at GitHub
YaoApp/design-assets and downloaded on demand. It provides live reload
via WebSocket and serves all design projects under the workspace.
The preview server is a daemon — once started, it stays running for the
entire session. Use start.sh to ensure it's alive (idempotent: it skips
if already running). Only restart when the server itself has been updated.
All scripts are in $CTX_SKILLS_DIR/preview-server/. Run them via bash:
| Script | Purpose |
|---|---|
download.sh | Download or update the preview server from GitHub |
check.sh | Check if the preview server is running |
start.sh | Idempotent start — download + start if not already running |
stop.sh | Stop the running preview server |
restart.sh | Stop then start (use after server version update) |
bash $CTX_SKILLS_DIR/preview-server/start.sh
This downloads the server if needed, then starts it if it's not already running. It is safe to call after every file change — it won't restart unnecessarily.
bash $CTX_SKILLS_DIR/preview-server/check.sh
Only needed when the preview server version changed and dist.zip was re-downloaded:
bash $CTX_SKILLS_DIR/preview-server/restart.sh
bash $CTX_SKILLS_DIR/preview-server/stop.sh
Always include ?theme= and ?lang= parameters:
# Parse theme
THEME="${CTX_THEME:-dark}"
case "$THEME" in
light) THEME="light" ;;
*) THEME="dark" ;;
esac
# Parse locale
CTX_LOCALE="${CTX_LOCALE:-en-us}"
LANG="${CTX_LOCALE%%-*}"
case "$LANG" in
zh) LANG="zh" ;;
*) LANG="en" ;;
esac
Then output the link:
[Design Preview](service://local/{session}/3000?theme=dark&lang=en)
| Context | Link |
|---|---|
| Dark + English | service://local/{session}/3000?theme=dark&lang=en |
| Dark + Chinese | service://local/{session}/3000?theme=dark&lang=zh |
| Light + English | service://local/{session}/3000?theme=light&lang=en |
| Light + Chinese | service://local/{session}/3000?theme=light&lang=zh |
The preview server SPA (project list, sidebar, 404 page) applies theme and language from these parameters. Users can toggle theme/language via sidebar buttons at runtime.
Preview server uses WebSocket for automatic live reload. No manual refresh needed when project files change.
curl -X POST http://localhost:3000/api/screenshot \
-H "Content-Type: application/json" \
-d '{"path": "/{project}/index.html", "scale": 2, "width": 1200}' \
-o $WORKDIR/design-works/{project}/.captures/screenshot.png
bash $CTX_SKILLS_DIR/preview-server/start.sh to ensure the server is alivestart.sh is idempotent: call it freely, it skips if already runningrestart.sh after the preview server dist.zip was re-downloaded (version bump)YaoApp/design-assets, never bundleddownload.sh runs npm install --production if node_modules/ is missing?theme= and ?lang= params to the preview link$CTX.THEME, locale from $CTX.LOCALEpython3 -m http.server as a substituteWORKDIR env so the server can resolve .attachments/clips/ for clip_write