@dynokostya/just-works 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.claude/agents/csharp-code-writer.md +32 -0
- package/.claude/agents/diagrammer.md +49 -0
- package/.claude/agents/frontend-code-writer.md +36 -0
- package/.claude/agents/prompt-writer.md +38 -0
- package/.claude/agents/python-code-writer.md +32 -0
- package/.claude/agents/swift-code-writer.md +32 -0
- package/.claude/agents/typescript-code-writer.md +32 -0
- package/.claude/commands/git-sync.md +96 -0
- package/.claude/commands/project-docs.md +287 -0
- package/.claude/settings.json +112 -0
- package/.claude/settings.json.default +15 -0
- package/.claude/skills/csharp-coding/SKILL.md +368 -0
- package/.claude/skills/ddd-architecture-python/SKILL.md +288 -0
- package/.claude/skills/feature-driven-architecture-python/SKILL.md +302 -0
- package/.claude/skills/gemini-3-prompting/SKILL.md +483 -0
- package/.claude/skills/gpt-5-2-prompting/SKILL.md +295 -0
- package/.claude/skills/opus-4-6-prompting/SKILL.md +315 -0
- package/.claude/skills/plantuml-diagramming/SKILL.md +758 -0
- package/.claude/skills/python-coding/SKILL.md +293 -0
- package/.claude/skills/react-coding/SKILL.md +264 -0
- package/.claude/skills/rest-api/SKILL.md +421 -0
- package/.claude/skills/shadcn-ui-coding/SKILL.md +454 -0
- package/.claude/skills/swift-coding/SKILL.md +401 -0
- package/.claude/skills/tailwind-css-coding/SKILL.md +268 -0
- package/.claude/skills/typescript-coding/SKILL.md +464 -0
- package/.claude/statusline-command.sh +34 -0
- package/.codex/prompts/plan-reviewer.md +162 -0
- package/.codex/prompts/project-docs.md +287 -0
- package/.codex/skills/ddd-architecture-python/SKILL.md +288 -0
- package/.codex/skills/feature-driven-architecture-python/SKILL.md +302 -0
- package/.codex/skills/gemini-3-prompting/SKILL.md +483 -0
- package/.codex/skills/gpt-5-2-prompting/SKILL.md +295 -0
- package/.codex/skills/opus-4-6-prompting/SKILL.md +315 -0
- package/.codex/skills/plantuml-diagramming/SKILL.md +758 -0
- package/.codex/skills/python-coding/SKILL.md +293 -0
- package/.codex/skills/react-coding/SKILL.md +264 -0
- package/.codex/skills/rest-api/SKILL.md +421 -0
- package/.codex/skills/shadcn-ui-coding/SKILL.md +454 -0
- package/.codex/skills/tailwind-css-coding/SKILL.md +268 -0
- package/.codex/skills/typescript-coding/SKILL.md +464 -0
- package/AGENTS.md +57 -0
- package/CLAUDE.md +98 -0
- package/LICENSE +201 -0
- package/README.md +114 -0
- package/bin/cli.mjs +291 -0
- package/package.json +39 -0
|
@@ -0,0 +1,758 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: plantuml-diagramming
|
|
3
|
+
description: Apply when writing or editing PlantUML (.puml, .plantuml, .pu) files or when generating diagrams from text descriptions. Covers diagram type selection, syntax conventions, modern styling, preprocessing, audience-aware abstraction levels, and common anti-patterns. Project conventions always override these defaults.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# PlantUML Diagramming
|
|
7
|
+
|
|
8
|
+
Match the project's existing conventions. When uncertain, check for existing `.puml` files to infer the local style -- naming, layout direction, theme usage, and abstraction level. Check for shared includes (`!include`) or a project theme file. These defaults apply only when the project has no established convention.
|
|
9
|
+
|
|
10
|
+
## Never rules
|
|
11
|
+
|
|
12
|
+
These are unconditional. They prevent broken or unreadable diagrams regardless of project style.
|
|
13
|
+
|
|
14
|
+
- **Never omit `@startuml`/`@enduml` delimiters** -- PlantUML silently fails or produces garbage without them. Every `.puml` file must start with `@startuml` and end with `@enduml` (or the equivalent for the diagram type: `@startmindmap`/`@endmindmap`, `@startgantt`/`@endgantt`, etc.).
|
|
15
|
+
|
|
16
|
+
- **Never use cryptic abbreviations or internal codenames as labels** -- use plain English that any team member understands. `AuthSvc` means nothing to a product manager; `Authentication Service` does. Labels are for humans, not compilers.
|
|
17
|
+
|
|
18
|
+
- **Never create diagrams with more than ~15 elements without grouping/nesting** -- overcrowded diagrams defeat the purpose. Use `package`, `rectangle`, `node`, `cloud`, or `together` to group related elements. If you cannot group meaningfully, split into multiple diagrams.
|
|
19
|
+
|
|
20
|
+
- **Never use legacy `skinparam` when `<style>` blocks achieve the same result** -- `skinparam` is deprecated. Use CSS-like `<style>` blocks for all visual customization. The only exception: edge cases where `<style>` does not yet support a specific property.
|
|
21
|
+
|
|
22
|
+
- **Never hardcode colors inline on individual elements** -- use stereotype-based `skinparam` or `<style>` blocks for consistency. Inline colors (`#FF0000` or `#CCFFCC` after `;`) on individual elements create maintenance nightmares, visual inconsistency, and often cause syntax errors in activity diagrams.
|
|
23
|
+
|
|
24
|
+
- **Never mix arrow direction keywords (`-up->`, `-down->`) with layout hacks** -- let PlantUML auto-layout first. Only add direction hints when the auto-layout result is genuinely unreadable. Overriding layout in multiple places creates conflicts that produce worse results than no hints at all.
|
|
25
|
+
|
|
26
|
+
- **Never use `autonumber` without explicit format** -- bare `autonumber` produces plain integers that add visual noise without aiding comprehension. Use a format string: `autonumber "<b>[000]"` or `autonumber 1 10 "<b>[00]"`.
|
|
27
|
+
|
|
28
|
+
- **Never omit participant declarations in sequence diagrams** -- undeclared participants render in source-order, which produces unpredictable layouts. Declare all participants at the top in the order you want them displayed.
|
|
29
|
+
|
|
30
|
+
- **Never write diagrams without a `title`** -- every diagram needs context for the reader. A diagram without a title is a screenshot without a caption.
|
|
31
|
+
|
|
32
|
+
## Audience and abstraction level
|
|
33
|
+
|
|
34
|
+
**Default to high-level, business-friendly diagrams.** The primary audience is non-technical team members and new joiners. Use business-friendly labels, simple relationships, and minimal jargon.
|
|
35
|
+
|
|
36
|
+
- Use full words: "Payment Service", not "PaySvc" or "pmtSvc"
|
|
37
|
+
- Show system boundaries and data flow, not implementation details
|
|
38
|
+
- Label arrows with business actions: "submits order", "sends notification"
|
|
39
|
+
- Omit method signatures, database column names, and class internals unless explicitly requested
|
|
40
|
+
|
|
41
|
+
**Only produce detailed/technical diagrams** (class diagrams with methods, database schemas, detailed state machines) when the user explicitly asks for a technical or detailed diagram. When in doubt, ask.
|
|
42
|
+
|
|
43
|
+
## Diagram type selection
|
|
44
|
+
|
|
45
|
+
| Scenario | Recommended Type | Why |
|
|
46
|
+
|----------|-----------------|-----|
|
|
47
|
+
| How systems or services interact over time | Sequence | Shows temporal ordering and message flow clearly |
|
|
48
|
+
| High-level system architecture or service boundaries | Component | Shows parts and their relationships without temporal ordering |
|
|
49
|
+
| Infrastructure and deployment topology | Deployment | Shows physical/cloud nodes and what runs where |
|
|
50
|
+
| Business process or workflow with decisions | Activity | Shows branching, parallel paths, and swimlanes |
|
|
51
|
+
| Object relationships and data modeling (technical) | Class | Shows inheritance, composition, and structure -- technical audiences only |
|
|
52
|
+
| Lifecycle of a single entity | State | Shows transitions and conditions for one stateful object |
|
|
53
|
+
| Feature scope or user goals | Use Case | Shows actors and what they can do at a glance |
|
|
54
|
+
| Brainstorming or knowledge structure | Mindmap | Non-linear, quick to create |
|
|
55
|
+
| Project timeline with dependencies | Gantt | Shows scheduling, milestones, and critical path |
|
|
56
|
+
| Work breakdown or deliverable hierarchy | WBS | Shows hierarchical decomposition of deliverables |
|
|
57
|
+
| Data relationships (technical) | ER (class with stereotypes) | Shows entities, attributes, and cardinality |
|
|
58
|
+
|
|
59
|
+
## Sequence diagrams
|
|
60
|
+
|
|
61
|
+
Sequence diagrams are the most common type. They show how components interact over time.
|
|
62
|
+
|
|
63
|
+
### Participants
|
|
64
|
+
|
|
65
|
+
Declare all participants at the top in display order. Use the right stereotype for each:
|
|
66
|
+
|
|
67
|
+
```plantuml
|
|
68
|
+
@startuml
|
|
69
|
+
title Order Placement Flow
|
|
70
|
+
|
|
71
|
+
actor Customer as C
|
|
72
|
+
participant "Web App" as Web
|
|
73
|
+
participant "Order Service" as Orders
|
|
74
|
+
database "Order Database" as DB
|
|
75
|
+
queue "Event Bus" as Events
|
|
76
|
+
|
|
77
|
+
C -> Web: Places order
|
|
78
|
+
Web -> Orders: Create order request
|
|
79
|
+
Orders -> DB: Store order
|
|
80
|
+
Orders -> Events: Publish "Order Created"
|
|
81
|
+
Orders --> Web: Order confirmation
|
|
82
|
+
Web --> C: Display confirmation
|
|
83
|
+
|
|
84
|
+
@enduml
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
**Participant types:** `actor` (human user), `participant` (generic service), `boundary` (system edge/API gateway), `control` (orchestrator/coordinator), `entity` (domain object/data), `database` (data store), `queue` (message broker), `collections` (grouped instances).
|
|
88
|
+
|
|
89
|
+
### Arrows
|
|
90
|
+
|
|
91
|
+
| Syntax | Meaning |
|
|
92
|
+
|--------|---------|
|
|
93
|
+
| `->` | Synchronous request (solid line, filled arrow) |
|
|
94
|
+
| `-->` | Synchronous response (dashed line, filled arrow) |
|
|
95
|
+
| `->>` | Asynchronous message (solid line, open arrow) |
|
|
96
|
+
| `-->>` | Asynchronous response (dashed line, open arrow) |
|
|
97
|
+
| `->x` | Lost message (message that goes nowhere) |
|
|
98
|
+
| `<->` | Bidirectional |
|
|
99
|
+
|
|
100
|
+
### Activation and deactivation
|
|
101
|
+
|
|
102
|
+
Use `activate`/`deactivate` or the shorthand `++`/`--` to show when a participant is processing:
|
|
103
|
+
|
|
104
|
+
```plantuml
|
|
105
|
+
Web -> Orders ++: Create order
|
|
106
|
+
Orders -> DB ++: INSERT order
|
|
107
|
+
DB --> Orders --: OK
|
|
108
|
+
Orders --> Web --: Order ID
|
|
109
|
+
```
|
|
110
|
+
|
|
111
|
+
### Grouping
|
|
112
|
+
|
|
113
|
+
Use grouping to show conditional and repetitive flows:
|
|
114
|
+
|
|
115
|
+
```plantuml
|
|
116
|
+
alt Payment succeeds
|
|
117
|
+
Orders -> Payments: Charge card
|
|
118
|
+
Payments --> Orders: Success
|
|
119
|
+
else Payment fails
|
|
120
|
+
Payments --> Orders: Declined
|
|
121
|
+
Orders --> Web: Payment failed
|
|
122
|
+
end
|
|
123
|
+
|
|
124
|
+
opt Customer has loyalty account
|
|
125
|
+
Orders -> Loyalty: Award points
|
|
126
|
+
end
|
|
127
|
+
|
|
128
|
+
loop For each item in cart
|
|
129
|
+
Orders -> Inventory: Reserve stock
|
|
130
|
+
end
|
|
131
|
+
|
|
132
|
+
par Parallel notifications
|
|
133
|
+
Orders ->> Email: Send confirmation
|
|
134
|
+
Orders ->> SMS: Send text
|
|
135
|
+
end
|
|
136
|
+
```
|
|
137
|
+
|
|
138
|
+
### Notes, dividers, and delays
|
|
139
|
+
|
|
140
|
+
```plantuml
|
|
141
|
+
note right of Orders: Validates inventory\nbefore charging
|
|
142
|
+
note over Web, Orders: All communication over HTTPS
|
|
143
|
+
|
|
144
|
+
== Fulfillment Phase ==
|
|
145
|
+
|
|
146
|
+
...Warehouse picks and packs order...
|
|
147
|
+
|
|
148
|
+
Shipping -> Customer: Delivery notification
|
|
149
|
+
```
|
|
150
|
+
|
|
151
|
+
## Component and deployment diagrams
|
|
152
|
+
|
|
153
|
+
Use these for high-level system architecture. Focus on boundaries and data flow, not internals.
|
|
154
|
+
|
|
155
|
+
### Component diagram
|
|
156
|
+
|
|
157
|
+
```plantuml
|
|
158
|
+
@startuml
|
|
159
|
+
title E-Commerce Platform Overview
|
|
160
|
+
|
|
161
|
+
package "Frontend" {
|
|
162
|
+
[Web Application] as Web
|
|
163
|
+
[Mobile App] as Mobile
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
package "API Gateway" {
|
|
167
|
+
[Gateway] as GW
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
package "Backend Services" {
|
|
171
|
+
[Order Service] as Orders
|
|
172
|
+
[Payment Service] as Payments
|
|
173
|
+
[Inventory Service] as Inventory
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
package "Data Layer" {
|
|
177
|
+
database "Orders DB" as ODB
|
|
178
|
+
database "Products DB" as PDB
|
|
179
|
+
queue "Event Bus" as Events
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
Web --> GW: REST/HTTPS
|
|
183
|
+
Mobile --> GW: REST/HTTPS
|
|
184
|
+
GW --> Orders
|
|
185
|
+
GW --> Payments
|
|
186
|
+
GW --> Inventory
|
|
187
|
+
Orders --> ODB
|
|
188
|
+
Inventory --> PDB
|
|
189
|
+
Orders --> Events: Publishes events
|
|
190
|
+
Payments --> Events: Publishes events
|
|
191
|
+
|
|
192
|
+
@enduml
|
|
193
|
+
```
|
|
194
|
+
|
|
195
|
+
### Deployment diagram
|
|
196
|
+
|
|
197
|
+
```plantuml
|
|
198
|
+
@startuml
|
|
199
|
+
title Production Deployment
|
|
200
|
+
|
|
201
|
+
cloud "CDN" as cdn
|
|
202
|
+
|
|
203
|
+
node "AWS Region us-east-1" {
|
|
204
|
+
node "EKS Cluster" {
|
|
205
|
+
[API Gateway] as gw
|
|
206
|
+
[Order Service] as orders
|
|
207
|
+
[Payment Service] as payments
|
|
208
|
+
}
|
|
209
|
+
database "RDS PostgreSQL" as db
|
|
210
|
+
queue "SQS" as sqs
|
|
211
|
+
}
|
|
212
|
+
|
|
213
|
+
cloud "Stripe" as stripe
|
|
214
|
+
|
|
215
|
+
cdn --> gw: HTTPS
|
|
216
|
+
gw --> orders
|
|
217
|
+
gw --> payments
|
|
218
|
+
orders --> db
|
|
219
|
+
orders --> sqs
|
|
220
|
+
payments --> stripe: Payment processing
|
|
221
|
+
|
|
222
|
+
@enduml
|
|
223
|
+
```
|
|
224
|
+
|
|
225
|
+
**Container types:** `node` (server/VM/container), `cloud` (external/cloud provider), `database` (data store), `package` (logical grouping), `rectangle` (generic boundary), `frame` (subsystem boundary).
|
|
226
|
+
|
|
227
|
+
Use `interface` or `()` for exposed ports:
|
|
228
|
+
|
|
229
|
+
```plantuml
|
|
230
|
+
() "REST API" as api
|
|
231
|
+
[Order Service] - api
|
|
232
|
+
```
|
|
233
|
+
|
|
234
|
+
## Activity diagrams
|
|
235
|
+
|
|
236
|
+
Use for business processes, workflows, and decision flows. Swimlane partitions make it clear who is responsible for each step.
|
|
237
|
+
|
|
238
|
+
```plantuml
|
|
239
|
+
@startuml
|
|
240
|
+
title Order Processing Workflow
|
|
241
|
+
|
|
242
|
+
start
|
|
243
|
+
|
|
244
|
+
:Customer submits order;
|
|
245
|
+
|
|
246
|
+
if (Payment valid?) then (yes)
|
|
247
|
+
:Charge payment method;
|
|
248
|
+
if (Inventory available?) then (yes)
|
|
249
|
+
fork
|
|
250
|
+
:Reserve inventory;
|
|
251
|
+
fork again
|
|
252
|
+
:Send confirmation email;
|
|
253
|
+
end fork
|
|
254
|
+
:Ship order;
|
|
255
|
+
else (no)
|
|
256
|
+
:Notify customer of backorder;
|
|
257
|
+
:Add to waitlist;
|
|
258
|
+
endif
|
|
259
|
+
else (no)
|
|
260
|
+
:Reject order;
|
|
261
|
+
:Notify customer;
|
|
262
|
+
stop
|
|
263
|
+
endif
|
|
264
|
+
|
|
265
|
+
:Update order status to "Complete";
|
|
266
|
+
|
|
267
|
+
stop
|
|
268
|
+
|
|
269
|
+
@enduml
|
|
270
|
+
```
|
|
271
|
+
|
|
272
|
+
### Swimlanes with partitions
|
|
273
|
+
|
|
274
|
+
```plantuml
|
|
275
|
+
@startuml
|
|
276
|
+
title Support Ticket Resolution
|
|
277
|
+
|
|
278
|
+
|Customer|
|
|
279
|
+
start
|
|
280
|
+
:Submit support ticket;
|
|
281
|
+
|
|
282
|
+
|Support Agent|
|
|
283
|
+
:Review ticket;
|
|
284
|
+
if (Can resolve immediately?) then (yes)
|
|
285
|
+
:Provide solution;
|
|
286
|
+
else (no)
|
|
287
|
+
|Engineering|
|
|
288
|
+
:Investigate issue;
|
|
289
|
+
:Implement fix;
|
|
290
|
+
|Support Agent|
|
|
291
|
+
:Communicate resolution;
|
|
292
|
+
endif
|
|
293
|
+
|
|
294
|
+
|Customer|
|
|
295
|
+
:Confirm resolution;
|
|
296
|
+
stop
|
|
297
|
+
|
|
298
|
+
@enduml
|
|
299
|
+
```
|
|
300
|
+
|
|
301
|
+
**Key syntax:** `start`/`stop`, `:action;`, `if (condition?) then (yes) else (no) endif`, `fork`/`fork again`/`end fork`, `|Swimlane|`, floating notes with `floating note right: text`.
|
|
302
|
+
|
|
303
|
+
### Coloring activity steps with stereotypes
|
|
304
|
+
|
|
305
|
+
To highlight specific paths (e.g., desired flow, error paths, regeneration vs new), use **stereotypes with skinparam**. Do NOT use inline `#color` after `;` — it causes syntax errors in activity diagrams.
|
|
306
|
+
|
|
307
|
+
```plantuml
|
|
308
|
+
@startuml
|
|
309
|
+
skinparam activity {
|
|
310
|
+
BackgroundColor #F5F5F5
|
|
311
|
+
BorderColor #333333
|
|
312
|
+
}
|
|
313
|
+
|
|
314
|
+
skinparam activity {
|
|
315
|
+
BackgroundColor<<desired>> #E3F2E7
|
|
316
|
+
BorderColor<<desired>> #7BAA87
|
|
317
|
+
FontColor<<desired>> #000000
|
|
318
|
+
|
|
319
|
+
BackgroundColor<<error>> #FDE2E2
|
|
320
|
+
BorderColor<<error>> #C77C7C
|
|
321
|
+
FontColor<<error>> #000000
|
|
322
|
+
}
|
|
323
|
+
|
|
324
|
+
title Example Flow
|
|
325
|
+
|
|
326
|
+
start
|
|
327
|
+
:Normal step;
|
|
328
|
+
:Desired step; <<desired>>
|
|
329
|
+
:Error step; <<error>>
|
|
330
|
+
stop
|
|
331
|
+
|
|
332
|
+
legend right
|
|
333
|
+
|= Color |= Meaning |
|
|
334
|
+
|<#E3F2E7>| Desired flow |
|
|
335
|
+
|<#FDE2E2>| Error path |
|
|
336
|
+
endlegend
|
|
337
|
+
@enduml
|
|
338
|
+
```
|
|
339
|
+
|
|
340
|
+
**Rules:**
|
|
341
|
+
- Define stereotype colors in a `skinparam activity {}` block at the top
|
|
342
|
+
- Apply with `<<stereotype>>` after the `;` on the activity line
|
|
343
|
+
- Use a color legend table to explain meanings
|
|
344
|
+
- Common stereotypes: `<<desired>>`, `<<error>>`, `<<regen>>`, `<<newgen>>`, `<<fallback>>`
|
|
345
|
+
- `elseif` always requires `then` — omitting it causes syntax errors downstream
|
|
346
|
+
|
|
347
|
+
## Class diagrams
|
|
348
|
+
|
|
349
|
+
**Technical diagrams only.** Use class diagrams when the user explicitly requests a technical or detailed diagram showing object relationships, inheritance, or data modeling.
|
|
350
|
+
|
|
351
|
+
### Relationships
|
|
352
|
+
|
|
353
|
+
| Syntax | Meaning | Use When |
|
|
354
|
+
|--------|---------|----------|
|
|
355
|
+
| `<\|--` | Extension/inheritance | "is a" relationship |
|
|
356
|
+
| `*--` | Composition | Part cannot exist without whole |
|
|
357
|
+
| `o--` | Aggregation | Part can exist independently |
|
|
358
|
+
| `-->` | Dependency | Uses temporarily |
|
|
359
|
+
| `--` | Association | General relationship |
|
|
360
|
+
| `..\|>` | Implements | Realizes an interface |
|
|
361
|
+
|
|
362
|
+
### Example
|
|
363
|
+
|
|
364
|
+
```plantuml
|
|
365
|
+
@startuml
|
|
366
|
+
title Domain Model
|
|
367
|
+
|
|
368
|
+
class Order {
|
|
369
|
+
- id: UUID
|
|
370
|
+
- status: OrderStatus
|
|
371
|
+
- createdAt: DateTime
|
|
372
|
+
+ addItem(product: Product, qty: int)
|
|
373
|
+
+ calculateTotal(): Money
|
|
374
|
+
}
|
|
375
|
+
|
|
376
|
+
class OrderItem {
|
|
377
|
+
- quantity: int
|
|
378
|
+
- unitPrice: Money
|
|
379
|
+
}
|
|
380
|
+
|
|
381
|
+
class Product {
|
|
382
|
+
- name: String
|
|
383
|
+
- sku: String
|
|
384
|
+
- price: Money
|
|
385
|
+
}
|
|
386
|
+
|
|
387
|
+
enum OrderStatus {
|
|
388
|
+
PENDING
|
|
389
|
+
CONFIRMED
|
|
390
|
+
SHIPPED
|
|
391
|
+
DELIVERED
|
|
392
|
+
CANCELLED
|
|
393
|
+
}
|
|
394
|
+
|
|
395
|
+
Order *-- "1..*" OrderItem: contains
|
|
396
|
+
OrderItem --> Product: references
|
|
397
|
+
Order --> OrderStatus: has
|
|
398
|
+
|
|
399
|
+
@enduml
|
|
400
|
+
```
|
|
401
|
+
|
|
402
|
+
**Visibility modifiers:** `-` private, `+` public, `#` protected, `~` package-private.
|
|
403
|
+
|
|
404
|
+
**Stereotypes:** `<<interface>>`, `<<abstract>>`, `<<enum>>`, `<<service>>`, `<<entity>>`.
|
|
405
|
+
|
|
406
|
+
**Packages** group related classes:
|
|
407
|
+
|
|
408
|
+
```plantuml
|
|
409
|
+
package "Orders Domain" {
|
|
410
|
+
class Order
|
|
411
|
+
class OrderItem
|
|
412
|
+
}
|
|
413
|
+
```
|
|
414
|
+
|
|
415
|
+
## State diagrams
|
|
416
|
+
|
|
417
|
+
Use for modeling the lifecycle of a single entity -- orders, tickets, user accounts, deployments.
|
|
418
|
+
|
|
419
|
+
```plantuml
|
|
420
|
+
@startuml
|
|
421
|
+
title Order Lifecycle
|
|
422
|
+
|
|
423
|
+
[*] --> Pending: Order created
|
|
424
|
+
|
|
425
|
+
state Pending {
|
|
426
|
+
[*] --> AwaitingPayment
|
|
427
|
+
AwaitingPayment --> PaymentReceived: Payment confirmed
|
|
428
|
+
AwaitingPayment --> [*]: Payment timeout
|
|
429
|
+
}
|
|
430
|
+
|
|
431
|
+
Pending --> Confirmed: Payment succeeds
|
|
432
|
+
Pending --> Cancelled: Payment fails
|
|
433
|
+
|
|
434
|
+
Confirmed --> Shipped: Carrier picks up
|
|
435
|
+
Shipped --> Delivered: Delivery confirmed
|
|
436
|
+
Shipped --> Returned: Customer returns
|
|
437
|
+
|
|
438
|
+
Delivered --> [*]
|
|
439
|
+
Cancelled --> [*]
|
|
440
|
+
Returned --> Refunded: Refund processed
|
|
441
|
+
Refunded --> [*]
|
|
442
|
+
|
|
443
|
+
@enduml
|
|
444
|
+
```
|
|
445
|
+
|
|
446
|
+
### Key syntax
|
|
447
|
+
|
|
448
|
+
- `[*]` -- initial and final pseudo-states
|
|
449
|
+
- `state Name { }` -- composite/nested states
|
|
450
|
+
- `state "Long Name" as alias` -- aliasing for readability
|
|
451
|
+
- `state fork_point <<fork>>` / `<<join>>` -- concurrent region fork/join
|
|
452
|
+
- `state choice_point <<choice>>` -- decision point
|
|
453
|
+
|
|
454
|
+
### Concurrent regions
|
|
455
|
+
|
|
456
|
+
```plantuml
|
|
457
|
+
state Processing {
|
|
458
|
+
state "Verify Payment" as vp
|
|
459
|
+
state "Check Inventory" as ci
|
|
460
|
+
[*] --> vp
|
|
461
|
+
[*] --> ci
|
|
462
|
+
vp --> [*]
|
|
463
|
+
ci --> [*]
|
|
464
|
+
--
|
|
465
|
+
state "Send Notification" as sn
|
|
466
|
+
[*] --> sn
|
|
467
|
+
sn --> [*]
|
|
468
|
+
}
|
|
469
|
+
```
|
|
470
|
+
|
|
471
|
+
## Other diagram types
|
|
472
|
+
|
|
473
|
+
### Use case diagram
|
|
474
|
+
|
|
475
|
+
Good for feature scope and actor interactions at a glance:
|
|
476
|
+
|
|
477
|
+
```plantuml
|
|
478
|
+
@startuml
|
|
479
|
+
title Customer Portal Features
|
|
480
|
+
|
|
481
|
+
left to right direction
|
|
482
|
+
|
|
483
|
+
actor Customer as C
|
|
484
|
+
actor "Support Agent" as SA
|
|
485
|
+
|
|
486
|
+
rectangle "Customer Portal" {
|
|
487
|
+
usecase "View Orders" as UC1
|
|
488
|
+
usecase "Track Shipment" as UC2
|
|
489
|
+
usecase "Request Return" as UC3
|
|
490
|
+
usecase "Chat with Support" as UC4
|
|
491
|
+
usecase "Manage Returns" as UC5
|
|
492
|
+
}
|
|
493
|
+
|
|
494
|
+
C --> UC1
|
|
495
|
+
C --> UC2
|
|
496
|
+
C --> UC3
|
|
497
|
+
C --> UC4
|
|
498
|
+
SA --> UC4
|
|
499
|
+
SA --> UC5
|
|
500
|
+
|
|
501
|
+
@enduml
|
|
502
|
+
```
|
|
503
|
+
|
|
504
|
+
### Mindmap
|
|
505
|
+
|
|
506
|
+
Quick brainstorming or knowledge structure:
|
|
507
|
+
|
|
508
|
+
```plantuml
|
|
509
|
+
@startmindmap
|
|
510
|
+
title Project Architecture Decisions
|
|
511
|
+
* Architecture
|
|
512
|
+
** Frontend
|
|
513
|
+
*** React SPA
|
|
514
|
+
*** Server-Side Rendering
|
|
515
|
+
** Backend
|
|
516
|
+
*** Microservices
|
|
517
|
+
*** Monolith
|
|
518
|
+
** Data
|
|
519
|
+
*** PostgreSQL
|
|
520
|
+
*** Redis Cache
|
|
521
|
+
@endmindmap
|
|
522
|
+
```
|
|
523
|
+
|
|
524
|
+
### Gantt chart
|
|
525
|
+
|
|
526
|
+
Project timelines with dependencies:
|
|
527
|
+
|
|
528
|
+
```plantuml
|
|
529
|
+
@startgantt
|
|
530
|
+
title Q1 Release Plan
|
|
531
|
+
project starts 2026-01-05
|
|
532
|
+
|
|
533
|
+
[Design Phase] lasts 10 days
|
|
534
|
+
[Backend Development] lasts 15 days
|
|
535
|
+
[Frontend Development] lasts 15 days
|
|
536
|
+
[Testing] lasts 10 days
|
|
537
|
+
[Deployment] lasts 3 days
|
|
538
|
+
|
|
539
|
+
[Backend Development] starts at [Design Phase]'s end
|
|
540
|
+
[Frontend Development] starts at [Design Phase]'s end
|
|
541
|
+
[Testing] starts at [Backend Development]'s end
|
|
542
|
+
[Deployment] starts at [Testing]'s end
|
|
543
|
+
|
|
544
|
+
[Design Phase] is colored in LightBlue
|
|
545
|
+
[Deployment] is colored in LightGreen
|
|
546
|
+
|
|
547
|
+
@endgantt
|
|
548
|
+
```
|
|
549
|
+
|
|
550
|
+
### WBS (Work Breakdown Structure)
|
|
551
|
+
|
|
552
|
+
Hierarchical deliverable decomposition:
|
|
553
|
+
|
|
554
|
+
```plantuml
|
|
555
|
+
@startwbs
|
|
556
|
+
title Product Launch
|
|
557
|
+
* Product Launch
|
|
558
|
+
** Research
|
|
559
|
+
*** User Interviews
|
|
560
|
+
*** Competitive Analysis
|
|
561
|
+
** Development
|
|
562
|
+
*** Backend API
|
|
563
|
+
*** Frontend UI
|
|
564
|
+
*** Mobile App
|
|
565
|
+
** Launch
|
|
566
|
+
*** Marketing Campaign
|
|
567
|
+
*** Documentation
|
|
568
|
+
*** Training
|
|
569
|
+
@endwbs
|
|
570
|
+
```
|
|
571
|
+
|
|
572
|
+
### ER diagram (using class diagram syntax)
|
|
573
|
+
|
|
574
|
+
```plantuml
|
|
575
|
+
@startuml
|
|
576
|
+
title Database Schema
|
|
577
|
+
|
|
578
|
+
entity "users" {
|
|
579
|
+
* id : UUID <<PK>>
|
|
580
|
+
--
|
|
581
|
+
* email : VARCHAR(255)
|
|
582
|
+
* name : VARCHAR(100)
|
|
583
|
+
created_at : TIMESTAMP
|
|
584
|
+
}
|
|
585
|
+
|
|
586
|
+
entity "orders" {
|
|
587
|
+
* id : UUID <<PK>>
|
|
588
|
+
--
|
|
589
|
+
* user_id : UUID <<FK>>
|
|
590
|
+
* status : VARCHAR(20)
|
|
591
|
+
* total : DECIMAL(10,2)
|
|
592
|
+
created_at : TIMESTAMP
|
|
593
|
+
}
|
|
594
|
+
|
|
595
|
+
users ||--o{ orders : places
|
|
596
|
+
|
|
597
|
+
@enduml
|
|
598
|
+
```
|
|
599
|
+
|
|
600
|
+
### JSON and YAML visualization
|
|
601
|
+
|
|
602
|
+
```plantuml
|
|
603
|
+
@startjson
|
|
604
|
+
title API Response Structure
|
|
605
|
+
{
|
|
606
|
+
"order": {
|
|
607
|
+
"id": "abc-123",
|
|
608
|
+
"status": "confirmed",
|
|
609
|
+
"items": [
|
|
610
|
+
{"product": "Widget", "qty": 2},
|
|
611
|
+
{"product": "Gadget", "qty": 1}
|
|
612
|
+
]
|
|
613
|
+
}
|
|
614
|
+
}
|
|
615
|
+
@endjson
|
|
616
|
+
```
|
|
617
|
+
|
|
618
|
+
## Styling
|
|
619
|
+
|
|
620
|
+
### Modern `<style>` blocks (preferred)
|
|
621
|
+
|
|
622
|
+
Use CSS-like `<style>` blocks instead of legacy `skinparam`. Place the style block immediately after `@startuml`:
|
|
623
|
+
|
|
624
|
+
```plantuml
|
|
625
|
+
@startuml
|
|
626
|
+
title Styled Sequence Diagram
|
|
627
|
+
|
|
628
|
+
<style>
|
|
629
|
+
sequenceDiagram {
|
|
630
|
+
actor {
|
|
631
|
+
BackgroundColor #E8F5E9
|
|
632
|
+
BorderColor #2E7D32
|
|
633
|
+
}
|
|
634
|
+
participant {
|
|
635
|
+
BackgroundColor #E3F2FD
|
|
636
|
+
BorderColor #1565C0
|
|
637
|
+
}
|
|
638
|
+
arrow {
|
|
639
|
+
LineColor #333333
|
|
640
|
+
}
|
|
641
|
+
note {
|
|
642
|
+
BackgroundColor #FFF9C4
|
|
643
|
+
BorderColor #F9A825
|
|
644
|
+
}
|
|
645
|
+
}
|
|
646
|
+
</style>
|
|
647
|
+
|
|
648
|
+
actor Customer
|
|
649
|
+
participant "Order Service" as OS
|
|
650
|
+
...
|
|
651
|
+
@enduml
|
|
652
|
+
```
|
|
653
|
+
|
|
654
|
+
### Built-in themes
|
|
655
|
+
|
|
656
|
+
PlantUML ships with themes. Use `!theme` to apply one:
|
|
657
|
+
|
|
658
|
+
```plantuml
|
|
659
|
+
@startuml
|
|
660
|
+
!theme cerulean
|
|
661
|
+
title Themed Diagram
|
|
662
|
+
...
|
|
663
|
+
@enduml
|
|
664
|
+
```
|
|
665
|
+
|
|
666
|
+
Common themes: `cerulean`, `plain`, `sketchy-outline`, `aws-orange`, `mars`, `minty`. Preview themes before committing to one.
|
|
667
|
+
|
|
668
|
+
### Color formats
|
|
669
|
+
|
|
670
|
+
- Named colors: `Red`, `LightBlue`, `DarkGreen`
|
|
671
|
+
- Hex: `#FF5733`, `#2196F3`
|
|
672
|
+
- Gradients: `#White/#LightBlue` (top to bottom)
|
|
673
|
+
|
|
674
|
+
### Layout direction
|
|
675
|
+
|
|
676
|
+
Default is top-to-bottom. For wide diagrams with many horizontal relationships:
|
|
677
|
+
|
|
678
|
+
```plantuml
|
|
679
|
+
left to right direction
|
|
680
|
+
```
|
|
681
|
+
|
|
682
|
+
Add this immediately after `@startuml` (before any elements).
|
|
683
|
+
|
|
684
|
+
## Preprocessing
|
|
685
|
+
|
|
686
|
+
### !include
|
|
687
|
+
|
|
688
|
+
Split large diagrams or share common definitions across files:
|
|
689
|
+
|
|
690
|
+
```plantuml
|
|
691
|
+
!include common/styles.puml
|
|
692
|
+
!include common/actors.puml
|
|
693
|
+
```
|
|
694
|
+
|
|
695
|
+
Use relative paths. Keep shared definitions (themes, common participants, standard styles) in a `common/` or `shared/` directory.
|
|
696
|
+
|
|
697
|
+
### !procedure
|
|
698
|
+
|
|
699
|
+
Reusable diagram fragments:
|
|
700
|
+
|
|
701
|
+
```plantuml
|
|
702
|
+
!procedure $service($name, $alias)
|
|
703
|
+
participant "$name" as $alias
|
|
704
|
+
!endprocedure
|
|
705
|
+
|
|
706
|
+
$service("Order Service", OS)
|
|
707
|
+
$service("Payment Service", PS)
|
|
708
|
+
```
|
|
709
|
+
|
|
710
|
+
### !function
|
|
711
|
+
|
|
712
|
+
Reusable computed values:
|
|
713
|
+
|
|
714
|
+
```plantuml
|
|
715
|
+
!function $endpoint($service, $path)
|
|
716
|
+
!return $service + " " + $path
|
|
717
|
+
!endfunction
|
|
718
|
+
```
|
|
719
|
+
|
|
720
|
+
### Variables
|
|
721
|
+
|
|
722
|
+
```plantuml
|
|
723
|
+
!$primary_color = "#1565C0"
|
|
724
|
+
!$secondary_color = "#2E7D32"
|
|
725
|
+
```
|
|
726
|
+
|
|
727
|
+
### Conditionals and loops
|
|
728
|
+
|
|
729
|
+
```plantuml
|
|
730
|
+
!if (%getenv("DETAIL_LEVEL") == "high")
|
|
731
|
+
class Order {
|
|
732
|
+
- id: UUID
|
|
733
|
+
- status: OrderStatus
|
|
734
|
+
+ addItem(product: Product, qty: int)
|
|
735
|
+
}
|
|
736
|
+
!else
|
|
737
|
+
rectangle "Order Service"
|
|
738
|
+
!endif
|
|
739
|
+
|
|
740
|
+
!$i = 0
|
|
741
|
+
!while ($i < 3)
|
|
742
|
+
node "Worker $i"
|
|
743
|
+
!$i = $i + 1
|
|
744
|
+
!endwhile
|
|
745
|
+
```
|
|
746
|
+
|
|
747
|
+
## Anti-patterns
|
|
748
|
+
|
|
749
|
+
- **Overcrowded diagrams without grouping** -- more than ~15 ungrouped elements makes the diagram unreadable. Split or group.
|
|
750
|
+
- **Technical jargon in business-level diagrams** -- `POST /api/v2/orders` belongs in API docs, not in a diagram for stakeholders. Use "Creates order" instead.
|
|
751
|
+
- **Mixing styling approaches** -- combining inline colors (`#Red`), `skinparam`, and `<style>` blocks in one file creates conflicting rules and unpredictable rendering. Pick one approach per file; prefer `<style>`.
|
|
752
|
+
- **Deep nesting beyond 3 levels in component diagrams** -- deeply nested `package` blocks produce tiny, illegible boxes. Flatten the hierarchy or split into separate diagrams.
|
|
753
|
+
- **Missing titles and legends** -- a diagram without a title is useless in a document with multiple diagrams. Add `title` always, `legend` when relationships need explanation.
|
|
754
|
+
- **Using class diagrams when a simpler type suffices** -- showing `Order -> PaymentService` as a class relationship when a component or sequence diagram communicates the same thing more clearly. Choose the simplest diagram type that conveys the information.
|
|
755
|
+
- **Duplicating diagram content instead of using `!include`** -- copy-pasted participant declarations and styles across multiple files drift out of sync. Extract shared definitions into include files.
|
|
756
|
+
- **Forcing layout with direction keywords everywhere** -- sprinkling `-up->`, `-left->`, `-right->` on every arrow fights the layout engine and usually produces worse results. Use them sparingly, only when auto-layout genuinely fails.
|
|
757
|
+
- **Bare `autonumber`** -- plain sequential integers (1, 2, 3...) on every arrow add clutter without meaning. Use formatted autonumber or omit it.
|
|
758
|
+
- **Undeclared participants** -- letting PlantUML infer participants from usage produces unstable ordering that changes when you add a new message.
|