Skip to content

yzsp-studio/mediakit-shared-suite / artifact-preview

artifact-preview

Verified

Render workspace artifacts (pdf/pptx/docx/xlsx/html/png/jpg/txt/zip) into text + page screenshots + thumbnail + multi-page collages, saved under ./.preview/{hash}/. Use Read on the resulting jpg/png files to visually inspect your own deliverables before delivering them; it catches what a structural checker cannot — text truncation, colour clashes, clipped chart titles, layout drift, blank slides, CJK rendered as boxes. Triggered by: "看看产物长什么样", "视觉自检", "preview pptx", "render artifact", "screenshot pdf", "渲染产物", "我的报告画出来好看吗", "图表是否完整".

FileKindSize
README.mdmarkdown7.6 KB
SKILL.mdskill md10.1 KB
bin/previewother2.0 KB
bin/preview.cmdscript482 B
lib/__init__.pyscript1.7 KB
lib/_common.pyscript13.1 KB
lib/_types.pyscript3.5 KB
lib/cache.pyscript3.3 KB
lib/cli.pyscript10.2 KB
lib/collage.pyscript4.6 KB
lib/dispatch.pyscript8.3 KB
lib/docx.pyscript1.1 KB
lib/html.pyscript2.1 KB
lib/image.pyscript1.4 KB
lib/manifest.pyscript2.7 KB
lib/pdf.pyscript2.2 KB
lib/pptx.pyscript2.5 KB
lib/render/__init__.pyscript2.4 KB
lib/render/collage.pyscript10.9 KB
lib/render/constants.pyscript1.4 KB
lib/render/docx.pyscript2.2 KB
lib/render/html.pyscript12.4 KB
lib/render/pdf.pyscript3.4 KB
lib/render/pptx.pyscript5.6 KB
lib/render/types.pyscript1.3 KB
lib/render/xlsx.pyscript2.9 KB
lib/text.pyscript1.4 KB
lib/xlsx.pyscript1.1 KB
lib/zip_.pyscript1.4 KB
requirements.txtmanifest4.2 KB

bin/preview

View on GitHub
#!/usr/bin/env python3
"""preview — render workspace artifacts (PDF/PPTX/DOCX/XLSX/HTML/...)
into text + per-page PNG screenshots + collage JPEGs that the model can
consume via ``Read``.

Usage:
    preview render <file>            # render and emit JSON summary
    preview info <hash|dir|file>     # dump cached manifest as JSON
    preview list                     # list cached previews
    preview clean [<hash> | --all]   # remove cached previews

All subcommands print structured JSON to stdout. Output of ``render``
points at ``manifest.json``, ``text.md``, ``thumb.jpg`` and ``collages/``,
which the model then reads with the ``Read`` tool to inspect.

Hub layout (verifier-hub-style):
    bin/preview          ← this entry point
    lib/cli.py           ← argparse subcommands
    lib/dispatch.py      ← detect_kind + render dispatcher
    lib/render/          ← pure rendering primitives (lazy_import deps)
"""
from __future__ import annotations

import os
import sys

# The contract is "one JSON object on stdout", written with
# ensure_ascii=False so the original Unicode survives. On Windows a piped
# stdout defaults to the legacy ANSI code page (cp936 on a zh-CN host), and
# any character outside it — a rare hanzi, an emoji — makes the write raise
# UnicodeEncodeError and kills the tool. Force UTF-8 before anything can
# write; on POSIX the streams are already UTF-8 so this is a no-op.
for _stream in (sys.stdout, sys.stderr):
    try:
        if _stream.encoding and _stream.encoding.lower().replace("-", "") != "utf8":
            _stream.reconfigure(encoding="utf-8", errors="replace")
    except (AttributeError, ValueError):
        pass

# Make ``lib/*`` importable when invoked via the absolute hub path
# (/home/user/.../workspace/.skills/artifact-preview/bin/preview).
_HERE = os.path.dirname(os.path.abspath(__file__))
_HUB_ROOT = os.path.dirname(_HERE)
if _HUB_ROOT not in sys.path:
    sys.path.insert(0, _HUB_ROOT)

from lib.cli import main  # noqa: E402

if __name__ == "__main__":
    sys.exit(main())
canvas-designanthropics/skillsCreate beautiful visual art in .png and .pdf documents using design philosophy. You should use this skill when the user asks to create a poster, piece of art, design, or other static piece. Create original visual designs, never copying existing artists' work to avoid copyright violations.Stars: 198kUpdated Claude CodeCodexVerifiedInstall
docxanthropics/skillsUse this skill whenever the user wants to create, read, edit, or manipulate Word documents (.docx files) or Word templates (.dotx files). Triggers include: any mention of 'Word doc', 'word document', '.docx', '.dotx', or requests to produce professional documents with formatting like tables of contents, headings, page numbers, or letterheads. Also use when extracting or reorganizing content from .docx or .dotx files, inserting or replacing images in documents, performing find-and-replace in Word files, working with tracked changes or comments, or converting content into a polished Word document. If the user asks for a 'report', 'memo', 'letter', 'template', or similar deliverable as a Word or .docx file, use this skill. Do NOT use for PDFs, spreadsheets, Google Docs, or general coding tasks unrelated to document generation.Stars: 198kUpdated Claude CodeCodexVerifiedInstall
pdfanthropics/skillsUse this skill whenever the user wants to do anything with PDF files. This includes reading or extracting text/tables from PDFs, combining or merging multiple PDFs into one, splitting PDFs apart, rotating pages, adding watermarks, creating new PDFs, filling PDF forms, encrypting/decrypting PDFs, extracting images, and OCR on scanned PDFs to make them searchable. If the user mentions a .pdf file or asks to produce one, use this skill.Stars: 198kUpdated Claude CodeCodexVerifiedInstall
pptxanthropics/skillsUse this skill any time a .pptx or .potx file is involved in any way — as input, output, or both. This includes: creating slide decks, pitch decks, or presentations; reading, parsing, or extracting text from any .pptx or .potx file (even if the extracted content will be used elsewhere, like in an email or summary); editing, modifying, or updating existing presentations; combining or splitting slide files; working with templates (.potx), layouts, speaker notes, or comments. Trigger whenever the user mentions "deck," "slides," "presentation," or references a .pptx or .potx filename, regardless of what they plan to do with the content afterward. If a .pptx or .potx file needs to be opened, created, or touched, use this skill.Stars: 198kUpdated Claude CodeCodexVerifiedInstall