- Home
- Skills
- D Oit
- Do Novelist Ai
- Domain Expert
domain-expert_skill
- TypeScript
0
GitHub Stars
1
Bundled Files
2 months ago
Catalog Refreshed
4 months ago
First Indexed
Readme & install
Copy the install command, review bundled files from the catalogue, and read any extended description pulled from the listing source.
Installation
Preview and clipboard use veilstrat where the catalogue uses aiagentskills.
npx veilstrat add skill d-oit/do-novelist-ai --skill domain-expert- SKILL.md11.4 KB
Overview
This skill applies domain-driven design (DDD) principles to shape business logic, entities, events, and aggregate boundaries in TypeScript projects. It helps you model rich domain objects, enforce invariants, and maintain a clear separation between domain, application, and infrastructure layers. Use it to produce testable, maintainable feature modules and robust business rules.
How this skill works
The skill inspects domain modeling patterns and suggests concrete implementations: entities, value objects, aggregates, domain events, specifications, and repository interfaces. It recommends layer separation (domain, application, infrastructure), feature-based folder layout under src/features/, and provides examples of factories, services, and event handlers. It flags anti-patterns like anemic models, god aggregates, and infrastructure leakage, and replaces them with idiomatic DDD alternatives.
When to use it
- Designing or extending domain models (entities, value objects, aggregates)
- Implementing business rules, invariants, and domain validation
- Defining domain events and event-driven flows
- Creating repository interfaces and implementing persistence in infrastructure
- Organizing feature modules in src/features/ with clear bounded contexts
Best practices
- Model rich entities that encapsulate business logic and enforce invariants
- Use immutable value objects for equality-by-value and validation at creation
- Define one aggregate root per consistency boundary and enforce invariants at that root
- Emit minimal, immutable domain events (past-tense names) and handle side effects in application layer
- Keep domain layer pure: only interfaces for persistence; implementations belong to infrastructure
Example use cases
- Create a ProjectAggregate with methods that enforce chapter limits and emit ChapterAdded events
- Design a Character value object for immutable attributes with equals() for comparisons
- Implement a ChapterRepository interface in the domain layer and provide a Turso-backed implementation in infrastructure
- Use Specification objects for reusable business rules like ValidChapterSpecification
- Write unit tests for domain entities that validate invariants and error conditions
FAQ
Define repository interfaces in the domain layer (feature types) and implement them in the infrastructure layer to avoid leaking persistence concerns into domain code.
How do I decide aggregate boundaries?
Group closely related invariants and transactional operations under one aggregate root. Keep aggregates small and focused; reference other aggregates by ID only.