@comfanion/workflow 4.1.2 → 4.3.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 (46) hide show
  1. package/README.md +1 -2
  2. package/bin/cli.js +2 -4
  3. package/package.json +1 -1
  4. package/src/build-info.json +1 -1
  5. package/src/opencode/ARCHITECTURE.md +7 -6
  6. package/src/opencode/FLOW.yaml +10 -10
  7. package/src/opencode/agents/coder.md +82 -0
  8. package/src/opencode/agents/dev.md +10 -0
  9. package/src/opencode/commands/architecture.md +1 -1
  10. package/src/opencode/commands/prd.md +1 -1
  11. package/src/opencode/config.yaml +1 -1
  12. package/src/opencode/skills/adr-writing/SKILL.md +122 -159
  13. package/src/opencode/skills/adr-writing/template.md +130 -0
  14. package/src/opencode/skills/architecture-design/SKILL.md +113 -107
  15. package/src/opencode/skills/architecture-design/template.md +212 -0
  16. package/src/opencode/skills/architecture-validation/SKILL.md +1 -1
  17. package/src/opencode/skills/changelog/template.md +23 -0
  18. package/src/opencode/skills/epic-writing/SKILL.md +116 -264
  19. package/src/opencode/skills/epic-writing/template.md +119 -0
  20. package/src/opencode/skills/prd-validation/SKILL.md +1 -1
  21. package/src/opencode/skills/prd-writing/SKILL.md +79 -43
  22. package/src/opencode/skills/prd-writing/template.md +147 -0
  23. package/src/opencode/skills/requirements-gathering/SKILL.md +128 -78
  24. package/src/opencode/skills/requirements-gathering/template.md +156 -0
  25. package/src/opencode/skills/story-writing/SKILL.md +106 -464
  26. package/src/opencode/skills/story-writing/template.md +214 -0
  27. package/src/opencode/skills/unit-writing/SKILL.md +185 -0
  28. package/src/opencode/skills/unit-writing/template.md +136 -0
  29. package/src/repo-structure/docs/README.md +5 -5
  30. package/src/repo-structure/docs/requirements/README.md +1 -1
  31. package/src/opencode/templates/CHANGELOG.md +0 -82
  32. package/src/opencode/templates/adr-template.md +0 -115
  33. package/src/opencode/templates/architecture-template.md +0 -362
  34. package/src/opencode/templates/epic-template.md +0 -166
  35. package/src/opencode/templates/prd-template.md +0 -479
  36. package/src/opencode/templates/requirements-template.md +0 -132
  37. package/src/opencode/templates/story-template.md +0 -182
  38. /package/src/opencode/{templates/prd-acceptance-criteria-template.md → skills/acceptance-criteria/template.md} +0 -0
  39. /package/src/opencode/{templates/change-proposal-template.md → skills/archiving/template-change-proposal.md} +0 -0
  40. /package/src/opencode/{templates/git-workflow-template.md → skills/coding-standards/template-git.md} +0 -0
  41. /package/src/opencode/{templates/testing-standards-template.md → skills/coding-standards/template-testing.md} +0 -0
  42. /package/src/opencode/{templates/jira-cache-template.yaml → skills/jira-integration/template-cache.yaml} +0 -0
  43. /package/src/opencode/{templates/module-index-template.md → skills/module-documentation/template.md} +0 -0
  44. /package/src/opencode/{templates/sprint-status-template.yaml → skills/sprint-planning/template.yaml} +0 -0
  45. /package/src/opencode/{templates/integration-tests-template.md → skills/test-design/template-integration.md} +0 -0
  46. /package/src/opencode/{templates/module-test-cases-template.md → skills/test-design/template-module.md} +0 -0
