feat(core): add 8 AGENTS.md files (package, layer, domain levels)
This commit is contained in:
33
packages/core/src/entities/AGENTS.md
Normal file
33
packages/core/src/entities/AGENTS.md
Normal 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`
|
||||
Reference in New Issue
Block a user