interactive-component-creator
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseWeb Artifacts Builder
Web制品构建指南
To build powerful frontend claude.ai artifacts, follow these steps:
- Initialize the frontend repo using
scripts/init-artifact.sh - Develop your artifact by editing the generated code
- Bundle all code into a single HTML file using
scripts/bundle-artifact.sh - Display artifact to user
- (Optional) Test the artifact
Stack: React 18 + TypeScript + Vite + Parcel (bundling) + Tailwind CSS + shadcn/ui
要构建功能强大的前端claude.ai制品,请遵循以下步骤:
- 使用初始化前端仓库
scripts/init-artifact.sh - 通过编辑生成的代码来开发你的制品
- 使用将所有代码打包为单个HTML文件
scripts/bundle-artifact.sh - 向用户展示制品
- (可选)测试制品
技术栈:React 18 + TypeScript + Vite + Parcel(打包工具) + Tailwind CSS + shadcn/ui
Design & Style Guidelines
设计与风格指南
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.
非常重要:为避免出现所谓的“AI式敷衍设计”,请避免使用过多居中布局、紫色渐变、统一圆角以及Inter字体。
Quick Start
快速开始
Step 1: Initialize Project
步骤1:初始化项目
Run the initialization script to create a new React project:
bash
bash scripts/init-artifact.sh <project-name>
cd <project-name>This creates a fully configured project with:
- ✅ React + TypeScript (via Vite)
- ✅ Tailwind CSS 3.4.1 with shadcn/ui theming system
- ✅ Path aliases () configured
@/ - ✅ 40+ shadcn/ui components pre-installed
- ✅ All Radix UI dependencies included
- ✅ Parcel configured for bundling (via .parcelrc)
- ✅ Node 18+ compatibility (auto-detects and pins Vite version)
运行初始化脚本以创建新的React项目:
bash
bash scripts/init-artifact.sh <project-name>
cd <project-name>此脚本会创建一个配置齐全的项目,包含:
- ✅ React + TypeScript(基于Vite)
- ✅ 带有shadcn/ui主题系统的Tailwind CSS 3.4.1
- ✅ 已配置路径别名()
@/ - ✅ 预安装40+个shadcn/ui组件
- ✅ 包含所有Radix UI依赖项
- ✅ 已配置Parcel打包工具(通过.parcelrc)
- ✅ 兼容Node 18+(自动检测并固定Vite版本)
Step 2: Develop Your Artifact
步骤2:开发你的制品
To build the artifact, edit the generated files. See Common Development Tasks below for guidance.
要构建制品,请编辑生成的文件。可参考下方常见开发任务获取指导。
Step 3: Bundle to Single HTML File
步骤3:打包为单个HTML文件
To bundle the React app into a single HTML artifact:
bash
bash scripts/bundle-artifact.shThis creates - a self-contained artifact with all JavaScript, CSS, and dependencies inlined. This file can be directly shared in Claude conversations as an artifact.
bundle.htmlRequirements: Your project must have an in the root directory.
index.htmlWhat the script does:
- Installs bundling dependencies (parcel, @parcel/config-default, parcel-resolver-tspaths, html-inline)
- Creates config with path alias support
.parcelrc - Builds with Parcel (no source maps)
- Inlines all assets into single HTML using html-inline
要将React应用打包为单个HTML制品:
bash
bash scripts/bundle-artifact.sh此操作会生成——一个自包含的制品,所有JavaScript、CSS及依赖项均已内联。该文件可直接在Claude对话中作为制品分享。
bundle.html要求:你的项目根目录必须包含文件。
index.html脚本执行内容:
- 安装打包依赖(parcel、@parcel/config-default、parcel-resolver-tspaths、html-inline)
- 创建支持路径别名的.parcelrc配置文件
- 使用Parcel进行构建(不生成源映射)
- 使用html-inline将所有资源内联到单个HTML文件中
Step 4: Share Artifact with User
步骤4:与用户分享制品
Finally, share the bundled HTML file in conversation with the user so they can view it as an artifact.
最后,在对话中与用户分享打包后的HTML文件,以便他们可以将其作为制品查看。
Step 5: Testing/Visualizing the Artifact (Optional)
步骤5:(可选)测试/可视化制品
Note: This is a completely optional step. Only perform if necessary or requested.
To test/visualize the artifact, use available tools (including other Skills or built-in tools like Playwright or Puppeteer). In general, avoid testing the artifact upfront as it adds latency between the request and when the finished artifact can be seen. Test later, after presenting the artifact, if requested or if issues arise.
注意:这是完全可选的步骤。仅在必要或被请求时执行。
要测试/可视化制品,请使用可用工具(包括其他Skill或内置工具如Playwright或Puppeteer)。一般情况下,请勿提前测试制品,因为这会增加请求与成品展示之间的延迟。若有请求或出现问题,可在展示制品后再进行测试。
Reference
参考资料
- shadcn/ui components: https://ui.shadcn.com/docs/components
- shadcn/ui组件:https://ui.shadcn.com/docs/components