SuperAPI AI Directory

extract-island

Frontend & websites

View repository

Updated 10-15 10:07

About this skill

Extract Storefront Island

Extract a single component from a live webpage and produce a compiled layout JSON compatible with the Lexsis renderer.

This is a maintainer-only layout format. The html field contains compiled runtime markup. Agents authoring a page must convert that markup to <lx-island> source format before calling lexsis_pages action compile.

When to Use

  • Reverse-engineering a competitor's hero section, navigation, or product card
  • Creating a new layout variant for an existing island (e.g., a new BuyBox arrangement)
  • Capturing design inspiration from any website as a reusable template
  • Contributing new layouts to the storefront-skills repo via PR

Output Format

The output MUST match this exact structure (same as storefront-engine/references/islands/{name}/layouts/*.json):

{
  "id": "{island-kebab}-{variant-slug}",
  "html": "<section ...>...</section>",
  "css": "",
  "js": ""
}

Renderer Compatibility Rules

These rules are NON-NEGOTIABLE. Violating any produces broken output:

  1. --lx-* CSS variables for ALL colors, fonts, spacing that should be themeable:

    • var(--lx-color-primary), var(--lx-color-accent), var(--lx-bg-surface)
    • var(--lx-font-heading), var(--lx-font-body)
    • var(--lx-text-color), var(--lx-text-muted), var(--lx-border-color)
    • var(--lx-radius), var(--lx-shadow)
  2. Compiled data-island markers must reference a REAL active island from the 47-island catalog. Read the schema directory; do not copy a hardcoded name list from prose.

  3. Compiled data-props must match the island's schema — read storefront-engine/references/islands/{name}/schema.json for valid props, types, and required fields. Never invent props that don't exist.

  4. {{PLACEHOLDER}} for content slots — dynamic content uses double-brace placeholders:

    • {{PRODUCT_ID}}, {{HEADLINE}}, {{CTA_TEXT}}, {{IMAGE_SRC}}
    • Never hardcode product-specific content
  5. Tailwind CSS for all structural layout (grid, flex, spacing, responsive breakpoints)

  6. Responsive: mobile-first, use sm:, md:, lg: breakpoints

  7. No external JS — interactive behavior comes from islands only, not custom scripts

Workflow

Step 1: Navigate and capture

browser_navigate → {url}
browser_take_screenshot (full page)
browser_snapshot (accessibility tree)

Step 2: Identify the target component

User tells you which component to extract ("the hero", "that FAQ section", "the sticky cart bar"). Find it in the DOM snapshot.

Step 3: Deep analysis

For the target component, analyze:

  • Structure: semantic HTML elements, nesting depth, grid/flex layout
  • Styling: colors, typography, spacing, borders, shadows, animations
  • Responsive: how it collapses/stacks on mobile
  • Interactive parts: accordions, carousels, popovers, add-to-cart → map to islands
  • Content slots: what's dynamic vs decorative

Step 4: Map to Lexsis islands

For each interactive element found:

  1. Identify closest matching island from the catalog above
  2. Read its schema.json to get valid props
  3. Construct valid data-props JSON using only documented props
  4. If no island matches, use pure HTML (static rendering)

Step 5: Output layout JSON

Produce the final JSON with:

  • id: descriptive slug (e.g., hero-split-video-left)
  • html: complete section HTML using --lx-* vars + Tailwind + data-island markers
  • css: empty string (Tailwind handles styling)
  • js: empty string (islands handle interactivity)

Example Output

{
  "id": "hero-split-video-left",
  "html": "<section class=\"grid grid-cols-1 lg:grid-cols-5 min-h-[80vh] overflow-hidden\"><div class=\"lg:col-span-3 relative\"><video autoplay muted loop playsinline class=\"absolute inset-0 w-full h-full object-cover\"><source src=\"{{VIDEO_SRC}}\" type=\"video/mp4\" /></video></div><div class=\"lg:col-span-2 flex flex-col justify-center px-8 lg:px-12 py-16\" style=\"background-color: var(--lx-bg-surface)\"><h1 class=\"text-4xl lg:text-5xl font-bold leading-tight\" style=\"font-family: var(--lx-font-heading); color: var(--lx-text-color)\">{{HEADLINE}}</h1><p class=\"mt-4 text-lg\" style=\"color: var(--lx-text-muted)\">{{SUBHEAD}}</p><div class=\"mt-8\"><div data-island=\"BuyBox\" data-props='{\"productId\":\"{{PRODUCT_ID}}\",\"ctaText\":\"{{CTA_TEXT}}\",\"variant\":\"compact\"}'></div></div></div></section>",
  "css": "",
  "js": ""
}

Contributing the Layout

After extracting, the user can PR the layout into the repo:

skills/storefront-engine/references/islands/{island-name}/layouts/{variant-slug}.json

The filename becomes the layout identifier used by generation skills.

Optional Follow-Up

Submit the layout for maintainer review and schema validation. After it is accepted into the reference catalog, visual-page and generate may select it; do not use this maintainer-only compiled output as page source.