add-database-developmentlisted
Install: claude install-skill brabos-ai/code-addiction
# Database Development
Skill for implementing the database layer following universal data architecture principles.
**Use for:** Entities, Migrations, Repositories, Enums, Database types
**Do not use for:** Controllers/DTOs (`backend-development`), Frontend (`ux-design`), API contracts, query optimization tuning
**Stack orientation:** Consult `CLAUDE.md ## Architecture Contract` for the ORM and database in use. Apply these principles using the project's ORM API.
---
## Entities
TypeScript interfaces representing domain objects.
```typescript
export interface User {
id: string;
accountId: string; // multi-tenant
email: string;
role: UserRole;
status: EntityStatus;
createdAt: Date;
updatedAt: Date;
}
```
Rules:
- Use interfaces, not classes
- camelCase props
- Reference enums from domain layer
- Include `id`, `createdAt`, `updatedAt`
- Include `accountId` for multi-tenant
**MANDATORY:** Export in barrel file (`entities/index.ts`).
---
## Enums
```typescript
export enum UserRole {
OWNER = 'owner',
ADMIN = 'admin',
MEMBER = 'member',
}
```
Rules:
- PascalCase name
- Lowercase string values
- Export in `index.ts`
- Use enums over free strings for constrained values
---
## Naming Convention
| Layer | Casing | Example |
|---|---|---|
| Database | snake_case | `user_id`, `created_at`, `account_id` |
| Application | camelCase | `userId`, `createdAt`, `accountId` |
The repository layer converts between the two via mapper functions (`toEntity` / `t