Portaljs Define Schema logo

Portaljs Define Schema

OrganizationPopular
datopian
portaljs-define-schema

Define a dataset's metadata profile — infer a Frictionless Table Schema from its data, add Data Package metadata (license, sources, keywords), and write it into datasets.json so the showcase renders a typed field table. Extend or customize via the L0-L3 profile ladder. Use when a registered dataset needs field types, constraints, or catalog metadata before publishing.

Overview

Publisherdatopian
Repositoryportaljs
Skill nameportaljs-define-schema
Stars
2.4K
Forks
332
Bundled files
1
LicenseMIT
Links
  • Markdown instructions

    A SKILL.md file the model loads on demand, so it only costs tokens when a request actually matches.

  • Works with any LLM

    AI skills are plain Markdown, not provider-specific code, so this works with GPT, Claude, Gemini, Grok, or a local model.

  • 1 bundled files

    Scripts, templates, and references the model can read while it works. Files are read-only and never executed.

  • Open source

    Published by datopian on GitHub. Read the source before you install it.

Installation

Install the Portaljs Define Schema AI skill in TypingMind to use it with any LLM, or drop it into another agent that reads SKILL.md.

1

Install in TypingMind

TypingMind installs a skill straight from its GitHub folder — it reads SKILL.md, bundles the resource files, and stores the result locally.

  1. Open the app and go to Plugins → Skills.
  2. Choose "Install from GitHub".
  3. Paste the skill folder URL below and confirm.
  4. Enable the skill in any chat where you want it available.
Plugins → Skills → Add skill → From GitHub URL, then paste the folder URL and press Continue.
2

Install in another agent

Any agent that reads the Agent Skills format can use this skill — copy the folder into that agent's skills directory.

Claude Code — .claude/skills
git clone --depth 1 https://github.com/datopian/portaljs.git /tmp/portaljs
mkdir -p .claude/skills
cp -r /tmp/portaljs/skills/portaljs-define-schema .claude/skills/portaljs-define-schema
Restart Claude Code after copying so it picks up the new skill.

Use it in TypingMind

Enable Portaljs Define Schema in any TypingMind chat and the model takes it from there. Its name and description sit in the system prompt, and the moment a request matches, the model loads the full instructions itself — you never invoke it by hand, and it costs no tokens until it is actually used.

The model loads Portaljs Define Schema on its own as soon as a request matches it.

Works with any AI model

AI skills are plain Markdown instructions rather than provider-specific code, so Portaljs Define Schema is not tied to the model it was written for. Install it once in TypingMind and use it with GPT-5, Claude, Gemini, Grok, DeepSeek, Mistral, Llama, or a local model you run yourself — all on your own API keys.

  • Loaded only when it is needed

    The system prompt carries just the name and description. The instructions are fetched on the first matching request, so an idle skill costs nothing.

  • Switch models mid-chat

    Because the skill is instructions rather than code, changing model does not break it — the next model reads the same SKILL.md.

Skill instructions

This is the SKILL.md content the model loads. Read it before installing — a skill is instructions your model will follow.

PortalJS — Define Schema

Overview

Define a dataset's metadata profile — the authoring skill for the metadata-profile contract (lib/metadata). Where portaljs-add-dataset registers that a dataset exists, this skill describes what its data means: infer a Frictionless Table Schema (fields, types, constraints) from sampled data, add the Data Package fields a catalog surfaces (title, licenses, sources, keywords), and write them onto the dataset's entry in datasets.json. The showcase at /@<namespace>/<slug> then renders a typed field table instead of a bare preview. The model is Frictionless-native; DCAT is a serialization layer built on top later, not authored here.

The skill runs on a profile ladder — reach for higher levels only when needed:

LevelWhat it isWhen
L0Default frictionless-tabular profile; declare schema + metadata.Default. Standard tabular CSV/TSV.
L1L0 plus extra descriptive package fields.Extra metadata, standard validation is fine.
L2Fully custom profile (own schema template + validate()).A dataset type needing custom validation rules.
L3Multiple registered profiles, resolved per dataset.A portal mixing dataset types.

The skill is interactive and never dead-ends: if input is thin it interviews in short rounds, infers defaults from the data, echoes the schema for confirmation, and accepts "use defaults" to proceed with the inferred schema as-is.

Prerequisites

  • A scaffolded PortalJS portal with the metadata contract (lib/metadata/types.ts, pages/[owner]/[slug].tsx); see portaljs-new-portal.
  • The target dataset already registered in datasets.json (see portaljs-add-dataset).
  • For tabular schema inference, the dataset's CSV/TSV file present under PORTAL_DIR/public/data/. JSON/GeoJSON datasets get package metadata only — no fields.
  • Node 18+; tsx optional, used for the schema-validation check.

Instructions

