web-artifacts-builder 是构建复杂 claude.ai HTML Artifact 的脚手架工具——用 init + bundle 两个 Shell 脚本,从空白到单文件 HTML 的完整管线。
- 🏗 项目初始化:一键创建 React 18 + TypeScript + Vite + Tailwind + shadcn/ui 项目
- 📦 单文件打包:使用 Parcel + html-inline 将完整项目打包为自包含 HTML
- 🧩 40+ shadcn/ui 组件预装:包括 dialog、form、table、card、dropdown 等
- 🔧 自动兼容:检测 Node.js 版本,自动匹配兼容的 Vite
- 🎨 反”AI 模板风”设计指南:避免通用、千篇一律的视觉风格
当用户请求”复杂 Artifact”、“多组件 React 应用”、“需要 shadcn/ui 的页面”、“完整的交互式 UI”等时触发。
One-Line Summary
Section titled “One-Line Summary”web-artifacts-builder is a scaffolding tool for building complex claude.ai HTML Artifacts — a complete pipeline from blank slate to single-file HTML using two Shell scripts: init + bundle.
Core Capabilities
Section titled “Core Capabilities”- 🏗 Project initialization: one-click create React 18 + TypeScript + Vite + Tailwind + shadcn/ui project
- 📦 Single-file bundling: use Parcel + html-inline to bundle the complete project into a self-contained HTML
- 🧩 40+ shadcn/ui components pre-installed: including dialog, form, table, card, dropdown, etc.
- 🔧 Auto-compatibility: detects Node.js version, auto-matches compatible Vite
- 🎨 Anti-”AI template” design guidelines: avoids generic, cookie-cutter visual styles
Trigger Scenarios
Section titled “Trigger Scenarios”Triggers when users request “complex artifact”, “multi-component React app”, “page needing shadcn/ui”, “complete interactive UI”, etc.
File Inventory
Section titled “File Inventory”- web-artifacts-builder
目录结构分析
Section titled “目录结构分析”web-artifacts-builder 是**“脚本驱动型”** Skill,结构精炼。2 个 Shell 脚本构成了完整的”开发 → 构建”管线。
- SKILL.md(约 75 行):定义了 5 步工作流 + 设计风格指南
- scripts/init-artifact.sh(约 320 行):完整的 React 项目脚手架——从零创建包含 Tailwind、shadcn/ui、Vite、路径别名的项目
- scripts/bundle-artifact.sh(约 55 行):使用 Parcel 构建 + html-inline 内联,生成自包含单 HTML 文件
SKILL.md 结构解析
Section titled “SKILL.md 结构解析”5 步工作流
Section titled “5 步工作流”- 初始化项目(Initialize):运行
init-artifact.sh <project-name>,创建完整的前端项目 - 开发 Artifact(Develop):编辑生成的代码,构建应用
- 打包为单文件(Bundle):运行
bundle-artifact.sh,生成bundle.html - 展示给用户(Display):将 bundle.html 作为 artifact 分享
- 测试(Test,可选):仅在需要时测试
React 18 + TypeScript + Vite + Parcel(打包)+ Tailwind CSS 3.4.1 + shadcn/ui
设计风格指南
Section titled “设计风格指南”SKILL.md 包含反”AI 模板风”指南——避免过度居中布局、紫色渐变、统一圆角和 Inter 字体。这与 frontend-design 的美学理念一致。
Directory Structure Analysis
Section titled “Directory Structure Analysis”web-artifacts-builder is a “Script-driven” Skill with a lean structure. 2 Shell scripts form a complete “develop → build” pipeline.
- SKILL.md (~75 lines): Defines 5-step workflow + design style guide
- scripts/init-artifact.sh (~320 lines): Complete React project scaffold — creates a project with Tailwind, shadcn/ui, Vite, path aliases from scratch
- scripts/bundle-artifact.sh (~55 lines): Uses Parcel build + html-inline to generate a self-contained single HTML file
SKILL.md Structure Analysis
Section titled “SKILL.md Structure Analysis”5-Step Workflow
Section titled “5-Step Workflow”- Initialize Project: Run
init-artifact.sh <project-name>, create complete frontend project - Develop Artifact: Edit generated code, build the application
- Bundle to Single File: Run
bundle-artifact.sh, generatebundle.html - Display to User: Share bundle.html as artifact
- Test (Optional): Only if needed
Tech Stack
Section titled “Tech Stack”React 18 + TypeScript + Vite + Parcel (bundling) + Tailwind CSS 3.4.1 + shadcn/ui
Design Style Guide
Section titled “Design Style Guide”SKILL.md includes anti-”AI template” guidance — avoid excessive centered layouts, purple gradients, uniform rounded corners, and Inter fonts. This aligns with the aesthetic philosophy of frontend-design.
Module Relationships
Section titled “Module Relationships”web-artifacts-builder 工作流
graph LR SKILL[SKILL.md] -->|指导| Claude Claude -->|Step 1| Init[scripts/init-artifact.sh] Claude -->|Step 2| Dev[开发 Artifact] Dev -->|Step 3| Bundle[scripts/bundle-artifact.sh] Bundle -->|输出| HTML[bundle.html] HTML -->|Step 4| User[展示给用户] Init -->|创建| Project[React + Vite + Tailwind + shadcn/ui] Project --> Dev style SKILL fill:#4fc3f7,stroke:#0288d1,color:#000 style Init fill:#81c784,stroke:#388e3c,color:#000 style Bundle fill:#81c784,stroke:#388e3c,color:#000 style HTML fill:#ce93d8,stroke:#7b1fa2,color:#000 style Project fill:#ffb74d,stroke:#f57c00,color:#000
Full Script Inventory
Section titled “Full Script Inventory”init-artifact.sh — Project Scaffold
Section titled “init-artifact.sh — Project Scaffold”| 脚本 | 语言 | 行数 | 复杂度 | 功能 |
|---|---|---|---|---|
init-artifact.sh | Shell | ~320 | ⭐⭐⭐ | 项目脚手架:React + Vite + Tailwind + shadcn/ui |
bundle-artifact.sh | Shell | ~55 | ⭐⭐ | 单文件打包:Parcel 构建 + html-inline 内联 |
| Script | Language | Lines | Complexity | Function |
|---|---|---|---|---|
init-artifact.sh | Shell | ~320 | ⭐⭐⭐ | Project scaffold: React + Vite + Tailwind + shadcn/ui |
bundle-artifact.sh | Shell | ~55 | ⭐⭐ | Single-file bundle: Parcel build + html-inline |
bundle-artifact.sh — 单文件打包
Section titled “bundle-artifact.sh — 单文件打包”bundle-artifact.sh — Single-File Bundling
Section titled “bundle-artifact.sh — Single-File Bundling”脚本依赖关系
Section titled “脚本依赖关系”init → develop → bundle 构成了完整的”脚手架 → 开发 → 打包”管线。两个脚本相对独立,但 bundle 脚本依赖 init 脚本创建的项目结构。
Script Dependency
Section titled “Script Dependency”init → develop → bundle forms the complete “scaffold → develop → bundle” pipeline. The two scripts are relatively independent, but bundle depends on the project structure created by init.
web-artifacts-builder 脚本依赖图
graph LR A[init-artifact.sh] -->|创建项目| B[React + Vite + Tailwind + shadcn/ui] B -->|开发| C[用户编辑源码] C -->|Step 3| D[bundle-artifact.sh] D -->|Parcel 构建| E[dist/] E -->|html-inline| F[bundle.html] style A fill:#81c784,stroke:#388e3c,color:#000 style D fill:#81c784,stroke:#388e3c,color:#000 style F fill:#ce93d8,stroke:#7b1fa2,color:#000
- “Scaffold + Bundle”模式:先搭建完整项目环境,再打包为自包含文件——兼顾开发体验和部署便捷性
- Shell 脚本作为 Skill 工具:在需要创建文件系统、安装依赖、运行构建等操作系统级操作时,Shell 比 Python 更自然
- 预构建组件 tarball:40+ shadcn/ui 组件被预先提取为 tarball,避免了 npx shadcn-ui add 的网络依赖
- 版本兼容检测:Node.js 版本自动检测 + Vite 版本锁定,确保在不同环境中运行一致
- 单文件输出:最终产出 bundle.html 是完全自包含的,可直接在 claude.ai 中运行
“如果你想为其他框架(Vue、Svelte、Solid)创建类似的脚手架 Skill…”
- 保留 Scaffold + Bundle 模式:脚手架 + 打包是最通用的模式
- 替换 init 脚本中的模板:将 React + Vite 替换为你的框架(Vue/Vite、SvelteKit、SolidStart)
- 保留 bundle 脚本逻辑:Parcel + html-inline 是框架无关的
- 替换组件库:将 shadcn/ui 替换为你的组件库(PrimeVue、SvelteShadcn、daisyUI)
- 更新设计指南:在 SKILL.md 中调整风格约束以适应新框架的特性
⚠️ shadcn-components.tar.gz 必须存在: init 脚本依赖这个 tarball——如果文件缺失或损坏,整个初始化流程会失败。这需要和脚本一起版本管理
⚠️ pnpm 依赖全局安装: 需要用户系统有 pnpm。脚本会尝试 npm install -g pnpm,但在受限环境中可能失败
⚠️ Node.js 版本兼容: Node 18 使用 Vite 5.4.11(不能使用 Vite 6)——版本锁定逻辑必须紧跟 Vite 的发布节奏
⚠️ Parcel 可能有兼容问题: parcel-resolver-tspaths 的版本需要和 Parcel 主版本匹配——锁定版本号很重要
⚠️ bundle.html 可能很大: 包含 React 运行时 + Tailwind + shadcn/ui 的 bundle 可能超过 1MB——需要在 SKILL.md 中告知用户
Design Highlights
Section titled “Design Highlights”- “Scaffold + Bundle” Pattern: Build a complete project environment first, then package into a self-contained file — balancing development experience and deployment convenience
- Shell Scripts as Skill Tools: Shell is more natural than Python for filesystem operations, dependency installation, and build processes
- Pre-built Component Tarball: 40+ shadcn/ui components pre-packaged as a tarball, avoiding npx shadcn-ui add’s network dependency
- Version Compatibility Detection: Auto-detect Node.js version + pin Vite version, ensuring consistent behavior across environments
- Single-File Output: The final bundle.html is fully self-contained, runnable directly in claude.ai
Reusable Patterns
Section titled “Reusable Patterns”Porting Guide
Section titled “Porting Guide”“If you want to create similar scaffolding Skills for other frameworks (Vue, Svelte, Solid)…”
- Keep Scaffold + Bundle pattern: scaffolding + bundling is the most universal pattern
- Replace init script template: swap React + Vite for your framework (Vue/Vite, SvelteKit, SolidStart)
- Keep bundle script logic: Parcel + html-inline is framework-agnostic
- Replace component library: swap shadcn/ui for your library (PrimeVue, SvelteShadcn, daisyUI)
- Update design guide: adjust style constraints in SKILL.md for the new framework’s features
Common Pitfalls
Section titled “Common Pitfalls”⚠️ shadcn-components.tar.gz must exist: init script depends on this tarball — if missing or corrupted, the entire init flow fails. Must be versioned with the script
⚠️ pnpm requires global install: user system needs pnpm. Script tries npm install -g pnpm but may fail in restricted environments
⚠️ Node.js version compatibility: Node 18 uses Vite 5.4.11 (not Vite 6) — version pinning must keep up with Vite’s release cadence
⚠️ Parcel may have compatibility issues: parcel-resolver-tspaths version must match Parcel main version — pinning versions is important
⚠️ bundle.html can be large: A bundle with React runtime + Tailwind + shadcn/ui may exceed 1MB — inform users in SKILL.md
| 模式 | 说明 | 适用于... |
|---|---|---|
| Scaffold + Bundle | 先搭建项目 -> 开发 -> 打包为单文件 | 任何需要"开发环境"+"生产部署"的 skill |
| Shell 作为工具 | 用 Shell 处理文件系统、依赖安装、进程管理 | 需要操作系统级操作的 skill |
| 预构建 tarball | 将依赖预打包为 tarball,避免运行时网络请求 | 需要大量预构建资源的 skill |
| 版本兼容检测 | 运行时检测环境版本,自动适配 | 跨平台/跨版本兼容的 skill |
| 单文件输出 | 将所有资源内联到一个 HTML 文件 | claude.ai artifact 发布 |
| Pattern | Description | Applies to... |
|---|---|---|
| Scaffold + Bundle | Scaffold project → develop → bundle to single file | Any skill needing "dev environment" + "production deployment" |
| Shell as Tool | Shell for filesystem, dependency install, process mgmt | Skills needing OS-level operations |
| Pre-built Tarball | Pre-package dependencies as tarball, avoid runtime network requests | Skills needing large pre-built resources |
| Version Detection | Detect environment version at runtime, auto-adapt | Cross-platform/cross-version skills |
| Single-File Output | Inline all resources into one HTML file | claude.ai artifact publishing |