--- name: new-context description: Scaffold a new DDD bounded context (folders, path alias, boundary rules, lazy route). Use when adding a new business capability that doesn't belong in an existing context. --- # New bounded context A context is a business **capability**, not a user group — a user group is an actor that may span contexts (ADR-0002). Check first whether the capability belongs in an existing context; new contexts are rare. Naming: domain contexts are **Dutch** (`registratie`, `herregistratie`); only shared/reusable code is English. The context name is the ubiquitous language term. ## Steps 1. Run `npm run gen:context` (WP-44) and give it the lowercase context name. It mechanises the manual edits below in one shot: - Folders — `src/app//{domain,application,infrastructure,contracts}/.gitkeep` + a starter `ui/.page.ts` (replace with the real first feature). - Path alias — `"@/*": ["src/app//*"]` added to `tsconfig.json` `paths`. - Boundary entry — one new key in `.dependency-cruiser.js`'s `CONTEXT_ALLOWED` map (WP-38's single declarative source; every context's forbidden list is _derived_ from that map, so adding one key is enough — nothing else to hand-edit). List the OTHER contexts the new one may import (usually `[]` — a leaf, like `brief`). - Route — a lazy child under the persistent shell in `app.routes.ts`, gated by `authGuard`. 2. Verify: `npm run dep:check && npm run lint && npm run build` (regenerate the graph with `npm run dep:graph` if you want the committed diagram to reflect it too). 3. Build the first feature slice with the **new-feature** skill — replace the generated placeholder page. ## Worked example `src/app/brief/` — an independent leaf context (depends only on shared): see its folder layout and its `contextRule` entry in `.dependency-cruiser.js`. ## Verify ```bash npm run dep:check && npm run lint && npm run build # prove the fence works: add a forbidden import (e.g. new ctx → @herregistratie/*), # confirm `npm run dep:check` fails, remove it. ```