@@ -0,0 +1,130 @@
1
+ # ADR-{{N}}: {{title}}
2
+
3
+ ```yaml
4
+ id: ADR-{{N}}
5
+ status: proposed | accepted | deprecated | superseded
6
+ date: {{date}}
7
+ deciders: [{{names}}]
8
+ supersedes: ADR-{{X}} # if applicable
9
+ ```
10
+
11
+ ---
12
+
13
+ ## Context
14
+
15
+ {{describe_the_situation_and_problem}}
16
+
17
+ We need to decide {{what_decision_is_needed}} because {{why_decision_is_needed_now}}.
18
+
19
+ **Forces:**
20
+ - {{force_1}} — {{tension_it_creates}}
21
+ - {{force_2}} — {{tension_it_creates}}
22
+
23
+ **Constraints:**
24
+ - {{constraint}}
25
+
26
+ <!-- e.g.
27
+ We need to choose the primary database for the Task module. The decision affects data modeling, query patterns, and operational complexity.
28
+
29
+ We need to decide now because development starts next sprint and database choice impacts schema design.
30
+
31
+ **Forces:**
32
+ - Need ACID transactions for task assignments — pushes toward relational DB
33
+ - May need flexible attributes later — pushes toward document DB
34
+ - Team expertise is primarily SQL — reduces risk with familiar tech
35
+
36
+ **Constraints:**
37
+ - Must run on existing Kubernetes cluster
38
+ - Budget limits exclude managed services over $500/month
39
+ -->
40
+
41
+ ---
42
+
43
+ ## Decision
44
+
45
+ **We will {{chosen_approach}}.**
46
+
47
+ {{brief_explanation_of_what_this_means_in_practice}}
48
+
49
+ ---
50
+
51
+ ## Options Considered
52
+
53
+ ### Option 1: {{name}}
54
+
55
+ {{brief_description}}
56
+
57
+ | Pros | Cons |
58
+ |------|------|
59
+ | {{pro}} | {{con}} |
60
+ | {{pro}} | {{con}} |
61
+
62
+ ### Option 2: {{name}}
63
+
64
+ {{brief_description}}
65
+
66
+ | Pros | Cons |
67
+ |------|------|
68
+ | {{pro}} | {{con}} |
69
+
70
+ ### Option 3: {{name}} ✓ CHOSEN
71
+
72
+ {{brief_description}}
73
+
74
+ | Pros | Cons |
75
+ |------|------|
76
+ | {{pro}} | {{con}} |
77
+
78
+ **Why chosen:** {{rationale}}
79
+
80
+ <!-- e.g.
81
+ ### Option 1: MongoDB
82
+
83
+ Document database with flexible schema.
84
+
85
+ | Pros | Cons |
86
+ |------|------|
87
+ | Flexible schema | No ACID across documents |
88
+ | Good for nested data | Team unfamiliar |
89
+
90
+ ### Option 2: PostgreSQL ✓ CHOSEN
91
+
92
+ Relational database with JSON support.
93
+
94
+ | Pros | Cons |
95
+ |------|------|
96
+ | ACID transactions | Schema migrations needed |
97
+ | Team expertise | Less flexible than document DB |
98
+ | JSON columns for flexibility | |
99
+
100
+ **Why chosen:** ACID transactions critical for task assignments. Team expertise reduces risk. JSON columns provide flexibility where needed.
101
+ -->
102
+
103
+ ---
104
+
105
+ ## Consequences
106
+
107
+ ### Positive
108
+ - {{benefit}}
109
+ - {{benefit}}
110
+
111
+ ### Negative
112
+ - {{drawback}}
113
+ - {{mitigation_if_any}}
114
+
115
+ ### Risks
116
+ - {{risk}} — mitigated by {{approach}}
117
+
118
+ ---
119
+
120
+ ## Implementation Notes
121
+
122
+ {{any_specific_guidance_for_implementation}}
123
+
124
+ ---
125
+
126
+ ## References
127
+
128
+ → Architecture: `{{path}}`
129
+ → Related ADR: → ADR: `ADR-{{X}}`
130
+ → Affected Units: → Unit: `{{unit}}`
@@ -26,11 +26,107 @@ Always check project standards: `@CLAUDE.md`
26
26
 
27
27
  ## Template
28
28
 
