.claude/skills/add-analytics-widget/SKILL.md
Add an analytics chart or metric card to a dashboard or report page. Handles the API aggregation query, react-query hook, and Recharts visualization. Use when building analytics features.
npx skillsauth add malhajri07/real-estate-CRM-project add-analytics-widgetInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
Creates a complete analytics widget: backend aggregation query → API endpoint → react-query hook → Recharts visualization. Follows the project's chart conventions (ChartContainer, design tokens).
Create the API endpoint at the relevant route file:
router.get("/analytics/{widget-name}", authenticateToken, async (req, res) => {
const orgId = req.user?.organizationId;
const period = req.query.period as string || "month";
// Prisma groupBy or raw SQL aggregation
const data = await prisma.deals.groupBy({
by: ["stage"],
where: { organizationId: orgId, createdAt: { gte: periodStart } },
_count: true,
_sum: { agreedPrice: true },
});
res.json(data);
});
Create the react-query hook using /add-react-query.
Build the chart component:
import { ChartContainer, ChartTooltip, ChartTooltipContent } from "@/components/ui/chart";
import { BarChart, Bar, XAxis, YAxis, CartesianGrid } from "recharts";
import { CHART_COLORS } from "@/config/design-tokens";
Follow chart conventions:
<ChartContainer config={{} as ChartConfig}>CHART_COLORS from design tokens — never hardcode colors<ChartTooltip content={<ChartTooltipContent />} /> — never nest tooltipsstyle={{ direction: "ltr" }} on chart container (Recharts is LTR)Add to the target page inside a Card with CardHeader + CardTitle.
direction: ltr, labels are Arabic/typecheck passes<ReTooltip> inside <ChartTooltip> — use <ChartTooltip content={<ChartTooltipContent />} /> directlyResponsiveContainer manually — ChartContainer already includes itCHART_COLORS or CHART_COLOR_ARRAYtesting
Create and edit Obsidian Flavored Markdown with wikilinks, embeds, callouts, properties, and other Obsidian-specific syntax. Use when working with .md files in Obsidian, or when the user mentions wikilinks, callouts, frontmatter, tags, embeds, or Obsidian notes.
tools
Interact with Obsidian vaults using the Obsidian CLI to read, create, search, and manage notes, tasks, properties, and more. Also supports plugin and theme development with commands to reload plugins, run JavaScript, capture errors, take screenshots, and inspect the DOM. Use when the user asks to interact with their Obsidian vault, manage notes, search vault content, perform vault operations from the command line, or develop and debug Obsidian plugins and themes.
data-ai
Create and edit Obsidian Bases (.base files) with views, filters, formulas, and summaries. Use when working with .base files, creating database-like views of notes, or when the user mentions Bases, table views, card views, filters, or formulas in Obsidian.
tools
Create and edit JSON Canvas files (.canvas) with nodes, edges, groups, and connections. Use when working with .canvas files, creating visual canvases, mind maps, flowcharts, or when the user mentions Canvas files in Obsidian.