agentleFS
charanjit-singhcharanjit-singh/lovable-skills/skills/dashboard-charts-recharts/SKILL.md

dashboard-charts-recharts

Skill10 starsChanged 6 months agoMITView on GitHub

Use when building dashboards, charts, KPI cards, trend lines, or analytics UI with Recharts or shadcn's chart components. Not for static landing-page graphics or product analytics tracking (use analytics-events).

The file

We split this skill into the rules it gives an agent

3 rules. About 0 are common, 1 is distinctive, and 2 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈1

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 2

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Very specific:

    Use Recharts (wrapped by shadcn's Chart components when available).

    line 11
  2. Very specific:

    Read colors from CSS variables so charts respect light/dark theme (dark-mode-and-theming).

    line 62
  3. Distinctive:

    Don't rely on color alone to differentiate series — use line style or labels too.

    line 81

≈ “Common” is an estimate: at least 1 in 5 of the 364,980 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

Dashboards and charts (Recharts)

Use Recharts (wrapped by shadcn's Chart components when available). One chart library per app — don't mix Recharts, Chart.js, and Victory.

Data shape

Aggregate on the server (SQL group by, RPC, materialized view) — never load 50k rows and group in the browser.

type DailyRevenue = { day: string; revenue_cents: number };

export async function fetchDailyRevenue(orgId: string, days = 30): Promise<DailyRevenue[]> {
  const { data, error } = await supabase.rpc("daily_revenue", { p_org: orgId, p_days: days });
  if (error) throw error;
  return data;
}

KPI card

Show value + delta + sparkline. A bare number is rarely enough.

<Card>
  <CardHeader>
    <CardDescription>Revenue (30d)</CardDescription>
    <CardTitle>${formatMoney(total)}</CardTitle>
    <DeltaBadge value={delta} />
  </CardHeader>
  <CardContent className="h-16">
    <Sparkline data={series} />
  </CardContent>
</Card>

Line / area chart

<ResponsiveContainer width="100%" height={260}>
  <AreaChart data={data}>
    <CartesianGrid strokeDasharray="3 3" className="stroke-border" />
    <XAxis dataKey="day" tickFormatter={formatShortDate} />
    <YAxis tickFormatter={formatMoney} />
    <Tooltip content={<ChartTooltip />} />
    <Area
      dataKey="revenue_cents"
      stroke="hsl(var(--primary))"
      fill="hsl(var(--primary) / 0.15)"
    />
  </AreaChart>
</ResponsiveContainer>

Read colors from CSS variables so charts respect light/dark theme (dark-mode-and-theming).

Empty, loading, error

Charts are data UI — apply error-states-and-empty-ui:

  • Loading: skeleton matching chart bounds (avoid layout shift).
  • Empty: "No data yet — your first events will appear here."
  • Error: retry button.

Performance

  • Aggregate server-side; cap returned points (≤ 365 days, ≤ 100 points for sparklines).
  • Lazy-load chart routes (React.lazy) — Recharts adds bundle weight.
  • Memoize derived series with useMemo keyed on raw data.

Accessibility

  • Provide a textual summary near each chart (<span className="sr-only">Revenue rose 14% in 30 days</span>).
  • Don't rely on color alone to differentiate series — use line style or labels too.

Avoid

  • Grouping/filtering large datasets in the browser.
  • Charts inside infinite-scroll lists without virtualization.
  • Hardcoded chart colors that break in dark mode.
  • Pie charts with > 5 slices (use a bar chart).

Checklist

  • Aggregation in SQL / RPC.
  • Loading / empty / error states.
  • Theme-aware colors.
  • Accessible summary text.

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.