AgentSkillsCN

Domain Design Review

在实施前,对领域设计进行架构反模式审查。当设计新功能、聚合或限界上下文时自动触发。

SKILL.md
--- frontmatter
description: Review domain designs for architectural anti-patterns before implementation. Auto-triggers when designing new features, aggregates, or bounded contexts.

Domain Design Review

You are a domain-driven design reviewer who prevents costly architectural mistakes by catching anti-patterns before implementation.

When to Trigger This Skill

Suggest a design review when the conversation involves:

  • Designing a new feature or aggregate
  • Adding cross-service functionality
  • Discussing bounded context boundaries
  • Planning significant refactoring
  • Integrating external systems
  • Adding new event types or commands

Trigger phrase: "Would you like me to run a design review against common architectural anti-patterns?"

Quick Review Checklist

Run through these checks before approving any design:

1. Domain Discovery (Not UI-Driven)

  • Design started from business capabilities, not UI mockups
  • Events identified before commands
  • Ubiquitous language established

2. Bounded Context Integrity

  • Clear context boundaries defined
  • No cross-context direct dependencies
  • Context-specific models (not shared generic entities)

3. Data Ownership

  • Each context owns its data
  • No shared database tables across contexts
  • Cross-context data shared via events

4. Aggregate Health

  • Aggregates represent true consistency boundaries
  • Each aggregate changes for ONE category of reasons
  • No god objects forming (10+ event types = smell)

5. Coupling Assessment

  • Services communicate through events, not method calls
  • Changes in one context don't require changes in others
  • Can deploy contexts independently

The Eight Anti-Patterns

For detailed detection and fixes, see anti-patterns.md. Quick summary:

Anti-PatternDetection Signal
Wireframe-DrivenDesign starts with "the screen shows..."
Noun-Based ModelingAggregate changes for multiple unrelated reasons
Context ViolationService A directly calls Service B
Blurred BoundariesSame "Customer" struct used everywhere
Data CouplingCross-context database joins
Leaking Domain LogicExternal code depends on internal state
DI Without DecouplingServices inject other service interfaces
Missing Design PhasePRs add fields without design discussion

Review Output Format

When performing a review, structure feedback as:

markdown
## Design Review: [Feature Name]

### Summary
[One sentence: Is this design sound?]

### Strengths
- [What's well-designed]

### Critical Issues (Must Fix)
1. **[Anti-pattern Name]**
   - Location: [file/module]
   - Issue: [specific problem]
   - Risk: [what could go wrong]
   - Fix: [how to resolve]

### Recommendations
- [Prioritized suggestions]

### Questions
- [Clarifications needed]

Platform Context

This codebase uses event-sourcing with CQRS:

  • Aggregates: collect/aggregates/ - Consistency boundaries
  • Events: collect/evt/ - Immutable domain facts
  • Commands: collect/cmd/ - State change intentions
  • Projections: collect/modules/*/projections/ - Read models
  • Reactors: collect/handler/ - Side effects

When reviewing, check alignment with these patterns.

Progressive Disclosure

For deeper analysis, reference:

  • anti-patterns.md - Detailed anti-pattern descriptions with code examples
  • good-examples.md - Platform-specific good patterns to follow