home / skills / bobmatnyc / claude-mpm-skills / artifacts-builder

artifacts-builder skill

/universal/main/artifacts-builder

This skill helps you create self-contained HTML artifacts from React projects by bundling code, assets, and styles into a single shareable file.

npx playbooks add skill bobmatnyc/claude-mpm-skills --skill artifacts-builder

Review the files below or copy the command above to add this skill to your agents.

Files (2)
SKILL.md
3.6 KB
---
name: artifacts-builder
description: "Suite of tools for creating elaborate, multi-component claude.ai HTML artifacts using modern frontend web technologies (React, Tailwind CSS, shadcn/ui)"
license: Complete terms in LICENSE.txt
progressive_disclosure:
  entry_point:
    summary: "Build complex React + TypeScript + shadcn/ui artifacts bundled to single HTML files"
    when_to_use: "Complex artifacts requiring state management, routing, or shadcn/ui components (not simple HTML/JSX)"
    quick_start: |
      1. Initialize: bash scripts/init-artifact.sh <project-name>
      2. Develop: Edit generated React/TypeScript files
      3. Bundle: bash scripts/bundle-artifact.sh → creates bundle.html
      4. Share bundled HTML as artifact with user
      Stack: React 18 + TypeScript + Vite + Tailwind CSS + shadcn/ui
    note: "Already optimal at 73 lines - scripts/ directory provides implementation details, no fragmentation needed"
  references: []
---

# Artifacts Builder

To build powerful frontend claude.ai artifacts, follow these steps:
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`
4. Display artifact to user
5. (Optional) Test the artifact

**Stack**: React 18 + TypeScript + Vite + Parcel (bundling) + 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.

## Quick Start

### Step 1: Initialize Project

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)

### Step 2: Develop Your Artifact

To build the artifact, edit the generated files. See **Common Development Tasks** below for guidance.

### Step 3: Bundle to Single HTML File

To bundle the React app into a single HTML artifact:
```bash
bash scripts/bundle-artifact.sh
```

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.

**Requirements**: Your project must have an `index.html` in the root directory.

**What the script does**:
- Installs bundling dependencies (parcel, @parcel/config-default, parcel-resolver-tspaths, html-inline)
- Creates `.parcelrc` config with path alias support
- Builds with Parcel (no source maps)
- Inlines all assets into single HTML using html-inline

### Step 4: Share Artifact with User

Finally, share the bundled HTML file in conversation with the user so they can view it as an artifact.

### Step 5: Testing/Visualizing the Artifact (Optional)

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.

## Reference

- **shadcn/ui components**: https://ui.shadcn.com/docs/components

Overview

This skill is a toolkit for creating compact, multi-component HTML artifacts using modern frontend tech (React, TypeScript, Tailwind CSS, shadcn/ui). It scaffolds a Vite-based project, helps you develop with familiar components, and produces a single self-contained HTML file that can be shared directly in Claude conversations. The goal is rapid, polished artifact delivery with progressive loading and toolchain detection.

How this skill works

The skill initializes a ready-to-edit React + TypeScript project (Vite) with Tailwind and shadcn/ui, plus Parcel bundling support. You develop inside the generated repo, then run the bundling script to inline all JS/CSS/assets into bundle.html. The bundling process detects Node/Vite versions, installs required bundlers and resolvers, builds with Parcel, and inlines assets so the artifact is standalone and shareable.

When to use it

  • Deliver an interactive UI as a single HTML file for a Claude conversation
  • Prototype or demo small multi-component frontend experiences quickly
  • Create self-contained artifacts for offline review or sharing without a hosting step
  • Bundle complex component libraries (shadcn/ui + Radix) into a portable artifact
  • Ensure consistent toolchain setup across team members or agents

Best practices

  • Avoid clichéd design patterns: skip excessive centered layouts, purple gradients, uniform rounded corners, and the Inter font to reduce "AI slop"
  • Start from the init script to get configured path aliases, shadcn components, and Parcel setup out of the box
  • Keep index.html and entry points minimal; rely on component composition for complexity
  • Bundle only after core development to reduce latency—share early drafts without heavy testing unless requested
  • Use progressive loading and light assets to keep the single-file artifact performant

Example use cases

  • Create a small multi-section dashboard or settings panel to embed in a conversation
  • Build an interactive form or guided workflow that users open directly from Claude
  • Produce a visual prototype showing component interactions using shadcn/ui components
  • Share a polished, self-contained demo of a feature with stakeholders without deploying to a server
  • Package a frontend snippet that other agents or users can open and test locally

FAQ

Do I need Node or specific versions installed?

Yes. The scripts detect Node 18+ and will pin compatible Vite versions; ensure Node 18 or later is available.

Can I include third-party assets or large media?

Yes, but bundling inlines everything into one file. Large media will bloat the artifact and can harm performance—prefer optimized/inline SVGs and compressed assets.