Skip to main content

Build

Portaljs Add Resource

portaljs

Add another file (resource) to an EXISTING dataset in a PortalJS portal — a data dictionary, methodology, or an additional data file. Turns a single-file dataset into a multi-resource one; the showcase renders a section per resource. Use when a dataset needs a second file, such as a data dictionary, methodology doc, or an additional period's data.

  • New
  • v1.0.0
  • Reviewed Aug 24
  • No reviews yet

Getting started

Full instructions

Install 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 Resource

Overview

Add a resource — an additional file — to a dataset that already exists in a
portaljs-catalog portal. Where /portaljs-add-dataset creates a new dataset
(one file), this skill adds a file to an existing one: a data dictionary, a
methodology document, or another data file (e.g. a second year's figures).

Mirrors the Frictionless Data Package model: a dataset holds a resources[] array,
and the showcase at /@<namespace>/<slug> renders one section per resource (preview,
schema, download). A single-file dataset migrates to resources[] automatically the
first time a second file is added — no data is lost.

Prerequisites

  • An existing PortalJS portal (portaljs-catalog template) with datasets.json,
    package.json, and pages/[owner]/[slug].tsx present.
  • The target dataset already registered in datasets.json.
  • The new resource's source: a local file path or a public URL, in CSV, TSV, JSON
    (array), or GeoJSON format.
  • Node 18+ installed to run npx next build for verification.

Instructions

The canonical, full step-by-step workflow lives in
.claude/commands/portaljs-add-resource.md
in this repository — that file is the single source of truth. Read and follow it. Summary:

  1. Gather input (interview if thin): DATASET (slug or namespace/slug), SOURCE
    (path or URL), PORTAL_DIR (default .), RESOURCE_NAME, RESOURCE_TITLE,
    DESCRIPTION. If DATASET or SOURCE is missing, list datasets from
    datasets.json and ask.
  2. Validate the portal and locate the dataset entry by slug (and namespace, if
    given). If the dataset does not exist, offer /portaljs-add-dataset instead.
  3. Detect the format from extension/Content-Type, fetch (check HTTP status) or
    confirm the local path exists, then copy into PORTAL_DIR/public/data/ under a
    non-colliding filename.
  4. Update datasets.json: if the dataset has no resources yet, migrate its
    top-level file/format/schema into the first resource (lossless), then
    append the new resource; if resources already exists, just append, keeping
    name unique within the array.
  5. Verify the build with npx next build, capturing output to a log file; fix
    malformed JSON before reporting success.
  6. Report the outcome (see Output below).

Output

text
✓ Resource added to DATASET: RESOURCE_TITLE (RESOURCE_NAME.EXT)
  - Data file: public/data/RESOURCE_NAME.EXT
  - Manifest:  datasets.json (dataset now has <n> resources)
  - Showcase:  /@<namespace>/<slug> renders a section per resource

If this was the first migration to multi-resource, note that the dataset's single
file was moved into resources[] with no data lost.

Error Handling

Symptom Cause Fix
"Dataset not found" DATASET slug/namespace doesn't match any entry in datasets.json List datasets from datasets.json and ask the user to pick, or run /portaljs-add-dataset to create it
npx next build fails with a JSON parse error Manually edited datasets.json has a trailing comma or unescaped character Re-open the file, fix the JSON, and rebuild before reporting success
Resource file fails to fetch (non-2xx) SOURCE URL is wrong, private, or the host is down Confirm the URL in a browser or with curl -I SOURCE; ask for a corrected URL or a local path
New resource's filename collides with an existing one in /public/data Auto-derived RESOURCE_NAME matches an existing file stem Pick a distinct RESOURCE_NAME, or let the skill append a numeric suffix
Showcase doesn't render the new section after build name in the new resource object duplicates an existing resource's name Rename the resource's name to something unique within that dataset's resources[]

Examples

Example 1 — Add a data dictionary to a single-file dataset

text
/portaljs-add-resource orders ./data/orders-data-dictionary.csv --title "Data dictionary"

orders was a single CSV. It is migrated to a two-resource dataset (the original
data plus the dictionary), and its showcase now renders a section for each.

Example 2 — Add a resource by URL to a dataset that already has resources

text
/portaljs-add-resource climate-observations https://example.org/data/methodology.json --name methodology --title "Methodology notes"

The skill fetches the URL, checks the HTTP status, copies it to
public/data/methodology.json, and appends it to the existing resources[] array.

Example 3 — Run with no arguments (interview mode)

text
/portaljs-add-resource

With no arguments, the skill lists datasets from datasets.json, asks which one to
extend and for the new file's path or URL, then proceeds through steps 2-6 above.

Resources

  • .claude/commands/portaljs-add-resource.md — canonical workflow this skill follows
  • references/reference.md — resource entry fields, single-to-multi-resource layout, troubleshooting
  • Related skills: /portaljs-add-dataset (create a new dataset), /portaljs-define-schema (describe a resource's fields)
  • Frictionless Data — Data Package resources — the data model this feature mirrors

Explore more skills

Browse all
This skill doesn’t include stateful context yet, instructions only. Learn about stateful skills.

Security

Loading security scan...

Reviews (0)

More from portaljs

View source →
arcgis-to-portaljsMigrate a whole ArcGIS Hub site into a PortalJS Arc portal end-to-end. Harvests the Hub /data.json (DCAT-US) inventory, exports every FeatureService layer through the ArcGIS REST query API with resultOffset paging, converts each to the…1 installsportaljs-add-geoAuto-ingest a geospatial file (GeoJSON, Shapefile, GeoPackage, KML/KMZ, FlatGeobuf, CSV-with-geometry) into a PortalJS portal on the user's own machine, with no server. Normalizes CRS to EPSG:4326, derives a PMTiles render tier and a…0 installsportaljs-add-chartAdd a chart (line, bar, area, pie, or scatter) to a dataset's showcase in a PortalJS portal. Installs recharts, writes a reusable Chart component, and renders it in the showcase Views section. Use when visualizing a dataset already…0 installsportaljs-add-dcatMake a PortalJS portal harvestable by national/EU/US open-data portals — emit standards-compliant DCAT catalog feeds (DCAT 2/3, DCAT-AP, DCAT-US, national profiles) in JSON-LD, Turtle, and RDF/XML at build, with autodiscovery and…0 installsportaljs-add-mapRender a GeoJSON dataset on an interactive Leaflet map in the Views section of a dataset's showcase. Installs react-leaflet and a Map component, then renders the map for the chosen dataset. Use when a dataset's data is geographic and a map…0 installsportaljs-add-datasetAdd 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…0 installs

Frequently asked questions about portaljs-add-resource

What does the portaljs-add-resource skill do?

Add another file (resource) to an EXISTING dataset in a PortalJS portal — a data dictionary, methodology, or an additional data file. Turns a single-file dataset into a multi-resource one; the showcase renders a section per resource. Use when a dataset needs a second file, such as a data dictionary, methodology doc, or an additional period's data. 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-resource skill?

Run `npx @skills-hub-ai/cli install portaljs-add-resource` from your terminal. The CLI writes the SKILL.md to the correct location for your AI tool (e.g. ~/.claude/skills/portaljs-add-resource/ 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-resource work with?

portaljs-add-resource 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-resource 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-resource after installing it?

In Claude Code, type `/portaljs-add-resource` (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-resource 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.

Install on Skills Hub badge preview
Markdown
[![Install on Skills Hub](https://skills-hub.ai/api/badges/skill/portaljs-add-resource)](https://skills-hub.ai/skills/portaljs-add-resource)
HTML
<a href="https://skills-hub.ai/skills/portaljs-add-resource"><img src="https://skills-hub.ai/api/badges/skill/portaljs-add-resource" alt="Install on Skills Hub"></a>

More options in the badge docs.