添加数据集

本条目介绍 添加数据集 的公开用途。DeepSkill 当前公开目录说明:“将一个数据集(CSV、TSV、JSON 或 GeoJSON)添加到现有的 PortalJS 门户中。向 datasets.json 追加一条记录,以便目录和展示页面自动渲染该数据集;根据数据来源进行路由(本地文件 vs 远程 URL)——默认通过 Git LFS 使用 R2,远程 URL 则通过直传方式。适用于在已搭建的门户中注册新数据集时使用。” 适用场景包括部署发布与上云、写 SQL 取数。本页根据公开目录资料和固定版本的上游仓库整理,建议使用前核对该版本的环境、工具、权限及数据处理要求。Skillπ 提供站方用途介绍与原站链接;原始 SKILL.md 和附件仅在对应许可允许时开放。

仓库
jeremylongshore/tons-of-skills-marketplace

安装方式

先用 Prompt 核对来源,也可切换到安装命令或下载可用的安装包。

安装方式

用 AI 助手安装

复制提示词,让助手先核对固定版本和依赖。

查看 Prompt收起 Prompt
先检查当前 Agent 是否已安装 SkillPI Skill Finder。如果尚未安装,请按官方仓库的说明安装并启用:https://github.com/Findskills/skillpi。然后使用 Skill Finder 打开此 SkillPI 详情页并定位 "portaljs-add-dataset":https://skillpi.com/zh/skills/deepskill-71ccb054f8112c0ba01de157e1e6d7715d7271666c29e940f1207c4e7b56a975。安装前核对上游来源和版本:https://github.com/jeremylongshore/tons-of-skills-marketplace/blob/6ea46b08dce892944db7c16f28d0b5308d402402/plugins/community/portaljs/skills/portaljs-add-dataset/SKILL.md。来源不一致时停止并说明差异。核对通过后,用 Skill Finder 安装目标 Skill,并报告安装路径和来源版本。

此命令从 GitHub 来源仓库获取指定技能。运行前请先查看源文件。

运行工具
npx skills add https://github.com/jeremylongshore/tons-of-skills-marketplace/tree/6ea46b08dce892944db7c16f28d0b5308d402402/plugins/community/portaljs/skills/portaljs-add-dataset --skill portaljs-add-dataset
许可协议: —

来源与配置

查看 GitHub 源码

jeremylongshore/tons-of-skills-marketplace固定提交 6ea46b08dce892944db7c16f28d0b5308d402402

配置方式待核实

请查看原始来源中的适用工具、依赖和权限要求。

安装实测待补充

本条目介绍 添加数据集 的公开用途。DeepSkill 当前公开目录说明:“将一个数据集(CSV、TSV、JSON 或 GeoJSON)添加到现有的 PortalJS 门户中。向 datasets.json 追加一条记录,以便目录和展示页面自动渲染该数据集;根据数据来源进行路由(本地文件 vs 远程 URL)——默认通过 Git LFS 使用 R2,远程 URL 则通过直传方式。适用于在已搭建的门户中注册新数据集时使用。” 适用场景包括部署发布与上云、写 SQL 取数。本页根据公开目录资料和固定版本的上游仓库整理,建议使用前核对该版本的环境、工具、权限及数据处理要求。Skillπ 提供站方用途介绍与原站链接;原始 SKILL.md 和附件仅在对应许可允许时开放。

↓ 0 下载 ↗ 0 分享点击

文件浏览

在原站浏览文件 ↗

原始 SKILL.md

打开原文 ↗
---
name: portaljs-add-dataset
description: 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.
allowed-tools: Read, Write, Edit, Bash(npm:*), Bash(npx:*), Bash(git:*), Bash(curl:*), Bash(mkdir:*), Bash(cp:*), WebFetch
version: 1.0.0
author: Datopian <hello@datopian.com>
license: MIT
compatibility: Claude Code with PortalJS portals (Next.js 14, React 18, Node 18+). Runs from any project via the plugin, a personal ~/.claude/commands install, or a portaljs clone.
tags:
  - portaljs
  - data-portal
  - dataset
  - csv
  - geojson
  - catalog
