← 输入框|github.com|刷新
Skip to content

About

用 React + shadcn/ui 生成单个自包含 HTML 文件的 agent skill,无需服务端,双击就能打开。An agent skill that generates single-file, self-contained HTML with React + shadcn/ui — no server needed, just double-click to open.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Repository files navigation

html-artifact-builder

skills.sh

English · 简体中文

An agent skill (per the Agent Skills specification) that produces one self-contained HTML file: no server, no CDN, nothing fetched at runtime, just double-click to open. You do not run the scripts yourself — you describe the deliverable, the agent selects this skill from its description, then follows SKILL.md.

What to ask for

Plain language is enough:

  • "Turn this Markdown into a shareable page"
  • "Build a status page with tabs and progress bars, export it as one HTML file"
  • "Render this release note with a sidebar and search"

Two paths, and the agent picks between them:

Path What the agent does
Compose a page in React (main) Scaffolds with init-artifact.sh, edits src/App.tsx, bundles with bundle-artifact.sh — 43 shadcn/ui components
Start from a document Runs md-to-html.sh — sidebar TOC with scroll-spy, search, offline highlighting, copy buttons, callouts

Both paths put a generation timestamp (YYYY-MM-DD HH:MM:SS, baked in at build time) at the very top of the page, so a reader can tell how current the file is.

See it first — the renderer's own smoke test, already rendered to a single file.

Rendered sample: sticky contents sidebar, search box, a callout and a highlighted code block

A modified derivative of Anthropic's web-artifacts-builder, now maintained independently under Apache 2.0. Reasoning: DECISIONS.md; file-level record: NOTICE.md.

Value, and how it differs from upstream

Handing someone a finished document is the awkward part: deployments rot, links die, attachments do not open. One HTML file avoids all three, and the environment setup that usually stops people is what this skill does for you.

Anthropic's web-artifacts-builder This project
Built for claude.ai HTML artifacts Any agent skill; the output is a local file
Bundler Parcel 2.16 + html-inline Vite + vite-plugin-singlefile
Self-containment Reported, not checked Checked after every build; a leak fails it
Markdown input None md-to-html.sh — TOC, search, offline highlighting
Components One 20 KB tarball 45 files (43 components + helpers), MIT headers
Hosts macOS / Linux macOS / Linux / WSL / Git Bash

Two of those decide whether you get a file at all:

  • Bundling works on current dependencies. Parcel cannot resolve @radix-ui/primitive's nested export conditions, so upstream's bundling step fails instead of producing output. Vite does not have that problem.
  • The output is verified, not assumed. An accidental /assets/... reference goes blank the moment the file is moved; bundle-artifact.sh exits non-zero rather than shipping it.

Requirements

The agent runs the scripts, so these must be on the machine first:

Requirement Notes
Node.js 20.19+ or 22.12+ Checked by init-artifact.sh (Vite's engine range)
pnpm Installed globally by the script if missing
python3 Embeds content and rewrites <title>; probed as python3 → python → py
Bash macOS / Linux / WSL natively; on Windows use Git Bash

There is no zero-dependency mode: if you need one, write a static HTML file instead. The first run installs ~40 npm packages.

On Windows the scripts must run from Git Bash or WSL, not PowerShell or cmd. python3 is probed rather than assumed (the Microsoft Store leaves a python3.exe that fails), and .gitattributes pins LF so core.autocrlf=true cannot mangle the scripts.

Install

npx skills add python012/html-artifact-builder   # add -g for a user-level install

Or copy this directory into ~/.agents/skills/ (shared by DSH, OpenCode and Claude-compatible agents), ~/.claude/skills/ for Claude Code, or .github/skills/ inside a repository for GitHub Copilot. The directory name must match name: in SKILL.md. npx itself needs Node 22.20+.

Let your agent do it

Installing the skill itself runs no build and installs nothing globally, so copying the directory is the whole install. Paste this into your agent:

Install the agent skill at https://github.com/python012/html-artifact-builder on this machine.

  1. Read README.md and SKILL.md in that repository first, so you know what the skill does and what it needs.
  2. Check the machine against the requirements: Node.js 20.19+ or 22.12+, pnpm, python3, and bash (on Windows, Git Bash — not PowerShell).
  3. Copy the whole repository into the skills directory your own runtime loads — ~/.agents/skills/, ~/.claude/skills/, or .github/skills/ in this project. Keep every file (scripts/, templates/, licenses/); the scripts are useless without them. The directory name must stay html-artifact-builder.
  4. Tell me the install path, anything still missing, and what to say to trigger it.

The agent knows its own skills directory; SKILL.md carries the rest.

License

  • This project: Apache License 2.0 — LICENSE.txt
  • Upstream: Apache 2.0, Copyright 2026 Anthropic, PBC
  • Bundled shadcn/ui components: MIT, Copyright (c) 2023 shadcn — licenses/shadcn-ui-MIT.txt

Changes are recorded in NOTICE.md as Apache 2.0 §4(b) requires; reasoning is in DECISIONS.md. Per §6, no trademark rights are granted — this project is not affiliated with or endorsed by Anthropic.

About

用 React + shadcn/ui 生成单个自包含 HTML 文件的 agent skill,无需服务端,双击就能打开。An agent skill that generates single-file, self-contained HTML with React + shadcn/ui — no server needed, just double-click to open.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages