dennisonbertram/steal-react-component

Claude Code skill to extract React components from any production website

License:MITLanguage:N/A486

Deep Analysis

Claude Code skill suite for extracting React components, design systems, and cloning entire sites from any production website

Highly Recommended

Core Features

Extract single React component props, hooks, HTML, and source by accessing React Fiber internals

Extract complete design systems using StyleStealer with direct Tailwind config generation

End-to-end website cloning process generating complete Next.js projects

Visual Navigator UI for interactive component browsing

Format extracted component info into LLM-processable format

Technical Implementation

Architecture:Dual-file subagent architecture for context isolation: main agent only loads lightweight dispatcher, heavy operations execute in subagents
Execution Flow:

Key Components:
React Fiber
__reactFiber$*
Chrome MCP
Subagent Architecture
Tailwind CSS
Highlights
  • Innovative dual-file subagent architecture for context isolation
  • Direct access to React Fiber internals for deep component analysis
  • Style extraction directly generates Tailwind config
  • Complete end-to-end workflow
  • ReactStealer and StyleStealer provide rich APIs
  • Parallel subagents for code deobfuscation
Use Cases
  • Quickly extract UI components from competitor sites for learning
  • Clone existing site design systems to generate Tailwind config
  • Extract specific React components for reverse engineering
  • Rapid prototyping
  • Design system migrations
Limitations
  • Animation states may not capture correctly
  • Some component names may be obfuscated
  • React Server Components may lack client-side Fiber data
  • Requires Claude-in-Chrome extension installed
Tech Stack
Claude Code CLIChromeζ΅θ§ˆε™¨Claude-in-Chrome扩展React Fiber APINext.js 14TypeScriptTailwind CSS

Steal React Component

A Claude Code skill suite for extracting and reconstructing React components and entire websites using browser automation.

Features

Component Extraction (steal-react-component)

Extract individual React components from any production website by accessing React Fiber internals.

Design System Extraction (css-extractor)

Extract complete design systems including CSS variables, typography, colors, and spacing.

Full Site Cloning (copy-site)

Clone entire websites by combining component extraction, style extraction, and automatic project scaffolding.

Quick Start

Extract a Single Component

/steal-react-component https://example.com

Clone an Entire Site

/copy-site https://example.com

Installation

This skill suite uses a two-file architecture for context isolation:

Skill Dispatcher Agent Purpose
steal-react-component SKILL.md (~300 tokens) AGENT.md (~4k tokens) Extract individual components
copy-site COPY-SITE.md (~400 tokens) COPY-SITE-AGENT.md (~6k tokens) Clone entire websites

Why Subagent Architecture?

The subagent runs in isolated context, keeping the main agent's context clean. A typical site clone:

  • Main agent: ~6k tokens (dispatcher + subagent response summary)
  • Subagent: ~50k tokens internally (browser automation, style extraction, component de-minification, project scaffolding)

Without subagents, all ~50k tokens would accumulate in the main agent's context, quickly filling it up.

Step 1: Install the Agents (Required)

Copy agent files to your Claude Code agents directory:

# User-level (available in all projects)
cp AGENT.md ~/.claude/agents/steal-react-component.md
cp COPY-SITE-AGENT.md ~/.claude/agents/copy-site.md

# Or project-level
cp AGENT.md .claude/agents/steal-react-component.md
cp COPY-SITE-AGENT.md .claude/agents/copy-site.md

Step 2: Install the Skills

Copy skill files to enable slash commands:

# User-level
mkdir -p ~/.claude/skills/steal-react-component
cp SKILL.md CSS-EXTRACTOR.md COPY-SITE.md ~/.claude/skills/steal-react-component/

# Or project-level
mkdir -p .claude/skills/steal-react-component
cp SKILL.md CSS-EXTRACTOR.md COPY-SITE.md .claude/skills/steal-react-component/

Optional: Install as Commands

Create slash commands for site cloning:

mkdir -p ~/.claude/commands
cp COPY-SITE.md ~/.claude/commands/copy-site.md

Now use /copy-site https://target-site.com to clone any site.

Components

SKILL.md + AGENT.md - ReactStealer

The core component extraction tool (split for token efficiency):

  • Access React Fiber internals via __reactFiber$* keys
  • Extract component props, hooks, HTML, and minified source
  • Visual Navigator UI for interactive component browsing
  • LLM-formatted output for clean code reconstruction
// Inject ReactStealer, then:
ReactStealer.summary()           // List all components
ReactStealer.getForLLM('Button') // Get reconstruction prompt

CSS-EXTRACTOR.md - StyleStealer

Design system extraction tool:

  • CSS custom properties (design tokens)
  • Typography system (fonts, sizes, weights)
  • Color palette with semantic naming
  • Direct Tailwind config generation
// Inject StyleStealer, then:
StyleStealer.extractAll()       // Get full design system
StyleStealer.toTailwindConfig() // Generate Tailwind config
StyleStealer.toCSSVariables()   // Export as CSS file

