portaljs-add-chart

portaljs-add-chart is a command for Claude Code from datopian/portaljs. It costs 46 tokens per session (3,523 once invoked), scanned A, original, MIT.

A command for adding a chart to a dataset page in a PortalJS data portal. PortalJS is a web framework for publishing datasets, and the chart reads the same data as the page’s table.

In plain words
What is it for?
Use it to add line, bar, area, pie, or scatter charts by selecting a dataset and its category and numeric columns.
Why use it?
It avoids duplicating dataset values and reduces the code needed to display data visually.

Command for Claude Code

Written for Claude Code: allowed-tools in frontmatter. Also seen: mentions CLAUDE.md.

Needs its repository: it reads a path above its own folder, which exists only inside the repository. The line is import { Chart } from '../../components/Chart'.

Part of the portaljs plugin — 14 skills, 25 commands shipped together

Good fit Use it to add line, bar, area, pie, or scatter charts by selecting a dataset and its category and numeric columns.

Compare 6 commands from other repositories ↓
About the project

PortalJS is a framework for building data portals that present searchable datasets through a home page, catalog, and dataset showcase. It is for teams that want to choose a data backend, scaffold a Next.js portal, load CSV or JSON data, connect services such as CKAN, and deploy the result. The catalogue entries are agent commands, skills, instructions, and a plugin that guide portal creation and data loading.

datopian/portaljs · 2,349 stars · on GitHub · portaljs.com

Install

Getting it into your agent

It runs from inside its repository, so the clone comes first — what it calls does not travel with the file alone.

Clone the repo
git clone --depth 1 https://github.com/datopian/portaljs
agentmods
npx agentmods add commands/datopian/portaljs/portaljs-add-chart

Made for: Claude Code.

Or install portaljs, the plugin that ships this one along with the rest of its 14 skills, 25 commands.

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 portaljs-add-chart

README.md
[![agentmods](https://agentmods.dev/badge/commands/datopian/portaljs/portaljs-add-chart.svg)](https://agentmods.dev/commands/datopian/portaljs/portaljs-add-chart)
Your own site
<a href="https://agentmods.dev/commands/datopian/portaljs/portaljs-add-chart"><img src="https://agentmods.dev/badge/commands/datopian/portaljs/portaljs-add-chart.svg" alt="Measured on agentmods" height="20"></a>
Per session 46 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 3,523 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 1 finding. A grade says what 26 rules found in the file — not that it is safe.
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.00046 $0.03523
Opus 5 $0.00023 $0.01761
Sonnet 5 $0.00009 $0.00705
Haiku 4.5 $0.00005 $0.00352

Measured 8d ago against content hash 28846ae8ef66, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-07, from the pricing page.

Security

Grade A, and why

portaljs-add-chart scanned grade A with 1 finding 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 8d 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.

Makes network callslowCapability

Not a fault in itself. Listed so you know the mod talks to something, and to what.

fetch(url)
.claude/commands/portaljs-add-chart.md · 309 lines

How it starts

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

/portaljs-add-chart

Add a visualization to a dataset's showcase in a portaljs-catalog portal. Installs recharts (added directly — not @portaljs/components), writes a reusable client-side Chart component into the portal's components/, and renders a <Chart /> into the Views section of the showcase route pages/[owner]/[slug].tsx for the chosen dataset.

Use this after the dataset is registered in datasets.json (e.g. via /portaljs-add-dataset). The chart reads the same /public/data/<file> the showcase's <Table /> already uses — no data is duplicated.

Required input — ask, don't error

  • Dataset — which dataset to chart, by slug (e.g. co2-emissions) or slug within a namespace. It must already be an entry in datasets.json.
  • X axis column — the column name for the category/X axis (e.g. year).
  • Y axis column(s) — one or more numeric column names to plot (e.g. population or imports,exports).
  • Portal directory — path to the portal project (defaults to current directory).
  • Chart typeline (default), bar, area, pie, or scatter.

If the target dataset isn't specified, ask which one (by name/slug) — never dead-end with a missing-input error.

Steps

1. Gather input from $ARGUMENTS (interview if thin)

Extract:

  • DATASET — dataset slug (required)
  • X — x-axis column name (required)
  • Y — comma-separated y-axis column name(s) (required)
  • TYPE — chart type, one of line|bar|area|pie|scatter (default: line)
  • PORTAL_DIR — portal directory (default: .)
  • TITLE — chart heading (default: derived from Y columns, e.g. "Population over Year")

If the dataset (or X/Y) is missing, ask and wait. When the user doesn't know the slug, read PORTAL_DIR/datasets.json and list the available datasets (nameslug) so they can pick one:

To add a chart I need:
1. Which dataset? (slug — your catalog has: <name (slug)>, …)
2. X axis column (e.g. year)
3. Y axis column(s), comma-separated (e.g. population or imports,exports)
4. Chart type [line] (line|bar|area|pie|scatter)
5. Portal directory (Enter for current directory)

Read the full file on GitHub · 309 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. 8d ago First seen · 309 lines · 46 tokens per session scan A 28846ae8ef66

Subscribe to this mod's changes

portaljs-add-chart is a command published in the GitHub repository datopian/portaljs (2,349 stars, last pushed 4d ago), licensed MIT. It adds 46 tokens to every session and 3,523 once invoked, about $0.0002 per session on Opus 5. A static security scan graded it A with 1 finding (makes network calls). No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.