@comfanion/workflow 4.38.4-dev.1 → 4.39.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 (40) hide show
  1. package/package.json +1 -1
  2. package/src/build-info.json +2 -2
  3. package/src/opencode/agents/architect.md +8 -3
  4. package/src/opencode/agents/pm.md +9 -3
  5. package/src/opencode/gitignore +1 -0
  6. package/src/opencode/skills/acceptance-criteria/SKILL.md +58 -176
  7. package/src/opencode/skills/architecture-design/SKILL.md +86 -576
  8. package/src/opencode/skills/archiving/SKILL.md +60 -140
  9. package/src/opencode/skills/coding-standards/SKILL.md +113 -434
  10. package/src/opencode/skills/coding-standards/what-to-document.md +512 -0
  11. package/src/opencode/skills/database-design/SKILL.md +94 -778
  12. package/src/opencode/skills/database-design/indexing.md +187 -0
  13. package/src/opencode/skills/database-design/migrations.md +239 -0
  14. package/src/opencode/skills/database-design/schema-design.md +319 -0
  15. package/src/opencode/skills/doc-todo/SKILL.md +35 -27
  16. package/src/opencode/skills/epic-writing/SKILL.md +156 -244
  17. package/src/opencode/skills/epic-writing/template.md +11 -1
  18. package/src/opencode/skills/methodologies/SKILL.md +91 -354
  19. package/src/opencode/skills/methodologies/define.md +336 -0
  20. package/src/opencode/skills/methodologies/diagnose.md +374 -0
  21. package/src/opencode/skills/methodologies/empathize.md +253 -0
  22. package/src/opencode/skills/methodologies/ideate.md +458 -0
  23. package/src/opencode/skills/prd-writing/SKILL.md +162 -366
  24. package/src/opencode/skills/prd-writing/template.md +178 -48
  25. package/src/opencode/skills/requirements-gathering/SKILL.md +102 -117
  26. package/src/opencode/skills/requirements-gathering/template.md +97 -17
  27. package/src/opencode/skills/sprint-planning/SKILL.md +76 -225
  28. package/src/opencode/skills/sprint-planning/template.yaml +8 -0
  29. package/src/opencode/skills/story-writing/SKILL.md +76 -210
  30. package/src/opencode/skills/story-writing/template.md +10 -1
  31. package/src/opencode/skills/test-design/SKILL.md +78 -84
  32. package/src/opencode/skills/test-design/test-strategy.md +279 -0
  33. package/src/opencode/skills/test-design/unit-tests-mocking.md +247 -0
  34. package/src/opencode/skills/test-design/unit-tests-patterns.md +181 -0
  35. package/src/opencode/skills/test-design/unit-tests.md +117 -0
  36. package/src/opencode/skills/unit-writing/SKILL.md +119 -377
  37. package/src/opencode/skills/module-documentation/SKILL.md +0 -224
  38. package/src/opencode/skills/module-documentation/template.md +0 -139
  39. /package/src/opencode/skills/test-design/{template-integration.md → templates/template-integration.md} +0 -0
  40. /package/src/opencode/skills/test-design/{template-module.md → templates/template-module.md} +0 -0
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  name: coding-standards
3
- description: Use when establishing coding standards, patterns, naming conventions, and best practices
3
+ description: Establish coding standards, design patterns, naming conventions, code organization, and best practices for the project. Use when defining code style, setting up standards, documenting patterns, or when user mentions "coding standards", "code style", "naming conventions", "best practices", "code patterns", or "style guide".
4
4
  license: MIT
5
5
  compatibility: opencode
6
6
  metadata:
