| name | business-data-access |
| description | Implement or modify ChatbotX business services, repositories, cache invalidation, event emission, and data-access boundaries. Use when app, worker, or integration code needs database-backed reads or mutations without importing db directly. |
Business Data Access
Use this skill whenever code outside packages/business or
packages/database/src/repositories needs database-backed behavior.
Boundary Rule
Do not add direct database imports in:
apps/builder
apps/worker
integrations
These layers call services from @chatbotx.io/business or repositories from
@chatbotx.io/database/repositories. Legacy direct db imports are exceptions,
not examples to copy.
Allowed direct db usage:
packages/business/src/**
packages/database/src/repositories/**
Choosing Service vs Repository
Use a business service when the method has business semantics, authorization
adjacent constraints, cache invalidation, event emission, composition across
tables, or is reused by app and worker code.
Use a repository when the method is a low-level persistence concern such as
shard routing, specialized pagination, or reusable raw query mechanics.
Service Pattern
Services live in packages/business/src/<domain>/.
<domain>/
service.ts
index.ts
Typical shape:
import { type DatabaseClient, db }
{ }
{
() {
{ workspaceId, tx = db } = props
.([])
}
}
exampleService = ()