Skip to main content
skill CX Codex

zenstack-project-setup — Claude Code skill: ZenStack setup

The zenstack-project-setup Claude Code skill sets up ZenStack V3 projects, scaffolds new ones, and runs zen CLI tasks. It activates for ZenStack installation, project creation, or CLI use.

MIT 510 installs ★ 3 updated 2026-10-28

Install into Claude Code · Skills CLI (Vercel) All methods and platforms ↓
npx skills add zenstackhq/skills --skill zenstack-project-setup -a claude-code
Open on GitHub

What zenstack-project-setup does

The skill guides ZenStack V3 installation, project setup, and CLI use. It works with zenstack/schema.zmodel, generates TypeScript with zen generate, and covers database migration commands. Prisma conversions and upgrades from ZenStack V2 use separate skills.

Node.js v20+ and TypeScript v5.8.0+ are required. ZenStack does not bundle database drivers: PostgreSQL uses pg, MySQL uses mysql2, and SQLite uses better-sqlite3. Use zen db push for development or testing, not production; zen migrate deploy applies pending migrations.

What it helps with

  • scaffold a ZenStack V3 project
  • add ZenStack to an existing codebase
  • generate a TypeScript client from ZModel
  • choose a CLI command for database migrations

Example prompts for the agent

  • Create a new ZenStack project named my-project.
  • Set up ZenStack in this project and generate code from zenstack/schema.zmodel.
  • Explain how to apply ZenStack migrations in production.

How to install zenstack-project-setup

1Skills CLI (Vercel)

npx skills add zenstackhq/skills --skill zenstack-project-setup -a claude-code

2Manually: put the files in place

~/.claude/skills/zenstack-project-setup/SKILL.md

Copy the whole skill folder; for one project use .claude/skills/zenstack-project-setup/

Step by step, with commands for each platform: How to install skills in Claude Code: five ways

Questions about zenstack-project-setup

How do I install zenstack-project-setup in Claude Code?

Run npx skills add zenstackhq/skills --skill zenstack-project-setup -a claude-code. The skill file is installed at ~/.claude/skills/zenstack-project-setup/SKILL.md.

What does zenstack-project-setup do?

It guides ZenStack V3 installation and project setup, then helps run CLI commands for code generation and database migrations.

What does zenstack-project-setup need to work?

It requires Node.js v20+ and TypeScript v5.8.0+. Install a database driver too: pg for PostgreSQL, mysql2 for MySQL, or better-sqlite3 for SQLite.

Source text

SKILL.md · MIT
---
name: zenstack-project-setup
description: Set up, configure, and manage a ZenStack V3 project. Use when installing ZenStack, scaffolding a new project, or running the `zen` CLI (generate). (For database schema migrations use zenstack-db-migration; to migrate a Prisma project use zenstack-migrate-from-prisma; to upgrade from ZenStack V2 use zenstack-migrate-from-v2.)
---

# ZenStack V3 — Project Setup & Migrations

