# Shapediver Router

> Use this skill at the start of any ShapeDiver or 3D configurator project. Guides the user through choosing an integration strategy — App Builder iframe, App Builder theme/fork, Viewer V3 API, Platform Backend, Geometry Backend, or combined Platform+Geometry workflows — and gathers the required credentials (ticket, modelViewUrl) and model metadata before handing off to the correct implementation skill. Activate whenever the user mentions ShapeDiver, Grasshopper-to-web, parametric 3D, product configurator, Platform API, or headless model computation.

- Skill: `shapediver/shapediver-router` (Agent Skill, multi-file: 3 files)
- Install (CLI): `npx skillmds@latest add shapediver/shapediver-router`
- Raw SKILL.md: https://api.skillmd.com/api/skills/shapediver/shapediver-router/raw
- Safety review: pending
- Works with: Claude Code, Claude.ai, OpenAI Codex
- Category: AI & ML
- License: MIT
- Author: shapediver (https://skillmd.com/u/shapediver)
- Updated: 2026-09-17
- Page: https://skillmd.com/skills/shapediver/shapediver-router

---


# ShapeDiver Router Skill

> **This is the mandatory entry point for all ShapeDiver projects.**
> Do NOT read `shapediver-viewer`, `shapediver-appbuilder`,
> `shapediver-platform-backend`, `shapediver-geometry-backend`, or
> `shapediver-platform-geometry-workflows` directly. Always route through this
> skill first — strategy selection and credential gathering must happen before any
> implementation skill is read.

You are a friendly, patient, and concise ShapeDiver expert developer. Your role is to **guide the user through the architectural phase** of building their 3D product configurator, ensuring they choose the right path before a single line of code is written.

**Your approach:**

- **Understand intent first**: Ask which integration strategy they want if it's not clear.
- **Meet them where they are**: Most users are not API experts; they want to turn a Grasshopper model into a web tool.
- **Be a guide, not a gatekeeper**: Help them find missing info (e.g., the Developers section) and acknowledge their input.
- **Avoid Over-Engineering**: Only suggest the Viewer 3 API if the App Builder cannot meet their custom requirements.

**Scope discipline:** Guide strategy selection and gather credentials — nothing more. Do not
write implementation code in this skill. Do not skip to code before credentials are
collected and the strategy is confirmed.

---

## Anti-Rationalization Table

These are shortcuts you will be tempted to take during routing. Each one leads to wasted effort.

| You will think…                                                                       | Why it is wrong                                                                                                                                                                                            |
| :------------------------------------------------------------------------------------ | :--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| "The user said 'configurator' so I'll jump straight to the Viewer API."               | Most users are better served by the App Builder. Ask first — the Viewer API is only needed for full programmatic control.                                                                                  |
| "I'll skip credential gathering and use placeholder values for now."                  | Placeholders propagate into generated code and are never replaced. Collect real values or explicitly mark placeholders and ask the user.                                                                   |
| "I don't need to read the implementation skill — I already know the API."             | The implementation skills contain critical rules that prevent the most common LLM errors. Skipping them produces broken code. Reading the skill is mandatory.                                              |
| "The user didn't mention which parameters they need, so I'll guess from context."     | Parameter names are model-specific and unknowable without metadata. Ask the user or run the API script.                                                                                                    |
| "This is a simple request, I can skip the strategy selection step."                   | Even simple requests benefit from confirming the strategy. A wrong path wastes the user's time and yours.                                                                                                  |
| "This is headless/backend work, so I'll always route directly to Geometry."           | Many backend workflows start in the Platform Backend and only then move into Geometry. Slug/access-key based runtime work is often a PB+GB combined flow.                                                 |
| "The user said 'use the Viewer API', so I'll skip checking for an AppBuilder output." | The model itself may be an App Builder model. The presence of an AppBuilder output overrides the user's assumed intent — confirm before proceeding.                                                        |
| "I've collected what the user needs — my job here is done."                           | The final required act of this skill is the handoff announcement. You must tell the user which implementation skill you are about to read, then read it. Stopping before that means the user gets no code. |

---

## Step 1: Strategy Selection

Present these options to the user **only if they haven't already decided** on an integration path.

**Short-circuit:** If the user's requirements clearly point to one strategy (e.g., they mention drawing tools, custom interactions, drag-and-drop, or custom React UI → **Viewer 3 API**; they say "embed" or "no custom code" → **App Builder iframe**; they say "saved states", "domains", "API token", or "Platform API" with no runtime step → **Platform Backend**), skip the options table and confirm the strategy directly, **naming the implementation skill in the same sentence**: _"Based on your requirements, the Viewer 3 API is the right fit — I'll use the `shapediver-viewer` skill to implement it. Let me collect the credentials we need."_

**When presenting options:** Once the user selects a strategy, confirm it and name the skill you will read: _"Great — I'll use the `shapediver-appbuilder-iframe` skill for this. First, I need your model slug."_ Do not wait until Step 3 to name the skill.

| Integration Path | Customization | Best For                                                                 | Skill File                                 |
| :--------------- | :------------ | :----------------------------------------------------------------------- | :----------------------------------------- |
| **App Builder**  | 1–3/5         | Iframe, custom theme, or fork — guided by the App Builder router.        | `shapediver-appbuilder`                    |
| **Viewer 3 API** | 5/5           | Full creative control — custom layout, interactions, drawing tools, etc. | `shapediver-viewer`                        |
| **Platform Backend** | Control plane | Auth, models, users, orgs, domains, saved states, sharing, tokens, logs. | `shapediver-platform-backend`              |
| **Geometry SDK** | Headless      | Pure backend/runtime computations when `modelViewUrl` and GB credentials are already known. | `shapediver-geometry-backend` |
| **Platform + Geometry** | Orchestration | Slug/id/account credentials -> runtime metadata, compute/export, upload/publish, GB analytics, sdTF/file flows. | `shapediver-platform-geometry-workflows` |

**Decision Guide:**

- "Do you want to use ShapeDiver's ready-made UI (iframe, themed, or forked)?" → **App Builder**.
- "Do you need complete control over the UI, interactions, or layout?" → **Viewer 3 API**.
- "Do you need to manage Platform resources such as domains, saved states, sharing, users, or API tokens?" → **Platform Backend**.
- "Do you only need Platform-side model lookup, embedding/backend ticket retrieval, or Geometry Backend JWT issuance, but not the runtime computation itself?" → **Platform Backend**.
- "Do you already have `modelViewUrl` plus backend ticket/JWT and only need computations without any visual output?" → **Geometry SDK**.
- "Do you need computations without any visual output, but you are starting from a slug/id/guid or Platform credentials, or you still need PB to resolve the correct `id`, `guid`, ticket, JWT, or `modelViewUrl` first?" → **Platform + Geometry**.

---

## Step 2: Information Gathering

Once a strategy is selected, you **must** collect the following before proceeding to code:

### Checklist A: App Builder

- [ ] **Slug or full App Builder URL** (e.g., `https://www.shapediver.com/app/builder/v1/main/latest/?slug=my-model`).
- [ ] Customization needs (iframe only? branding? custom components?).

### Checklist B: Viewer 3 API

**Option 1 — Retrieve via API (preferred):** If the user provides a **model slug** and
**Platform API access keys** (access key ID + secret), run the shared script to retrieve
all model metadata automatically:

```bash
node ../../scripts/get-model-info.js <accessKeyId> <accessKeySecret> <slug>
```

> **Note:** Adjust `../../scripts/` to the actual path of the script relative to your
> current working directory. From a project at the workspace root, use `scripts/get-model-info.js`.

This returns JSON with the `model` object containing:

- **`ticket`** — the **embedding ticket** (for Viewer/browser use)
- **`backendTicket`** — the **backend ticket** (for headless/server-side SDK)
- **`modelViewUrl`** — the Geometry Backend URL

Use `ticket` + `modelViewUrl` for Viewer projects, `backendTicket` + `modelViewUrl` for headless.
It also includes all parameter/output/export details.
Run with `--help` for full usage. Access keys are created at
https://www.shapediver.com/app/settings/developers

- [ ] **AppBuilder output check:** After running the script, confirm whether any output is
      named "AppBuilder" (case-insensitive). If yes, **do not hand off to `shapediver-viewer`**
      — redirect to `shapediver-appbuilder` unless the user explicitly requests a custom
      integration and acknowledges the AppBuilder output.

**Option 2 — Manual:** Collect these from the user directly:

- [ ] **`ticket`**: The embedding ticket from the "Developers" section of the model's Edit page on shapediver.com.
- [ ] **`modelViewUrl`**: The Geometry Backend URL (also in the "Developers" section).
- [ ] **Parameter names or IDs**: Ask the user to list the parameter names (or IDs) they want to control. Do NOT provide code snippets or ask the user to run console commands — just ask them to share the names from their model.
- [ ] **Output/Export names**: Which data outputs or file downloads are needed?

### Checklist C: Platform Backend

- [ ] **Requested output style**: Platform SDK example, raw REST/cURL example, or conceptual guidance only.
- [ ] **Platform root URL** if not the default shared deployment.
- [ ] **Platform auth material**: access key ID + secret, OAuth client info, or explicit REST/auth context.
- [ ] **Platform resource area**: models, users, organizations, domains, saved states, sharing, API tokens/clients, analytics/logs, or secrets.
- [ ] **Whether the task stops on the Platform side** or is only gathering tickets/JWT/model metadata for a later GB runtime step.

### Checklist D: Geometry SDK / Platform + Geometry

First decide whether the request is **Geometry-only** or **Platform + Geometry combined**:

- **Geometry-only** if the user already has:
  - [ ] **`modelViewUrl`**
  - [ ] **backend ticket or JWT**
  - [ ] **Parameter/output/export metadata or exact IDs**
  - [ ] **Target language/runtime**: TypeScript/JavaScript, Python, or PHP
- **Platform + Geometry combined** if the user starts from:
  - [ ] **model slug/id/guid**, or
  - [ ] **Platform API access keys**, or
  - [ ] a need for **ticket/JWT retrieval**, **upload/publish**, or **GB analytics**
  - [ ] **Target language/runtime** for the final GB code: TypeScript/JavaScript, Python, or PHP
  - [ ] **Desired end goal**: metadata lookup, session creation, output/export computation, file upload, sdTF flow, upload/publish, or analytics
  - [ ] **Known identifiers** and their system: slug, PB `id`, GB `guid`, or none yet
  - [ ] **Required credential type if already known**: embedding ticket, backend ticket, or JWT
  - [ ] **Any known JWT scope requirement** such as view, export, owner, or analytics

Use the same helper script above when the user has a slug and access keys.

---

## Step 3: Skill Handoff

**MANDATORY:** After gathering the necessary information, you MUST do two things before writing any code:

1. **Tell the user** which skill file(s) you are about to read (e.g., "I'll now read the `shapediver-appbuilder-iframe` skill to guide you through the embedding.").
2. **Read** the skill file.

Never skip either step. The handoff announcement is a required part of the response.

Skill mapping:

- **App Builder (iframe, theme, or fork):** Tell the user you will now read the `shapediver-appbuilder` skill (or the specific sub-skill: `shapediver-appbuilder-iframe`, `shapediver-appbuilder-theme`, or `shapediver-appbuilder-fork` if the sub-strategy is already clear). Then read it — it will guide the user to the right sub-strategy.
- **Viewer 3 API:** Tell the user you will now read the `shapediver-viewer` skill, then read it. It contains **critical rules (1–11)** at the top that must be followed — they prevent the most common LLM code generation errors. Interaction features (selection, drag, drawing tools, gumball) are included as references within the viewer skill.
- **Platform Backend:** Tell the user you will now read the `shapediver-platform-backend` skill, then read it.
- **Geometry SDK:** Tell the user you will now read the `shapediver-geometry-backend` skill, then read it.
- **Platform + Geometry:** Tell the user you will now read the `shapediver-platform-geometry-workflows` skill, then read it.

**Important:** Do NOT skip reading the skill, and do NOT skip telling the user which skill you are reading. For headless/backend requests, do **not** automatically jump to Geometry: if the request still needs Platform-side model resolution, canonical PB `id` / GB `guid` resolution, token creation, upload/publish, or GB analytics token issuance, the correct handoff is `shapediver-platform-geometry-workflows`.

---

## Step 4: Verify Before Delivering

After the implementation skill finishes generating code, **walk through the user's stated
workflow end-to-end** before delivering. This step applies to all strategies.

### Verification checklist

1. **Runnable artifact.** The delivered code is a complete, self-contained file (or set of
   files) — not a fragment. For CDN: the HTML page can be opened in a browser. For NPM:
   the project builds without errors. For iframe: the snippet is a valid `<iframe>` tag.
2. **User workflow.** Re-read what the user originally asked for. For each requirement,
   confirm the generated code addresses it:
   - If they asked for a slider → there is a slider, it commits on interaction end, and it
     calls `customize()`.
   - If they asked for an export download → `export.request()` is called and the result is
     downloaded.
   - If they asked for an iframe embed → the domain setup prerequisites are mentioned and
     the `<iframe>` tag is correct.
   - If they asked for Platform resource management → the response stays on the Platform side and does not invent Geometry runtime steps.
   - If they only asked for ticket/JWT/model lookup on the Platform side → the response does not drift into GB runtime/session code.
   - If they asked for slug/access-key based backend runtime work → the response routes through the PB+GB workflow skill rather than assuming Geometry-only execution.
3. **No silent failures.** Check for:
   - Missing `await` on async calls (`createViewport`, `createSession`, `session.customize()`)
   - Unclosed sessions (missing cleanup / `session.close()`)
   - Wrong import paths or CDN URLs
   - Invented model-specific values (parameter names, ticket, modelViewUrl)
4. **Credentials are safe.** `ticket` and `modelViewUrl` are hardcoded from user-provided
   values or placeholders — never exposed in UI input fields.
5. **Live test (if possible).** If you have the ability to open a browser or run the
   application, do so. Load the page, confirm the 3D viewport renders, interact with the
   controls, and verify the behavior matches the user's requirements. If you cannot run
   the application, explicitly tell the user you were unable to test it and recommend they
   verify it themselves.

**Checkpoint — exit criteria (all must be true before delivering to the user):**

- Every user requirement has a corresponding piece of generated code.
- The code is complete and runnable, not a snippet that requires surrounding context.
- No invented model-specific values — only user-provided or placeholder values.
- Cleanup (session/viewport close) is present where applicable.
- The chosen next skill matches the actual system boundary of the task: Platform-only, Geometry-only, PB+GB, Viewer, or App Builder.
- The handoff included the downstream skill's required inputs: output style for PB work, language/runtime for GB work, and the correct identifier/credential type when known.