29
- Use template at: `@.opencode/templates/architecture-template.md`
29
+ Use template at: `@.opencode/skills/architecture-design/template.md`
30
+
31
+ ## Architecture Document Structure (v2)
32
+
33
+ ### 1. Executive Summary
34
+
35
+ Brief prose with:
36
+ - What the system is
37
+ - Architecture pattern + why chosen
38
+ - Key domains with module counts
39
+ - Critical business rules
40
+ - Scale targets
41
+
42
+ ### 2. Decision Summary
43
+
44
+ | Category | Decision | Rationale |
45
+ |----------|----------|-----------|
46
+ | Architecture | Hexagonal | Organizational standard |
47
+ | Database | PostgreSQL per module | Service isolation |
48
+
49
+ ### 3. System Context
50
+
51
+ ASCII diagram showing:
52
+ - External systems
53
+ - Main system boundary
54
+ - Internal modules
55
+ - Storage layer
56
+
57
+ ### 4. Modules Overview
58
+
59
+ For each domain, then each module:
60
+
61
+ ```markdown
62
+ ### {{Domain}} ({{N}} modules)
63
+
64
+ #### {{Module}}
65
+
66
+ **Purpose:** {{single_responsibility}}
67
+
68
+ **Internal Services:**
69
+
70
+ | Service | Responsibilities | Storage |
71
+ |---------|-----------------|---------|
72
+
73
+ **Database Schema:**
74
+ ```
75
+ table_name # field descriptions
76
+ ```
77
+
78
+ **Events:**
79
+ - **Produces:** Event1, Event2
80
+ - **Consumes:** Event3
81
+
82
+ **Notes:**
83
+ - Important details
84
+ ```
85
+
86
+ ### 5. Data Architecture
87
+
88
+ | Module | Primary DB | Cache | Other |
89
+ |--------|-----------|-------|-------|
90
+
91
+ With entity relations diagram.
92
+
93
+ ### 6. Integration
94
+
95
+ External systems table + internal communication table.
96
+
97
+ ### 7. Cross-Cutting Concerns
98
+
99
+ - Security (AuthN, AuthZ)
100
+ - Observability (Logging, Metrics, Tracing)
101
+ - Error Handling table
102
+
103
+ ### 8. NFR Compliance
104
+
105
+ | NFR | Requirement | How Addressed |
106
+ |-----|-------------|---------------|
107
+
108
+ ### 9. References
109
+
110
+ ```
111
+ → PRD: `docs/prd.md`
112
+ → ADRs: `docs/architecture/adr/`
113
+ ```
114
+
115
+ ## Unit Documentation
116
+
117
+ For each module/domain/entity, create separate Unit document.
118
+
119
+ Use: `@.opencode/skills/unit-writing/template.md`
120
+
121
+ Reference in architecture:
122
+ ```
123
+ → Unit: `catalog`
124
+ → Unit: `Task`
125
+ ```
30
126
 
31
127
  ## Architecture Principles
32
128
 
33
- ### 1. Hexagonal Architecture (Ports & Adapters)
129
+ ### Hexagonal Architecture
34
130
 
35
131
  ```
36
132
  ┌─────────────────────────────────────────────────────┐
@@ -47,33 +143,9 @@ Use template at: `@.opencode/templates/architecture-template.md`
47
143
  └─────────────────────────────────────────────────────┘
48
144
 
49
145
  Dependency Direction: Infrastructure → Application → Domain
50
- (NEVER reverse!)
51
146
  ```
52
147
 
53
- ### 2. Module Structure
54
-
55
- ```
56
- module/
57
- ├── domain/ # Business logic ONLY
58
- │ ├── aggregate/ # Entities with business rules
59
- │ ├── valueobject/ # Immutable value objects
60
- │ ├── service/ # Domain services
61
- │ ├── repository/ # Repository INTERFACES (ports)
62
- │ └── event/ # Domain events
63
- ├── application/ # Use cases
64
- │ └── usecase/
65
- │ └── CreateEntity/
66
- │ ├── inport.go # Interface
67
- │ ├── dto.go # Command & Result
68
- │ ├── handler.go # Orchestration
69
- │ └── mappers.go # Explicit mapping
70
- └── infrastructure/ # Adapters
71
- ├── repo/ # DB implementations
72
- ├── http/ # HTTP handlers
73
- └── kafka/ # Event publishers
74
- ```
75
-
76
- ### 3. Module Boundaries
148
+ ### Module Boundaries
77
149
 
