Add a dataset (CSV, TSV, JSON, or GeoJSON) to an existing PortalJS portal. Appends an entry to datasets.json so the catalog and showcase render it automatically; routes the data by source (local file vs remote URL) — R2 via Git LFS by default, remote URLs by passthrough. Use when registering a new dataset in a scaffolded portal.
Capabilities
Example 1 — Local CSV, default R2 route
Moves the file into data/, tracks it with Git LFS, pushes it to R2…
Example 3 — GeoJSON adopted into R2
Downloads the file, then routes it as a local file through the Git LFS…
Getting started
Full instructionsInstall the skill, then ask your AI tool for the task in plain words. The full SKILL.md below shows what it covers.
Instructions: SKILL.mdv1.0.0
PortalJS — Add Dataset
Overview
Register a dataset in a PortalJS (portaljs-catalog) portal. The skill appends one entry to
datasets.json — the single source of truth for the catalog — and routes the underlying
bytes by source first, then size: a local file defaults to R2 via Git LFS, a remote URL
defaults to passthrough (no copy). No per-dataset page is created; the catalog at /search
lists the new entry and the dynamic showcase route pages/[owner]/[slug].tsx renders it
automatically at /@<namespace>/<slug>. Supported formats for the showcase preview: CSV,
TSV, JSON (array), and GeoJSON.
Prerequisites
- A scaffolded PortalJS portal (see
portaljs-new-portal) withdatasets.json,
package.json, andpages/[owner]/[slug].tsxpresent. - The source data: a local file path or a publicly reachable URL.
- For the R2/Git LFS default route:
gitandgit-lfsinstalled, and an Arc account token
(or an OSS Giftless key) to mint a push-scoped LFS credential. - Node 18+ and npm available in the portal directory.
Instructions
The canonical, full step-by-step workflow is
.claude/commands/portaljs-add-dataset.md —
the single source of truth. Read and follow it when executing. Summary:
- Gather input from
$ARGUMENTS— source (file path or URL), portal directory (default
.), dataset name/slug, description, namespace. If the source is missing, interview the
user; never dead-end. - Validate the portal directory: confirm
datasets.json,package.json, and
pages/[owner]/[slug].tsxexist. - Detect the format from the file extension, URL extension, or
Content-Typeheader
(CSV, TSV, JSON array, or GeoJSON); reject anything else and ask for a conversion. - Route the data by source: remote URL → passthrough (default) or adopt into R2 (opt-in);
local file → R2 via Git LFS (default) or inline intopublic/data/(fenced exception for
bundled samples or an OSS-no-R2 fallback). - Append one entry to
datasets.json—slug,namespace,name,description,file
(the routed path/URL),format— keeping(namespace, slug)unique. - Verify the build with
npx next build; fix errors (commonly malformed JSON) before
reporting success. - Report the route taken, the manifest change, and the showcase URL.
Output
- Modified:
datasets.json(one entry appended). - Created (route-dependent):
data/<slug>.<ext>tracked via Git LFS (R2 default), or
public/data/<slug>.<ext>(inline exception). Nothing is created for remote passthrough. - Verified:
npx next buildpasses. - Result: the dataset appears in
/searchand renders at/@<namespace>/<slug>.
Error Handling
| Symptom | Cause | Fix |
|---|---|---|
| Fetch fails for a URL source | Non-200 status or unreachable host | Report the HTTP status and ask the user to confirm the URL is publicly accessible. |
| "Not a portaljs-catalog portal" | datasets.json missing |
This is an older single-page template; ask the user how to proceed rather than failing silently. |
| Unsupported format | Extension/content-type isn't csv/tsv/json/geojson | Ask the user to convert the source before continuing. |
git lfs push has nothing to stream |
git lfs install --local never ran, so raw bytes were committed instead of a pointer |
Run git lfs install --local before git lfs track, re-add and re-commit the file. |
| R2 PUT returns 400 | A broad http.extraHeader was set and replayed onto the presigned URL |
Use the _jwt Basic-auth piggyback in lfs.url only — never a global http.extraHeader. |
(namespace, slug) clash |
Another entry already uses that pair | Ask the user for a different slug or namespace. |
next build fails |
Malformed JSON in datasets.json |
Print the build log, fix the JSON, rebuild before reporting success. |
Examples
Example 1 — Local CSV, default R2 route
/portaljs-add-dataset ./data/co2-emissions.csv namespace=climate
Moves the file into data/, tracks it with Git LFS, pushes it to R2, and appends a manifest
entry whose file is the resulting https://data.portaljs.com/... URL.
Example 2 — Remote URL, passthrough (no download)
/portaljs-add-dataset https://example.org/open-data/trade.csv namespace=trade
Detects the format from the response headers and records the URL as-is in datasets.json —
no bytes are copied.
Example 3 — GeoJSON adopted into R2
/portaljs-add-dataset https://example.org/boundaries.geojson namespace=reference adopt=true
Downloads the file, then routes it as a local file through the Git LFS → R2 path so it is
hosted and versioned under the portal (useful when in-browser range queries are needed).
Example 4 — Bundled sample data, inline exception
/portaljs-add-dataset ./samples/demo.csv namespace=reference
When the portal has no R2 credentials (OSS self-host) or the file is bundled sample data,
the skill copies it into public/data/ instead, per the .gitattributes inline fence.
Resources
- Full workflow:
.claude/commands/portaljs-add-dataset.md - Manifest fields and routing details:
references/reference.md - Related skills:
portaljs-new-portal,portaljs-add-chart,portaljs-add-map,portaljs-define-schema - Git LFS documentation: https://git-lfs.com/
Explore more skills
Browse all- Portaljs MigrateMigrate (harvest) datasets between open-data platforms. Reads CKAN, a DCAT-US /data.json catalog (DKAN, ArcGIS Hub,…
- Portaljs New PortalScaffold a new PortalJS data portal from a brief. Copies the canonical template from examples/portaljs-catalog and…
- Portaljs Check Data QualityAudit a local or remote tabular file (CSV/TSV) for common data quality issues — schema, nulls, types, duplicates.…
- Portaljs ArchitectRecommend a data-portal architecture (storage, compute, catalog, access, hosting, metadata) from stated needs, then…
- Portaljs Connect CkanWire a scaffolded PortalJS portal to a CKAN backend over its API. Generates a tiny server-side fetch client (no runtime…
- Portaljs Define SchemaDefine a dataset's metadata profile — infer a Frictionless Table Schema from its data, add Data Package metadata…
Security
Reviews (0)
More from portaljs
View source →Frequently asked questions about portaljs-add-dataset
What does the portaljs-add-dataset skill do?
Add a dataset (CSV, TSV, JSON, or GeoJSON) to an existing PortalJS portal. Appends an entry to datasets.json so the catalog and showcase render it automatically; routes the data by source (local file vs remote URL) — R2 via Git LFS by default, remote URLs by passthrough. Use when registering a new dataset in a scaffolded portal. It's a reusable SKILL.md instruction set that loads into your AI coding assistant on demand, no prompt engineering, no copy-pasting every session.
How do I install the portaljs-add-dataset skill?
Run `npx @skills-hub-ai/cli install portaljs-add-dataset` from your terminal. The CLI writes the SKILL.md to the correct location for your AI tool (e.g. ~/.claude/skills/portaljs-add-dataset/ for Claude Code or ~/.cursor/skills/ for Cursor with --target cursor) and adds it to your project's .skills.json lockfile.
Which AI tools does portaljs-add-dataset work with?
portaljs-add-dataset runs in Claude Code. It follows the open Agent Skills standard (SKILL.md), so the same skill works in every supported tool without modification.
Is the portaljs-add-dataset skill free?
Yes. Every skill on skills-hub.ai is free and open-source. There are no premium tiers, paywalls, or usage limits. You only pay for whatever AI assistant you're already using.
How do I use portaljs-add-dataset after installing it?
In Claude Code, type `/portaljs-add-dataset` (or whatever slash command the skill registers) and the AI follows the skill's instructions immediately. You can also reference it by name in natural language, your AI loads the skill into context when relevant.
Can I share the portaljs-add-dataset skill with my team?
Yes. Commit your project's .skills.json lockfile and teammates run `npx @skills-hub-ai/cli install` (no args) to install every skill at the exact version you pinned. Organization-scoped installs work via skills-hub.ai organizations.
Badge for your README
Show that this skill is on Skills Hub. The badge links back to this page and shows the live install count.
[](https://skills-hub.ai/skills/portaljs-add-dataset)<a href="https://skills-hub.ai/skills/portaljs-add-dataset"><img src="https://skills-hub.ai/api/badges/skill/portaljs-add-dataset" alt="Install on Skills Hub"></a>More options in the badge docs.