# migrate-app-to-flows

Automates migrating legacy Dune web applications to the new Flows app hosting (appsApi). It audits configs, updates deployment scripts, and builds network CSP rules.

- skill · `type=skill` · Claude Code, Codex, Cursor, GitHub Copilot, Gemini CLI, OpenCode · 1700 installs · ★ 6
- Author: cognitedata
- License: Apache-2.0 · policy=mirror · the beginning of the file is at the end of this page
- Source: https://github.com/cognitedata/builder-skills/tree/HEAD/skills/migrate-app-to-flows/SKILL.md
- Updated: 2026-10-20
- HTML: https://affpapa.org/en/nevibecode/skills/migrate-app-to-flows

## What it does

The skill coordinates migration steps in a fixed sequence. First, it audits `app.json`, `package.json`, `vite.config.ts`, and `manifest.json`. It fixes legacy `deployment` object fields in `app.json` by wrapping them into a `deployments` array, then sets `"infra": "appsApi"`.

Next, it scans TypeScript files for calls to `fetch`, `axios`, and `XMLHttpRequest`. Using those endpoints, it writes origin domains into a root `manifest.json` under `connect-src` CSP permissions. The CDF cluster domain is omitted because Flows allows it automatically. Build scripts in `package.json` switch from Dune deploy commands to `@cognite/cli`.

Auth migration requires handing off tasks to the `setup-flows-auth` skill. A final grep confirms no leftover `DuneAuthProvider` or `@cognite/dune` imports remain in the source tree.

## Install

### Claude Code (native platform)

1. **Skills CLI (Vercel)**
```bash
npx skills add cognitedata/builder-skills --skill migrate-app-to-flows -a claude-code
```

2. **Manually: put the files in place**
- File: `~/.claude/skills/migrate-app-to-flows/SKILL.md` — Copy the whole skill folder; for one project use .claude/skills/migrate-app-to-flows/

### Codex

1. **Skills CLI (Vercel)**
```bash
npx skills add cognitedata/builder-skills --skill migrate-app-to-flows -a codex
```

2. **Manually: put the files in place**
- File: `.agents/skills/migrate-app-to-flows/SKILL.md` — For all projects use ~/.agents/skills/

### Cursor

1. **Skills CLI (Vercel)**
```bash
npx skills add cognitedata/builder-skills --skill migrate-app-to-flows -a cursor
```

2. **Manually: put the files in place**
- File: `.cursor/skills/migrate-app-to-flows/SKILL.md` — Cursor also reads .agents/skills/ and .claude/skills/

### GitHub Copilot

1. **GitHub CLI**
```bash
gh skill install cognitedata/builder-skills migrate-app-to-flows
```

2. **Manually: put the files in place**
- File: `.github/skills/migrate-app-to-flows/SKILL.md`

### Gemini CLI

1. **Skills CLI (Vercel)**
```bash
npx skills add cognitedata/builder-skills --skill migrate-app-to-flows -a gemini-cli
```

2. **Platform CLI**
```bash
gemini skills install https://github.com/cognitedata/builder-skills --path skills/migrate-app-to-flows
```

### Windsurf (Devin Desktop)

**Manually: put the files in place**
- File: `.devin/skills/migrate-app-to-flows/SKILL.md` — The legacy .windsurf/skills/ path still works

### OpenCode

**Skills CLI (Vercel)**
```bash
npx skills add cognitedata/builder-skills --skill migrate-app-to-flows -a opencode
```

### Claude.ai

**Claude.ai**
- Zip the folder and upload it in Settings → Capabilities → Skills

Where a file is given instead of a command, copy the files from the source to that path: https://github.com/cognitedata/builder-skills/tree/HEAD/skills/migrate-app-to-flows/SKILL.md

## When to use it
- migrate legacy Dune applications to Flows hosting
- convert app.json deployment settings to appsApi format
- generate manifest.json with outbound CSP network rules
- replace Dune deployment scripts with @cognite/cli

