scaffold-civitai-app

Scaffolds new monorepo apps wired to shared @civitai workspace packages.

7.2k|734|Updated Oct 11, 2022
One-click install
npx skills add https://github.com/civitai/civitai --skill scaffold-civitai-app
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: scaffold-civitai-app
Source: https://github.com/civitai/civitai/tree/main/.claude/skills/scaffold-civitai-app
Command: npx skills add https://github.com/civitai/civitai --skill scaffold-civitai-app

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Setting up a new app in the Civitai monorepo requires correctly wiring shared @civitai/* packages, each with its own dependencies, bundler transpile entries, environment variables, and server shims. Doing this manually risks missing transitive workspace peers, misconfigured env vars, or silently broken features like the Redis session cache.

Core Features & Use Cases

  • Cherry-picked package wiring: Adds only the @civitai/* packages the app imports, with each package's deps, transpile entries, env vars, and server shim applied from a recipe table.
  • Framework scaffolding: Creates the base SvelteKit (default) or Next.js app structure under apps/<name>, mirroring the canonical apps/moderator example.
  • Gotcha prevention: Calls out critical pitfalls such as requiring both REDIS_URL and REDIS_SYS_URL, choosing the Kysely vs Prisma db entry, and SSL settings for the cnpg pooler.
  • Use Case: A developer needs a new internal moderator dashboard at a *.civitai.com spoke. The skill gathers the app name, framework, packages, and auth policy, then scaffolds the app, wires @civitai/auth and @civitai/db, and verifies with typecheck and build.

Quick Start

Ask the assistant to scaffold a new Civitai app named 'moderator-tools' with SvelteKit using the auth, db, and brand packages.

Frequently Asked Questions about scaffold-civitai-app

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I create a new app in the Civitai monorepo?

Scaffold a new directory under apps/<name> with package name @civitai/<name>-app, copying the structure of apps/moderator for SvelteKit. Then cherry-pick the @civitai/* packages you need and wire each one's dependencies, transpile entries, env vars, and server shims.

How do I add @civitai/auth to a SvelteKit app?

Add @civitai/auth as a dependency, include it in Vite's ssr.noExternal transpile list, set AUTH_JWT_ISSUER, AUTH_JWKS_URI, and AUTH_INTERNAL_TOKEN env vars, and create a lib/server/auth.ts shim using createSpokeGuard plus a hooks.server.ts file.

Should I use SvelteKit or Next.js for a new Civitai app?

SvelteKit with adapter-node is the default and recommended choice, with apps/moderator serving as the canonical worked example. Next.js is supported but follows the older app shape and uses transpilePackages instead of Vite's ssr.noExternal.

Why is my Redis session cache silently not working?

The @civitai/redis package requires both REDIS_URL and REDIS_SYS_URL to be set. Setting only REDIS_URL makes loadRedisEnv throw, which is caught as fail-open, so the cache is silently lost without any visible error.

What is the difference between the Kysely and Prisma entries of @civitai/db?

The @civitai/db/kysely entry is env-free and Prisma-free, suited for light apps with explicit connection strings. The Prisma entry requires the full four-variable database env set including notification database URLs.

When should I not use this scaffolding workflow?

Do not use it when adding a feature to an existing app, since it is designed only for creating new monorepo apps or spokes. It also defers to docs/packages/new-app-integration.md and package READMEs as the source of truth rather than replacing them.