@comfanion/workflow 4.38.4-dev.1 → 4.39.0-dev.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.
Files changed (37) hide show
  1. package/package.json +1 -1
  2. package/src/build-info.json +2 -2
  3. package/src/opencode/skills/acceptance-criteria/SKILL.md +58 -176
  4. package/src/opencode/skills/architecture-design/SKILL.md +86 -576
  5. package/src/opencode/skills/archiving/SKILL.md +60 -140
  6. package/src/opencode/skills/coding-standards/SKILL.md +113 -434
  7. package/src/opencode/skills/coding-standards/what-to-document.md +512 -0
  8. package/src/opencode/skills/database-design/SKILL.md +94 -778
  9. package/src/opencode/skills/database-design/indexing.md +187 -0
  10. package/src/opencode/skills/database-design/migrations.md +239 -0
  11. package/src/opencode/skills/database-design/schema-design.md +319 -0
  12. package/src/opencode/skills/doc-todo/SKILL.md +35 -27
  13. package/src/opencode/skills/epic-writing/SKILL.md +156 -244
  14. package/src/opencode/skills/epic-writing/template.md +11 -1
  15. package/src/opencode/skills/methodologies/SKILL.md +91 -354
  16. package/src/opencode/skills/methodologies/define.md +336 -0
  17. package/src/opencode/skills/methodologies/diagnose.md +374 -0
  18. package/src/opencode/skills/methodologies/empathize.md +253 -0
  19. package/src/opencode/skills/methodologies/ideate.md +458 -0
  20. package/src/opencode/skills/prd-writing/SKILL.md +162 -366
  21. package/src/opencode/skills/prd-writing/template.md +178 -48
  22. package/src/opencode/skills/requirements-gathering/SKILL.md +102 -117
  23. package/src/opencode/skills/requirements-gathering/template.md +97 -17
  24. package/src/opencode/skills/sprint-planning/SKILL.md +76 -225
  25. package/src/opencode/skills/sprint-planning/template.yaml +8 -0
  26. package/src/opencode/skills/story-writing/SKILL.md +76 -210
  27. package/src/opencode/skills/story-writing/template.md +10 -1
  28. package/src/opencode/skills/test-design/SKILL.md +78 -84
  29. package/src/opencode/skills/test-design/test-strategy.md +279 -0
  30. package/src/opencode/skills/test-design/unit-tests-mocking.md +247 -0
  31. package/src/opencode/skills/test-design/unit-tests-patterns.md +181 -0
  32. package/src/opencode/skills/test-design/unit-tests.md +117 -0
  33. package/src/opencode/skills/unit-writing/SKILL.md +119 -377
  34. package/src/opencode/skills/module-documentation/SKILL.md +0 -224
  35. package/src/opencode/skills/module-documentation/template.md +0 -139
  36. /package/src/opencode/skills/test-design/{template-integration.md → templates/template-integration.md} +0 -0
  37. /package/src/opencode/skills/test-design/{template-module.md → templates/template-module.md} +0 -0
@@ -1,394 +1,136 @@
1
1
  ---
2
2
  name: unit-writing
3
- description: Use when documenting modules, domains, services, or entities - creating index.md, data-model.md, API specs, or event schemas for architectural components
3
+ description: Document architectural units (modules, domains, services, entities) with index.md, data-model.md, API specifications, and event schemas. Use when documenting modules, creating unit docs, defining service contracts, or when user mentions "module documentation", "domain docs", "service spec", "API contract", "event schema", or "unit index".
4
4
  license: MIT
5
5
  compatibility: opencode
6
6
  metadata:
