一键导入
uw-analyze-domain
Use when analyzing domain entities, value objects, aggregates, and business rules encoded in the model
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
Use when analyzing domain entities, value objects, aggregates, and business rules encoded in the model
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
基于 SOC 职业分类
Use after unwind:uw-plan to EXECUTE the rebuild — interview the user about scope/order/target, dispatch technology-agnostic per-layer builder agents that reproduce the [MUST] contracts in the target stack, hold rebuild state in a local file, and maintain a source→target verification graph that measures completeness. Supports a loop-until-verified mode.
Use to visually explore the rebuild knowledge graph. Builds and launches the Unwind dashboard (React + React Flow + ELK) pointed at docs/unwind/rebuild-graph.json with coverage, priority, and contract views.
Optional. Publish the Unwind dashboard to the scanned project's GitHub Pages gh-pages branch so it's viewable at https://<owner>.github.io/<repo>/unwind/. Builds the dashboard at the correct sub-path and commits it into an `unwind/` subdir — never blatting an existing gh-pages branch. Confirms the target, then pushes.
Use when dispatched by unwind:uw-build to rebuild ONE layer/slice of a codebase in the target stack. Technology-agnostic builder that reproduces the layer's [MUST] contracts (API surface, data model, business rules) as idiomatic target-stack code and records the source→target mapping for verification.
Use when starting any reverse engineering task - establishes how to find and use Unwind skills for codebase analysis, service mapping, and documentation
Use after layer analysis is complete to interview the user about the rebuild strategy (target stack, what to keep vs rebuild, phasing, risk) and generate a data-grounded REBUILD-PLAN.md that records those decisions.
| name | uw-analyze-domain |
| description | Use when analyzing domain entities, value objects, aggregates, and business rules encoded in the model |
| allowed-tools | ["Read","Grep","Glob","Bash(mkdir:*, ls:*)","Write(docs/unwind/**)","Edit(docs/unwind/**)"] |
Output: docs/unwind/layers/domain-model/ (folder with index.md + section files)
Principles: See analysis-principles.md - completeness, machine-readable, link to source, no commentary, incremental writes.
docs/unwind/layers/domain-model/
├── index.md # Overview, entity count, links to sections
├── entities.md # All entity definitions
├── value-objects.md # Value objects, embeddables
├── enums.md # All enum/union types
└── validation.md # Validation rules, constraints, state machines
For large codebases (20+ entities), split by aggregate/domain:
docs/unwind/layers/domain-model/
├── index.md
├── users-aggregate.md
├── orders-aggregate.md
└── ...
Step 1: Setup
mkdir -p docs/unwind/layers/domain-model/
Write initial index.md:
# Domain Model
## Sections
- [Entities](entities.md) - _pending_
- [Value Objects](value-objects.md) - _pending_
- [Enums](enums.md) - _pending_
- [Validation](validation.md) - _pending_
## Summary
_Analysis in progress..._
Step 2: Analyze and write entities.md
entities.md immediatelyindex.mdStep 3: Analyze and write value-objects.md
value-objects.md immediatelyindex.mdStep 4: Analyze and write enums.md
enums.md immediatelyindex.mdStep 5: Analyze and write validation.md
validation.md immediatelyindex.mdStep 6: Finalize index.md Update with final counts and summary
# Domain Model
## Entities
### User
[User.java](https://github.com/owner/repo/blob/main/src/domain/User.java)
```java
@Entity
@Table(name = "users")
public class User {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Long id;
@Column(nullable = false, unique = true)
private String email;
@Enumerated(EnumType.STRING)
private UserStatus status = UserStatus.ACTIVE;
@OneToMany(mappedBy = "user", cascade = CascadeType.ALL)
private List<Order> orders = new ArrayList<>();
public void suspend() {
if (this.status == UserStatus.DELETED) {
throw new IllegalStateException("Cannot suspend deleted user");
}
this.status = UserStatus.SUSPENDED;
}
}
[Continue for ALL entities...]
@Embeddable
public class Money {
private BigDecimal amount;
@Enumerated(EnumType.STRING)
private Currency currency;
public Money add(Money other) {
if (!this.currency.equals(other.currency)) {
throw new IllegalArgumentException("Currency mismatch");
}
return new Money(this.amount.add(other.amount), this.currency);
}
}
public enum UserStatus {
ACTIVE, SUSPENDED, DELETED
}
stateDiagram-v2
[*] --> DRAFT
DRAFT --> SUBMITTED: submit()
SUBMITTED --> PAID: markPaid()
SUBMITTED --> CANCELLED: cancel()
PAID --> SHIPPED: ship()
SHIPPED --> DELIVERED: deliver()
Source: Order.java:78-95
## Additional Requirements
### Validation Constraint Tables [MUST]
For each validation schema, create a constraint table:
```markdown
### Position Validation [MUST]
| Field | Type | Min | Max | Required | Default | Notes |
|-------|------|-----|-----|----------|---------|-------|
| name | string | 1 | 200 | yes | - | |
| fteBasis | number | 0 | 2 | yes | 1.0 | Full-time equivalent |
| capexPerc | number | 0 | 100 | yes | 0 | Percentage |
| allocation | number | 0 | 100 | yes | 100 | Percentage |
**Source:** `src/validation/positions.ts`
Document ALL enum/union type values:
### Position Type Enum [MUST]
```typescript
type PositionType = 'standard' | 'acting' | 'interim' | 'vacant'
| Value | Description |
|---|---|
| standard | Permanent position |
| acting | Temporary assignment |
| interim | Short-term coverage |
| vacant | Unfilled position |
### Permission Matrix [MUST]
Document role-permission mappings:
```markdown
### Permission Matrix [MUST]
| Resource | owner | admin | manager | member |
|----------|-------|-------|---------|--------|
| Organisation | manage | read | read | read |
| Employee | manage | manage | manage | read |
| Budget | manage | manage | read | - |
| Rate | manage | manage | read | - |
Document any self-referential constraints:
### Relationship Constraints [MUST]
- Position cannot report to itself: `fromPositionId !== toPositionId`
- End date must be after start date: `endDate > startDate`
Every entity, enum, and validation rule must have a [MUST], [SHOULD], or [DON'T] tag in its heading.
Default categorizations for domain model:
Example:
### User entity [MUST]
### UserStatus enum [MUST]
### EmailValidator [MUST]
### UserDTO [SHOULD]
See analysis-principles.md section 9 for full tagging rules.
If docs/unwind/layers/domain-model/ exists, compare current state and add ## Changes Since Last Review section to index.md.