1---2name: bce3description: Generic, composable architecture rules for the Boundary-Control-Entity (BCE/ECB) pattern — business components, layer responsibilities, package structure, and cross-component relationships. Technology-neutral; meant to be composed with language- or framework-specific skills (e.g. microprofile-server, web-components, aws-cdk, java-cli-app). Use when creating, generating, scaffolding, writing, or reviewing code organized as business components with boundary/control/entity layers. Triggers on "BCE", "ECB", "Boundary-Control-Entity", "business component", "BC layout", "BC structure", "boundary layer", "control layer", "entity layer", or requests to organize, package, refactor, or review code along BCE lines.4---56## Pattern78- structure code using the Boundary-Control-Entity (BCE/ECB) pattern9- the unit of organization is the business component (BC); each BC owns a responsibility and is composed of one or more layers10- the three layers are boundary, control, entity; each has a distinct responsibility (see layer sections below)11- do not explain the BCE pattern in generated documentation1213## Package / Directory Structure1415- package or directory path: `[ORGANIZATION].[PROJECT].[BC].[boundary|control|entity]`16- the top-level package reflects the application responsibility or name17- business components are direct children of the top-level package and named after their responsibilities18- the `boundary`, `control`, `entity` segments are only allowed inside a business component19- name packages after their domain responsibilities, not technical concerns2021## Business Components (BC)2223- a BC may represent a domain concept or a shared concern; both are valid when the responsibility has a name and is reused24- a BC does not need every layer; a BC may consist of only a control layer when its responsibility is procedural and consumed by other BCs25- not every BC needs a dedicated boundary; control contents may be consumed directly when no facade is justified26- prefer a dedicated BC over the root application package when a shared concern carries domain or protocol semantics, exposes more than one operation, or is expected to grow27- reserve the root application package for trivial single-class plumbing with no business semantics and no protocol coupling28- create new BCs with minimal logic and essential fields only2930## Boundary Layer3132- keep coarse-grained classes in the boundary33- place facades that adapt external protocols, transports, or UI events to internal operations in the boundary34- boundary classes are the only entry points called from outside the system; external actors (UI, protocols, transports, tests) never reach control or entity directly35- cross-cutting concerns that wrap an operation (transactions, authorization checks, request/response mapping) belong in the boundary, not in control or entity3637## Control Layer3839- implement procedural business logic in the control layer40- prefer stateless, function-like units for procedural logic41- control may be called by the boundary of the same BC or directly by other BCs; the boundary is not a gate for cross-BC calls4243## Entity Layer4445- maintain domain objects, data classes, and entities in the entity layer46- entities maintain state and corresponding behavior; they are not anemic data holders47- model value objects as enums or equivalent closed sets where the language supports them48- direct references between entities from independent BCs are allowed, but always aim for Maximal Cohesion and Minimal Coupling between BCs49- if a relation exists in the persistent store (e.g. foreign key), the entities must carry a corresponding reference (id field or association); the schema is the source of truth50- excessive cross-BC references or shared configuration is a refactoring signal — split, merge, or rebalance the BCs to restore cohesion5152## Naming5354- name classes, modules, and files after their responsibilities55- avoid meaningless suffixes (e.g. `*Impl`, `*Service`, `*Manager`, `*Creator`)56- a class or module name must not end with `Control`57- reserve protocol- or pattern-specific suffixes (e.g. `Resource`, `Factory`, `Builder`) for elements that actually fulfill that role5859## Documentation6061- document only domain-specific packages where the purpose is not self-evident62- when documenting a top-level package or BC, describe design decisions and responsibilities — not contents63- in Java, use `package-info.java` with JavaDoc to document packages64- do not write documentation that restates the BCE pattern itself6566## Composition with Other Skills6768- this skill defines only the architectural pattern; language, framework, build, testing, and protocol rules come from the composed skill (e.g. `microprofile-server`, `web-components`, `aws-cdk`, `java-cli-app`)69- when a composed skill adds a layer rule (e.g. "health checks belong in boundary", "JAX-RS resources are boundary classes"), apply it on top of the BCE rules above; the composed skill always specializes, never contradicts