d3-color-legend

d3-color-legend is a skill for Claude Code, Codex from cxcscmu/SkillLearnBench. It costs 34 tokens per session (866 once invoked), scanned A, original, MIT.

A guide to adding a color legend to a D3 chart. A legend explains which color represents each category in a chart.

In plain words
What is it for?
Use it to display colored markers and labels inside an SVG chart or in a separate HTML area.
Why use it?
It makes category colors understandable instead of forcing users to guess what they mean.

Skill for Claude CodeCodex

Written for no agent in particular: nothing here depends on one.

Good fit Use it to display colored markers and labels inside an SVG chart or in a separate HTML area.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/cxcscmu/skilllearnbench/d3-color-legend
Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

Any agent
npx skills add cxcscmu/SkillLearnBench --skill d3-color-legend
Clone the repo
git clone --depth 1 https://github.com/cxcscmu/SkillLearnBench

Made for: Claude Code, Codex.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for d3-color-legend

README.md
[![agentmods](https://agentmods.dev/badge/skills/cxcscmu/skilllearnbench/d3-color-legend/github.svg)](https://agentmods.dev/skills/cxcscmu/skilllearnbench/d3-color-legend)
Your own site
<a href="https://agentmods.dev/skills/cxcscmu/skilllearnbench/d3-color-legend"><img src="https://agentmods.dev/badge/skills/cxcscmu/skilllearnbench/d3-color-legend/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for d3-color-legend

Your own site · 80×15
<a href="https://agentmods.dev/skills/cxcscmu/skilllearnbench/d3-color-legend"><img src="https://agentmods.dev/badge/skills/cxcscmu/skilllearnbench/d3-color-legend.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 34 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 866 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe. Third-party audits
  • NVIDIA SkillSpector pass 7 Sept 2026
How audits are shown
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00034 $0.00866
Opus 5 $0.00017 $0.00433
Sonnet 5 $0.00007 $0.00173
Haiku 4.5 $0.00003 $0.00087

Measured 5d ago against content hash 7aa1e8134469, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-08, from the pricing page.

Security

Grade A, and why

d3-color-legend scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 5d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

skills/b1-one-shot-claude-sonnet-4-6/stock-data-visualization/d3-color-legend/SKILL.md · 120 lines

How it starts

The opening of the file, as written. The whole thing — 120 lines — stays where its author put it; the contents beside it link to each section on GitHub.

D3 v6 Categorical Color Legend

Overview

A color legend maps category names to colors, placed either inside the SVG or as an HTML overlay. Use this whenever a chart uses a categorical color scale.

SVG Inline Legend

const legend = svg.append('g')
    .attr('class', 'legend')
    .attr('transform', `translate(${margin.left}, ${margin.top})`);

const legendItems = legend.selectAll('.legend-item')
    .data(categories)
    .join('g')
    .attr('class', 'legend-item')
    .attr('transform', (d, i) => `translate(0, ${i * 22})`);

// Color swatch (circle or rect)
legendItems.append('circle')
    .attr('r', 7)
    .attr('cx', 7)
    .attr('cy', 0)
    .attr('fill', d => colorScale(d));

// Label
legendItems.append('text')
    .attr('x', 18)
    .attr('y', 4)
    .style('font-size', '13px')
    .text(d => d);

HTML Overlay Legend

Place outside the SVG for more flexible layout:

<div class="legend-container" id="chart-legend"></div>
const legendDiv = d3.select('#chart-legend');
legendDiv.selectAll('.legend-item')
    .data(categories)
    .join('div')
    .attr('class', 'legend-item')
    .html(d => `
        <span class="legend-swatch" style="background:${colorScale(d)}"></span>
        <span class="legend-label">${d}</span>
    `);

CSS:

.legend-container {
    display: flex;
    flex-wrap: wrap;
    gap: 10px 20px;
    margin: 8px 0;
}
.legend-item {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
}
.legend-swatch {
    width: 14px;
    height: 14px;
    border-radius: 50%;
    display: inline-block;
    flex-shrink: 0;
}
// Tableau10 (10 distinguishable categorical colors)
const colorScale = d3.scaleOrdinal(d3.schemeTableau10);

// Custom palette for specific categories
const colorScale = d3.scaleOrdinal()
    .domain(['ETF', 'Energy', 'Financial', 'Industry', 'Information Technology'])
    .range(['#6baed6', '#fd8d3c', '#74c476', '#9e9ac8', '#f768a1']);

// Safe for colorblind users (Wong palette)
const WONG = ['#E69F00','#56B4E9','#009E73','#F0E442','#0072B2','#D55E00','#CC79A7','#000000'];
const colorScale = d3.scaleOrdinal().range(WONG);

Read the full file on GitHub · 120 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 5d ago First seen · 120 lines · 34 tokens per session scan A 7aa1e8134469

Subscribe to this mod's changes

d3-color-legend is a skill published in the GitHub repository cxcscmu/SkillLearnBench (83 stars, last pushed 2mo ago), licensed MIT. It adds 34 tokens to every session and 866 once invoked, about $0.0002 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-09-03.

Related

Other skills, from other repositories

d3-visualization

Build deterministic, verifiable data visualizations with D3.js (v6). Generate standalone HTML/SVG (and optional PNG) from local data files without external network dependencies. Use when tasks require charts, plots, axes/scales, legends, tooltips, or data-driven SVG output.

benchflow-ai/skillsbench · 64 tokens

web-interface-guidelines

Vercel's comprehensive UI guidelines for building accessible, performant web interfaces. Use this skill when reviewing or building UI components for compliance with best practices around accessibility, performance, animations, and visual stability.

benchflow-ai/skillsbench · 45 tokens

Popular Web Designs

Design contemporary web layouts, visual systems, and polished interface patterns.

Raidriar7170/hermes-skilleval · 17 tokens

browser-visual-review

Use when reviewing local browser screenshots for layout shifts, visual regressions, and viewport state.

Raidriar7170/hermes-skilleval · 23 tokens

react-best-practices

IMPORTANT: Any change to React or Next.js code must read through this skill first. React and Next.js guidelines from Vercel Engineering covering visual instability, layout shifts, CLS, flickering, hydration issues, and font loading.

benchflow-ai/skillsbench · 54 tokens

frontend-engineer

Pro frontend engineering discipline. Enforces build-test-verify workflow for every web project. Never declare done until the site is built, tested, responsive, accessible, and visually verified in a real browser. Use alongside vercel-cli for production-quality deployments.

suyoumo/ClawProBench · 54 tokens