The canonical, full step-by-step workflow is .claude/commands/portaljs-define-schema.md — the single source of truth. Read and follow it when executing. Summary:

  1. Gather PORTAL_DIR, DATASET (slug or namespace/slug), and LEVEL (default L0) from input; if DATASET is missing, list the portal's slugs and ask.
  2. Validate the portal has the metadata contract (datasets.json, lib/metadata/types.ts, the showcase route); proceed anyway if lib/metadata/ predates the contract.
  3. For tabular datasets, sample the header and ~50 rows from public/data/<file> and infer each field's type, constraints (required, unique, pattern), and a primary key.
  4. Echo the inferred schema as a table for confirmation; offer to go beyond L0 only if warranted.
  5. Ask for optional Data Package metadata: license, source(s), keywords, version.
  6. Write the schema and metadata onto the dataset's entry in datasets.json in place, preserving all other fields; for L2/L3, scaffold and register a custom profile module.
  7. Optionally validate the schema against the data's rows via the profile's validate().
  8. Verify with npx next build; fix malformed JSON or an invalid FieldType before reporting success.
  9. Report the profile, fields, metadata set, and the showcase URL.

Output

  • Modified: datasets.json (target entry gains profile, schema, licenses, sources, keywords, version — unset fields omitted).
  • Created (L2/L3 only): lib/metadata/<profile-id>.ts; lib/metadata/registry.ts updated with a registerProfile(...) call.
  • Verified: npx next build succeeds.
  • Result: /@<namespace>/<slug> renders a typed field table in place of a bare preview.

Error Handling

SymptomCauseFix
Dataset not found in datasets.jsonWrong slug or missing namespace/ prefixList available slugs and re-prompt.
lib/metadata/ missingPortal predates the metadata-profile contractProceed anyway — schema fields are optional and ignored by older showcases.
No fields schema producedDataset is JSON/GeoJSON, not tabularExpected — capture Data Package metadata only.
Validation reports type errorsSampled values don't coerce to the inferred typeRelax the type or drop the offending required/pattern constraint.
next build fails on datasets.jsonStray comma or a type outside FieldTypeFix the JSON/type and rebuild before reporting success.

Examples

Example 1 — Default L0 schema for a CSV dataset

/portaljs-define-schema population-2022

Infers fields (e.g. country: string, population: integer), drafts titles, asks for a license and source, and writes the schema under the default frictionless-tabular profile.

Example 2 — Metadata only for a GeoJSON dataset

/portaljs-define-schema neighborhoods-geo

GeoJSON has no tabular fields; the skill captures license, sources, and keywords onto the entry and skips schema inference.

Example 3 — Custom L2 profile with its own validation

/portaljs-define-schema co2-emissions level=L2

Scaffolds lib/metadata/co2-emissions-profile.ts with a custom validate(), registers it in lib/metadata/registry.ts, and sets "profile": "co2-emissions-profile" on the entry.

Resources

Bundled files

The model reads these on demand while the skill is loaded. They are exposed as readable files and are never executed.

Frequently asked questions

What does the Portaljs Define Schema AI skill do?

Define a dataset's metadata profile — infer a Frictionless Table Schema from its data, add Data Package metadata (license, sources, keywords), and write it into datasets.json so the showcase renders a typed field table. Extend or customize via the L0-L3 profile ladder. Use when a registered dataset needs field types, constraints, or catalog metadata before publishing.

Why use Portaljs Define Schema on TypingMind?

Because you install it once and use it with any model. Portaljs Define Schema is plain Markdown rather than provider-specific code, so the same skill runs on GPT-5, Claude, Gemini, Grok, or a local model — and you can switch model mid-chat without it breaking. TypingMind runs on your own API keys, so you pay providers directly instead of a per-seat subscription, and your skills and chats stay in your own storage.

How do I install Portaljs Define Schema in TypingMind?

Open Plugins → Skills → Install from GitHub in TypingMind and paste https://github.com/datopian/portaljs/tree/main/skills/portaljs-define-schema. TypingMind reads its SKILL.md and bundles its files and installs it as a skill you can enable per chat.

Which AI models can use Portaljs Define Schema?

Any model you connect in TypingMind. AI skills are plain Markdown instructions rather than provider-specific code, so GPT, Claude, Gemini, Grok, and local models can all load this skill when a request matches it.

How many AI models can I use with Portaljs Define Schema?

As many as you like. As long as a model supports skills, you can use Portaljs Define Schema with it — GPT, Claude, Gemini, Grok, DeepSeek, Mistral, Llama and more — all on TypingMind with your own API keys.

Is the Portaljs Define Schema AI skill free?

Yes. It is published on GitHub by datopian under the MIT license. You only pay your own AI provider for the tokens you use.

What are AI skills?

An AI skill is a reusable instruction bundle that teaches an AI model how to do one specific task. It follows the open Agent Skills format: a SKILL.md file with a name and description, plus any scripts, templates or reference files the model may need. The model reads the instructions only when your request matches the skill, so an installed skill costs nothing until it is used.

How are AI skills different from plugins or MCP servers?

A plugin or MCP server gives a model new tools to call — code that runs somewhere and returns a result. An AI skill gives the model knowledge and process instead: how to approach a task, which steps to follow, what good output looks like. Skills are plain Markdown, so they need no server, no API key and no runtime, and they work with any model.

View all

Set up your own AI workspace now

Get notified about new features and future giveaways by subscribing to our newsletter 👇