{"data":{"slug":"github-datopian-portaljs-skills-portaljs-new-portal-e9be1788f16f","title":"PortalJS \u2014 New Portal","summary":"Scaffold a new PortalJS data portal from a brief. Copies the canonical template and substitutes project tokens. Creates a new directory with the template, modifies configuration files, and verifies the scaffold with a type check.","url":"https:\/\/skillshunter.net\/skills\/github-datopian-portaljs-skills-portaljs-new-portal-e9be1788f16f","json_url":"https:\/\/skillshunter.net\/api\/public\/v1\/skills\/github-datopian-portaljs-skills-portaljs-new-portal-e9be1788f16f","markdown_url":"https:\/\/skillshunter.net\/skills\/github-datopian-portaljs-skills-portaljs-new-portal-e9be1788f16f.md","download_url":"https:\/\/skillshunter.net\/skills\/github-datopian-portaljs-skills-portaljs-new-portal-e9be1788f16f\/download","category":{"slug":"software-development","name":"Software & Development"},"editor_note":"Prerequisites: Node.js >=22 and npm available on PATH. A destination directory name that does not already contain files (or user consent to overwrite one that does).","instructions":"---\nname: portaljs-new-portal\ndescription: Scaffold a new PortalJS data portal from a brief. Copies the canonical template from examples\/portaljs-catalog and substitutes project tokens. Use when starting a brand-new data portal project from scratch.\nallowed-tools: Read, Write, Edit, Bash(npm:*), Bash(npx:*), Bash(cp:*), Bash(mkdir:*), Bash(git:*)\nversion: 1.0.0\nauthor: Datopian <hello@datopian.com>\nlicense: MIT\ncompatibility: 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.\ntags:\n  - portaljs\n  - data-portal\n  - scaffold\n  - nextjs\n  - template\n  - catalog\n---\n\n# PortalJS \u2014 New Portal\n\n## Overview\n\nScaffold a production-ready PortalJS data portal from a brief. The skill is\n**interactive**: if the brief is thin it interviews the user in three short rounds\n(mapped to the template's three surfaces \u2014 Home, Catalog, Showcase), echoes a brief\nback for confirmation, then copies `examples\/portaljs-catalog` (locally or via a\nremote `tiged` fetch), substitutes placeholder tokens, sets the namespace mode and the\nUI language, seeds any datasets named in the interview, installs dependencies, and verifies the scaffold\nwith a type check.\n\n## Prerequisites\n\n- Node.js >=22 and npm available on `PATH`.\n- Network access, unless a current local checkout of the portaljs repo is available\n  (the resolver defaults to a remote fetch of the template).\n- A destination directory name that does not already contain files (or user consent\n  to overwrite one that does).\n\n## Instructions\n\nThe canonical, full step-by-step workflow is\n[`.claude\/commands\/portaljs-new-portal.md`](https:\/\/github.com\/datopian\/portaljs\/blob\/main\/.claude\/commands\/portaljs-new-portal.md) \u2014\nthe single source of truth. Read and follow it when executing. Summary:\n\n1. Interview the user in up to three rounds \u2014 Home\/basics (incl. the UI language,\n   default English), Catalog & discovery\n   (datasets, namespace mode `theme` vs `owner`), Showcase\/views \u2014 skipping any round\n   already answered by the input brief. Accept \"use defaults\" at any point.\n2. Confirm a short brief (name, slug, description, language, namespace, datasets,\n   views) before building.\n3. Resolve the template source: prefer a remote `tiged` fetch of\n   `examples\/portaljs-catalog` at `main` (or `PORTALJS_TEMPLATE_REF`); use a local\n   checkout only when it is current (has `pages\/[owner]\/[slug].tsx`) and the\n   destination is outside that repo.\n4. Materialize the template into `.\/PROJECT_SLUG`, asking first if the destination\n   already exists and is non-empty.\n5. Substitute `__PROJECT_NAME__`, `__PROJECT_SLUG__`, `__DESCRIPTION__` tokens\n   across all files with `perl -pi`, escaping `\/`, `\\`, and `&` in the values.\n6. Set `NAMESPACE_TYPE` (`'theme'` or `'owner'`) in `lib\/datasets.ts` per the\n   interview.\n7. Set the UI language (skip for English): translate `locales\/en.json` into\n   `locales\/<code>.json` (every key, `{placeholders}` verbatim, the plural forms the\n   language uses, `_intl` BCP 47 tag such as `it-IT`), register it in `lib\/i18n.ts`,\n   set `DEFAULT_LOCALE` in `next.config.js`, and run `npm run i18n:check`.\n8. Seed datasets captured in Round 2 (via `\/portaljs-add-dataset` or by hand), or\n   clear `datasets.json` to `[]` if none were named.\n9. Run `npm install` inside the scaffolded portal.\n10. Verify with `npm run i18n:check` and `npx tsc --noEmit` (never `next build` here \u2014\n    it would corrupt a running dev server's `.next\/` directory).\n11. Report the scaffolded routes, namespace mode, language, and next steps.\n\n## Output\n\n- **Created:** a new directory `.\/PROJECT_SLUG\/` containing the full\n  `examples\/portaljs-catalog` template with tokens substituted.\n- **Modified:** `lib\/datasets.ts` (`NAMESPACE_TYPE`); `datasets.json` (seeded\n  datasets or cleared to `[]`); for a non-English portal, `locales\/<code>.json`\n  (created), `lib\/i18n.ts` (registered) and `next.config.js` (`DEFAULT_LOCALE`).\n- **Verified:** `npm run i18n:check` and `npx tsc --noEmit` pass inside the scaffolded\n  portal.\n- **Result:** a runnable portal at `.\/PROJECT_SLUG` with Home (`\/`), Catalog\n  (`\/search`), and Showcase (`\/@<namespace>\/<slug>`) surfaces wired up.\n\n## Error Handling\n\n| Symptom | Cause | Fix |\n| --- | --- | --- |\n| `DIR_EXISTS` | `.\/PROJECT_SLUG` already exists and is non-empty | Ask the user for a different name or consent to remove it; then proceed. |\n| Remote fetch fails | Bad `PORTALJS_TEMPLATE_REF`, network outage, or `tiged` unavailable | Tell the user plainly and ask to retry, use a different ref, or check network. |\n| Stale local scaffold (`pages\/datasets\/[slug].tsx`) | Old local clone missing `pages\/[owner]\/[slug].tsx` | Resolver already falls back to remote in this case \u2014 do not force local mode. |\n| `npm install` fails | Node <22 or no network | Report the error and ask the user to check Node version and connectivity. |\n| `tsc --noEmit` fails | Token substitution or manifest error | Print the log and fix before reporting success \u2014 never report success with a failing type check. |\n\n## Examples\n\n### Example 1 \u2014 Full brief up front\n\n```\n\/portaljs-new-portal Auckland Open Data Portal \u2014 datasets published by several council\ndepartments (multiple publishers). Start with .\/data\/parks.csv and .\/data\/budget.csv.\n```\nInfers name + description, picks `NAMESPACE_TYPE = 'owner'`, asks for namespace\nvalues (e.g. `parks-dept`, `finance`), confirms the brief, scaffolds the template, and\nseeds both datasets at `\/@parks-dept\/parks` and `\/@finance\/budget`.\n\n### Example 2 \u2014 No arguments, full interview\n\n```\n\/portaljs-new-portal\n```\nRuns all three interview rounds from scratch, accepting \"use defaults\" for any round,\nthen confirms the brief before scaffolding.\n\n### Example 3 \u2014 Single-publisher portal with no datasets yet\n\n```\n\/portaljs-new-portal Reference Data Hub \u2014 a single-team reference catalog, no data yet.\n```\nPicks `NAMESPACE_TYPE = 'theme'` with namespace `reference`, clears `datasets.json` to\n`[]`, and reports `\/portaljs-add-dataset` as the next step.\n\n## Resources\n\n- Full workflow: [`.claude\/commands\/portaljs-new-portal.md`](https:\/\/github.com\/datopian\/portaljs\/blob\/main\/.claude\/commands\/portaljs-new-portal.md)\n- Template and token reference: [`references\/reference.md`](references\/reference.md)\n- Related skills: `portaljs-add-dataset`, `portaljs-add-chart`, `portaljs-add-map`, `portaljs-connect-ckan`\n- PortalJS documentation: <https:\/\/portaljs.org>\n","use_cases":["Create a new data portal with a custom name, description, and datasets.","Generate a PortalJS template with predefined namespace and language settings.","Seed datasets into the portal's showcase based on user input."],"limitations":[],"compatibility":[],"setup_tip":null,"sample_input":null,"sample_output":null,"source_url":"https:\/\/github.com\/datopian\/portaljs\/blob\/fc7ccd651459549a962c8b7aa08f60f8849fd9a5\/skills\/portaljs-new-portal\/SKILL.md","source_commit":"fc7ccd651459549a962c8b7aa08f60f8849fd9a5","license":"MIT","version":"1.0.0","listing_approved_at":"2026-11-22","created_at":"2026-11-21T15:58:59.000000Z","updated_at":"2026-11-22T11:18:24.000000Z","seo_title":"PortalJS New Portal Scaffold","seo_description":"Scaffold a new PortalJS data portal from a brief. Copies the canonical template and substitutes project tokens.","seo_keywords":["PortalJS new portal","data portal scaffold","PortalJS template","data portal setup","PortalJS project creation"]}}