bounded-context

Scaffolds a new DDD bounded context with folder structure, DI registry, and router wiring.

4|Updated Jul 30, 2026
One-click install
npx skills add https://github.com/gabriellst/codm --skill bounded-context-gabriellst
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: bounded-context
Source: https://github.com/gabriellst/codm/tree/main/.claude/skills/bounded-context
Command: npx skills add https://github.com/gabriellst/codm --skill bounded-context-gabriellst

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Creating a new domain module in this TypeScript backend requires many coordinated steps — folder structure, DI registry, router registration, enum and error wiring — and missing any one of them causes compile errors or invisible endpoints. This Skill guides the full process so nothing is forgotten. ## Core Features & Use Cases - Context Scaffolding: Runs bun cli context <name> to generate the standard folder structure (entities, usecases, controllers, repositories, registry.ts, and more). - Bootstrap via BoundedContext.create(): Shows how to wire controllers, middlewares, handlers, jobs, and DI bindings through the shared abstraction instead of manual container setup. - Registration Checklist: Covers declaring the context in CONTEXTS, wiring its router into ROUTERS, merging its registry into CONTEXT_REGISTRIES, and registering enums and errors. - Use Case: When adding a new business domain like 'billing', follow the skill to scaffold the context, define entities and use cases, and end with a fully wired, compile-checked module. ## Quick Start Ask the AI to create a new bounded context named 'billing' using the bounded-context skill and follow its checklist through router registration.

Frequently Asked Questions about bounded-context

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

FAQPage Schema
How do I create a new bounded context in a DDD TypeScript backend?

Run `bun cli context <name>` to scaffold the folder structure, then bootstrap it with BoundedContext.create() in the context index.ts. Finally declare it in the CONTEXTS manifest and wire its router into the ROUTERS map.

When should I create a new bounded context instead of extending an existing one?

Create a new context when starting a distinct business domain with its own ubiquitous language, like billing or scheduling. Do not create one for features belonging to an existing domain, utility code, or UI-specific read queries.

Why is my new context's controller not appearing in OpenAPI?

The context is missing from the ROUTERS map in src/routers.ts or the CONTEXTS manifest. The satisfies Record<ContextModule, Router> check turns this into a compile error, so wire the router before SDK generation.

Which folders in a bounded context get an index.ts barrel?

Only controllers, enums, objects, schemas, and middlewares get barrels, as declared in scripts/lib/context-layers.ts. Layers like usecases, entities, repositories, services, and events are imported directly by module path.

How do I register dependency injection bindings for a new context?

Create a flat registry.ts file exporting INSTANCE_REGISTRY built with expandBindings, one declaration per token with mock and real implementations. Then add it to CONTEXT_REGISTRIES in the shared registry, which mechanically derives ALL_REGISTRIES.