flutter/extract-to-jaspr
Extracts a part of a website and converts it to a Jaspr component. Use when you need to migrate a part of a website to Jaspr.
npx skills add https://github.com/flutter/website --skill extract-to-jaspr
This document outlines the process and key learnings from extracting a complex HTML component from a live website to a Jaspr component using Dart.
Use this skill when you need to extract a part of a website and migrate it to Jaspr.
The migration process follows a strict "Structure Only" approach:
curl to fetch the raw HTML. This ensures you get the initial server-rendered markup without client-side modifications.curl for the source extraction.StatelessComponent for the extracted HTML.div, nav, ul, li, img, etc.).x- attributes from alpine.js) as is and DO NOT ATTEMPT TO RE-IMPLEMENT LOGIC in Dart.When encountering assets (images, videos, etc.), look for them in /assets/src/img or /assets/src/video.
Note: The production site appends hashes to asset names, but the source files do not have them.
Use the asset() function imported from lib/constants/asset_loader.dart with the non-hashed filename. It returns the correct path after bundling.
img(src: asset('my-image.png'), alt: 'My Image')
For components with repetitive or dynamic content (like carousels, event grids, or country lists), separate the data from the structure:
content/_data/ (e.g., my_data_file.yaml).package:jaspr_content/jaspr_content.dart to access the data in your component.import 'package:jaspr_content/jaspr_content.dart';
// Inside build method
final items = context.page.data['my_data_file'] as List? ?? [];
div(classes: 'grid', [
for (final item in items)
_buildItem(item as Map<String, dynamic>),
])
When possible, reuse existing sections from lib/components/sections like the CtaSection or NewsletterSection.
Do not add new sections yourself.
The desired outcome is 1-to-1 translation of the HTML to Jaspr. The component should be as close to the original HTML as possible.
Fidelity is King: When porting, trust that the original CSS/HTML structure is correct. Don't refactor the *structure* while migrating the *technology*. Data-driven patterns should enhance maintainability without changing the rendered HTML.
Take flutter/extract-to-jaspr from the repository into ~/.claude/skills for personal
use, or into .claude/skills inside a project.
The agent identifies a skill by the name field in its header. Two skills with the
same name cannot sit side by side — one of them will be ignored.