@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
@@ -0,0 +1,512 @@
1
+ # What to Document in Coding Standards
2
+
3
+ Complete guide on what to include in your project's coding standards.
4
+
5
+ ## Essential Sections
6
+
7
+ ### 1. Project Structure
8
+
9
+ **What to document:**
10
+ - Directory layout
11
+ - Module organization
12
+ - File naming conventions
13
+ - Where to put what
14
+
15
+ **Example:**
16
+ ```markdown
17
+ ## Project Structure
18
+
19
+ \`\`\`
20
+ project/
21
+ ├── internal/ # Private application code
22
+ │ ├── domain/ # Business entities
23
+ │ ├── service/ # Business logic
24
+ │ ├── repository/ # Data access
25
+ │ └── handler/ # HTTP handlers
26
+ ├── pkg/ # Public libraries
27
+ ├── cmd/ # Application entry points
28
+ ├── docs/ # Documentation
29
+ └── tests/ # Integration tests
30
+ \`\`\`
31
+
32
+ **Rules:**
33
+ - `internal/` - private code, not importable
34
+ - `pkg/` - reusable libraries
35
+ - `cmd/` - one folder per binary
36
+ ```
37
+
38
+ ---
39
+
40
+ ### 2. Naming Conventions
41
+
42
+ **What to document:**
43
+ - Files (snake_case, kebab-case, PascalCase)
44
+ - Types/Classes (PascalCase, snake_case)
45
+ - Functions/Methods (camelCase, snake_case)
46
+ - Variables (camelCase, snake_case)
47
+ - Constants (UPPER_SNAKE_CASE)
48
+ - Tests (*_test, *.test, *.spec)
49
+
50
+ **Example:**
51
+ ```markdown
52
+ ## Naming Conventions
53
+
54
+ | Type | Convention | Example |
55
+ |------|------------|---------|
56
+ | Files | snake_case | user_service.go |
57
+ | Types | PascalCase | UserService |
58
+ | Functions | camelCase | getUserById |
59
+ | Variables | camelCase | userId, isValid |
60
+ | Constants | UPPER_SNAKE_CASE | MAX_RETRIES |
61
+ | Private | _prefix | _internalHelper |
62
+ | Tests | *_test | user_service_test.go |
63
+
64
+ **Rules:**
65
+ - Exported (public) functions: PascalCase (Go)
66
+ - Unexported (private) functions: camelCase (Go)
67
+ - Boolean variables: is/has/can prefix (isValid, hasPermission)
68
+ ```
69
+
70
+ ---
71
+
72
+ ### 3. Code Organization Patterns
73
+
74
+ **What to document:**
75
+ - Layered architecture
76
+ - Dependency direction
77
+ - Module boundaries
78
+ - Common patterns
79
+
80
+ **Example:**
81
+ ```markdown
82
+ ## Code Organization
83
+
84
+ ### Layers
85
+
86
+ \`\`\`
87
+ Handler → Service → Repository → Database
88
+ ↓ ↓ ↓
89
+ HTTP Business Data
90
+ Layer Logic Access
91
+ \`\`\`
92
+
93
+ **Rules:**
94
+ - Handlers: HTTP/API only, no business logic
95
+ - Services: Business logic, orchestration
96
+ - Repositories: Data access, queries
97
+ - Domain: Entities, value objects, rules
98
+
99
+ ### Dependency Direction
100
+
101
+ \`\`\`
102
+ Handler → Service → Domain
103
+ ↓ ↓ ↑
104
+ Infrastructure ←────────┘
105
+ \`\`\`
106
+
107
+ **Rule:** Dependencies point inward (toward domain)
108
+ ```
109
+
110
+ ---
111
+
112
+ ### 4. Error Handling
113
+
114
+ **What to document:**
115
+ - Error types
116
+ - Error wrapping
117
+ - Error codes
118
+ - Error responses
119
+
120
+ **Example:**
121
+ ```markdown
122
+ ## Error Handling
123
+
124
+ ### Error Types
125
+
126
+ \`\`\`go
127
+ // Domain errors
128
+ type ValidationError struct {
129
+ Field string
130
+ Message string
131
+ }
132
+
133
+ // Application errors
134
+ type NotFoundError struct {
135
+ Resource string
136
+ ID string
137
+ }
138
+
139
+ // Infrastructure errors
140
+ type DatabaseError struct {
141
+ Operation string
142
+ Cause error
143
+ }
144
+ \`\`\`
145
+
146
+ ### Error Wrapping
147
+
148
+ \`\`\`go
149
+ // Always wrap errors with context
150
+ if err != nil {
151
+ return fmt.Errorf("failed to create user: %w", err)
152
+ }
153
+ \`\`\`
154
+
155
+ ### Error Codes
156
+
157
+ | Code | Meaning | HTTP Status |
158
+ |------|---------|-------------|
159
+ | VALIDATION_ERROR | Invalid input | 400 |
160
+ | NOT_FOUND | Resource not found | 404 |
161
+ | UNAUTHORIZED | Not authenticated | 401 |
162
+ | FORBIDDEN | Not authorized | 403 |
163
+ | INTERNAL_ERROR | Server error | 500 |
164
+
165
+ ### API Error Response
166
+
167
+ \`\`\`json
168
+ {
169
+ "error": {
170
+ "code": "VALIDATION_ERROR",
171
+ "message": "Invalid input",
172
+ "details": [
173
+ {
174
+ "field": "email",
175
+ "message": "Invalid email format"
176
+ }
177
+ ]
178
+ }
179
+ }
180
+ \`\`\`
181
+ ```
182
+
183
+ ---
184
+
185
+ ### 5. Testing Standards
186
+
187
+ **What to document:**
188
+ - Test types (unit, integration, E2E)
189
+ - Coverage targets
190
+ - Test naming
191
+ - Test structure
192
+
193
+ **Example:**
194
+ ```markdown
195
+ ## Testing Standards
196
+
197
+ ### Coverage Targets
198
+
199
+ | Layer | Target | Focus |
200
+ |-------|--------|-------|
201
+ | Domain | 80%+ | Business rules |
202
+ | Service | 70%+ | Use cases |
203
+ | Handler | 60%+ | API contracts |
204
+ | Repository | 50%+ | Queries |
205
+
206
+ ### Test Naming
207
+
208
+ \`\`\`
209
+ Test{Component}_{Method}_{Scenario}_{Expected}
210
+
211
+ Examples:
212
+ - TestUserService_Create_ValidInput_ReturnsUser
213
+ - TestUserService_Create_DuplicateEmail_ReturnsError
214
+ \`\`\`
215
+
216
+ ### Test Structure (AAA)
217
+
218
+ \`\`\`go
219
+ func TestUserService_Create(t *testing.T) {
220
+ // Arrange
221
+ service := NewUserService(mockRepo)
222
+ user := &User{Email: "test@example.com"}
223
+
224
+ // Act
225
+ result, err := service.Create(user)
226
+
227
+ // Assert
228
+ assert.NoError(t, err)
229
+ assert.NotNil(t, result)
230
+ }
231
+ \`\`\`
232
+ ```
233
+
234
+ ---
235
+
236
+ ### 6. API Standards
237
+
238
+ **What to document:**
239
+ - REST conventions
240
+ - URL structure
241
+ - HTTP methods
242
+ - Status codes
243
+ - Request/response format
244
+
245
+ **Example:**
246
+ ```markdown
247
+ ## API Standards
248
+
249
+ ### REST Conventions
250
+
251
+ | Method | Path | Action |
252
+ |--------|------|--------|
253
+ | GET | /users | List users |
254
+ | GET | /users/:id | Get user |
255
+ | POST | /users | Create user |
256
+ | PUT | /users/:id | Update user |
257
+ | DELETE | /users/:id | Delete user |
258
+
259
+ ### URL Structure
260
+
261
+ \`\`\`
262
+ /api/v1/{resource}/{id}/{sub-resource}
263
+
264
+ Examples:
265
+ - GET /api/v1/users
266
+ - GET /api/v1/users/123
267
+ - GET /api/v1/users/123/orders
268
+ \`\`\`
269
+
270
+ ### Status Codes
271
+
272
+ | Code | Usage |
273
+ |------|-------|
274
+ | 200 | Success (GET, PUT) |
275
+ | 201 | Created (POST) |
276
+ | 204 | No Content (DELETE) |
277
+ | 400 | Bad Request |
278
+ | 401 | Unauthorized |
279
+ | 403 | Forbidden |
280
+ | 404 | Not Found |
281
+ | 500 | Internal Error |
282
+
283
+ ### Response Format
284
+
285
+ \`\`\`json
286
+ // Success
287
+ {
288
+ "data": {...},
289
+ "meta": {
290
+ "page": 1,
291
+ "total": 100
292
+ }
293
+ }
294
+
295
+ // Error
296
+ {
297
+ "error": {
298
+ "code": "VALIDATION_ERROR",
299
+ "message": "Invalid input"
300
+ }
301
+ }
302
+ \`\`\`
303
+ ```
304
+
305
+ ---
306
+
307
+ ### 7. Database Standards
308
+
309
+ **What to document:**
310
+ - Schema conventions
311
+ - Naming (tables, columns)
312
+ - Migrations
313
+ - Query patterns
314
+
315
+ **Example:**
316
+ ```markdown
317
+ ## Database Standards
318
+
319
+ ### Table Naming
320
+
321
+ - Plural, snake_case: `users`, `order_items`
322
+ - Junction tables: `user_roles`, `product_categories`
323
+
324
+ ### Column Naming
325
+
326
+ - snake_case: `user_id`, `created_at`
327
+ - Foreign keys: `{table}_id` (user_id, order_id)
328
+ - Timestamps: `created_at`, `updated_at`, `deleted_at`
329
+
330
+ ### Migrations
331
+
332
+ \`\`\`sql
333
+ -- Up migration: 20260129_create_users.up.sql
334
+ CREATE TABLE users (
335
+ id UUID PRIMARY KEY,
336
+ email VARCHAR(255) UNIQUE NOT NULL,
337
+ created_at TIMESTAMP NOT NULL DEFAULT NOW()
338
+ );
339
+
340
+ -- Down migration: 20260129_create_users.down.sql
341
+ DROP TABLE users;
342
+ \`\`\`
343
+
344
+ ### Query Patterns
345
+
346
+ \`\`\`go
347
+ // Use prepared statements
348
+ stmt, err := db.Prepare("SELECT * FROM users WHERE id = $1")
349
+ defer stmt.Close()
350
+
351
+ // Use transactions for multiple operations
352
+ tx, err := db.Begin()
353
+ defer tx.Rollback()
354
+ // ... operations
355
+ tx.Commit()
356
+ \`\`\`
357
+ ```
358
+
359
+ ---
360
+
361
+ ### 8. Security Standards
362
+
363
+ **What to document:**
364
+ - Authentication
365
+ - Authorization
366
+ - Input validation
367
+ - Secrets management
368
+
369
+ **Example:**
370
+ ```markdown
371
+ ## Security Standards
372
+
373
+ ### Authentication
374
+
375
+ - Use JWT tokens
376
+ - Token expiry: 1 hour
377
+ - Refresh token: 30 days
378
+ - Store tokens in httpOnly cookies
379
+
380
+ ### Authorization
381
+
382
+ \`\`\`go
383
+ // Check permissions
384
+ if !user.HasPermission("user:create") {
385
+ return ErrForbidden
386
+ }
387
+ \`\`\`
388
+
389
+ ### Input Validation
390
+
391
+ \`\`\`go
392
+ // Always validate input
393
+ func (s *UserService) Create(input CreateUserInput) error {
394
+ if err := input.Validate(); err != nil {
395
+ return ValidationError{err}
396
+ }
397
+ // ...
398
+ }
399
+ \`\`\`
400
+
401
+ ### Secrets Management
402
+
403
+ - Never commit secrets to git
404
+ - Use environment variables
405
+ - Use secret management (Vault, AWS Secrets Manager)
406
+
407
+ \`\`\`bash
408
+ # .env (gitignored)
409
+ DATABASE_URL=postgres://...
410
+ JWT_SECRET=...
411
+ \`\`\`
412
+ ```
413
+
414
+ ---
415
+
416
+ ### 9. Dependencies
417
+
418
+ **What to document:**
419
+ - Approved libraries
420
+ - Forbidden libraries
421
+ - Version constraints
422
+
423
+ **Example:**
424
+ ```markdown
425
+ ## Dependencies
426
+
427
+ ### Approved Libraries
428
+
429
+ | Purpose | Library | Version |
430
+ |---------|---------|---------|
431
+ | HTTP Router | chi | v5.x |
432
+ | Database | pgx | v5.x |
433
+ | Validation | validator | v10.x |
434
+ | Testing | testify | v1.x |
435
+
436
+ ### Forbidden Libraries
437
+
438
+ - ❌ `gorm` - Use pgx instead
439
+ - ❌ `gin` - Use chi instead
440
+ - ❌ `reflect` - Avoid reflection
441
+
442
+ ### Version Constraints
443
+
444
+ - Use semantic versioning
445
+ - Pin major versions
446
+ - Update dependencies monthly
447
+ ```
448
+
449
+ ---
450
+
451
+ ### 10. Git Workflow
452
+
453
+ **What to document:**
454
+ - Branch naming
455
+ - Commit messages
456
+ - PR process
457
+
458
+ **Example:**
459
+ ```markdown
460
+ ## Git Workflow
461
+
462
+ ### Branch Naming
463
+
464
+ \`\`\`
465
+ feature/PROJ-123-add-user-auth
466
+ bugfix/PROJ-456-fix-login
467
+ hotfix/PROJ-789-critical-bug
468
+ \`\`\`
469
+
470
+ ### Commit Messages
471
+
472
+ \`\`\`
473
+ <type>(<scope>): <subject>
474
+
475
+ feat(auth): add JWT authentication
476
+ fix(user): handle duplicate email error
477
+ docs(api): update API documentation
478
+ \`\`\`
479
+
480
+ ### PR Process
481
+
482
+ 1. Create feature branch
483
+ 2. Make changes
484
+ 3. Write tests
485
+ 4. Create PR
486
+ 5. Code review
487
+ 6. Merge to main
488
+ ```
489
+
490
+ ---
491
+
492
+ ## Tips
493
+
494
+ **Keep it practical:**
495
+ - Use real examples from your project
496
+ - Show code, not just rules
497
+ - Include anti-patterns (what NOT to do)
498
+
499
+ **Make it searchable:**
500
+ - Clear headings
501
+ - Table of contents
502
+ - Examples for each rule
503
+
504
+ **Keep it updated:**
505
+ - Review quarterly
506
+ - Update when patterns change
507
+ - Remove obsolete rules
508
+
509
+ **Make it accessible:**
510
+ - Link from README
511
+ - Reference in stories
512
+ - Include in onboarding