portaljs-add-map

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

A command that adds an interactive Leaflet map to a PortalJS dataset showcase. GeoJSON is a format for geographic data such as points, lines, and areas.

In plain words
What is it for?
Use it to add a map view for a GeoJSON dataset in a PortalJS catalog, including datasets that first need to be registered.
Why use it?
It lets people view location-based data on a map instead of only reading metadata or downloading the file.

Command for Claude Code

Written for Claude Code: allowed-tools in frontmatter.

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

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

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-map

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-map

README.md
[![agentmods](https://agentmods.dev/badge/commands/datopian/portaljs/portaljs-add-map.svg)](https://agentmods.dev/commands/datopian/portaljs/portaljs-add-map)
Your own site
<a href="https://agentmods.dev/commands/datopian/portaljs/portaljs-add-map"><img src="https://agentmods.dev/badge/commands/datopian/portaljs/portaljs-add-map.svg" alt="Measured on agentmods" height="20"></a>
Per session 41 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,463 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 1 finding. Scan, not verified.
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.00041 $0.03463
Opus 5 $0.00020 $0.01732
Sonnet 5 $0.00008 $0.00693
Haiku 4.5 $0.00004 $0.00346

Measured 6d ago against content hash 2be99b7feece, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-06, from the pricing page.

Security

Grade A, and why

portaljs-add-map 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 6d 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.

# or for URLs: curl -L SOURCE -o PORTAL_DIR/public/data/MAP_SLUG.geojson
.claude/commands/portaljs-add-map.md · 334 lines

How it starts

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

/portaljs-add-map

Add an interactive Leaflet map as a view on a dataset's showcase in a portaljs-catalog portal. Installs react-leaflet/leaflet (once), generates a reusable Map component, and renders the map into the Views section of the showcase route pages/[owner]/[slug].tsx for the chosen GeoJSON dataset.

Use this when a dataset's data is geographic (points, lines, polygons) and you want a map view in addition to the showcase's default metadata + download. The dataset should already be registered in datasets.json (e.g. via /portaljs-add-dataset) with format: "geojson"; if it isn't yet, this skill can copy the file and add the entry first.

Required input — ask, don't error

  • Dataset — which dataset to map, by slug. It should be a geojson entry in datasets.json. If a source file/URL is given for a not-yet-registered dataset, the skill copies it into /public/data/ and appends a manifest entry.
  • Portal directory — path to the portal project (defaults to current directory).
  • Source (only if the dataset isn't registered yet) — a local file path (./data/file.geojson) or public URL. Must be GeoJSON (a Feature, FeatureCollection, or geometry object).

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 (the map target)
  • SOURCE — file path or URL (only needed if the dataset isn't already in the manifest)
  • PORTAL_DIR — portal directory (default: .)
  • MAP_SLUG — slug for a new dataset (default: lowercase hyphenated filename)
  • MAP_NAME — human-readable name (default: derived from filename)
  • NAMESPACE — namespace for a new dataset (default: the catalog's existing namespace)
  • DESCRIPTION — optional one-line description

If neither a dataset nor a source is given, ask and wait. When the user doesn't know the slug, read PORTAL_DIR/datasets.json and list the GeoJSON datasets so they can pick:

To add a map I need either:
1. Which existing dataset to map? (slug — GeoJSON datasets in your catalog: <name (slug)>, …)
   …or a GeoJSON source to add and map:
2. Source: local file path or public URL to a GeoJSON file
3. Portal directory (Enter for current directory)

Read the full file on GitHub · 334 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. 6d ago First seen · 334 lines · 41 tokens per session scan A 2be99b7feece

Subscribe to this mod's changes

portaljs-add-map is a command published in the GitHub repository datopian/portaljs (2,349 stars, last pushed 2d ago), licensed MIT. It adds 41 tokens to every session and 3,463 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.