web-artifacts-builder
Suite of tools for creating elaborate, multi-component claude.ai HTML artifacts using modern frontend web technologies (React, Tailwind CSS, shadcn/ui). Use for complex artifacts requiring state management, routing, or shadcn/ui components - not for simple single-file HTML/JSX artifacts.
1How It Works & Mechanism
The mechanism follows a two-stage 'scaffolding + bundling' pipeline: init-artifact.sh uses pnpm create vite on the fly to generate a React-TS project, installs Tailwind and shadcn dependencies, and unpacks 43 pre-packaged shadcn/ui components; bundle-artifact.sh builds the project using Parcel and inlines it into a single bundle.html via html-inline.
1. Initialize the frontend repo using `scripts/init-artifact.sh` 2. Develop your artifact by editing the generated code 3. Bundle all code into a single HTML file using `scripts/bundle-artifact.sh`
Components are shipped directly with the package rather than fetched on demand: shadcn-components.tar.gz bundles 40+ components/ui/*.tsx files, ready to use via offline extraction, avoiding component-by-component CLI downloads.
✅ 40+ shadcn/ui components pre-installed
Output philosophy = a single self-contained HTML file: bundle.html inlines all JS, CSS, and dependencies, ready to be shared directly as a claude.ai artifact or opened in a browser.
This creates `bundle.html` - a self-contained artifact with all JavaScript, CSS, and dependencies inlined. This file can be directly shared in Claude conversations as an artifact.
Scope discipline: Exclusively serves 'multi-component / stateful / routed / complex interactive' artifacts; simple single-file HTML/JSX is explicitly out of scope (complexity must be evaluated before triggering).
Use for complex artifacts requiring state management, routing, or shadcn/ui components - not for simple single-file HTML/JSX artifacts.
Testing/visualization is explicitly downgraded to an optional post-generation step: Avoids adding latency before the user can see the finished artifact; issues are tested only if they arise.
Note: This is a completely optional step. Only perform if necessary or requested.
Built-in anti-'AI slop' styling rules: Explicitly bans overly centered layouts, purple gradients, uniform border-radii, and the Inter font.
VERY IMPORTANT: To avoid what is often referred to as "AI slop", avoid using excessive centered layouts, purple gradients, uniform rounded corners, and Inter font.
2Core Capabilities
3External Dependencies
| Kind | Dependency / Endpoint |
|---|---|
| network | npm registry(registry.npmjs.org) |
| package | create-vite / vite / tailwindcss@3.4.1 / postcss / autoprefixer / tailwindcss-animate / class-variance-authority / clsx / tailwind-merge / lucide-react / next-themes / @radix-ui/react-*(20+)/ sonner / cmdk / vaul / embla-carousel-react / react-day-picker / react-resizable-panels / date-fns / react-hook-form / zod |
| package | parcel / @parcel/config-default / parcel-resolver-tspaths / html-inline(打包期,bundle 脚本安装) |
| cli | node ≥18 / pnpm(宿主环境) |
4Recommended Governance & Evidence
- scripts/: Executes local scripts or commands: init-artifact.sh / bundle-artifact.sh (bash) → internally runs pnpm (create/install/add/e
- 网络端点: Declares external network access: During each initialization: registry.npmjs.org (pnpm create vite, multiple rounds of pnpm install dependencies, pnpm add parcel
- 本地工作目录: File read/write and artifact output: Complete project directory (package.json/tsconfig/vite.config/src components, etc.)
5Second-Pass Verification
- [ok] 40+ 组件声称 vs tarball — tar -tzf 实测 43 个 components/ui/*.tsx(含 sonner/drawer/resizable),声称成立。
- [ok] init 脚本步骤与 SKILL 流程一致 — create vite(react-ts)→ 清理模板 → 装 tailwind/依赖 → 写 postcss/tailwind/vite/tsconfig → tar 解包,SKILL 描述可逐句对应。
- [ok] bundle 单文件化 — parcel build --no-source-maps + html-inline 输出 bundle.html;.parcelrc tspaths 配置存在。
- [ok] 网络外发对象 — 无自有端点/回调;全部为 pnpm→registry.npmjs.org(create-vite/tailwind/radix/parcel)。版本 pin:tailwindcss@3.4.1 固定,create-vite 与多数依赖取 latest——版本漂移与供应链留意点已在 reason 说明。
- [ok] 凭证读取 — skill 脚本零凭证读取;pnpm 读 ~/.npmrc 属包管理器宿主行为(已在 credential_reads 注明,非脚本显式读取)。
- [ok] PROJECT_NAME 注入点 — pnpm create vite "$PROJECT_NAME" 引号安全;sed 标题替换串未转义(& / \ 字符可破坏表达式)——本地低危输入面,已在 injection_surface 记录。
- [ok] Node 版本门禁 — 脚本有 NODE_VERSION < 18 拒绝与 Vite 版本 pin 逻辑,与 SKILL 'Node 18+ compatibility' 声称一致。
- [ok] 元数据 — 本地 HEAD==pin 41bbe19;Apache-2.0 LICENSE.txt。
6Verdict & Scenarios
c56ef465edf880ee…