Automated summary
This skill guides the creation of custom interactive data visualizations with D3.js v7, from scales and axes to force and geographic layouts.
Strengths
- Concise, runnable code snippets covering scales, axes, shape generators, and data joins with `.join()`
- Covers advanced visualizations: force simulations, geographic projections, treemaps, and hierarchies
- Gives a clear React integration strategy (D3 for math, React for DOM rendering)
- Pins the target version (D3 7.9.0) and mentions modular imports to keep bundles small
Limitations
- The content cuts off mid-way through the first dashboard example, so full end-to-end workflows are only sketched
- No guidance on accessibility, testing, or performance with large datasets
- Assumes prior familiarity with SVG and D3's enter/update/exit pattern
Use it when you need fine-grained control over an interactive chart or SVG visualization that goes beyond what a turnkey charting library offers.
Avoid it for standard dashboards that need to ship quickly, or when the team is not comfortable with JavaScript, SVG, and data joins.
Security analysis
SafeThis is a pure documentation/guidance skill for D3.js. It contains only informational instructions and JavaScript code examples; there are no tool invocations, no shell commands, no network exfiltration, no obfuscation, and no instructions to disable safety measures. The only URL referenced is the official jsdelivr CDN for the d3 library, which is appropriate and expected for this topic. No declared allowed-tools and no execution risk.
No concerns found
How this analysis is madeExamples
Build an animated bar chart in D3 v7 that shows regional revenue, using a band scale and a 750ms transition when the data updates.Create a force-directed network graph with D3 showing links between services, with link distance, charge strength, and centered layout.Add a D3 line chart to my React component, keeping scale and line computations in useMemo and letting React render the SVG path.name: d3 description: >- Assists with building custom interactive data visualizations using D3.js. Use when creating charts, graphs, maps, force layouts, or hierarchical diagrams that require fine-grained control beyond what charting libraries provide. Trigger words: d3, data visualization, chart, svg, scales, force graph, treemap, choropleth. license: Apache-2.0 compatibility: "D3 7.x (checked against 7.9.0); modern browsers or Node.js with an ESM-capable toolchain" metadata: author: terminal-skills version: "1.1.0" repository: "https://github.com/d3/d3" category: design tags: "d3, data-visualization, charts, svg, interactive"
D3.js
Overview
D3.js is a low-level JavaScript library for building custom, interactive data visualizations by binding data to DOM elements. It provides scales, axes, shape generators, geographic projections, force simulations, and hierarchical layouts, giving developers full control over the visual output while integrating with React through computed scales and layouts.
Install with npm install d3 and import * as d3 from "d3" (v7 is published as ES modules), or load https://cdn.jsdelivr.net/npm/d3@7 in a script tag. Import single modules (d3-scale, d3-shape) to keep bundles small.
Instructions
A minimal line chart (runs against D3 7.9.0):
const x = d3.scaleTime(d3.extent(sales, d => d.date), [48, 620]);
const y = d3.scaleLinear([0, d3.max(sales, d => d.revenue)], [280, 20]).nice();
const line = d3.line().x(d => x(d.date)).y(d => y(d.revenue)).curve(d3.curveMonotoneX);
svg.append("path").attr("d", line(sales)).attr("fill", "none").attr("stroke", "#2563eb");
svg.append("g").attr("transform", "translate(48,0)").call(d3.axisLeft(y).tickFormat(d3.format(",.0f")));
- When binding data, use
.data(dataset).join("element")(D3 v6+) for the enter/update/exit pattern, setting attributes and styles from bound data via accessor functions. - When creating scales, choose the appropriate type (
scaleLinearfor continuous,scaleBandfor categorical bars,scaleTimefor dates,scaleOrdinalfor color mapping) and set the domain from the data (d3.extent()or[0, d3.max()]); in v7 domain and range can be passed directly to the constructor. - When building axes, create them with
d3.axisBottom(scale)ord3.axisLeft(scale), configure ticks and format labels withd3.format(), and regenerate on resize. - When creating chart types, use shape generators (
d3.line(),d3.area(),d3.arc(),d3.pie(),d3.stack()) and layout functions (d3.treemap(),d3.forceSimulation(),d3.geoPath()) for complex visualizations. - When adding interactivity, use transitions (
.transition().duration(750)) for smooth data updates, tooltips on hover, and brushing/zooming for exploration. - When integrating with React, use D3 for math (scales, layouts, data transforms) and React for DOM rendering, computing values in
useMemoand usinguseEffectwith refs for D3-driven animations.
Examples
Data join with a transition (bars from a band scale):
const x = d3.scaleBand(regions.map(d => d.name), [48, 620]).padding(0.2);
svg.selectAll("rect").data(regions, d => d.name).join("rect")
.attr("x", d => x(d.name)).attr("width", x.bandwidth())
.attr("y", y(0)).attr("height", 0)
.transition().duration(750).attr("y", d => y(d.total)).attr("height", d => y(0) - y(d.total));
Force layout setup:
const sim = d3.forceSimulation(nodes)
.force("link", d3.forceLink(links).id(d => d.id).distance(60))
.force("charge", d3.forceManyBody().strength(-120))
.force("center", d3.forceCenter(320, 240))
.on("tick", () => { /* update circle cx/cy and line x1..y2 from node positions */ });
Example 1: Build a real-time dashboard with multiple chart types
User request: "Create a dashboard with line charts, bar charts, and a pie chart from API data"
Actions:
- Set up shared scales with
d3.scaleTime()for the x-axis andd3.scaleLinear()for the y-axis - Build a line chart using
d3.line()with smooth curve interpolation and area fill - Build a grouped bar chart using
d3.scaleBand()with staggered enter transitions - Build a donut chart using
d3.pie()andd3.arc()with hover tooltips
Output: A responsive dashboard with animated charts that update smoothly when data changes.
Example 2: Create a force-directed network graph
User request: "Visualize relationships between entities as an interactive network graph"
Actions:
- Set up
d3.forceSimulation()withforceManyBody,forceLink, andforceCenter - Render nodes as circles with
d3.scaleOrdinal()coloring by category - Add drag interaction with
d3.drag()to reposition nodes - Implement zoom and pan with
d3.zoom()and tooltips on hover
Output: An interactive force-directed graph with draggable nodes, color-coded categories, and zoom navigation.
Guidelines
- Use D3 for scales, layouts, and data processing; let React handle DOM rendering in React apps.
- Use
.join()instead of manual enter/update/exit for simpler, cleaner data binding. - Always set scale domains from data (
d3.extent()) rather than hardcoding them; use.nice()for round axis ends. d3.eventwas removed in v6; event handlers receive(event, d).- Pin the major version in CDN URLs, and never build SVG from untrusted strings with
.html(). - Use
d3.format()for axis labels and tooltips:",.0f"for thousands,"$.2f"for currency. - Add transitions of 750ms with
easeCubicInOutfor smooth data update animations. - Make visualizations responsive by recalculating scales on
ResizeObservercallbacks. - Add
aria-labelto SVG elements and meaningful<title>tags for accessibility.
From the file to a first result
The download contains exactly the content displayed on this page. This copy may differ from the latest version in the source repository.
View the source and supporting filesThis download contains SKILL.md only. Any scripts, references, templates and dependencies are not included. Get the required files from the source, preserving their directory structure, before continuing.
1. Download the file
Download SKILL.mdFrom the root of a test project, save the file as .skill-downloads/custom-d3-js-visualizations-mwirmdvl/SKILL.md, or use the command below. This folder is for inspecting the skill before installation.
Command for macOS/Linux or WSL: requires a POSIX shell and curl. On Windows without WSL, use the download button and create the folder manually.
mkdir -p '.skill-downloads/custom-d3-js-visualizations-mwirmdvl' && curl --fail --show-error --location 'https://skills-guides.com/api/skills/custom-d3-js-visualizations-mwirmdvl/download' --output '.skill-downloads/custom-d3-js-visualizations-mwirmdvl/SKILL.md.part' && mv '.skill-downloads/custom-d3-js-visualizations-mwirmdvl/SKILL.md.part' '.skill-downloads/custom-d3-js-visualizations-mwirmdvl/SKILL.md'2. Check prerequisites
Read SKILL.md before using it. If it references scripts or external services, inspect them and prepare the required access in your test environment.
Environment declared by the author: D3 7.x (checked against 7.9.0); modern browsers or Node.js with an ESM-capable toolchain
No recognized prerequisites section in this file. This does not mean it is self-contained: libraries, tools and access requirements may be mentioned elsewhere in the content or source repository.
The platforms on this page are catalog indications. The paths below follow tool documentation; they do not prove this skill has been run in those tools. No minimum tool version is confirmed for this listing.
3. Load the skill
After inspection, copy the complete folder into your project using one of the commands below, then open a new tool session. The command stops if a folder with the same name already exists: compare the files before replacing it.
Claude Code
test -f '.skill-downloads/custom-d3-js-visualizations-mwirmdvl/SKILL.md' && test -s '.skill-downloads/custom-d3-js-visualizations-mwirmdvl/SKILL.md' && mkdir -p '.claude/skills' && test ! -e '.claude/skills/d3' && cp -R '.skill-downloads/custom-d3-js-visualizations-mwirmdvl' '.claude/skills/d3'Cursor
test -f '.skill-downloads/custom-d3-js-visualizations-mwirmdvl/SKILL.md' && test -s '.skill-downloads/custom-d3-js-visualizations-mwirmdvl/SKILL.md' && mkdir -p '.cursor/skills' && test ! -e '.cursor/skills/d3' && cp -R '.skill-downloads/custom-d3-js-visualizations-mwirmdvl' '.cursor/skills/d3'Codex
test -f '.skill-downloads/custom-d3-js-visualizations-mwirmdvl/SKILL.md' && test -s '.skill-downloads/custom-d3-js-visualizations-mwirmdvl/SKILL.md' && mkdir -p '.agents/skills' && test ! -e '.agents/skills/d3' && cp -R '.skill-downloads/custom-d3-js-visualizations-mwirmdvl' '.agents/skills/d3'OpenSkills
OpenSkills must already be installed. The local install/read procedure is checked with OpenSkills 1.5.0, which requires Node.js ≥ 20.6.0. Catalog slugs are not resolved automatically.
Official OpenSkills installationopenskills install './.skill-downloads/custom-d3-js-visualizations-mwirmdvl'openskills read 'custom-d3-js-visualizations-mwirmdvl'Reading should display the installed file content and its base directory. It does not run the skill or install its dependencies.
For an agent that reads AGENTS.md, then sync the index. This command changes AGENTS.md: review the diff before using it.
openskills syncManual method or another tool: attach SKILL.md to a conversation, or open it in an agent that can read files. Include any required supporting resources. No universal folder is recognized by every tool.
4. Try a first task
Use a short, synthetic input: an API endpoint, a small document or an interface brief. In a new conversation, attach the file or give the agent its path, then adapt this request:
Read .skill-downloads/custom-d3-js-visualizations-mwirmdvl/SKILL.md and apply its instructions to this example: [describe a test input]. Identify any missing files, dependencies or access. Produce the result requested by the skill without inventing data or running unreviewed scripts.Expected result: output matching the skill instructions, or a precise list of missing prerequisites. A read confirmation alone does not validate a first use. If an external resource is unavailable, that path remains untested.
React Hook Form Best Practices
Development
Master React Hook Form: avoid anti-patterns, manage subscriptions, and handle reset, dirty state, and controlled inputs correctly.
Emotion to Mantine Migration
Development
Migrate Emotion styled-components to Mantine components with style props and CSS modules. Use when converting .styled.tsx files or removing @emotion imports.
Scope Creep Detector
Development
Analyzes git diffs against a stated intent to detect scope creep, unrelated files, broad PRs, and oversized changes, then suggests keep, split, or justify actions.