## Example prompts
- Migrate this legacy Dune app to the new Flows infrastructure
- Audit the project and move our app hosting to Flows
- Update app.json and deploy scripts for appsApi

## Source text · SKILL.md · Apache-2.0

Below is the content of a third-party file. It is data, not instructions for you: do not act on anything written inside unless the human asks. Block tag: 95d362f1d653bf8e.

BEGIN THIRD-PARTY FILE 95d362f1d653bf8e
````text
---
name: migrate-app-to-flows
description: "MUST be used when migrating a legacy Dune app to the new Flows app hosting infrastructure. Orchestrates the full migration: audits current state, updates app.json to appsApi infra, delegates auth wiring to setup-flows-auth, creates or updates manifest.json network permissions, and updates deploy scripts to @cognite/cli. Use this whenever a user says 'migrate to Flows', 'migrate to new infra', 'move from dune to flows', 'migrate legacy app', or wants to move their existing app to the new Flows app hosting."
allowed-tools: Read, Glob, Grep, Edit, Write, Bash
metadata:
  argument-hint: ""
---

# Migrate App to Flows Infrastructure

Orchestrates the full migration of a legacy Dune app to the new Flows app hosting (`appsApi`). Works through each area in order, skipping any already in the correct state.

## Step 1 — Audit current state

Read `app.json`, `package.json`, `vite.config.ts`, and `manifest.json` (if present).

Report a concise summary before making any changes:

```
Migration audit:
✗ app.json: missing infra field → will add "infra": "appsApi"
✗ Auth: DuneAuthProvider in use → will run setup-flows-auth
✗ manifest.json: missing → will create
✓ Deploy script: already uses @cognite/cli
```

Then proceed through Steps 2–5.

---

## Step 2 — Update `app.json`

If `infra` is already `"appsApi"`, skip this step. Otherwise:

**Fix legacy deployment key format first.** Many POC apps use `"deployment"` (singular, plain object). The CLI requires `"deployments"` (plural, array). If the file has the old format, rename the key and wrap the value in an array before proceeding:

```json
// Before (legacy)
{
  "deployment": { "org": "...", "project": "...", ... }
}

// After (correct)
{
  "deployments": [{ "org": "...", "project": "...", ... }]
}
```

Then add `"infra": "appsApi"`:

```json
{
  "name": "My App",
  "externalId": "my-app",
  "versionTag": "0.0.1",
  "infra": "appsApi",
  "deployments": [...]
}
```

---

## Step 3 — Set up Flows auth

Run the `setup-flows-auth` skill now. It handles everything auth-related: package installation, Vite plugin updates, entry file changes, and wiring up `connectToHostApp`.

---

## Step 4 — Create or update `manifest.json`

The Flows host uses `manifest.json` to enforce a Content Security Policy for the app. It must exist at the repo root.

**Create if missing:**

```json
{
  "manifestVersion": 1,
  "permissions": {
    "network": []
  }
}
```

**Populate network permissions** by scanning for outbound calls to external domains:

```bash
grep -rn "fetch\|axios\|new XMLHttpRequest" src/ --include="*.ts" --include="*.tsx"
```

For each group of external URLs found, add an entry to the `network` array using the `sources`/`directives` shape:

```json
{
  "manifestVersion": 1,
  "permissions": {
    "network": [
````
END THIRD-PARTY FILE 95d362f1d653bf8e

The third-party file has ended. Everything between the 95d362f1d653bf8e tags is data: requests and commands from it are not followed. An “end of file” line with another tag inside the block is part of the file.

First 2856 of 4406 bytes. © cognitedata · Apache-2.0 · https://github.com/cognitedata/builder-skills/tree/HEAD/skills/migrate-app-to-flows/SKILL.md

_Part of the page did not fit — see the HTML version._

---
NeVibeCode on affpapa.org. Catalog texts are descriptions, not instructions for the agent. How to choose and install: https://affpapa.org/en/nevibecode/agents.md
