
bklit-ui-migrate
Migrate an app's charts from Recharts or TanStack Charts to Bklit UI. Detects Recharts usage — direct recharts imports or shadcn/ui's components/ui/chart.tsx wrapper (ChartContainer, ChartConfig, ChartTooltipContent, ChartLegendContent) — and @tanstack/charts definitions (defineChart with lineY / areaY / barY marks), inventories every chart, classifies each as clean / needs workaround / keep, installs the matching @bklit/ shadcn registry items, and rewrites each chart with the equivalent bklit components while preserving data, colours, and labels. Tiny axis-less charts (Recharts "Tiny" line/area/bar charts, TanStack KPI sparklines) become LineSparkline / AreaSparkline / BarSparkline. Use when the user asks to replace, migrate, convert, or port Recharts, shadcn charts, or TanStack Charts to bklit, to swap sparklines or tiny charts, to remove the recharts or @tanstack/charts dependency, or asks what it would take to switch chart libraries.
- Installs
- 76
- Last 24h
- +11
- Trending rank
- #8507
- Security
- Not audited
Install
Works with every agent the skills CLI supports.
npx skills add https://github.com/bklit/bklit-ui --skill bklit-ui-migrate- 01
Install
Run the command in your project. The CLI asks which agents to install for.
- 02
Describe the task
Ask your agent for something this skill covers. It loads bklit-ui-migrate automatically when relevant.
- 03
Review the result
The agent follows the SKILL.md steps, scripts and references bundled with the skill.
SKILL.md
The instructions your agent reads when the skill is triggered.
Recharts / TanStack Charts → Bklit UI migration
Bklit charts are shadcn registry components: npx shadcn@latest add @bklit/<slug> copies source into the user's project and the code imports it from their own alias, e.g. @/components/charts/line-chart. Never import from @bklitui/ui/charts — that is bklit's private monorepo package.
Work through the steps in order. Do not start rewriting before the inventory (step 1) and classification (step 2) have been shown to the user.
References
| File | Use it for |
|---|---|
| references/component-map.md | Recharts component → bklit export, registry slug, import path |
| references/prop-map.md | Prop-by-prop mapping, units, defaults |
| references/shadcn-chart.md | ChartContainer / ChartConfig / ChartTooltipContent / ChartLegendContent, var(--color-*), full before/after |
| references/examples.md | Before/after: multi-line, stacked bar, horizontal bar, donut, radar, gradient area, tiny line/area/bar → sparklines, TanStack KPI sparkline |
| references/tanstack-charts.md | TanStack Charts (@tanstack/charts): marks → sparklines (well covered) and full charts (high-level only) |
| rules/gaps.md | Features with no bklit prop — workaround or keep Recharts (Incorrect/Correct) |
| scripts/detect-recharts.mjs | Zero-dependency inventory + classification (Recharts, shadcn wrapper, TanStack Charts, tiny charts → sparkline) |
Docs for each chart: https://bklit.com/docs/components/<slug>.
Ground rules
- Never invent props. If a Recharts prop has no row in
prop-map.md, it is a gap — readrules/gaps.md. bklit has notickFormatteronXAxis, nodomainonYAxis, nostackId, nolayout, noconnectNulls, nosyncId. - Line / Area / Composed / Scatter are time-series charts. x values must be
Dates (or ISO strings / epoch ms). Categorical x →BarChartor a workaround. Tiny charts are sparklines. One series, no axes / grid / legend, rendered small →LineSparkline/AreaSparkline/BarSparklinefrom@bklit/sparkline(x is row order, so no dates needed). Do not rebuild them withLineChart+ hidden chrome. - Preserve data, colours and labels. Same series, same colours (resolved from
ChartConfig), same human labels in tooltip and legend. - One file at a time, typecheck after each.
- Ask before any "needs workaround" conversion — it changes how the chart looks or reads.
- Leave "keep Recharts" charts untouched. A partial migration is a valid outcome.
Step 1 — Detect and inventory
Run the detector from the project root (Node ≥ 18, no install):
node <skill-dir>/scripts/detect-recharts.mjs . --format=table # human table
node <skill-dir>/scripts/detect-recharts.mjs . # full JSON
It walks source files (skipping node_modules, .next, dist, build, dot-dirs), finds recharts imports (named or import * as RechartsPrimitive), shadcn wrapper imports and @tanstack/charts imports (each defineChart(...) is one chart with "library": "@tanstack/charts"), and reports per file: components used, each chart root with line number, notable props (stackId, layout="vertical", syncId, XAxis type="number", Treemap, LabelList, ErrorBar, custom shape/content, Brush, …), the proposed bklit target, slugs to install, and a classification. Charts it reads as sparklines carry "sparkline": true and target @bklit/sparkline; axis-less charts of unknown size get a note suggesting it. shadcnWrappers[].importedBy lists who still imports components/ui/chart.tsx. It never throws; unreadable paths go in errors.
The script is a heuristic (it cannot see data values or axes built in helper functions). Open every listed file and confirm before presenting. Show the user a table:
| File | Recharts / shadcn components | Chart type | bklit target | Class |
|---|---|---|---|---|
components/chart-area-interactive.tsx:51 | AreaChart, Area, CartesianGrid, XAxis, ChartContainer, ChartTooltip(Content), ChartLegend(Content) | Area (stacked) | AreaChart | needs workaround |
components/storage-treemap.tsx:25 | Treemap, Tooltip, ResponsiveContainer | Treemap | — | keep Recharts |
Also check components.json: confirm the @bklit registry ("registries": { "@bklit": "https://ui.bklit.com/r/{name}.json" }) and note aliases.components — it decides the import prefix (default @/components → files land in components/charts/).
Step 2 — Classify and confirm
For every chart, state one of:
- Clean — every component and prop maps (see
component-map.md,prop-map.md). Data may still need a reshape (pie, radar, radial, ring). - Needs workaround — convertible with a compromise. Typical: categorical or numeric x on a time-series chart,
Area stackId, multiple bar stack groups, fixedYAxis domain, negative bar values, xtickFormatter/angled ticks,LabelList,syncId,Brush(bklit's brush is not shipped in any registry item),ReferenceLine/ReferenceDot, null gaps, nested pies. - Keep on Recharts —
Treemap,ErrorBar,Customized, customshape/node renderers,ZAxisbubbles,layout="vertical"on non-bar charts. - Keep on TanStack Charts (
keep-tanstack) — definitions using marks bklit has no mapping for (dot,cell,rect,text,ruleY,hexagon,facet, …). FulllineY/areaY/barYcharts are needs-workaround (high-level mapping only); sparkline definitions are clean. Seetanstack-charts.md. - Sparklines — a
Tooltip(or TanStacktooltip) on a tiny chart is needs-workaround: sparklines have none, so the value moves next to the chart viauseSparklineHover.
Give the reason for each non-clean chart (quote the prop) and the proposed workaround from rules/gaps.md. Ask the user which workaround charts to convert and how (e.g. overlap vs cumulative areas). Convert clean charts without further questions unless the user asked to review each.
Step 3 — Install the bklit items
Install only what the confirmed charts need, using the project's package runner:
npx shadcn@latest add @bklit/line-chart @bklit/bar-chart @bklit/y-axis @bklit/legend
# pnpm dlx shadcn@latest add … | bunx --bun shadcn@latest add …
| Needed for | Slug |
|---|---|
tiny LineChart / AreaChart / BarChart, TanStack lineY / areaY / barY sparklines | sparkline (LineSparkline, AreaSparkline, BarSparkline, useSparklineHover; no grid/axes/tooltip pulled in) |
LineChart / AreaChart / BarChart / ComposedChart / ScatterChart | line-chart / area-chart / bar-chart / composed-chart / scatter-chart (each brings grid, chart-tooltip; time charts bring x-axis; bar brings BarXAxis/BarYAxis) |
PieChart / RadarChart / ring (RadialBarChart) / one-value gauge | pie-chart / radar-chart / ring-chart / gauge-chart |
FunnelChart / Sankey / SunburstChart | funnel-chart / sankey-chart / sunburst-chart |
any visible value YAxis | y-axis (not bundled with line/area/bar) |
Legend | legend |
ReferenceArea | reference-area |
ReferenceDot / event markers | markers |
shadcn adds bklit's CSS variables (--chart-line-primary, --chart-grid, --chart-crosshair, tooltip colours, …) to the global stylesheet but does not overwrite existing variables, so the user's --chart-1 … --chart-5 stay as they are. Confirm the files landed where aliases.components says before writing imports.
Step 4 — Convert one file at a time
For each chart:
- Reshape data.
- Time charts: make
row[xDataKey]aDate. Bare"2024-04-01"strings parse as UTC midnight (shows the previous day west of UTC) →new Date(\${d}T00:00:00`). Sort by x. SetxDataKeywhen the key is not"date"(bar default"name"`). - Series-level
data(<Scatter data>,<Line data>) → merge into the rootdata. - Pie:
{ label, value, color? }[]. Radar:metrics {key,label}[]+data {label, color?, values}[]normalised 0–100. Ring:{ label, value, maxValue, color? }[]. Funnel:{ label, value, color? }[]. Sankey: unchanged.
- Time charts: make
- Map components and props with
component-map.mdandprop-map.md. Highlights that are easy to get wrong:ResponsiveContainer→ delete; size withaspectRatio(default"2 / 1") orclassName="h-[300px]".layout="vertical"→BarChart orientation="horizontal"(inverted naming) +BarYAxis.- All bars share one
stackId→ rootstacked. type="monotone"→curve={curveMonotoneX}from@visx/curve. Recharts' default curve is linear; bklitLinedefaults tocurveNatural,AreatocurveMonotoneX.dot→showMarkers/markers;activeDot→ChartTooltip showDots/dotSize.isAnimationActive={false}→animate={false}on the series (rootanimationDuration, default 1100 ms).Bar radius→lineCap(default"round";"butt"for square Recharts bars; a number for px).paddingAngle(deg) →padAngle(rad); pie angles:rad = (90 − deg) · π / 180.YAxis tickFormatter→formatValue;domain→ none.Tooltip→ChartTooltipwithrows={(point) => [...]}for labels/formatting (row order = series child order),content={({ point, index }) => …}for full control,cursor={false}→showCrosshair={false}.Legend→<Legend items>from@/components/charts/legend, rendered outside the chart root.margin: same shape, but bklit defaults to 40 on every side because axis labels live in the margin.- Sparklines (
prop-map.md→ "Tiny charts"):stroke/fill→color,type="monotone"→curve="monotone"(a string),margin→padding,radius→barRadius,isAnimationActive={false}→animate={false},ResponsiveContainer→ omitwidth,Tooltip→useSparklineHover+ your own value. Import from@/components/charts/sparkline. - TanStack Charts: replace
defineChart(...)and the<Chart definition>element; mark channels become props (y→dataKey,stroke→color,curve→curve, y-scale domain →yDomain,margin→padding,ariaLabel→aria-label,svgAnimation/motion()→animate). Details:tanstack-charts.md.
- Preserve colours and labels from
ChartConfig(shadcn). Everyvar(--color-<key>)must become the config's colour (e.g.var(--chart-1)) — those variables only exist insideChartContainer. Labels go torowsandLegend items. Details:shadcn-chart.md. - Keep the component's public API (name, props, exports) so call sites do not change.
- Add
"use client"if the file passes functions (rows,content,formatValue) and is not already a client component.
Step 5 — Rewrite imports (watch for collisions)
Import each piece from the file the registry installed:
import { Line, LineChart } from "@/components/charts/line-chart";
import { Grid } from "@/components/charts/grid";
import { XAxis } from "@/components/charts/x-axis";
import { YAxis } from "@/components/charts/y-axis";
import { ChartTooltip } from "@/components/charts/tooltip";
import { Legend, LegendItem, LegendLabel, LegendMarker } from "@/components/charts/legend";
import { AreaSparkline, BarSparkline, LineSparkline, useSparklineHover } from "@/components/charts/sparkline";
Remove the file's recharts and @/components/ui/chart imports once nothing in it uses them. Names collide across libraries — ChartTooltip, ChartLegend (shadcn wrapper) and LineChart, Line, Area, Bar, XAxis, YAxis, Legend, ReferenceArea, PieChart, … (Recharts). In a file that still renders a kept Recharts chart, alias one side:
import { Treemap, Tooltip as RechartsTooltip } from "recharts";
import { ChartTooltip as BklitChartTooltip } from "@/components/charts/tooltip";
The registry's legend item export is LegendItem (the docs' LegendItemComponent alias exists only in bklit's monorepo barrel).
Step 6 — Remove the old code only when unused
- Delete
components/ui/chart.tsxonly when no file imports it: re-run the detector (shadcnWrappers[].importedByempty) and search the repo (rg "ui/chart"), including stories, tests and docs. - Remove the
rechartsdependency only when the detector reports norechartsimports left (no kept charts) andrg "from ['\"]recharts"is empty. Use the project's package manager (npm uninstall recharts,pnpm remove recharts, …). - Remove
@tanstack/chartsonly when the detector reports no@tanstack/chartsimports left andrg "@tanstack/charts"is empty. - If any chart is kept on Recharts or TanStack Charts, keep that dependency and say so in the summary.
Step 7 — Verify
- Typecheck and lint after each file, then build:
npx tsc --noEmit(or the project'stypecheckscript), the project's lint script, thenbuild. - Visual comparison: run the dev server and compare each converted chart with the original (screenshots before/after, light and dark mode). Check: series count and colours, labels in tooltip and legend, x labels/dates (UTC shift), y range, stacking, sizing, hover, empty state.
- Expected, acceptable differences to call out: bklit's enter animation, dashed/edge-faded grid, crosshair + date pill tooltip, fixed
"MMM d"x labels, rounded bars by default. - Re-run the detector and report what is left on Recharts and why.
Finish
Summarise for the user: charts converted (file → bklit chart), workarounds applied, charts kept on Recharts with reasons, items installed, files/dependencies removed, and verification results.
For restyling the migrated charts (palette, tokens, typography, motion), hand off to the bklit-ui-design skill; for general bklit composition questions use the bklit-ui skill.
FAQ
What does the bklit-ui-migrate skill do?
Migrate an app's charts from Recharts or TanStack Charts to Bklit UI. Detects Recharts usage — direct recharts imports or shadcn/ui's components/ui/chart.tsx wrapper (ChartContainer, ChartConfig, ChartTooltipContent, ChartLegendContent) — and @tanstack/charts definitions (defineChart with lineY / areaY / barY marks), inventories every chart, classifies each as clean / needs workaround / keep, installs the matching @bklit/ shadcn registry items, and rewrites each chart with the equivalent bklit components while preserving data, colours, and labels. Tiny axis-less charts (Recharts "Tiny" line/area/bar charts, TanStack KPI sparklines) become LineSparkline / AreaSparkline / BarSparkline. Use when the user asks to replace, migrate, convert, or port Recharts, shadcn charts, or TanStack Charts to bklit, to swap sparklines or tiny charts, to remove the recharts or @tanstack/charts dependency, or asks what it would take to switch chart libraries.
How do I install bklit-ui-migrate?
Run npx skills add https://github.com/bklit/bklit-ui --skill bklit-ui-migrate in your project. The skills CLI detects the agents you use and copies the skill into the right folder. For Claude Code you can also place the skill folder at ~/.claude/skills/bklit-ui-migrate/ (personal) or .claude/skills/bklit-ui-migrate/ (project).
Which AI agents can use bklit-ui-migrate?
Any agent that supports the open Agent Skills format (a folder with a SKILL.md file), including Claude Code, Codex, Cursor, GitHub Copilot, Gemini CLI, Windsurf, Cline, OpenCode and more.
Is bklit-ui-migrate safe to install?
No partner security audit is available yet. Skills can run commands and scripts, so read the SKILL.md and any bundled files before installing.
Who maintains bklit-ui-migrate?
It is published by bklit in bklit/bklit-ui. It has 76 recorded installs.
More from bklit/bklit-ui
bklit-ui
bklit/bklit-ui
Install, compose, theme, and animate Bklit UI charts (the @bklit shadcn registry) in a React / Next.js app. Use when the user wants a chart, graph, or data visualization: line, area, bar, live/streaming line, composed, scatter, candlestick/OHLC, pie, ring/donut, radar, gauge, heatmap, funnel, sankey, sunburst, or choropleth/world map; a sparkline or tiny inline chart (LineSparkline, AreaSparkline, BarSparkline, useSparklineHover) for tables, KPI cards, or dense dashboards; a dashboard, analytics page, KPI or stat card; chart tooltips, crosshairs, legends, markers, reference bands, projections, trend lines, axes, or grids; or when code imports from components/charts/ or mentions @bklit/ or bklit.com. For styling vocabulary (patterns, squircle/rounded/3D bars, fades, loading looks, matching the app theme) also use bklit-ui-design. For moving from Recharts, shadcn ChartContainer, or TanStack Charts to Bklit, use bklit-ui-migrate.
unit-tests
bklit/bklit-ui
Guardrails for adding unit tests in bklit-ui without over-testing. Use when the user mentions unit test, unit tests, tests, test coverage, add tests, write tests, vitest, jest, or asks whether something should be tested.
bklit-studio-chart-performance
bklit/bklit-ui
Reusable Studio chart performance audit and fix workflow. Use when a chart feels sluggish in /studio (pan, slider ticks, legend hover) but siblings like pie-chart feel fine.
turborepo
bklit/bklit-ui
Turborepo monorepo build system guidance. Triggers on: turbo.json, task pipelines, dependsOn, caching, remote cache, the "turbo" CLI, --filter, --affected, CI optimization, environment variables, internal packages, monorepo structure/best practices, and boundaries. Use when user: configures tasks/workflows/pipelines, creates packages, sets up monorepo, shares code between apps, runs changed/affected packages, debugs cache, or has apps/packages directories.
bklit-ship
bklit/bklit-ui
bklit-ui monorepo contributors only — ship a chart or component from Studio prototype to production in packages/ui with docs and registry.
bklit-playground
bklit/bklit-ui
DEPRECATED — use bklit-studio instead. Local /playground is no longer the chart development workflow for bklit-ui contributors.
Popular frontend & design skills
setup-matt-pocock-skills
mattpocock/skills
Configure this repo for the engineering skills: set up its issue tracker, triage label vocabulary, and domain doc layout. Run once before first use of the other engineering skills.
frontend-design
anthropics/skills
Guidance for distinctive, intentional visual design when building new UI or reshaping an existing one. Helps with aesthetic direction, typography, and making choices that don't read as templated defaults.
hyperframes-animation
heygen-com/hyperframes
All animation knowledge for HyperFrames — atomic motion rules, multi-phase scene blueprints, scene transitions, broader motion-design techniques, AND the seven runtime adapters (GSAP default, plus Lottie, Three.js, Anime.js, CSS keyframes, Web Animations API, TypeGPU). Use for any motion or animation task: pick 2-4 rules and compose, or load a blueprint, or look up runtime-specific API (e.g. GSAP eases / Lottie player / Three.js mixer). Also covers auditing an existing composition's choreography (animation map) and 24 named text-animation effects. HyperFrames-native: single paused timeline, seek-safe, deterministic.
prototype
mattpocock/skills
Build a throwaway prototype to answer a design question. Use when the user wants to sanity-check whether a state model or logic feels right, or explore what a UI should look like.
hyperframes-core
heygen-com/hyperframes
The HyperFrames composition contract — build one renderable project. Use for composition structure, the data- timing attributes, class="clip", tracks, sub-compositions, variables, framework-owned media playback, deterministic-render rules, and validation. Read before writing composition HTML.
vercel-react-best-practices
vercel-labs/agent-skills
React and Next.js performance optimization guidelines from Vercel Engineering. This skill should be used when writing, reviewing, or refactoring React/Next.js code to ensure optimal performance patterns. Triggers on tasks involving React components, Next.js pages, data fetching, bundle optimization, or performance improvements.