---

# 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`) with `datasets.json`,
  `package.json`, and `pages/[owner]/[slug].tsx` present.
- The source data: a local file path or a publicly reachable URL.
- For the R2/Git LFS default route: `git` and `git-lfs` installed, 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`](https://github.com/datopian/portaljs/blob/main/.claude/commands/portaljs-add-dataset.md) —
the single source of truth. Read and follow it when executing. Summary:

1. 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.
2. Validate the portal directory: confirm `datasets.json`, `package.json`, and
   `pages/[owner]/[slug].tsx` exist.
3. Detect the format from the file extension, URL extension, or `Content-Type` header
   (CSV, TSV, JSON array, or GeoJSON); reject anything else and ask for a conversion.
4. Route the data by source: remote URL → passthrough (default) or adopt into R2 (opt-in);
   local file → R2 via Git LFS (default) or inline into `public/data/` (fenced exception for
   bundled samples or an OSS-no-R2 fallback).
5. Append one entry to `datasets.json` — `slug`, `namespace`, `name`, `description`, `file`
   (the routed path/URL), `format` — keeping `(namespace, slug)` unique.
6. Verify the build with `npx next build`; fix errors (commonly malformed JSON) before
   reporting success.
7. 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 build` passes.
- **Result:** the dataset appears in `/search` and 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`](https://github.com/datopian/portaljs/blob/main/.claude/commands/portaljs-add-dataset.md)
- Manifest fields and routing details: [`references/reference.md`](references/reference.md)
- Related skills: `portaljs-new-portal`, `portaljs-add-chart`, `portaljs-add-map`, `portaljs-define-schema`
- Git LFS documentation: <https://git-lfs.com/>

当前收录版本

1.0.0

核对来源版本 ↗

质量评测

满分 100。前四项来自 DeepSkill 收录的质量报告。

场景价值95/100
评分依据

解决 PortalJS 门户中注册新数据集的高频刚需任务

触发精准95/100
评分依据

description 清晰完整,覆盖功能、格式、路由逻辑和使用场景

结构规范95/100
评分依据

文档结构完整,Phase/步骤清晰,包含 prerequisites、instructions、output、error handling

执行可靠95/100
评分依据

工具来源明确,参数处理逻辑健壮

证据可验 (前四项均值)95/100
计算方式

取前四项原始分值的算术平均,四舍五入取整。可通过收录报告核对各项评分与说明,运行记录需单独查证。

权限与使用前检查

根据当前主文档自动整理,命中内容可能是示例或防护说明;不是实际权限声明,也未覆盖附件、外部依赖或运行行为。

  • 安装或获取外部依赖

    使用官方来源并锁定版本,在隔离环境检查安装脚本。当前文档检查不覆盖后续下载的代码。

    主文档提及 · 第 4, 57, 66 行
  • 账号、密钥或授权

    使用专用、最小权限账号,不把密钥粘贴到公开内容或命令日志;核对接收数据的服务与租户。

    主文档提及 · 第 36, 112 行
文档引用的域名或地址

这些地址可能用于文档链接或示例,不是已批准的联网清单。使用前核对实际目的地及发送的数据。

  • data.portaljs.com
  • example.org
  • git-lfs.com
  • github.com

本站展示提示不会授予权限。涉及文件改动、密钥、外部发送或费用时,仍由你使用的工具按需确认。

安全评级与访问范围

risk · 静态证据核验,不代表运行安全保证。

使用前请由宿主核对并授权实际文件读写、外部服务和联网目的地;本站的核验不会授予任何运行权限。

来源与使用声明 SkillPi 的部分技能资料来自公开来源或创作者提交。第三方内容的权利归各自权利人所有。安装或运行前,请查看原站的许可、权限要求和使用风险。

来源与使用

请按详情页的作者、原始来源和许可证核对使用条件,运行前检查技能需要的权限。目录收录不等于已验证安装或安全性。