d3
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.
What this skill does
# 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.
## Instructions
- 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 (`scaleLinear` for continuous, `scaleBand` for categorical bars, `scaleTime` for dates, `scaleOrdinal` for color mapping) and always set domain from the data using `d3.extent()`.
- When building axes, create them with `d3.axisBottom(scale)` or `d3.axisLeft(scale)`, configure ticks and format labels with `d3.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 `useMemo` and using `useEffect` with refs for D3-driven animations.
## Examples
### 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:**
1. Set up shared scales with `d3.scaleTime()` for the x-axis and `d3.scaleLinear()` for the y-axis
2. Build a line chart using `d3.line()` with smooth curve interpolation and area fill
3. Build a grouped bar chart using `d3.scaleBand()` with staggered enter transitions
4. Build a donut chart using `d3.pie()` and `d3.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:**
1. Set up `d3.forceSimulation()` with `forceManyBody`, `forceLink`, and `forceCenter`
2. Render nodes as circles with `d3.scaleOrdinal()` coloring by category
3. Add drag interaction with `d3.drag()` to reposition nodes
4. 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 ranges.
- Use `d3.format()` for axis labels and tooltips: `",.0f"` for thousands, `"$.2f"` for currency.
- Add transitions of 750ms with `easeCubicInOut` for smooth data update animations.
- Make visualizations responsive by recalculating scales on `ResizeObserver` callbacks.
- Add `aria-label` to SVG elements and meaningful `<title>` tags for accessibility.
Related in General
modeling-omnistudio-epc-catalog
IncludedSalesforce Industries CME EPC product-modeling skill for Product2-based catalog creation. Use when creating EPC products, configuring product attributes, building offer bundles with Product Child Items, or reviewing EPC DataPack JSON metadata for product catalog changes. TRIGGER when: user creates or updates Product2 EPC records, AttributeAssignment payloads, AttributeMetadata/AttributeDefaultValues, Offer bundles, or ProductChildItem relationships. DO NOT TRIGGER when: designing OmniScripts/FlexCards/Integration Procedures (use building-omnistudio-omniscript, building-omnistudio-flexcard, or building-omnistudio-integration-procedure), implementing Apex business logic (use generating-apex), or troubleshooting deployment pipelines (use deploying-metadata).
relationship-science-coach
IncludedUse this skill for direct, practical adult relationship coaching: couples conflict, repair, trust, marriage, dating, flirting, attachment patterns, emotional connection, sex, desire differences, eroticism, kink negotiation, affection, love languages, breakups, and long-term passion. Draw on Gottman, EFT and Hold Me Tight, attachment science, modern sex research, Perel, Nagoski, Kerner, Schnarch, Love and Stosny, and flexible love-language tools. Be concrete and low-hedge. Redirect only for imminent danger, abuse, coercive control, minors, non-consent, self-harm, stalking, or medical/legal/psychiatric decisions.
building-sf-integrations
IncludedSalesforce integration architecture and runtime plumbing with 120-point scoring. Use this skill to set up Named Credentials, External Credentials, External Services, REST/SOAP callout patterns, Platform Events, and Change Data Capture. TRIGGER when: user sets up Named Credentials, External Services, REST/SOAP callouts, Platform Events, CDC, or touches .namedCredential-meta.xml files. DO NOT TRIGGER when: Connected App/OAuth config (use configuring-connected-apps), Apex-only logic (use generating-apex), or data import/export (use handling-sf-data).
venue-templates
IncludedAccess comprehensive LaTeX templates, formatting requirements, and submission guidelines for major scientific publication venues (Nature, Science, PLOS, IEEE, ACM), academic conferences (NeurIPS, ICML, CVPR, CHI), research posters, and grant proposals (NSF, NIH, DOE, DARPA). This skill should be used when preparing manuscripts for journal submission, conference papers, research posters, or grant proposals and need venue-specific formatting requirements and templates.
let-fate-decide
IncludedDraws the 12 Houses of the Zodiac Tarot spread to inject entropy into planning when prompts are vague, ambiguous, or casually delegated. Interprets the spread to guide next steps. Use when the user says 'let fate decide', 'YOLO', 'whatever', 'idk', or other nonchalant phrases, makes Yu-Gi-Oh references, or when you are about to arbitrarily pick between multiple reasonable approaches. Prefer over ask-questions-if-underspecified when the user's tone is casual or playful rather than precision-seeking.
net-ops
IncludedCross-platform network troubleshooting (Windows, macOS, Linux) via local or remote shell. Use for: DNS broken, can't resolve hostnames, nslookup/dig works but apps fail, NRPT, WFP, scutil, /etc/resolver, systemd-resolved, /etc/resolv.conf, NetworkManager, VPN DNS leak residue (ProtonVPN/Mullvad/WireGuard/AnyConnect), AV/firewall blocking DNS or DoH, Tailscale DNS interaction, intermittent connectivity, remote diagnostics over SSH.