@comfanion/workflow 4.36.39 → 4.36.41
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/package.json +1 -1
- package/src/build-info.json +2 -2
- package/src/opencode/agents/dev.md +1 -1
- package/src/opencode/skills/adr-writing/SKILL.md +1 -1
- package/src/opencode/skills/api-design/SKILL.md +527 -0
- package/src/opencode/skills/architecture-design/SKILL.md +313 -10
- package/src/opencode/skills/architecture-validation/SKILL.md +4 -4
- package/src/opencode/skills/database-design/SKILL.md +820 -0
- package/src/opencode/skills/diagram-creation/SKILL.md +384 -10
- package/src/opencode/skills/unit-writing/SKILL.md +1 -1
|
@@ -1,17 +1,19 @@
|
|
|
1
1
|
---
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
2
|
+
name: diagram-creation
|
|
3
|
+
description: Use when creating technical diagrams - C4 architecture, sequence flows, ER data models, flowcharts, state machines, or deployment infrastructure
|
|
4
|
+
license: MIT
|
|
5
|
+
compatibility: opencode
|
|
6
|
+
metadata:
|
|
7
|
+
domain: documentation
|
|
8
|
+
formats: mermaid, ascii, plantuml
|
|
9
|
+
artifacts: docs/diagrams/
|
|
10
10
|
---
|
|
11
11
|
|
|
12
|
-
# Diagram
|
|
12
|
+
# Diagram Creation Skill
|
|
13
13
|
|
|
14
|
-
|
|
14
|
+
## Overview
|
|
15
|
+
|
|
16
|
+
Creates clear, informative diagrams for software architecture documentation. Produces diagrams in Mermaid format (renderable in GitHub/GitLab) or ASCII art for universal compatibility.
|
|
15
17
|
|
|
16
18
|
## Core Responsibilities
|
|
17
19
|
|
|
@@ -21,6 +23,58 @@ You are a Technical Diagram Specialist who creates clear, informative diagrams f
|
|
|
21
23
|
4. **Flowcharts** - Process and decision flows
|
|
22
24
|
5. **State Diagrams** - State machines
|
|
23
25
|
|
|
26
|
+
---
|
|
27
|
+
|
|
28
|
+
## When to Use Which Diagram
|
|
29
|
+
|
|
30
|
+
### Decision Guide
|
|
31
|
+
|
|
32
|
+
| Question | Diagram Type |
|
|
33
|
+
|----------|--------------|
|
|
34
|
+
| What systems exist and how they connect? | **C4 Context** |
|
|
35
|
+
| What are the main building blocks (services, DBs)? | **C4 Container** |
|
|
36
|
+
| What's inside a service/module? | **C4 Component** |
|
|
37
|
+
| How do components interact over time? | **Sequence** |
|
|
38
|
+
| What data entities exist and relate? | **ER Diagram** |
|
|
39
|
+
| What are the steps in a process? | **Flowchart** |
|
|
40
|
+
| What states can an entity be in? | **State Diagram** |
|
|
41
|
+
|
|
42
|
+
### By Audience
|
|
43
|
+
|
|
44
|
+
| Audience | Best Diagrams |
|
|
45
|
+
|----------|---------------|
|
|
46
|
+
| **Stakeholders / Business** | C4 Context, high-level Flowchart |
|
|
47
|
+
| **Architects** | C4 Container, C4 Component, ER |
|
|
48
|
+
| **Developers** | Sequence, ER, State, C4 Component |
|
|
49
|
+
| **New team members** | C4 Context → Container → Component (top-down) |
|
|
50
|
+
| **Code reviewers** | Sequence (for specific flow) |
|
|
51
|
+
|
|
52
|
+
### By Project Phase
|
|
53
|
+
|
|
54
|
+
| Phase | Diagrams to Create |
|
|
55
|
+
|-------|-------------------|
|
|
56
|
+
| **Discovery** | C4 Context (rough), ER (draft) |
|
|
57
|
+
| **Architecture** | C4 Container, C4 Component, ER (detailed) |
|
|
58
|
+
| **Development** | Sequence (per feature), State (per entity) |
|
|
59
|
+
| **Documentation** | All of above, refined |
|
|
60
|
+
| **Troubleshooting** | Sequence (problem flow) |
|
|
61
|
+
|
|
62
|
+
### C4 Model Zoom Levels
|
|
63
|
+
|
|
64
|
+
```
|
|
65
|
+
Level 1: CONTEXT — System + external actors
|
|
66
|
+
↓ zoom in
|
|
67
|
+
Level 2: CONTAINER — Services, DBs, queues inside system
|
|
68
|
+
↓ zoom in
|
|
69
|
+
Level 3: COMPONENT — Classes/modules inside a container
|
|
70
|
+
↓ zoom in
|
|
71
|
+
Level 4: CODE — Class diagrams (usually auto-generated)
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
**Rule:** Start at Context, zoom in only as needed. Most projects need L1-L3.
|
|
75
|
+
|
|
76
|
+
---
|
|
77
|
+
|
|
24
78
|
## Diagram Storage
|
|
25
79
|
|
|
26
80
|
All diagrams go in `docs/diagrams/` with clear naming:
|
|
@@ -106,6 +160,86 @@ C4Container
|
|
|
106
160
|
\`\`\`
|
|
107
161
|
```
|
|
108
162
|
|
|
163
|
+
### C4 Component Diagram
|
|
164
|
+
|
|
165
|
+
```markdown
|
|
166
|
+
# [Service Name] Component Diagram
|
|
167
|
+
|
|
168
|
+
## Overview
|
|
169
|
+
Internal structure of [Service Name] container.
|
|
170
|
+
|
|
171
|
+
## Diagram
|
|
172
|
+
|
|
173
|
+
\`\`\`mermaid
|
|
174
|
+
C4Component
|
|
175
|
+
title Component Diagram for [Service Name]
|
|
176
|
+
|
|
177
|
+
Container_Boundary(svc, "[Service Name]") {
|
|
178
|
+
Component(ctrl, "API Controller", "Go", "HTTP handlers")
|
|
179
|
+
Component(usecase, "Use Cases", "Go", "Business logic orchestration")
|
|
180
|
+
Component(domain, "Domain", "Go", "Core business rules")
|
|
181
|
+
Component(repo, "Repository", "Go", "Data access")
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
ContainerDb(db, "Database", "PostgreSQL")
|
|
185
|
+
Container(queue, "Message Queue", "Kafka")
|
|
186
|
+
|
|
187
|
+
Rel(ctrl, usecase, "Calls")
|
|
188
|
+
Rel(usecase, domain, "Uses")
|
|
189
|
+
Rel(usecase, repo, "Persists via")
|
|
190
|
+
Rel(repo, db, "SQL")
|
|
191
|
+
Rel(usecase, queue, "Publishes events")
|
|
192
|
+
\`\`\`
|
|
193
|
+
|
|
194
|
+
## Components
|
|
195
|
+
|
|
196
|
+
| Component | Responsibility | Dependencies |
|
|
197
|
+
|-----------|---------------|--------------|
|
|
198
|
+
| API Controller | HTTP routing, validation | Use Cases |
|
|
199
|
+
| Use Cases | Orchestration, transactions | Domain, Repository |
|
|
200
|
+
| Domain | Business rules, entities | None (pure) |
|
|
201
|
+
| Repository | Data persistence | Database |
|
|
202
|
+
|
|
203
|
+
## Patterns Used
|
|
204
|
+
|
|
205
|
+
- Hexagonal Architecture (Ports & Adapters)
|
|
206
|
+
- Dependency injection
|
|
207
|
+
- Repository pattern
|
|
208
|
+
```
|
|
209
|
+
|
|
210
|
+
### C4 with ASCII (Alternative)
|
|
211
|
+
|
|
212
|
+
When Mermaid C4 not supported, use ASCII:
|
|
213
|
+
|
|
214
|
+
```markdown
|
|
215
|
+
# System Context (ASCII)
|
|
216
|
+
|
|
217
|
+
\`\`\`
|
|
218
|
+
┌─────────────┐
|
|
219
|
+
│ Admin │
|
|
220
|
+
│ (Person) │
|
|
221
|
+
└──────┬──────┘
|
|
222
|
+
│ manages
|
|
223
|
+
▼
|
|
224
|
+
┌─────────────┐ ┌─────────────┐ ┌─────────────┐
|
|
225
|
+
│ Customer │─────────►│ System │─────────►│ Payment │
|
|
226
|
+
│ (Person) │ uses │ │ calls │ Gateway │
|
|
227
|
+
└─────────────┘ └─────────────┘ │ (External) │
|
|
228
|
+
│ └─────────────┘
|
|
229
|
+
│ sends
|
|
230
|
+
▼
|
|
231
|
+
┌─────────────┐
|
|
232
|
+
│ Email │
|
|
233
|
+
│ (External) │
|
|
234
|
+
└─────────────┘
|
|
235
|
+
\`\`\`
|
|
236
|
+
|
|
237
|
+
Legend:
|
|
238
|
+
- Box = System/Person
|
|
239
|
+
- Arrow = Relationship
|
|
240
|
+
- (External) = Outside our control
|
|
241
|
+
```
|
|
242
|
+
|
|
109
243
|
### Sequence Diagram
|
|
110
244
|
|
|
111
245
|
```markdown
|
|
@@ -271,3 +405,243 @@ stateDiagram-v2
|
|
|
271
405
|
3. **Include legend** - Explain symbols/colors
|
|
272
406
|
4. **Version with docs** - Update diagrams when architecture changes
|
|
273
407
|
5. **Cross-reference** - Link diagrams to relevant docs
|
|
408
|
+
|
|
409
|
+
---
|
|
410
|
+
|
|
411
|
+
## Complete Examples
|
|
412
|
+
|
|
413
|
+
### Example 1: E-commerce System (C4 Context → Container)
|
|
414
|
+
|
|
415
|
+
**Context Diagram:**
|
|
416
|
+
|
|
417
|
+
```mermaid
|
|
418
|
+
C4Context
|
|
419
|
+
title E-commerce System Context
|
|
420
|
+
|
|
421
|
+
Person(customer, "Customer", "Browses and buys products")
|
|
422
|
+
Person(admin, "Admin", "Manages catalog and orders")
|
|
423
|
+
|
|
424
|
+
System(ecommerce, "E-commerce Platform", "Allows customers to browse and purchase products")
|
|
425
|
+
|
|
426
|
+
System_Ext(payment, "Payment Provider", "Stripe/PayPal")
|
|
427
|
+
System_Ext(shipping, "Shipping Service", "Calculates rates, tracks packages")
|
|
428
|
+
System_Ext(email, "Email Service", "SendGrid")
|
|
429
|
+
|
|
430
|
+
Rel(customer, ecommerce, "Browses, purchases")
|
|
431
|
+
Rel(admin, ecommerce, "Manages")
|
|
432
|
+
Rel(ecommerce, payment, "Processes payments")
|
|
433
|
+
Rel(ecommerce, shipping, "Gets rates, creates labels")
|
|
434
|
+
Rel(ecommerce, email, "Sends notifications")
|
|
435
|
+
```
|
|
436
|
+
|
|
437
|
+
**Container Diagram:**
|
|
438
|
+
|
|
439
|
+
```mermaid
|
|
440
|
+
C4Container
|
|
441
|
+
title E-commerce Containers
|
|
442
|
+
|
|
443
|
+
Person(customer, "Customer")
|
|
444
|
+
|
|
445
|
+
Container_Boundary(system, "E-commerce Platform") {
|
|
446
|
+
Container(web, "Web App", "React", "Product browsing, checkout")
|
|
447
|
+
Container(api, "API", "Node.js", "REST API")
|
|
448
|
+
Container(catalog, "Catalog Service", "Go", "Products, categories")
|
|
449
|
+
Container(orders, "Orders Service", "Go", "Order processing")
|
|
450
|
+
Container(search, "Search", "Elasticsearch", "Product search")
|
|
451
|
+
ContainerDb(db, "Database", "PostgreSQL", "Products, orders, users")
|
|
452
|
+
ContainerQueue(queue, "Events", "Kafka", "Order events")
|
|
453
|
+
Container(cache, "Cache", "Redis", "Sessions, product cache")
|
|
454
|
+
}
|
|
455
|
+
|
|
456
|
+
Rel(customer, web, "HTTPS")
|
|
457
|
+
Rel(web, api, "REST")
|
|
458
|
+
Rel(api, catalog, "gRPC")
|
|
459
|
+
Rel(api, orders, "gRPC")
|
|
460
|
+
Rel(api, cache, "Gets/sets")
|
|
461
|
+
Rel(catalog, db, "SQL")
|
|
462
|
+
Rel(catalog, search, "Syncs")
|
|
463
|
+
Rel(orders, db, "SQL")
|
|
464
|
+
Rel(orders, queue, "Publishes")
|
|
465
|
+
```
|
|
466
|
+
|
|
467
|
+
### Example 2: Order Processing (Sequence)
|
|
468
|
+
|
|
469
|
+
```mermaid
|
|
470
|
+
sequenceDiagram
|
|
471
|
+
autonumber
|
|
472
|
+
|
|
473
|
+
participant C as Customer
|
|
474
|
+
participant API as API Gateway
|
|
475
|
+
participant O as Order Service
|
|
476
|
+
participant I as Inventory
|
|
477
|
+
participant P as Payment
|
|
478
|
+
participant N as Notifications
|
|
479
|
+
participant DB as Database
|
|
480
|
+
|
|
481
|
+
C->>API: POST /orders
|
|
482
|
+
API->>O: CreateOrder(items)
|
|
483
|
+
|
|
484
|
+
O->>I: ReserveItems(items)
|
|
485
|
+
alt Items available
|
|
486
|
+
I-->>O: Reserved
|
|
487
|
+
O->>DB: SaveOrder(pending)
|
|
488
|
+
|
|
489
|
+
O->>P: ChargePayment(amount)
|
|
490
|
+
alt Payment success
|
|
491
|
+
P-->>O: PaymentConfirmed
|
|
492
|
+
O->>DB: UpdateOrder(confirmed)
|
|
493
|
+
O->>I: CommitReservation
|
|
494
|
+
O->>N: SendConfirmation
|
|
495
|
+
O-->>API: OrderConfirmed
|
|
496
|
+
API-->>C: 201 Created
|
|
497
|
+
else Payment failed
|
|
498
|
+
P-->>O: PaymentFailed
|
|
499
|
+
O->>I: ReleaseReservation
|
|
500
|
+
O->>DB: UpdateOrder(failed)
|
|
501
|
+
O-->>API: PaymentError
|
|
502
|
+
API-->>C: 402 Payment Required
|
|
503
|
+
end
|
|
504
|
+
else Items unavailable
|
|
505
|
+
I-->>O: OutOfStock
|
|
506
|
+
O-->>API: StockError
|
|
507
|
+
API-->>C: 409 Conflict
|
|
508
|
+
end
|
|
509
|
+
```
|
|
510
|
+
|
|
511
|
+
### Example 3: Task Entity (State Diagram)
|
|
512
|
+
|
|
513
|
+
```mermaid
|
|
514
|
+
stateDiagram-v2
|
|
515
|
+
[*] --> Draft: create()
|
|
516
|
+
|
|
517
|
+
Draft --> Open: publish()
|
|
518
|
+
Draft --> [*]: delete()
|
|
519
|
+
|
|
520
|
+
Open --> InProgress: start()
|
|
521
|
+
Open --> Blocked: block()
|
|
522
|
+
Open --> Cancelled: cancel()
|
|
523
|
+
|
|
524
|
+
InProgress --> Open: pause()
|
|
525
|
+
InProgress --> Blocked: block()
|
|
526
|
+
InProgress --> Review: submitForReview()
|
|
527
|
+
|
|
528
|
+
Blocked --> Open: unblock()
|
|
529
|
+
Blocked --> Cancelled: cancel()
|
|
530
|
+
|
|
531
|
+
Review --> InProgress: requestChanges()
|
|
532
|
+
Review --> Done: approve()
|
|
533
|
+
|
|
534
|
+
Done --> [*]
|
|
535
|
+
Cancelled --> [*]
|
|
536
|
+
|
|
537
|
+
note right of Blocked: Waiting for external input
|
|
538
|
+
note right of Review: Requires approval
|
|
539
|
+
```
|
|
540
|
+
|
|
541
|
+
**State Transition Table:**
|
|
542
|
+
|
|
543
|
+
| From | To | Trigger | Conditions |
|
|
544
|
+
|------|-----|---------|------------|
|
|
545
|
+
| Draft | Open | publish() | Has title, assignee |
|
|
546
|
+
| Open | InProgress | start() | Assignee available |
|
|
547
|
+
| InProgress | Review | submitForReview() | All subtasks done |
|
|
548
|
+
| Review | Done | approve() | Reviewer approved |
|
|
549
|
+
| Review | InProgress | requestChanges() | Changes requested |
|
|
550
|
+
| Any | Blocked | block() | External dependency |
|
|
551
|
+
| Blocked | Previous | unblock() | Dependency resolved |
|
|
552
|
+
|
|
553
|
+
### Example 4: User Domain (ER Diagram)
|
|
554
|
+
|
|
555
|
+
```mermaid
|
|
556
|
+
erDiagram
|
|
557
|
+
TENANT ||--o{ USER : has
|
|
558
|
+
USER ||--o{ USER_ROLE : has
|
|
559
|
+
ROLE ||--o{ USER_ROLE : assigned_to
|
|
560
|
+
ROLE ||--o{ ROLE_PERMISSION : has
|
|
561
|
+
PERMISSION ||--o{ ROLE_PERMISSION : granted_to
|
|
562
|
+
USER ||--o{ SESSION : has
|
|
563
|
+
USER ||--o{ AUDIT_LOG : generates
|
|
564
|
+
|
|
565
|
+
TENANT {
|
|
566
|
+
uuid id PK
|
|
567
|
+
string name
|
|
568
|
+
string slug UK
|
|
569
|
+
string plan
|
|
570
|
+
timestamp created_at
|
|
571
|
+
}
|
|
572
|
+
|
|
573
|
+
USER {
|
|
574
|
+
uuid id PK
|
|
575
|
+
uuid tenant_id FK
|
|
576
|
+
string email UK
|
|
577
|
+
string password_hash
|
|
578
|
+
string name
|
|
579
|
+
boolean is_active
|
|
580
|
+
timestamp last_login_at
|
|
581
|
+
timestamp created_at
|
|
582
|
+
}
|
|
583
|
+
|
|
584
|
+
ROLE {
|
|
585
|
+
uuid id PK
|
|
586
|
+
uuid tenant_id FK
|
|
587
|
+
string name
|
|
588
|
+
string description
|
|
589
|
+
boolean is_system
|
|
590
|
+
}
|
|
591
|
+
|
|
592
|
+
USER_ROLE {
|
|
593
|
+
uuid user_id FK
|
|
594
|
+
uuid role_id FK
|
|
595
|
+
}
|
|
596
|
+
|
|
597
|
+
PERMISSION {
|
|
598
|
+
uuid id PK
|
|
599
|
+
string code UK
|
|
600
|
+
string description
|
|
601
|
+
}
|
|
602
|
+
|
|
603
|
+
ROLE_PERMISSION {
|
|
604
|
+
uuid role_id FK
|
|
605
|
+
uuid permission_id FK
|
|
606
|
+
}
|
|
607
|
+
|
|
608
|
+
SESSION {
|
|
609
|
+
uuid id PK
|
|
610
|
+
uuid user_id FK
|
|
611
|
+
string token_hash
|
|
612
|
+
string ip_address
|
|
613
|
+
timestamp expires_at
|
|
614
|
+
timestamp created_at
|
|
615
|
+
}
|
|
616
|
+
|
|
617
|
+
AUDIT_LOG {
|
|
618
|
+
uuid id PK
|
|
619
|
+
uuid user_id FK
|
|
620
|
+
string action
|
|
621
|
+
string resource_type
|
|
622
|
+
uuid resource_id
|
|
623
|
+
jsonb changes
|
|
624
|
+
timestamp created_at
|
|
625
|
+
}
|
|
626
|
+
```
|
|
627
|
+
|
|
628
|
+
---
|
|
629
|
+
|
|
630
|
+
## Common Mistakes
|
|
631
|
+
|
|
632
|
+
| Mistake | Problem | Fix |
|
|
633
|
+
|---------|---------|-----|
|
|
634
|
+
| Too much detail in Context | Overwhelming, loses purpose | Only external systems and actors |
|
|
635
|
+
| Mixing abstraction levels | Confusing, inconsistent | Stick to one C4 level per diagram |
|
|
636
|
+
| No legend | Reader guesses meaning | Always include legend for colors/shapes |
|
|
637
|
+
| Outdated diagrams | Misleading | Update with code changes, review in PRs |
|
|
638
|
+
| Sequence too long | Unreadable | Split into multiple diagrams by scenario |
|
|
639
|
+
| ER with all fields | Cluttered | Show only key fields, document rest separately |
|
|
640
|
+
|
|
641
|
+
---
|
|
642
|
+
|
|
643
|
+
## Related Skills
|
|
644
|
+
|
|
645
|
+
- `architecture-design` - Creates diagrams during design
|
|
646
|
+
- `unit-writing` - Links diagrams from unit docs
|
|
647
|
+
- `adr-writing` - ADRs may include decision diagrams
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: unit-writing
|
|
3
|
-
description:
|
|
3
|
+
description: Use when documenting modules, domains, services, or entities - creating index.md, data-model.md, API specs, or event schemas for architectural components
|
|
4
4
|
license: MIT
|
|
5
5
|
compatibility: opencode
|
|
6
6
|
metadata:
|