78
150
  Each module must have:
79
151
  - **Single responsibility** - One business capability
@@ -81,75 +153,17 @@ Each module must have:
81
153
  - **Defined interfaces** - API contracts for communication
82
154
  - **No cross-module imports** - Communicate via Kafka/HTTP only
83
155
 
84
- ## Design Process
85
-
86
- ### Step 1: Identify Bounded Contexts
87
-
88
- From PRD, identify:
89
- 1. Major business capabilities
90
- 2. Data ownership boundaries
91
- 3. Team boundaries (Conway's Law)
92
-
93
- ### Step 2: Define Module Contracts
94
-
95
- For each module:
96
- ```yaml
97
- module: catalog
98
- responsibility: Product and category management
99
- owns:
100
- - Product
101
- - Category
102
- - Attribute
103
- consumes:
104
- - merchant.created (from Merchant module)
105
- produces:
106
- - product.created
107
- - product.updated
108
- - category.created
109
- api:
110
- - POST /api/v1/products
111
- - GET /api/v1/products/{id}
112
- - GET /api/v1/categories
113
- ```
156
+ ### Reference Format
114
157
 
115
- ### Step 3: Design Data Model
116
-
117
- For each owned entity:
118
- - Primary key strategy (UUID recommended)
119
- - Required fields
120
- - Indexes (for query patterns)
121
- - Relationships
122
- - Audit fields (created_at, updated_at, version)
123
-
124
- ### Step 4: Design Events
125
-
126
- For state changes:
127
- ```yaml
128
- event: product.created
129
- version: "1.0"
130
- payload:
131
- product_id: uuid
132
- merchant_id: uuid
133
- name: string
134
- created_at: timestamp
158
+ Always use `→` prefix:
159
+ ```
160
+ Unit: `catalog`
161
+ FR: `FR-001`
162
+ ADR: `ADR-001`
163
+ PRD: `docs/prd.md`
135
164
  ```
136
165
 
137
- ### Step 5: Document Decisions (ADRs)
138
-
139
- Use skill: `adr-writing`
140
-
141
- ## NFR Mapping
142
-
143
- Map each NFR to architectural solution:
144
-
145
- | NFR | Architectural Support |
146
- |-----|----------------------|
147
- | Response < 200ms | Caching (Redis), connection pooling |
148
- | 99.9% availability | K8s HA, health checks, circuit breakers |
149
- | 1000 RPS | Horizontal scaling, async processing |
150
- | Data security | TLS, encryption at rest, audit logs |
151
-
152
- ## Architecture Checklist
166
+ ## Validation Checklist
153
167
 
154
168
  Before completing:
155
169
  - [ ] All PRD functional areas have architectural home
@@ -159,25 +173,17 @@ Before completing:
159
173
  - [ ] No circular dependencies between modules
160
174
  - [ ] Integration points are well-defined
161
175
  - [ ] ADRs exist for major decisions
162
- - [ ] Aligns with CLAUDE.md patterns
163
- - [ ] Diagrams included (context, container, component)
164
-
165
- ## Anti-patterns to Avoid
166
-
167
- 1. **Distributed monolith** - Modules that must deploy together
168
- 2. **Shared database** - Multiple modules accessing same tables
169
- 3. **Circular dependencies** - Module A depends on B depends on A
170
- 4. **God module** - One module doing everything
171
- 5. **Anemic domain** - Business logic in services, not entities
176
+ - [ ] Uses `→` reference format
177
+ - [ ] Unit docs created for key modules
172
178
 
173
179
  ## Output
174
180
 
175
- Save to: `docs/architecture.md`
181
+ - Main: `docs/architecture.md`
182
+ - Units: `docs/architecture/units/` or inline
183
+ - ADRs: `docs/architecture/adr/`
176
184
 
177
185
  ## Related Skills
178
186
 
179
187
  - `adr-writing` - For architecture decisions
180
- - `data-modeling` - For database design
181
- - `api-design` - For REST API contracts
182
- - `event-design` - For Kafka event schemas
188
+ - `unit-writing` - For module/entity documentation
183
189
  - `architecture-validation` - For validation
@@ -0,0 +1,212 @@
1
+ # {{project}} — Architecture
2
+
3
+ ```yaml
4
+ id: ARCH-001
5
+ version: 1.0
6
+ status: draft | approved
7
+ date: {{date}}
8
+ author: {{author}}
9
+ ```
10
+
11
+ ---
12
+
13
+ ## Executive Summary
14
+
15
+ {{project}} is a {{type}} for {{purpose}}. The system handles {{core_capabilities}}.
16
+
17
+ **Architecture Pattern:** {{pattern}} — {{why_this_pattern}}
18
+
19
+ **Key Domains:**
20
+ 1. **{{domain_1}}** ({{modules_count}} modules) — {{description}}
21
+ 2. **{{domain_2}}** ({{modules_count}} modules) — {{description}}
22
+
23
+ **Critical Business Rules:**
24
+ - {{rule_1}}
25
+ - {{rule_2}}
26
+
27
+ **Scale:**
28
+ - **MVP:** {{scale}}
29
+ - **Growth:** {{scale}}
30
+
31
+ <!-- e.g.
32
+ TaskFlow is a task management platform for distributed teams.
33
+
34
+ **Architecture Pattern:** Modular Monolith with Hexagonal Architecture — enables independent scaling while keeping deployment simple
35
+
36
+ **Key Domains:**
37
+ 1. **Task Domain** (2 modules) — Task CRUD, assignments, status workflow
38
+ 2. **Team Domain** (2 modules) — Users, roles, permissions
39
+
40
+ **Critical Business Rules:**
41
+ - One task = one assignee (no shared ownership)
42
+ - Status transitions: todo → in_progress → done
43
+ -->
44
+
45
+ ---
46
+
47
+ ## Decision Summary
48
+
49
+ | Category | Decision | Rationale |
50
+ |----------|----------|-----------|
51
+ | Architecture | {{decision}} | {{why}} |
52
+ | Database | {{decision}} | {{why}} |
53
+ | Communication | {{decision}} | {{why}} |
54
+
55
+ <!-- e.g.
56
+ | Architecture | Hexagonal (Ports & Adapters) | Organizational standard |
57
+ | Database | PostgreSQL per module | Service isolation |
58
+ | Communication | REST sync + Kafka async | REST for queries, Kafka for events |
59
+ -->
60
+
61
+ ---
62
+
63
+ ## System Context
64
+
65
+ ```
66
+ {{external_1}} {{external_2}}
67
+ │ │
68
+ ▼ ▼
69
+ ┌─────────────────────────────────────────┐
70
+ │ {{project}} │
71
+ │ │
72
+ │ ┌─────────┐ ┌─────────┐ ┌─────────┐ │
73
+ │ │{{mod_1}}│ │{{mod_2}}│ │{{mod_3}}│ │
74
+ │ └─────────┘ └─────────┘ └─────────┘ │
75
+ │ │
76
+ └─────────────────────────────────────────┘
77
+ │ │
78
+ ▼ ▼
79
+ {{storage_1}} {{storage_2}}
80
+ ```
81
+
82
+ ---
83
+
84
+ ## Modules Overview
85
+
86
+ ### {{Domain_1}} ({{N}} modules)
87
+
88
+ #### {{Module_1}}
89
+
90
+ **Purpose:** {{single_responsibility}}
91
+
92
+ **Internal Services:**
93
+
94
+ | Service | Responsibilities | Storage |
95
+ |---------|-----------------|---------|
96
+ | {{service}} | {{what_it_does}} | {{db}} |
97
+ | {{service}} | {{what_it_does}} | {{db}} |
98
+
99
+ **Database Schema:**
100
+ ```
101
+ {{table_1}} # {{fields_description}}
102
+ {{table_2}} # {{fields_description}}
103
+ ```
104
+
105
+ **Events:**
106
+ - **Produces:** {{event_1}}, {{event_2}}
107
+ - **Consumes:** {{event_1}}
108
+
109
+ **Notes:**
110
+ - {{important_detail}}
111
+
112
+ <!-- e.g.
113
+ #### Task Module
114
+
115
+ **Purpose:** Task lifecycle management — CRUD, assignments, status transitions
116
+
117
+ **Internal Services:**
118
+
119
+ | Service | Responsibilities | Storage |
120
+ |---------|-----------------|---------|
121
+ | tasks | Task CRUD, validation | PostgreSQL |
122
+ | assignments | User-task linking | PostgreSQL |
123
+ | workflow | Status transitions | PostgreSQL |
124
+
125
+ **Database Schema:**
126
+ ```
127
+ tasks # id, title, description, status, assignee_id, due_date
128
+ task_history # task_id, field, old_value, new_value, changed_at
129
+ ```
130
+
131
+ **Events:**
132
+ - **Produces:** TaskCreated, TaskUpdated, TaskAssigned, StatusChanged
133
+ - **Consumes:** UserDeactivated (to reassign tasks)
134
+
135
+ **Notes:**
136
+ - Status flow: todo → in_progress → done (configurable per workspace)
137
+ -->
138
+
139
+ ---
140
+
141
+ ## Data Architecture
142
+
143
+ ### Storage by Module
144
+
145
+ | Module | Primary DB | Cache | Other |
146
+ |--------|-----------|-------|-------|
147
+ | {{module}} | {{db}} | {{cache}} | {{other}} |
148
+
149
+ ### Key Entity Relations
150
+
151
+ ```
152
+ {{entity_1}} ──< {{entity_2}}
153
+
154
+ └──── {{entity_3}}
155
+ ```
156
+
157
+ ---
158
+
159
+ ## Integration
160
+
161
+ ### External Systems
162
+
163
+ | System | Protocol | Direction | Purpose |
164
+ |--------|----------|-----------|---------|
165
+ | {{system}} | {{protocol}} | In/Out | {{purpose}} |
166
+
167
+ **Notes:**
168
+ - {{integration_detail}}
169
+
170
+ ### Internal Communication
171
+
172
+ | From | To | Method | When |
173
+ |------|-----|--------|------|
174
+ | {{module}} | {{module}} | {{REST/Kafka}} | {{trigger}} |
175
+
176
+ ---
177
+
178
+ ## Cross-Cutting Concerns
179
+
180
+ ### Security
181
+ | Concern | Implementation |
182
+ |---------|---------------|
183
+ | AuthN | {{approach}} |
184
+ | AuthZ | {{approach}} |
185
+
186
+ ### Observability
187
+ - **Logging:** {{tool}}
188
+ - **Metrics:** {{tool}}
189
+ - **Tracing:** {{tool}}
190
+
191
+ ### Error Handling
192
+ | Error Type | HTTP | Strategy |
193
+ |------------|------|----------|
194
+ | Validation | 400 | Return field errors |
195
+ | Not Found | 404 | Return with message |
196
+ | Business Rule | 422 | Return error code |
197
+
198
+ ---
199
+
200
+ ## NFR Compliance
201
+
202
+ | NFR | Requirement | How Addressed |
203
+ |-----|-------------|---------------|
204
+ | NFR-001 | {{requirement}} | {{solution}} |
205
+
206
+ ---
207
+
208
+ ## References
209
+
210
+ → PRD: `{{path}}`
211
+ → ADRs: `{{path}}`
212
+ → Diagrams: `{{path}}`
@@ -184,7 +184,7 @@ After validation:
184
184
  ### Action Required
185
185
 
186
186
  Create the QA artifact using template:
187
- `@.opencode/templates/integration-tests-template.md`
187
+ `@.opencode/skills/test-design/template-integration.md`
188
188
 
189
189
  This artifact is MANDATORY before proceeding to epics.
190
190
  ```
@@ -0,0 +1,23 @@
1
+ # Changelog
2
+
3
+ All notable changes to this project will be documented in this file.
4
+
5
+ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
6
+ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
+
8
+ ## [Unreleased]
9
+
10
+ ### Added
11
+ -
12
+
13
+ ### Changed
14
+ -
15
+
16
+ ### Fixed
17
+ -
18
+
19
+ ## [0.1.0] - YYYY-MM-DD
20
+
21
+ ### Added
22
+ - Initial project setup
23
+ - Basic documentation structure