COPY-SITE.md + COPY-SITE-AGENT.md - Full Site Cloning

End-to-end site cloning workflow (split for context isolation):

  1. Screenshot and document the site
  2. Extract design system with StyleStealer
  3. Extract components with ReactStealer
  4. De-minify with parallel subagents
  5. Scaffold Next.js project
  6. Verify the clone matches original

templates/ - Project Scaffolding

Ready-to-use project templates:

  • Next.js 14 with App Router
  • TypeScript configuration
  • Tailwind CSS with design token placeholders
  • Component structure

Requirements

  • Claude Code CLI (started with claude --chrome)
  • Chrome browser with Claude-in-Chrome extension
  • Target website (React apps work best, any site works for style extraction)

How It Works

The Technique

  1. Two Trees - React maintains a Fiber tree parallel to the DOM
  2. Fiber Access - React attaches Fiber nodes via __reactFiber$* keys
  3. Data Extraction - Extract component type, props, hooks, rendered HTML
  4. Style Extraction - Pull CSS variables, computed styles, typography
  5. Example Collection - Gather multiple prop→HTML mappings
  6. LLM Reconstruction - Feed examples + minified source to LLM
  7. Project Scaffolding - Generate complete Next.js project
  8. Verification - Compare rendered output until it matches

Architecture

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚ Main Agent (opus/sonnet)                                    β”‚
β”‚                                                             β”‚
β”‚  Dispatcher loaded (~300-400 tokens)                        β”‚
β”‚  β”œβ”€ Pre-flight check (Chrome MCP available?)                β”‚
β”‚  └─ Dispatch to appropriate subagent                        β”‚
β”‚                                                             β”‚
β”‚  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”  β”‚
β”‚  β”‚ steal-react-component β”‚  β”‚ copy-site                  β”‚  β”‚
β”‚  β”‚ Subagent (sonnet)     β”‚  β”‚ Subagent (sonnet)          β”‚  β”‚
β”‚  β”‚                       β”‚  β”‚                            β”‚  β”‚
β”‚  β”‚ AGENT.md (~4k tokens) β”‚  β”‚ COPY-SITE-AGENT.md (~6k)   β”‚  β”‚
β”‚  β”‚ β”œβ”€ Navigate           β”‚  β”‚ β”œβ”€ Screenshot site         β”‚  β”‚
β”‚  β”‚ β”œβ”€ Inject ReactStealerβ”‚  β”‚ β”œβ”€ Extract design system   β”‚  β”‚
β”‚  β”‚ β”œβ”€ Extract component  β”‚  β”‚ β”œβ”€ Extract components      β”‚  β”‚
β”‚  β”‚ └─ Reconstruct code   β”‚  β”‚ β”œβ”€ De-minify (parallel)    β”‚  β”‚
β”‚  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜  β”‚ β”œβ”€ Scaffold Next.js        β”‚  β”‚
β”‚                             β”‚ └─ Test & verify           β”‚  β”‚
β”‚                             β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜  β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

Workflow Comparison

Feature steal-react-component copy-site
Scope Individual components Entire site
Output Component code Full Next.js app
Design System Optional Always extracted
Automation Interactive End-to-end
Use Case Grab specific components Clone entire UI

Limitations

  • Animations - Snapshots may not match animated state
  • Interactive State - Dropdowns, modals may not capture correctly
  • Minification - Some component names are minified (e.g., Hc, qv)
  • Server Components - RSC may not have client-side Fiber data
  • Authentication - Protected pages require manual login first
  • Non-React Sites - Only style extraction works

Example Output

Component Extraction

// After injection, use ReactStealer API:

// Get component summary
ReactStealer.summary()
// β†’ { totalComponents: 89, components: [{ name: "Button", count: 15 }, ...] }

// Extract specific component for LLM
ReactStealer.getForLLM('Button')
// β†’ Formatted prompt with source + examples

// Target specific element
ReactStealer.getBySelector('button.primary')
// β†’ { name, props, hooks, renderedHTML, source }

Site Cloning

After running /copy-site https://x.com:

sites/
└── x.com/
    β”œβ”€β”€ README.md           # Site documentation
    β”œβ”€β”€ style-guide.md      # Design system reference
    └── app/
        β”œβ”€β”€ package.json
        β”œβ”€β”€ tailwind.config.ts
        β”œβ”€β”€ app/
        β”‚   β”œβ”€β”€ layout.tsx
        β”‚   β”œβ”€β”€ page.tsx
        β”‚   └── globals.css
        └── components/
            β”œβ”€β”€ index.ts
            β”œβ”€β”€ Sidebar.tsx
            β”œβ”€β”€ Tweet.tsx
            β”œβ”€β”€ TweetComposer.tsx
            └── RightSidebar.tsx

License

MIT

Credits