feat(core): add 8 AGENTS.md files (package, layer, domain levels)

This commit is contained in:
2026-04-06 15:03:09 +02:00
parent eb195c8261
commit 95a46fe7f4
8 changed files with 258 additions and 0 deletions

View File

@@ -0,0 +1,33 @@
# Entities Layer — Innermost, Zero Dependencies
## Rules
- NEVER import from application/, infrastructure/, interface-adapters/, or di/
- NEVER import external libraries except Zod (for schema validation)
- Everything here is pure — no side effects, no I/O, no async
- Models are Zod schemas with inferred TypeScript types
- Errors are custom Error subclasses with domain-specific semantics
## Adding a New Model
1. Create `src/entities/models/{name}.ts`
2. Define Zod schema and export inferred type:
```typescript
import { z } from "zod";
export const {name}Schema = z.object({ ... });
export type {Name} = z.infer<typeof {name}Schema>;
```
3. Export from `src/entities/models/index.ts`
## Adding a New Error
1. Create or edit `src/entities/errors/{domain}.ts`
2. Extend Error with constructor accepting message + options:
```typescript
export class {Name}Error extends Error {
constructor(message: string, options?: ErrorOptions) {
super(message, options);
}
}
```
3. Export from `src/entities/errors/index.ts`