ZenStack V3 is a TypeScript database toolkit with a Prisma-compatible ORM API built on
[Kysely](https://kysely.dev) (no Rust/WASM). The schema is written in **ZModel** (`.zmodel`), a
superset of the Prisma schema language. This skill covers installing, scaffolding, the CLI, and
migrations. For schema syntax see `zenstack-schema-modeling`; for queries see `zenstack-querying`;
for access control see `zenstack-access-control`.

> Always confirm exact package versions and commands against the live docs at
> https://zenstack.dev/docs when something looks off — V3 evolves quickly.

## Prerequisites

- **Node.js** v20+
- **TypeScript** v5.8.0+
- VSCode extension: "ZenStack V3" (language id `zmodel-v3`) — distinct from the V2 extension.

## Installing

### Scaffold a new project (recommended)

```bash
npm create zenstack my-project
```

### Initialize ZenStack in an existing project

```bash
npx @zenstackhq/cli zen init
```

Then create `zenstack/schema.zmodel` and run `zen generate`.

### Manual install

```bash
npm install @zenstackhq/schema @zenstackhq/orm
npm install --save-dev @zenstackhq/cli
```

ZenStack does **not** bundle database drivers — install one yourself:

| Database   | Install |
| ---------- | ------- |
| PostgreSQL | `npm install pg` + `npm install -D @types/pg` |
| MySQL      | `npm install mysql2` |
| SQLite     | `npm install better-sqlite3` + `npm install -D @types/better-sqlite3` |

Add access control only if needed: `npm install @zenstackhq/plugin-policy` (see
`zenstack-access-control`).

## Project structure

- **Schema**: `zenstack/schema.zmodel` (default; override with `--schema`).
- **Generated output**: emitted next to the schema (override with `--output`). Import it as
  `import { schema } from './zenstack/schema'`.
- You may commit the generated TypeScript, or `.gitignore` it and run `zen generate` in CI.

## The `zen` CLI

The CLI is invoked as `zen` (or `zenstack` — equivalent). Add scripts to `package.json`:

```json
{
  "scripts": {
    "generate": "zen generate",
    "db:push": "zen db push",
    "migrate:dev": "zen migrate dev",
    "migrate:deploy": "zen migrate deploy"
  }
}
```

| Command | Purpose |
| ------- | ------- |
| `zen check` | **Only** validate `schema.zmodel` for syntax and semantic errors — does not regenerate anything. Use when you just want to confirm the schema is valid. |
| `zen generate` | Compile `schema.zmodel` → TypeScript (regenerate the database client); also validates the schema as it compiles. **Run after every schema change**, before using the client. Flags: `--schema <path>`, `--output <path>`. |
| `zen db push` | Push schema to the DB **without** a migration file. Dev/testing only — never in production. |
| `zen db pull` | Introspect an existing DB and update the ZModel schema (v3.4.0+, experimental). Can overwrite your schema — back up / use source control first. |
| `zen migrate dev` | Create a migration from schema changes and apply it (dev only). `--create-only` makes an empty migration to edit by hand (e.g. for views). |
| `zen migrate deploy` | Apply all pending migrations. Use this in your production/deploy pipeline. |
| `zen migrate reset` | Drop all tables and reapply migrations. Dev/testing only. |
| `zen migrate status` | Show applied vs. pending migrations. |
| `zen migrate resolve` | Mark a migration applied/rolled-back without changing the schema (manual recovery). |

> Migration commands wrap Prisma Migrate; `@zenstackhq/cli` has a peer dependency on `prisma` that
> is installed automatically when needed.

For the full migration story — `migrate dev`/`deploy`/`reset`/`status`/`resolve`, `db push`/`pull`,
seeding, `--create-only`, and deployment-pipeline guidance — see the `zenstack-db-migration` skill.

## Workflows

**Development loop**

1. Edit `zenstack/schema.zmodel`.
2. `zen generate` (regenerate types).
3. `zen db push` to try changes locally without a migration, *or* `zen migrate dev` to create a
   reviewable, committable migration file.
4. Review the migration SQL, then commit it.

**Production deploy**

```bash
zen migrate deploy
```

**Adopt ZenStack on an existing database**

1. `zen init`
2. Set the datasource `url` in `zenstack/schema.zmodel`.
3. `zen db pull` to generate the schema from the DB.
4. Refine it (add access policies, computed fields, etc.).
5. `zen generate`.

## Migrating from Prisma

See the dedicated `zenstack-migrate-from-prisma` skill — it walks through swapping dependencies,
converting `schema.prisma` to ZModel, replacing `PrismaClient` with `ZenStackClient`, updating the
generate/migrate scripts, and mapping Prisma custom generators and client extensions.

## Migrating from ZenStack V2

See the dedicated `zenstack-migrate-from-v2` skill — it covers the package renames, moving access
control to the policy plugin, the `future()` → `post-update`/`before()` change, abstract models →
types+mixins, the `getPrisma` → `getClient` server-adapter change, and the client-side hook
migration.

## Reference docs

Full ZenStack documentation for this topic is bundled under [`references/`](references/):

- [prerequisite.md](references/prerequisite.md) — supported Node/TypeScript versions, IDE setup
- [quick-start.md](references/quick-start.md) — scaffolding and the install paths
- [cli.md](references/cli.md) — overview of every `zen` CLI command
- [cli-reference.md](references/cli-reference.md) — full CLI reference
- [migration.md](references/migration.md) — dev/production migration workflow
- [introspection.md](references/introspection.md) — `zen db pull` from an existing database

© zenstackhq · MIT · zenstackhq/skills

Similar skills

All skills for Backend and APIs →
langgraph-project-setup soba-labs The langgraph-project-setup Claude Code skill scaffolds and configures LangGraph projects. It activates for project structure, langgraph.json, provider variables, dependency setup, and configuration troubleshooting. CX Codex +1 ★ 106repo stars prisma-postgres-setup prisma prisma-postgres-setup provisions or connects a Prisma Postgres database and links it to your app. Useful for spinning up dev databases quickly or wiring connections in Vercel and v0. CX Codex +1 425,700installs prisma-orm-setup prisma prisma-orm-setup is a Claude Code skill that configures Prisma ORM, connects a database, and diagnoses existing connection problems. New apps default to Prisma ORM 8. CX Codex +1 117,200installs setup-timescaledb-hypertables tigerdata setup-timescaledb-hypertables guides agents in designing TimescaleDB and Tiger Cloud hypertables for insert-heavy workloads. Helps configure chunk partitioning, columnstore compression, and sparse indexes. CX Codex +1 559installs project-setup codewithmukesh project-setup recommends .NET tech stack defaults for databases, auth, caching, and messaging. Helps pick stack defaults or review dependencies before writing code. CX Codex +1 4,000installs scaffolding-oracle-to-postgres-migration-test-project official github The scaffolding-oracle-to-postgres-migration-test-project GitHub Copilot skill creates an empty Oracle xUnit integration test project in a .NET solution before Phase 3 baseline tests are written. CX Codex +1 1,700installs

From the same set9

zenstack-access-control The zenstack-access-control Claude Code skill helps define access policies in a ZenStack V3 schema. It activates for @@allow, @@deny, auth(), and post-update rules. CX Codex +1 556installs zenstack-db-migration The zenstack-db-migration Claude Code skill manages database schema migrations in ZenStack V3. It activates for migration work, schema prototyping, or introspecting an existing database. CX Codex +1 551installs zenstack-crud-server zenstack-crud-server — a skill for Claude Code that turns ZenStack V3 models into REST or RPC CRUD APIs. It covers server routes, per-request access control, OpenAPI specs, and client calls. CX Codex +1 548installs zenstack-plugin-dev The zenstack-plugin-dev Claude Code skill guides development of ZenStack V3 plugins. It applies to ZModel extensions, CLI code generation, and ORM client plugins. CX Codex +1 521installs zenstack-migrate-from-prisma The zenstack-migrate-from-prisma Claude Code skill guides a project migration from Prisma to ZenStack V3. It covers schema, client, generation, and migration updates. CX Codex +1 520installs zenstack-migrate-from-v2 The zenstack-migrate-from-v2 skill for Claude Code guides a ZenStack project upgrade from V2 to V3. It covers schema, access policies, server adapters, and client hooks. CX Codex +1 515installs zenstack-querying The zenstack-querying Claude Code skill explains how to query and change data with the ZenStack V3 client. It covers ORM operations, relations, and SQL-shaped queries built with Kysely. CX Codex +1 494installs zenstack-schema-modeling The zenstack-schema-modeling Claude Code skill helps write and revise ZModel schemas for ZenStack V3. It activates for work on models, fields, relations, enums, and typed JSON fields. CX Codex +1 470installs

Project sponsors

Companies that keep this analytics open