7
- domain: documentation
8
- artifacts: docs/architecture/{modules,services,domains}/
7
+ domain: software-architecture
8
+ artifacts: docs/units/*/
9
9
  ---
10
10
 
11
11
  # Unit Writing Skill
12
12
 
13
- ## Overview
14
-
15
- Documentation follows a **folder-based structure** organized by type: modules, services, domains. Agent determines the appropriate type based on what is being documented.
16
-
17
- **Core Principles:**
18
- - Each file focuses on one concern
19
- - Files stay under 500 lines (RAG-friendly)
20
- - Agent decides the type no rigid rules
21
-
22
- ## When to Use
23
-
24
- Use this skill to document any logical piece of the system:
25
-
26
- | Type | When to Use | Example |
27
- |------|-------------|---------|
28
- | `module` | Deployable bounded context, largest scope | `catalog`, `auth`, `billing` |
29
- | `domain` | Business concept grouping within module | `Order`, `Payment`, `Identity` |
30
- | `service` | Stateless component with clear API | `NotificationService`, `CorrelationEngine` |
31
- | `entity` | Core data object with business rules | `User`, `Product`, `Invoice` |
32
- | `feature` | Cross-cutting capability | `Search`, `Import`, `Export` |
33
-
34
- ### Hierarchy
35
-
36
- Components can be nested when logical:
37
-
38
- | Parent | Can contain |
39
- |--------|-------------|
40
- | `module` | services, domains |
41
- | `service` | domains, entities |
42
- | `domain` | entities |
43
- | `entity` | — (leaf node) |
44
-
45
- Agent decides based on project context — no strict rules.
46
-
47
- ### Documentation Depth by Type
48
-
49
- | Type | Location | Required Files | Optional |
50
- |------|----------|----------------|----------|
51
- | `module` | `modules/{name}/` | index, data-model | api/, events/, services/, domains/ |
52
- | `service` | `services/{name}/` OR `modules/{m}/services/{name}/` | index | api/, data-model |
53
- | `domain` | `domains/{name}/` OR inside module/service | index, data-model | entities/ |
54
- | `entity` | inside domain | {entity}.md | — |
55
-
56
- **When to use separate folder vs inline:**
57
- - **Separate folder** — has own API, events, or multiple child units
58
- - **Single file** — simple entity, no children, < 200 lines
59
-
60
- **Don't create units for:**
61
- - Simple value objects (document inline in parent)
62
- - Internal implementation details
63
- - DTOs, request/response objects
64
-
65
- ---
66
-
67
- ## Folder Structure
68
-
69
- Documentation organized under `docs/architecture/`:
70
-
71
- ```
72
- docs/architecture/
73
- ├── modules/ # Bounded contexts
74
- │ └── {module}/
75
- │ ├── index.md
76
- │ ├── data-model.md
77
- │ ├── api/
78
- │ ├── events/
79
- │ ├── services/ # Services INSIDE module
80
- │ │ └── {service}/
81
- │ └── domains/ # Domains INSIDE module
82
- │ └── {domain}/
83
-
84
- ├── services/ # Standalone services (outside modules)
85
- │ └── {service}/
86
- │ ├── index.md
87
- │ └── api/
88
-
89
- └── domains/ # Standalone domains (rare)
90
- └── {domain}/
91
- ```
92
-
93
- ### Placement rules
94
-
95
- | Component | Standalone | Inside module |
96
- |-----------|------------|---------------|
97
- | service | `services/{name}/` | `modules/{m}/services/{name}/` |
98
- | domain | `domains/{name}/` | `modules/{m}/domains/{name}/` |
99
- | entity | — | always inside domain |
100
-
101
- Agent decides based on:
102
- - **Standalone service** — independent, used by multiple modules
103
- - **Service inside module** — belongs to one bounded context
104
-
105
- ### File Purposes
106
-
107
- | File | Purpose | Max Lines |
108
- |------|---------|-----------|
109
- | `index.md` | Overview, boundaries, navigation, key decisions | ~150 |
110
- | `data-model.md` | Database schema, relations, constraints, migrations | ~400 |
111
- | `api/*.yaml` | OpenAPI specs for each resource | ~300 each |
112
- | `events/index.md` | Event flow overview, topic mapping | ~200 |
113
- | `events/*.avsc` | Individual event schemas | ~100 each |
114
-
115
- ---
116
-
117
- ## Required Files
118
-
119
- ### 1. index.md (Overview)
120
-
121
- The main entry point for the unit. Contains:
122
- - Unit metadata (YAML frontmatter)
123
- - Overview paragraph
124
- - Boundaries table (owns/uses/provides)
125
- - Architecture diagram
126
- - Document navigation
127
- - Key decisions/ADRs
128
-
129
- **Template:** See `@.opencode/skills/unit-writing/templates/index.md`
130
-
131
- ```yaml
132
- # index.md frontmatter
133
- ---
134
- id: MOD-COLLABORATION
135
- type: module
136
- status: draft | approved
137
- version: "1.0"
138
- created: 2026-01-24
139
- ---
140
- ```
141
-
142
- **Boundaries Table Format:**
143
-
144
- | Aspect | Details |
145
- |--------|---------|
146
- | **Owns** | meetings, channels, focus_blocks (tables + behavior) |
147
- | **Uses** | → Unit: `identity` (contributor resolution) |
148
- | **Uses** | → Unit: `teams` (team attribution) |
149
- | **Provides** | Collaboration metrics API, Team health signals |
150
-
151
- ### 2. data-model.md (Database Schema)
152
-
153
- Complete database schema documentation:
154
- - Entity Relationship Diagram (ASCII/Mermaid)
155
- - Table definitions (SQL or structured tables)
156
- - Indexes and constraints
157
- - Migration strategy (if applicable)
158
-
159
- **Structure:**
160
- 1. Overview (design principles)
161
- 2. ERD diagram
162
- 3. Core tables (with full SQL or field tables)
163
- 4. Supporting tables
164
- 5. Indexes
165
- 6. Views/Aggregates (if any)
166
- 7. Migration notes
167
-
168
- **Example header:**
169
- ```markdown
170
- # Collaboration Data Model
171
-
172
- **Version:** 1.0
173
- **Date:** 2026-01-24
174
- **Status:** Active
175
-
176
- ## 1. Design Principles
177
-
178
- | Principle | Description |
179
- |-----------|-------------|
180
- | **Single Source of Truth** | PostgreSQL primary, Redis for cache |
181
- | **SCD2 History** | Time-scoped team membership |
182
- ```
183
-
184
- ### 3. events/index.md (Events Overview)
185
-
186
- Overview of all events the unit produces/consumes:
187
- - Event flow diagram
188
- - Topic naming convention
189
- - Event types table
190
- - Schema file references
191
-
192
- **Structure:**
193
- ```markdown
194
- # {Unit} Events
195
-
196
- ## Overview
197
- Brief description of event-driven patterns.
198
-
199
- ## Event Flow
200
- ASCII/Mermaid diagram showing producers/consumers.
201
-
202
- ## Topics
203
-
204
- | Topic | Events | Partition Key | Direction |
205
- |-------|--------|---------------|-----------|
206
- | `events.teams.canonical` | meeting_* | tenant_id | inbound |
207
-
208
- ## Schema Files
209
-
210
- | Schema | Description |
211
- |--------|-------------|
212
- | `meeting-scheduled.avsc` | New meeting created |
213
- ```
214
-
215
- ### 4. api/*.yaml (OpenAPI Specs)
216
-
217
- One OpenAPI file per resource or logical grouping:
218
- - `meetings.yaml` - Meeting endpoints
219
- - `focus-time.yaml` - Focus time endpoints
220
- - `graph.yaml` - Collaboration graph endpoints
221
-
222
- Follow OpenAPI 3.1 format.
223
-
224
- ---
225
-
226
- ## Naming Conventions
227
-
228
- ### Folder Names
229
-
230
- ```
231
- kebab-case, lowercase
232
-
233
- Examples:
234
- - modules/billing/
235
- - services/notification/
236
- - domains/subscription/
237
- ```
238
-
239
- ### File Names
240
-
241
- ```
242
- index.md # Entry point (always)
243
- data-model.md # Database schema
244
- {resource}.yaml # API specs by resource
245
- {event-type}.avsc # Event schemas by type
13
+ ```xml
14
+ <unit_writing>
15
+ <definition>Document modules, domains, services, entities with folder-based structure</definition>
16
+
17
+ <principles>
18
+ <focus>One concern per file</focus>
19
+ <size>Under 500 lines (RAG-friendly)</size>
20
+ <flexibility>Agent decides type, no rigid rules</flexibility>
21
+ </principles>
22
+
23
+ <types>
24
+ <module use="Bounded context, largest scope" example="catalog, auth, billing"/>
25
+ <domain use="Business concept grouping" example="Order, Payment, Identity"/>
26
+ <service use="Stateless with clear API" example="NotificationService"/>
27
+ <entity use="Core data object" example="User, Product, Invoice"/>
28
+ <feature use="Cross-cutting capability" example="Search, Import"/>
29
+ </types>
30
+
31
+ <hierarchy>
32
+ <module>Can contain: services, domains</module>
33
+ <service>Can contain: domains, entities</service>
34
+ <domain>Can contain: entities</domain>
35
+ <entity>Leaf node</entity>
36
+ </hierarchy>
37
+
38
+ <depth>
39
+ <module location="modules/{name}/" required="index, data-model" optional="api/, events/, services/, domains/"/>
40
+ <service location="services/{name}/" required="index" optional="api/, data-model"/>
41
+ <domain location="domains/{name}/" required="index, data-model" optional="entities/"/>
42
+ <entity location="inside domain" required="{entity}.md"/>
43
+ </depth>
44
+
45
+ <when_separate_folder>Has own API, events, or multiple children</when_separate_folder>
46
+ <when_single_file>Simple entity, no children, &lt;200 lines</when_single_file>
47
+
48
+ <dont_create_for>Value objects, DTOs, internal implementation details</dont_create_for>
49
+
50
+ <folder_structure>
51
+ <root>docs/architecture/</root>
52
+ <modules>modules/{name}/ - Bounded contexts</modules>
53
+ <services_standalone>services/{name}/ - Independent services</services_standalone>
54
+ <services_inside>modules/{m}/services/{name}/ - Module-specific</services_inside>
55
+ <domains_standalone>domains/{name}/ - Rare</domains_standalone>
56
+ <domains_inside>modules/{m}/domains/{name}/ - Inside module</domains_inside>
57
+ <entities>Always inside domain</entities>
58
+ </folder_structure>
59
+
60
+ <files>
61
+ <index max_lines="150">Overview, boundaries, navigation, decisions</index>
62
+ <data_model max_lines="400">DB schema, relations, constraints, migrations</data_model>
63
+ <api max_lines="300">OpenAPI specs per resource</api>
64
+ <events_index max_lines="200">Event flow, topic mapping</events_index>
65
+ <event_schema max_lines="100">Individual event schemas (.avsc)</event_schema>
66
+ </files>
67
+
68
+ <index_md>
69
+ <frontmatter>id, type, status, version, created</frontmatter>
70
+ <overview>Single responsibility paragraph</overview>
71
+ <boundaries>Table: Owns | Uses | Provides</boundaries>
72
+ <diagram>Architecture diagram (if complex)</diagram>
73
+ <navigation>Links to other files</navigation>
74
+ <decisions>Key ADRs</decisions>
75
+ </index_md>
76
+
77
+ <data_model_md>
78
+ <erd>Entity Relationship Diagram (ASCII/Mermaid)</erd>
79
+ <tables>Full SQL or field tables</tables>
80
+ <indexes>Constraints and indexes</indexes>
81
+ <migrations>Migration strategy</migrations>
82
+ </data_model_md>
83
+
84
+ <events>
85
+ <index>Event flow, topic mapping, schema references</index>
86
+ <schemas>Individual .avsc files per event type</schemas>
87
+ </events>
88
+
89
+ <api>
90
+ <format>OpenAPI 3.1</format>
91
+ <organization>One file per resource</organization>
92
+ </api>
93
+
94
+ <naming>
95
+ <folders>kebab-case, lowercase (modules/billing/)</folders>
96
+ <files>index.md, data-model.md, {resource}.yaml, {event-type}.avsc</files>
97
+ </naming>
98
+
99
+ <reference_format>
100
+ <relative>[identity](../domains/identity/)</relative>
101
+ <shorthand>→ modules/billing</shorthand>
102
+ </reference_format>
103
+
104
+ <workflow>
105
+ <step1>Determine type (module/service/domain/entity)</step1>
106
+ <step2>Create folder: docs/architecture/{type}/{name}</step2>
107
+ <step3>Start with index.md (overview, boundaries, diagram)</step3>
108
+ <step4>Add supporting files (data-model, api, events)</step4>
109
+ </workflow>
110
+ </unit_writing>
246
111
  ```
247
112
 
248
113
  ---
249
114
 
250
- ## Reference Format
251
-
252
- Reference other components with relative paths:
253
-
254
- ```markdown
255
- | Uses | [identity](../domains/identity/) (contributor resolution) |
256
- | Uses | [teams](../modules/teams/) (team attribution) |
257
- ```
258
-
259
- Or with `→` shorthand:
260
- ```markdown
261
- → modules/billing
262
- → services/notification
263
- → domains/subscription/data-model.md#plans
264
- ```
265
-
266
- ---
267
-
268
- ## Creating Documentation
269
-
270
- ### Step 1: Determine type
271
-
272
- Agent analyzes what is being documented:
273
- - Has own deployment/bounded context? → `modules/`
274
- - Stateless with clear API? → `services/`
275
- - Business logic grouping? → `domains/`
276
-
277
- ### Step 2: Create folder
278
-
279
- ```bash
280
- mkdir -p docs/architecture/{type}/{name}
281
- ```
282
-
283
- ### Step 3: Start with index.md
284
-
285
- Create `index.md` with:
286
- 1. Overview paragraph
287
- 2. Boundaries table (owns/uses/provides)
288
- 3. Architecture diagram (if complex)
289
- 4. Navigation to other files
290
-
291
- ### Step 4: Add supporting files as needed
292
-
293
- - `data-model.md` — if has database
294
- - `api/*.yaml` — if has REST/gRPC API
295
- - `events/` — if event-driven
296
- - `entities/*.md` — for leaf entities
297
-
298
- ---
299
-
300
- ## Validation Checklist
301
-
302
- ### index.md
303
- - [ ] Has YAML frontmatter (id, type, status, version)
304
- - [ ] Overview explains single responsibility
305
- - [ ] Boundaries table complete (owns/uses/provides)
306
- - [ ] Architecture diagram present
307
- - [ ] Navigation links to other files
308
- - [ ] References to related units
309
-
310
- ### data-model.md
311
- - [ ] ERD diagram present
312
- - [ ] All tables documented
313
- - [ ] Constraints and indexes listed
314
- - [ ] Follows project DB conventions
315
-
316
- ### events/
317
- - [ ] index.md with topic mapping
318
- - [ ] Individual schema files for each event
319
- - [ ] Event flow diagram
320
-
321
- ### api/
322
- - [ ] OpenAPI 3.1 format
323
- - [ ] Consistent naming
324
- - [ ] Request/response examples
325
-
326
- ---
327
-
328
- ## Example
115
+ ## Example: Billing Module
329
116
 
330
117
  ```
331
118
  docs/architecture/
332
- ├── modules/
333
- └── billing/ # Module
334
- │ ├── index.md
335
- │ ├── data-model.md
336
- │ ├── services/
337
- │ │ └── payment-gateway/ # Service INSIDE module
338
- │ │ ├── index.md
339
- │ │ └── api/
340
- │ └── domains/
341
- │ └── subscription/ # Domain INSIDE module
342
- │ ├── index.md
343
- │ └── entities/
344
- │ └── plan.md
345
-
346
- └── services/
347
- └── notification/ # Standalone service
119
+ └── modules/
120
+ └── billing/
348
121
  ├── index.md
349
- └── api/
350
- ```
351
-
352
- **Key patterns:**
353
- 1. `payment-gateway` is inside `billing` — it belongs to that module
354
- 2. `notification` is standalone — used by multiple modules
355
- 3. Each component has `index.md` as entry point
356
- 4. Entities are leaf nodes (single files inside domain)
357
-
358
- ---
359
-
360
- ## Anti-Patterns
361
-
362
- ❌ **DON'T:**
363
- - Create 500+ line monolithic files
364
- - Mix data model with API with events in one file
365
- - Embed full SQL schemas in index.md
366
- - Force everything into rigid structure
367
-
368
- ✅ **DO:**
369
- - Keep files focused and under 500 lines
370
- - Separate concerns (data model, API, events)
371
- - Let agent decide appropriate structure
372
- - Use relative paths for references
373
-
374
- ---
375
-
376
- ## Output
377
-
378
- ```
379
- docs/architecture/
380
- ├── modules/{name}/ # Bounded contexts
381
- │ ├── services/{name}/ # Services inside module
382
- │ └── domains/{name}/ # Domains inside module
383
- ├── services/{name}/ # Standalone services
384
- └── domains/{name}/ # Standalone domains
385
- ```
386
-
387
- Agent decides placement based on component relationships.
388
-
389
- ## Related Skills
390
-
391
- - `architecture-design` - Creates units during architecture phase
392
- - `story-writing` - Tasks reference units
393
- - `epic-writing` - Epics affect units
394
- - `adr-writing` - ADRs may be linked from unit index
122
+ ├── data-model.md
123
+ ├── api/
124
+ │ └── subscriptions.yaml
125
+ ├── services/
126
+ │ └── payment-gateway/
127
+ │ ├── index.md
128
+ │ └── api/
129
+ └── domains/
130
+ └── subscription/
131
+ ├── index.md
132
+ └── entities/
133
+ └── plan.md
134
+ ```
135
+
136
+ See `templates/` for full format.