Find and use the right domain spec when working on a backend domain, and write or extend domain specs in the same style as preview, billing, and modelling. Use when locating specs for a domain, implementing or reviewing domain behavior, or authoring/updating openspec/specs/<domain>/spec.md.
Domain specs live under openspec/specs/<domain>/spec.md. They define intended behavior of backend domains (API, auth, entities, DTOs, errors). Use them to align implementation, verify correctness, and keep a single source of truth. Style: requirements (SHALL/MUST) and scenarios (WHEN/THEN).
Reference examples: openspec/specs/preview/spec.md, openspec/specs/billing/spec.md, openspec/specs/modelling/spec.md. The DDD implementation (layout, seedwork, module wiring) is in openspec/specs/ddd-implementation/spec.md; each domain spec links to it and defines behavior and API contracts.
By Nx lib path
Domain name is the last segment of the backend lib path.
libs/printing/backend/preview → domain preview → spec: openspec/specs/preview/spec.mdlibs/printing/backend/modelling → modelling → openspec/specs/modelling/spec.mdlibs/printing/backend/billing → billing → openspec/specs/billing/spec.mdBy capability or change context
If a task or change mentions a capability (e.g. "preview generation", "billing wallets"), use that name as the domain: openspec/specs/<domain>/spec.md. Domain folder names are lowercase, one word (preview, modelling, billing).
List available specs
openspec/specs/ — each subfolder is a domain; spec file is spec.md inside it.openspec/specs/README.md for the current list and short descriptions.Cross-domain work
If you're integrating two domains (e.g. modelling calling billing), open both specs: the caller’s spec for its API and behavior, the callee’s for its internal API contracts.
DDD structure vs behavior
For where to put entities, use cases, and how to wire the module, use openspec/specs/ddd-implementation/spec.md (and the ddd-implementation skill). For what the domain must do (endpoints, auth, DTOs), use openspec/specs/<domain>/spec.md.
Follow the structure and level of detail of the existing domain specs (preview, billing, modelling). Each section uses requirements (SHALL/MUST) and scenarios (WHEN/THEN).
# Spec: <Domain> domain (backend)openspec/specs/ddd-implementation/spec.md, and that this spec defines behaviour and API contracts; the DDD spec defines how the domain is implemented. Link: [DDD implementation spec](../ddd-implementation/spec.md).preview/internal, billing/internal). List endpoints that live there and accept the internal key; state they do NOT require JWT.GET /costs → { preview, model, modelDownload }; internal can-afford → { canAfford: boolean }; purchase-download → { ok: true, alreadyPurchased?: boolean }. For errors (e.g. 402), document body shape (e.g. code: 'insufficient_credits') so callers can map to user-facing messages.openspec/specs/<domain>/spec.md so the spec remains the single source of truth. Drift between spec and code makes verification and onboarding harder; treat spec updates as part of the change, not optional.canAfford, hasPurchased, purchase-download).openspec/specs/ddd-implementation/spec.md and keep this spec focused on behavior and API contracts.| Domain | Spec path | Example use |
|---|---|---|
| preview | openspec/specs/preview/spec.md | Generate/upload preview, view image, internal API |
| modelling | openspec/specs/modelling/spec.md | Generate model, download GLB/STL, unlock-download |
| billing | openspec/specs/billing/spec.md | Wallets, reservations, vouchers, internal can-afford/purchase-download |
| ddd-implementation | openspec/specs/ddd-implementation/spec.md | Layout, seedwork, persistence, module wiring |
For full requirements and scenarios, read the spec file for the domain you are working on; use this skill to find the right file and to know which details to include when writing or extending a spec.