@@ -9,467 +9,146 @@ metadata:
9
9
  artifacts: docs/coding-standards/*.md
10
10
  ---
11
11
 
12
- # Coding Standards Architect
13
-
14
- You are a Senior Staff Engineer specializing in establishing coding standards. You create **modular documentation** - multiple focused files (1-10 files), each under 2000 lines.
15
-
16
- ## Core Principle: README.md is the Main File
17
-
18
- **CRITICAL:** During development, agents read ONLY `README.md` from coding-standards (to save context ~65KB).
19
-
20
- Therefore `README.md` MUST contain:
21
- - **ALL critical rules** (not just links!)
22
- - **Common patterns with examples**
23
- - **Naming conventions**
24
- - **Project structure overview**
25
- - Links to other files for deep dive
26
-
27
- Other files (testing.md, api.md, etc.) are for **deep dive only** - agents read them when story's "Required Reading" points to them.
28
-
29
- ## Size Guidelines
12
+ # Coding Standards Skill
13
+
14
+ ```xml
15
+ <coding_standards>
16
+ <definition>Establish coding standards, patterns, naming conventions</definition>
17
+
18
+ <core_principle>
19
+ <readme>Main file - agents read ONLY this during development (saves context)</readme>
20
+ <must_contain>All critical rules, common patterns, naming, project structure</must_contain>
21
+ <other_files>Deep dive only - read when story's "Required Reading" points to them</other_files>
22
+ </core_principle>
23
+
24
+ <size_guidelines>
25
+ <readme max="20-30KB">Main file, all critical rules</readme>
26
+ <other_files max="10-20KB">Deep dive on specific topics</other_files>
27
+ <limit>Under 2000 lines per file</limit>
28
+ </size_guidelines>
29
+
30
+ <structure>
31
+ <readme>Index and quick reference</readme>
32
+ <project_structure>Directory layout, module organization</project_structure>
33
+ <language_standards>Language-specific (go-standards.md, typescript-standards.md)</language_standards>
34
+ <architecture_patterns>Required patterns, anti-patterns</architecture_patterns>
35
+ <testing_standards>Test types, coverage, patterns</testing_standards>
36
+ <api_standards>REST/gRPC conventions, error codes</api_standards>
37
+ <database_standards>Schema, queries, migrations</database_standards>
38
+ <security_standards>Auth, validation, secrets</security_standards>
39
+ <libraries>Approved/forbidden dependencies</libraries>
40
+ <git_workflow>Branches, commits, PRs</git_workflow>
41
+ </structure>
42
+
43
+ <naming>
44
+ <files>snake_case (user_service.go, auth_handler.ts)</files>
45
+ <types_classes>PascalCase (UserService, AuthHandler)</types_classes>
46
+ <functions>camelCase (TS) or PascalCase (Go exported)</functions>
47
+ <variables>camelCase (userId, isValid)</variables>
48
+ <constants>UPPER_SNAKE_CASE (MAX_RETRIES)</constants>
49
+ <tests>*_test.go, *.test.ts</tests>
50
+ </naming>
51
+
52
+ <patterns>
53
+ <service>Business logic layer</service>
54
+ <repository>Data access layer</repository>
55
+ <handler>HTTP/API layer (no business logic)</handler>
56
+ <error_handling>Consistent error types and codes</error_handling>
57
+ </patterns>
58
+
59
+ <critical_rules>
60
+ <no_business_in_handlers>Handlers only validate and call services</no_business_in_handlers>
61
+ <dependency_injection>Use interfaces, inject dependencies</dependency_injection>
62
+ <error_wrapping>Wrap errors with context</error_wrapping>
63
+ <no_global_state>Avoid global variables</no_global_state>
64
+ <test_coverage>Domain 80%+, Application 70%+</test_coverage>
65
+ </critical_rules>
66
+
67
+ <api_response>
68
+ <success>{"data": {...}, "meta": {...}}</success>
69
+ <error>{"error": {"code": "...", "message": "...", "details": [...]}}</error>
70
+ </api_response>
71
+
72
+ <workflow>
73
+ <step1>Read PRD and Architecture to understand project</step1>
74
+ <step2>Create docs/coding-standards/ folder</step2>
75
+ <step3>Start with README.md (all critical rules)</step3>
76
+ <step4>Add deep-dive files as needed</step4>
77
+ <step5>Ensure README.md is self-contained (agents read only this)</step5>
78
+ </workflow>
79
+
80
+ <what_to_document>
81
+ <guide>See [what-to-document.md](what-to-document.md) for complete guide</guide>
82
+ <essential>Project structure, naming, patterns, errors, testing, API, database, security, dependencies, git</essential>
83
+ </what_to_document>
84
+ </coding_standards>
85
+ ```
30
86
 
31
- | File | Max Size | Purpose |
32
- |------|----------|---------|
33
- | README.md | 20-30KB | Main file, all critical rules |
34
- | Other files | 10-20KB each | Deep dive on specific topics |
35
- | Total | <2000 lines/file | Keep files readable |
87
+ ---
36
88
 
37
- ## Documentation Structure
89
+ ## Detailed Guide
38
90
 
39
- ```
40
- docs/coding-standards/
41
- ├── README.md # Index and quick reference (<500 lines)
42
- ├── project-structure.md # Directory layout, module organization
43
- ├── [language]-standards.md # Language-specific (go, typescript, python)
44
- ├── architecture-patterns.md # Required patterns, anti-patterns
45
- ├── testing-standards.md # Test types, coverage, patterns
46
- ├── api-standards.md # REST/gRPC conventions, error codes
47
- ├── database-standards.md # Schema, queries, migrations
48
- ├── security-standards.md # Auth, validation, secrets
49
- ├── libraries.md # Approved/forbidden dependencies
50
- └── git-workflow.md # Branches, commits, PRs
51
- ```
91
+ **For complete information on what to document:**
92
+ - [what-to-document.md](what-to-document.md) - 10 essential sections with examples
52
93
 
53
- ## File Templates
94
+ ---
54
95
 
55
- ### README.md (Main File - Agents Read This!)
96
+ ## Example: README.md Structure
56
97
 
57
98
  ```markdown
58
99
  # Coding Standards
59
100
 
60
- **Project:** [name]
61
- **Tech Stack:** [languages, frameworks]
62
- **Last Updated:** YYYY-MM-DD
101
+ **Project:** E-commerce Platform
102
+ **Tech Stack:** Go, PostgreSQL, React
103
+ **Last Updated:** 2026-01-29
63
104
 
64
105
  ## Project Structure
65
106
 
66
107
  \`\`\`
67
108
  project/
68
- ├── src/ # Source code
69
- │ ├── modules/ # Business modules (domain, service, handler)
70
- └── internal/ # Shared infrastructure
71
- ├── docs/ # Documentation
72
- └── tests/ # Test files
109
+ ├── internal/
110
+ │ ├── order/ # Order module
111
+ │ ├── domain/
112
+ │ │ ├── service/
113
+ │ │ └── handler/
114
+ │ └── shared/ # Shared utilities
115
+ ├── docs/
116
+ └── tests/
73
117
  \`\`\`
74
118
 
75
119
  ## Naming Conventions
76
120
 
77
- ### Files
78
- - `snake_case` for files: `user_service.go`, `auth_handler.ts`
79
- - Test files: `*_test.go`, `*.test.ts`
80
-
81
- ### Code
82
- - Types/Classes: `PascalCase` - `UserService`, `AuthHandler`
83
- - Functions: `camelCase` (TS) or `PascalCase` (Go exported)
84
- - Variables: `camelCase` - `userId`, `isValid`
85
- - Constants: `UPPER_SNAKE_CASE` - `MAX_RETRIES`
121
+ - Files: `snake_case` (user_service.go)
122
+ - Types: `PascalCase` (UserService)
123
+ - Functions: `camelCase` (getUserById)
124
+ - Constants: `UPPER_SNAKE_CASE` (MAX_RETRIES)
86
125
 
87
126
  ## Common Patterns
88
127
 
89
128
  ### Service Pattern
90
- [Example of service implementation in your language]
91
-
92
- ### Repository Pattern
93
- [Example of repository implementation]
94
-
95
- ### Error Handling
96
- [Example of error handling pattern]
97
-
98
- ## Critical Rules
99
-
100
- 1. **No business logic in handlers** - handlers only validate input and call services
101
- 2. **All errors must be wrapped** with context
102
- 3. **No hardcoded values** - use config or constants
103
- 4. **Tests required** for all business logic
104
-
105
- ## API Response Format
106
-
107
- ### Success
108
- \`\`\`json
109
- { "data": { ... } }
110
- \`\`\`
111
-
112
- ### Error
113
- \`\`\`json
114
- { "error": { "code": "VALIDATION_ERROR", "message": "..." } }
115
- \`\`\`
116
-
117
- ## Deep Dive Documents
118
-
119
- | Topic | File | When to Read |
120
- |-------|------|--------------|
121
- | Testing | [testing.md](./testing.md) | Writing tests |
122
- | API Design | [api.md](./api.md) | Creating endpoints |
123
- | Database | [database.md](./database.md) | Schema changes |
124
- | Security | [security.md](./security.md) | Auth, validation |
125
- | Git | [git.md](./git.md) | Commits, PRs |
126
- ```
127
-
128
- **Note:** This README should be 20-30KB with real examples, not placeholders.
129
-
130
- ### project-structure.md
131
-
132
- ```markdown
133
- # Project Structure
134
-
135
- ## Directory Layout
136
-
137
- \`\`\`
138
- project/
139
- ├── src/services/ # Service modules
140
- │ └── [service]/
141
- │ ├── cmd/ # Entry points
142
- │ ├── modules/ # Business modules
143
- │ ├── internal/ # Shared infrastructure
144
- │ └── migrations/ # Database migrations
145
- ├── docs/ # Documentation
146
- ├── scripts/ # Build/deploy scripts
147
- └── tools/ # Development tools
148
- \`\`\`
149
-
150
- ## Module Structure
151
-
152
- [Detailed module layout]
153
-
154
- ## File Organization Rules
155
-
156
- [Rules for organizing files]
157
- ```
158
-
159
- ### [language]-standards.md (e.g., go-standards.md)
160
-
161
- ```markdown
162
- # Go Coding Standards
163
-
164
- ## Naming Conventions
165
-
166
- ### Files
167
- - Use `snake_case.go`
168
- - Test files: `*_test.go`
169
-
170
- ### Packages
171
- - Single lowercase word
172
- - No underscores
173
-
174
- ### Types, Functions, Variables
175
- [Detailed conventions with examples]
176
-
177
- ## Import Organization
178
-
179
- [3-group structure with examples]
180
-
181
- ## Error Handling
182
-
183
- [Error wrapping, custom errors, examples]
184
-
185
- ## Code Style
186
-
187
- [Formatting, comments, line length]
188
-
189
- ## Common Patterns
190
-
191
- [Frequently used patterns with code examples]
192
- ```
193
-
194
- ### architecture-patterns.md
195
-
196
- ```markdown
197
- # Architecture Patterns
198
-
199
- ## Chosen Pattern
200
-
201
- ### [Pattern Name] (e.g., Layered, Hexagonal, Clean, Vertical Slices)
202
- [Description, why chosen for this project, example structure]
203
-
204
- See architecture-design skill for pattern selection guidance.
205
-
206
- ### Repository Pattern
207
- [Interface in domain, implementation in infrastructure]
208
-
209
- ## Forbidden Anti-Patterns
210
-
211
- | Anti-Pattern | Why Forbidden | What To Do Instead |
212
- |--------------|---------------|-------------------|
213
-
214
- ## Module Boundaries
215
-
216
- [How modules communicate, what's allowed]
217
- ```
218
-
219
- ### testing-standards.md
220
-
221
- ```markdown
222
- # Testing Standards
223
-
224
- ## Test Types
225
-
226
- ### Unit Tests
227
- - Location: Same package as code
228
- - Naming: `Test[Type]_[Method]_[Scenario]`
229
- - Coverage: Minimum 80%
230
-
231
- ### Integration Tests
232
- [Requirements and patterns]
233
-
234
- ### E2E Tests
235
- [Requirements and patterns]
236
-
237
- ## Test Patterns
238
-
239
- ### Table-Driven Tests
240
- [Example]
241
-
242
- ### Arrange-Act-Assert
243
- [Example]
244
-
245
- ## Mocking Guidelines
246
-
247
- [When to mock, how to mock]
248
-
249
- ## Coverage Requirements
250
-
251
- | Type | Minimum | Target |
252
- |------|---------|--------|
253
- ```
254
-
255
- ### api-standards.md
256
-
257
- ```markdown
258
- # API Standards
259
-
260
- ## REST Conventions
261
-
262
- ### URL Structure
263
- [Patterns and examples]
264
-
265
- ### HTTP Methods
266
- [When to use each]
267
-
268
- ### Status Codes
269
- [Standard usage]
270
-
271
- ## Request/Response Format
272
-
273
- ### Request Structure
274
- [Headers, body format]
275
-
276
- ### Response Structure
277
- [Success, error formats]
278
-
279
- ## Error Handling
280
-
281
- ### Error Response Format
282
- \`\`\`json
283
- {
284
- "error": {
285
- "code": "VALIDATION_ERROR",
286
- "message": "Human readable message",
287
- "details": []
288
- }
129
+ \`\`\`go
130
+ type UserService struct {
131
+ repo UserRepository
289
132
  }
290
- \`\`\`
291
-
292
- ### Error Codes
293
- [Standard error codes]
294
- ```
295
-
296
- ### database-standards.md
297
-
298
- ```markdown
299
- # Database Standards
300
-
301
- ## Schema Design
302
-
303
- ### Naming Conventions
304
- - Tables: `snake_case`, plural
305
- - Columns: `snake_case`
306
- - Indexes: `idx_[table]_[columns]`
307
-
308
- ### Required Columns
309
- [id, created_at, updated_at, version]
310
-
311
- ## Query Patterns
312
-
313
- ### Preventing N+1
314
- [Techniques]
315
-
316
- ### Transactions
317
- [When and how]
318
-
319
- ## Migrations
320
-
321
- ### File Naming
322
- [Sequence and naming]
323
-
324
- ### Up/Down Rules
325
- [Reversibility requirements]
326
-
327
- ## SQLC Usage
328
-
329
- [Configuration and patterns]
330
- ```
331
-
332
- ### security-standards.md
333
-
334
- ```markdown
335
- # Security Standards
336
-
337
- ## Input Validation
338
-
339
- ### All Inputs Must Be Validated
340
- [Rules and examples]
341
-
342
- ### Validation Libraries
343
- [Approved validators]
344
-
345
- ## Authentication
346
-
347
- [Patterns and requirements]
348
-
349
- ## Authorization
350
-
351
- [RBAC/ABAC patterns]
352
133
 
353
- ## Secrets Management
354
-
355
- ### Never Commit Secrets
356
- [What counts as secret]
357
-
358
- ### Environment Variables
359
- [Naming, loading]
360
-
361
- ## SQL Injection Prevention
362
-
363
- [Parameterized queries only]
364
-
365
- ## Logging Security
366
-
367
- [What to log, what NOT to log]
368
- ```
369
-
370
- ### libraries.md
371
-
372
- ```markdown
373
- # Library Standards
374
-
375
- ## Approved Libraries
376
-
377
- ### Core
378
- | Library | Purpose | Version | Notes |
379
- |---------|---------|---------|-------|
380
-
381
- ### HTTP
382
- | Library | Purpose | Version | Notes |
383
- |---------|---------|---------|-------|
384
-
385
- ### Database
386
- | Library | Purpose | Version | Notes |
387
- |---------|---------|---------|-------|
388
-
389
- ### Testing
390
- | Library | Purpose | Version | Notes |
391
- |---------|---------|---------|-------|
392
-
393
- ## Forbidden Libraries
394
-
395
- | Library | Reason | Alternative |
396
- |---------|--------|-------------|
397
-
398
- ## Adding New Libraries
399
-
400
- ### Evaluation Criteria
401
- 1. [Criterion 1]
402
- 2. [Criterion 2]
403
-
404
- ### Approval Process
405
- [How to get approval]
406
- ```
407
-
408
- ### git-workflow.md
409
-
410
- ```markdown
411
- # Git Workflow
412
-
413
- ## Branch Strategy
414
-
415
- ### Branch Types
416
- - `main` - Production
417
- - `develop` - Integration
418
- - `feature/epic-NN-name` - Feature branches
419
- - `fix/issue-description` - Bug fixes
420
-
421
- ### Naming Convention
422
- [Pattern and examples]
423
-
424
- ## Commit Messages
425
-
426
- ### Format (Conventional Commits)
427
- \`\`\`
428
- type(scope): subject
429
-
430
- body
431
-
432
- footer
134
+ func (s *UserService) Create(user *User) error {
135
+ // Business logic here
136
+ return s.repo.Save(user)
137
+ }
433
138
  \`\`\`
434
139
 
435
- ### Types
436
- - feat, fix, docs, style, refactor, test, chore
437
-
438
- ## Pull Requests
439
-
440
- ### PR Template
441
- [Required sections]
140
+ ## Critical Rules
442
141
 
443
- ### Review Requirements
444
- [Approvals needed, checks]
142
+ 1. No business logic in handlers
143
+ 2. Use dependency injection
144
+ 3. Wrap errors with context
145
+ 4. Test coverage: Domain 80%+
445
146
 
446
- ## Merge Strategy
147
+ ## Deep Dive
447
148
 
448
- [Squash/rebase/merge rules]
149
+ - → `project-structure.md` - Full directory layout
150
+ - → `go-standards.md` - Go-specific patterns
151
+ - → `testing-standards.md` - Test patterns
449
152
  ```
450
153
 
451
- ## Output Summary
452
-
453
- After creating standards, generate:
454
-
455
- 1. **docs/coding-standards/README.md** - Index (ALWAYS)
456
- 2. **docs/coding-standards/project-structure.md** - Layout
457
- 3. **docs/coding-standards/[lang]-standards.md** - Per language
458
- 4. **docs/coding-standards/architecture-patterns.md** - Patterns
459
- 5. **docs/coding-standards/testing-standards.md** - Testing
460
- 6. **docs/coding-standards/api-standards.md** - API (if applicable)
461
- 7. **docs/coding-standards/database-standards.md** - DB (if applicable)
462
- 8. **docs/coding-standards/security-standards.md** - Security
463
- 9. **docs/coding-standards/libraries.md** - Dependencies
464
- 10. **docs/coding-standards/git-workflow.md** - Git rules
465
-
466
- Plus linter configs: `.golangci.yml`, `.eslintrc`, `.editorconfig`
467
-
468
- ## Validation
469
-
470
- - [ ] Each file < 2000 lines
471
- - [ ] README index is complete
472
- - [ ] All languages covered
473
- - [ ] Examples for complex rules
474
- - [ ] No contradictions between files
475
- - [ ] Linter configs match docs
154
+ See `template-*.md` for full formats.