codex-genesis-harness 0.1.5 → 0.1.7

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 (178) hide show
  1. package/.codebase/ARCHITECTURE_REVIEW_COMPLETE.md +216 -216
  2. package/.codebase/CURRENT_STATE.md +8 -2
  3. package/.codebase/FILE_NAMING_CLARIFICATION.md +161 -161
  4. package/.codebase/HARNESS_COMPLETENESS_AUDIT.md +613 -613
  5. package/.codebase/IMPLEMENTATION_COMPLETE.md +429 -429
  6. package/.codebase/IMPLEMENTATION_HANDOFF.md +351 -351
  7. package/.codebase/IMPROVEMENTS_SUMMARY.md +419 -419
  8. package/.codebase/PHASE3_SKILLS_NAMING_COMPLETE.md +292 -292
  9. package/.codebase/PHASE_DEPENDENCY_MAP.md +486 -486
  10. package/.codebase/QUICK_START_SPEC_IMPACT.md +456 -456
  11. package/.codebase/README.md +139 -139
  12. package/.codebase/RECOVERY_POINTS.md +83 -438
  13. package/.codebase/beads.json +16 -0
  14. package/.codex/skills/genesis-ai-provider/SKILL.md +1 -1
  15. package/.codex/skills/genesis-api-contract/SKILL.md +1 -1
  16. package/.codex/skills/genesis-api-sync/SKILL.md +354 -354
  17. package/.codex/skills/genesis-api-sync/checklists/api-sync-checklist.md +101 -101
  18. package/.codex/skills/genesis-api-sync/templates/api-change-template.md +257 -257
  19. package/.codex/skills/genesis-architecture/SKILL.md +1 -1
  20. package/.codex/skills/genesis-codebase-map/SKILL.md +1 -1
  21. package/.codex/skills/genesis-debug-guide/SKILL.md +479 -479
  22. package/.codex/skills/genesis-debug-guide/checklists/flaky-test-investigation.md +339 -339
  23. package/.codex/skills/genesis-debug-guide/checklists/production-bug-debug.md +210 -210
  24. package/.codex/skills/genesis-debug-guide/checklists/test-failure-debug.md +158 -158
  25. package/.codex/skills/genesis-debug-guide/observability/debug-commands.md +365 -365
  26. package/.codex/skills/genesis-debug-guide/playbooks/unit-test-failures.md +289 -289
  27. package/.codex/skills/genesis-debug-guide/templates/debug-investigation-log.md +288 -288
  28. package/.codex/skills/genesis-design-spec/SKILL.md +3 -3
  29. package/.codex/skills/genesis-docs-automation/SKILL.md +1003 -1003
  30. package/.codex/skills/genesis-docs-automation/checklists/docs-validation.md +359 -359
  31. package/.codex/skills/genesis-docs-automation/checklists/spec-alignment.md +312 -312
  32. package/.codex/skills/genesis-docs-automation/observability/docs-tracking.md +382 -382
  33. package/.codex/skills/genesis-docs-automation/playbooks/auto-update-flow.md +851 -851
  34. package/.codex/skills/genesis-docs-automation/playbooks/changelog-generation.md +491 -491
  35. package/.codex/skills/genesis-docs-automation/templates/changelog-entry-template.md +187 -187
  36. package/.codex/skills/genesis-docs-automation/templates/handoff-template.md +297 -297
  37. package/.codex/skills/genesis-harness/SKILL.md +1428 -1427
  38. package/.codex/skills/genesis-harness/agents/openai.yaml +7 -7
  39. package/.codex/skills/genesis-harness/checklists/bug-fix-qa.md +169 -169
  40. package/.codex/skills/genesis-harness/checklists/new-feature-qa.md +157 -157
  41. package/.codex/skills/genesis-harness/checklists/refactor-qa.md +216 -216
  42. package/.codex/skills/genesis-harness/checklists/requirements-validation.md +211 -211
  43. package/.codex/skills/genesis-harness/references/planning-schema.md +35 -35
  44. package/.codex/skills/genesis-harness/references/quality-rubric.md +21 -21
  45. package/.codex/skills/genesis-harness/references/research-rubric.md +41 -41
  46. package/.codex/skills/genesis-harness/references/workflows.md +33 -33
  47. package/.codex/skills/genesis-harness/resources/agents-template.md +27 -27
  48. package/.codex/skills/genesis-harness/resources/api-docs-template.md +32 -32
  49. package/.codex/skills/genesis-harness/resources/architecture-template.md +30 -30
  50. package/.codex/skills/genesis-harness/resources/audit-template.md +26 -26
  51. package/.codex/skills/genesis-harness/resources/bug-template.md +34 -34
  52. package/.codex/skills/genesis-harness/resources/change-impact-matrix-template.md +204 -204
  53. package/.codex/skills/genesis-harness/resources/check-template.md +21 -21
  54. package/.codex/skills/genesis-harness/resources/conventions-template.md +42 -42
  55. package/.codex/skills/genesis-harness/resources/decision-template.md +33 -33
  56. package/.codex/skills/genesis-harness/resources/design-template.md +26 -26
  57. package/.codex/skills/genesis-harness/resources/escalation-template.md +21 -21
  58. package/.codex/skills/genesis-harness/resources/feature-template.md +49 -49
  59. package/.codex/skills/genesis-harness/resources/foundation-phase-template.md +131 -131
  60. package/.codex/skills/genesis-harness/resources/integrations-template.md +32 -32
  61. package/.codex/skills/genesis-harness/resources/journeys-template.md +13 -13
  62. package/.codex/skills/genesis-harness/resources/lessons-learned-template.md +12 -12
  63. package/.codex/skills/genesis-harness/resources/observability-template.md +34 -34
  64. package/.codex/skills/genesis-harness/resources/phase-00-foundation-template.md +76 -76
  65. package/.codex/skills/genesis-harness/resources/phase-template.md +34 -34
  66. package/.codex/skills/genesis-harness/resources/pitfalls-template.md +22 -22
  67. package/.codex/skills/genesis-harness/resources/planning-tree-template.md +39 -39
  68. package/.codex/skills/genesis-harness/resources/post-implementation-guide.md +347 -347
  69. package/.codex/skills/genesis-harness/resources/project-template.md +38 -38
  70. package/.codex/skills/genesis-harness/resources/quality-score-template.md +11 -11
  71. package/.codex/skills/genesis-harness/resources/requirements-template.md +26 -26
  72. package/.codex/skills/genesis-harness/resources/research-template.md +26 -26
  73. package/.codex/skills/genesis-harness/resources/review-template.md +22 -22
  74. package/.codex/skills/genesis-harness/resources/spec-changelog-template.md +6 -6
  75. package/.codex/skills/genesis-harness/resources/stack-template.md +33 -33
  76. package/.codex/skills/genesis-harness/resources/verification-template.md +26 -26
  77. package/.codex/skills/genesis-harness/scripts/check-architecture-boundaries.sh +0 -0
  78. package/.codex/skills/genesis-harness/scripts/check-docs-sync.sh +0 -0
  79. package/.codex/skills/genesis-harness/scripts/check-no-debug-logs.sh +0 -0
  80. package/.codex/skills/genesis-harness/scripts/check-required-planning-files.sh +0 -0
  81. package/.codex/skills/genesis-harness/scripts/check-spec-changelog.sh +0 -0
  82. package/.codex/skills/genesis-harness/scripts/check-task-tracking.sh +0 -0
  83. package/.codex/skills/genesis-harness/scripts/compact-context.sh +0 -0
  84. package/.codex/skills/genesis-harness/scripts/create-adr.sh +0 -0
  85. package/.codex/skills/genesis-harness/scripts/create-bug.sh +0 -0
  86. package/.codex/skills/genesis-harness/scripts/create-feature.sh +0 -0
  87. package/.codex/skills/genesis-harness/scripts/detect-stack.sh +0 -0
  88. package/.codex/skills/genesis-harness/scripts/init-planning.sh +0 -0
  89. package/.codex/skills/genesis-harness/scripts/list-changed-files.sh +0 -0
  90. package/.codex/skills/genesis-harness/scripts/offload-log.sh +0 -0
  91. package/.codex/skills/genesis-harness/scripts/run-verification.sh +0 -0
  92. package/.codex/skills/genesis-harness/scripts/run-verify-loop.sh +0 -0
  93. package/.codex/skills/genesis-harness/scripts/update-state.sh +0 -0
  94. package/.codex/skills/genesis-harness-engineering/SKILL.md +1 -1
  95. package/.codex/skills/genesis-new-design/SKILL.md +2 -1
  96. package/.codex/skills/genesis-new-design/agents/openai.yaml +3 -3
  97. package/.codex/skills/genesis-observability-automation/checklists/.gitkeep +0 -0
  98. package/.codex/skills/genesis-observability-automation/observability/.gitkeep +0 -0
  99. package/.codex/skills/genesis-observability-automation/playbooks/.gitkeep +0 -0
  100. package/.codex/skills/genesis-observability-automation/templates/.gitkeep +0 -0
  101. package/.codex/skills/genesis-pipeline-orchestration/SKILL.md +1 -1
  102. package/.codex/skills/genesis-planning/SKILL.md +26 -1
  103. package/.codex/skills/genesis-planning/checklists/mvp-readiness.md +18 -0
  104. package/.codex/skills/genesis-planning/examples/5-phase-roadmap-example.md +43 -0
  105. package/.codex/skills/genesis-planning/templates/phase-1-core.md +17 -0
  106. package/.codex/skills/genesis-planning/templates/phase-2-auth.md +17 -0
  107. package/.codex/skills/genesis-planning/templates/phase-3-features.md +17 -0
  108. package/.codex/skills/genesis-planning/templates/phase-4-integrations.md +17 -0
  109. package/.codex/skills/genesis-planning/templates/phase-5-readiness.md +17 -0
  110. package/.codex/skills/genesis-release/SKILL.md +24 -1
  111. package/.codex/skills/{genesis-release-orchestration → genesis-release}/checklists/post-deployment-verification.md +274 -274
  112. package/.codex/skills/{genesis-release-orchestration → genesis-release}/checklists/pre-release-validation.md +220 -220
  113. package/.codex/skills/{genesis-release-orchestration → genesis-release}/observability/release-tracking.md +253 -253
  114. package/.codex/skills/{genesis-release-orchestration → genesis-release}/playbooks/canary-deployment-orchestration.md +472 -472
  115. package/.codex/skills/{genesis-release-orchestration → genesis-release}/playbooks/semantic-versioning-automation.md +494 -494
  116. package/.codex/skills/{genesis-release-orchestration → genesis-release}/templates/deployment-strategy-template.md +303 -303
  117. package/.codex/skills/{genesis-release-orchestration → genesis-release}/templates/release-runbook-template.md +420 -420
  118. package/.codex/skills/genesis-research-first/SKILL.md +237 -237
  119. package/.codex/skills/genesis-research-first/templates/.gitkeep +0 -0
  120. package/.codex/skills/genesis-spec-propagation/SKILL.md +534 -534
  121. package/.codex/skills/genesis-spec-propagation/checklists/phase-update-verification.md +384 -384
  122. package/.codex/skills/genesis-spec-propagation/checklists/spec-change-detection.md +257 -257
  123. package/.codex/skills/genesis-spec-propagation/observability/propagation-tracking.md +373 -373
  124. package/.codex/skills/genesis-spec-propagation/playbooks/breaking-change-propagation.md +692 -692
  125. package/.codex/skills/genesis-spec-propagation/playbooks/feature-change-propagation.md +434 -434
  126. package/.codex/skills/genesis-spec-propagation/templates/migration-guide-template.md +407 -407
  127. package/.codex/skills/{ui-ux-test-skill → genesis-ui-ux-test}/SKILL.md +1 -1
  128. package/.codex/skills/genesis-upgrade-design/agents/openai.yaml +3 -3
  129. package/.codex/skills/spec-impact-engine/SKILL.md +504 -504
  130. package/.codex/skills/spec-impact-engine/detect-spec-changes.sh +0 -0
  131. package/.codex-plugin/plugin.json +19 -19
  132. package/CHANGELOG.md +56 -0
  133. package/LICENSE +22 -22
  134. package/README.EN.md +780 -730
  135. package/README.VI.md +772 -723
  136. package/README.md +102 -247
  137. package/VERSION +2 -2
  138. package/bin/genesis-harness.js +695 -92
  139. package/package.json +9 -3
  140. package/scripts/README.md +342 -342
  141. package/scripts/compact-context.sh +0 -0
  142. package/scripts/contract_integrity_gate.js +83 -0
  143. package/scripts/detect-changes.sh +0 -0
  144. package/scripts/healing_telemetry.js +118 -0
  145. package/scripts/install.sh +5 -6
  146. package/scripts/offload-log.sh +0 -0
  147. package/scripts/prompt_sentinel.js +84 -0
  148. package/scripts/run-evals.sh +20 -24
  149. package/scripts/run-verify-loop.sh +11 -0
  150. package/scripts/spec_visual_sync.js +157 -0
  151. package/scripts/test_generator.js +142 -0
  152. package/scripts/transition_state.sh +0 -0
  153. package/scripts/uninstall.sh +2 -5
  154. package/scripts/validation_gates.sh +40 -1
  155. package/scripts/verify.sh +6 -61
  156. package/tests/unit/contract_integrity_gate.test.js +74 -0
  157. package/tests/unit/healing_telemetry.test.js +58 -0
  158. package/tests/unit/prompt_sentinel.test.js +50 -0
  159. package/tests/unit/spec_visual_sync.test.js +77 -0
  160. package/tests/unit/test_generator.test.js +62 -0
  161. package/.codex/skills/genesis-docs/SKILL.md +0 -46
  162. package/.codex/skills/genesis-docs/agents/openai.yaml +0 -7
  163. package/.codex/skills/genesis-release-orchestration/SKILL.md +0 -653
  164. package/.codex/skills/genesis-release-orchestration/agents/openai.yaml +0 -7
  165. package/.codex/skills/genesis-research/SKILL.md +0 -46
  166. package/.codex/skills/genesis-research/agents/openai.yaml +0 -7
  167. /package/.codex/skills/{genesis-docs/checklists/checklist.md → genesis-docs-automation/checklists/manual-docs-checklist.md} +0 -0
  168. /package/.codex/skills/{genesis-docs/examples/example.md → genesis-docs-automation/examples/manual-docs-example.md} +0 -0
  169. /package/.codex/skills/{genesis-docs → genesis-docs-automation}/templates/docs-update-template.md +0 -0
  170. /package/.codex/skills/{genesis-state-machine/SKILL.md → genesis-harness/references/state-machine.md} +0 -0
  171. /package/.codex/skills/{genesis-release-orchestration/examples/example.md → genesis-release/examples/orchestration-example.md} +0 -0
  172. /package/.codex/skills/{genesis-research → genesis-research-first}/checklists/checklist.md +0 -0
  173. /package/.codex/skills/{genesis-research/examples/example.md → genesis-research-first/examples/manual-research-example.md} +0 -0
  174. /package/.codex/skills/{genesis-research → genesis-research-first}/templates/research-note-template.md +0 -0
  175. /package/.codex/skills/{ui-ux-test-skill → genesis-ui-ux-test}/agents/openai.yaml +0 -0
  176. /package/.codex/skills/{ui-ux-test-skill → genesis-ui-ux-test}/checklists/checklist.md +0 -0
  177. /package/.codex/skills/{ui-ux-test-skill → genesis-ui-ux-test}/examples/example.md +0 -0
  178. /package/.codex/skills/{ui-ux-test-skill → genesis-ui-ux-test}/templates/playwright-test-template.md +0 -0
@@ -1,354 +1,354 @@
1
- ---
2
- name: api-sync-skill
3
- description: Automatic API contract synchronization. Detects API changes in implementation, updates API_CONTRACTS.md, regenerates test contracts, and maintains backward compatibility documentation. Use after API-related implementation or when contracts drift from actual code.
4
- ---
5
-
6
- # API Sync Skill
7
-
8
- ## Purpose
9
-
10
- Keep API contracts synchronized with actual implementation. Detect changes, update contracts, regenerate tests, and document breaking changes automatically.
11
-
12
- ## When to use
13
-
14
- Use after API-related implementation when:
15
- - New endpoints added
16
- - Endpoint behavior changed
17
- - Request/response schemas modified
18
- - Error handling updated
19
- - Authentication/authorization changed
20
- - Deprecated endpoints need removal
21
-
22
- ## When NOT to use
23
-
24
- Do not use for read-only API documentation or when contract-first design hasn't been completed yet.
25
-
26
- ## Inputs required
27
-
28
- - Changed implementation files (API routes, controllers, handlers)
29
- - Current API_CONTRACTS.md file
30
- - Test suite location
31
- - Breaking change impact assessment
32
-
33
- ## Outputs required
34
-
35
- - Updated API_CONTRACTS.md with all changes
36
- - Updated API test contracts
37
- - Test code reflecting new contracts
38
- - Migration guide for breaking changes (if applicable)
39
- - Backward compatibility documentation
40
-
41
- ## Required tests
42
-
43
- - Contract validation tests (request/response schemas)
44
- - API integration tests updated
45
- - Backward compatibility tests (if versioning)
46
- - Error handling tests
47
-
48
- ## Required fixtures
49
-
50
- - Updated endpoint fixtures
51
- - Request/response examples
52
- - Error scenario fixtures
53
- - Edge case payloads
54
-
55
- ## Required contract updates
56
-
57
- - API_CONTRACTS.md (primary)
58
- - Versioning info (if breaking changes)
59
- - Deprecation notices (if applicable)
60
- - Migration guide (if breaking changes)
61
-
62
- ## Required codebase map updates
63
-
64
- - `.codebase/API_CONTRACTS.md` - complete update
65
- - `.codebase/CURRENT_STATE.md` - note API changes
66
- - `.codebase/KNOWN_PROBLEMS.md` - document migration issues
67
- - `.codebase/EVOLUTION_PLAN.md` - next API phases
68
-
69
- ## Token saving rules
70
-
71
- Extract schemas programmatically; don't paste entire files. Focus on deltas from previous contracts. Link to test fixtures rather than duplicating examples.
72
-
73
- ## Acceptance criteria
74
-
75
- - API contracts match actual implementation
76
- - All endpoints documented with schemas
77
- - Breaking changes clearly marked
78
- - Test contracts generated and passing
79
- - Migration paths documented for breaking changes
80
- - No contract drift validation passing
81
-
82
- ## Common mistakes
83
-
84
- - Skipping breaking change documentation
85
- - Not updating test contracts in parallel
86
- - Leaving old endpoints undocumented
87
- - Forgetting error response contracts
88
- - Not validating backward compatibility
89
-
90
- ## Recovery workflow
91
-
92
- If contracts drift or sync fails:
93
- 1. Read current API_CONTRACTS.md
94
- 2. Extract actual endpoint schemas from implementation
95
- 3. Identify changes and breaking status
96
- 4. Update contracts with full changelog
97
- 5. Regenerate test contracts
98
- 6. Validate all tests pass
99
- 7. Document migration guide if needed
100
-
101
- ---
102
-
103
- ## Workflow: API Change Detection & Sync
104
-
105
- ### Step 1: Detect API Changes
106
-
107
- Identify which files contain API code:
108
-
109
- ```
110
- Scan for:
111
- ├─ src/api/**
112
- ├─ src/**/route.ts, routes.ts
113
- ├─ src/**/controller.ts
114
- ├─ src/**/endpoint.ts
115
- └─ src/**/handler.ts
116
- ```
117
-
118
- For each file, extract:
119
- - HTTP method (GET, POST, PUT, DELETE, PATCH)
120
- - Route/path
121
- - Request schema (params, query, body)
122
- - Response schema (success, error)
123
- - Status codes
124
- - Authentication requirements
125
- - Rate limiting or other middleware
126
-
127
- ### Step 2: Compare Against Current Contract
128
-
129
- ```
130
- For each endpoint:
131
- New? → Add to contract
132
- Modified? → Mark change and version
133
- Deleted? → Mark as deprecated
134
- Unchanged? → Keep as-is
135
- ```
136
-
137
- ### Step 3: Generate Updated Contracts
138
-
139
- ```json
140
- {
141
- "endpoints": [
142
- {
143
- "id": "endpoint-id",
144
- "method": "POST",
145
- "path": "/api/v1/resource",
146
- "description": "Create a new resource",
147
- "version": "1.0",
148
- "breaking_changes_from": [],
149
- "request": {
150
- "body": { /* schema */ },
151
- "query": { /* schema */ },
152
- "headers": { /* required headers */ }
153
- },
154
- "responses": {
155
- "200": { /* success schema */ },
156
- "400": { /* error schema */ },
157
- "401": { /* auth error */ }
158
- },
159
- "auth_required": true,
160
- "rate_limit": "100/hour"
161
- }
162
- ]
163
- }
164
- ```
165
-
166
- ### Step 4: Mark Breaking Changes
167
-
168
- If changes break existing clients:
169
-
170
- ```markdown
171
- ## Breaking Changes in v2.0
172
-
173
- ### Changed: POST /api/v1/resource
174
- - Old: Returns `id`, `name`, `created_at`
175
- - New: Returns `resourceId`, `title`, `timestamp`
176
- - Impact: Clients expecting `id` field will break
177
- - Migration: Map `resourceId` → `id` in client code
178
- - Deadline: Migrate by [date], v1 endpoints removed [date]
179
- ```
180
-
181
- ### Step 5: Generate Test Contracts
182
-
183
- Automatically create test schemas:
184
-
185
- ```javascript
186
- // tests/contracts/api.test.ts
187
- import { apiContracts } from '.codebase/API_CONTRACTS.md'
188
-
189
- describe('API Contracts', () => {
190
- apiContracts.endpoints.forEach(endpoint => {
191
- it(`${endpoint.method} ${endpoint.path}`, async () => {
192
- const response = await request(endpoint.method, endpoint.path)
193
- validateSchema(response, endpoint.responses)
194
- })
195
- })
196
- })
197
- ```
198
-
199
- ### Step 6: Document Migration Path
200
-
201
- If breaking changes exist:
202
-
203
- ```markdown
204
- ## Migration Guide
205
-
206
- ### From v1.0 → v2.0
207
-
208
- #### Step 1: Update request payloads
209
- ```
210
- // OLD
211
- POST /api/v1/resource
212
- { "name": "Test" }
213
-
214
- // NEW
215
- POST /api/v2/resource
216
- { "title": "Test" }
217
- ```
218
-
219
- #### Step 2: Update response parsing
220
- ```
221
- // OLD
222
- const id = data.id
223
-
224
- // NEW
225
- const id = data.resourceId
226
- ```
227
-
228
- #### Step 3: Timeline
229
- - June 1: v2 available alongside v1
230
- - July 1: Clients should migrate
231
- - August 1: v1 endpoints deprecated
232
- - September 1: v1 endpoints removed
233
- ```
234
-
235
- ---
236
-
237
- ## Usage in Workflow
238
-
239
- ### During Feature Implementation
240
-
241
- ```bash
242
- # 1. Implement API changes
243
- # 2. Write tests with new contract
244
- # 3. Run tests - should pass
245
-
246
- # 4. After tests pass, sync contracts:
247
- invoke api-sync-skill
248
-
249
- # Parameters:
250
- - changed_files: ["src/api/users.ts", "src/routes/auth.ts"]
251
- - contract_file: ".codebase/API_CONTRACTS.md"
252
- - breaking_changes: true/false
253
- - version_bump: "major/minor/patch"
254
- ```
255
-
256
- ### After Sync Completed
257
-
258
- ```
259
- ✓ API_CONTRACTS.md updated
260
- ✓ Breaking changes documented
261
- ✓ Test contracts generated
262
- ✓ Migration guide created
263
- ✓ All tests still passing
264
-
265
- → Ready to merge
266
- ```
267
-
268
- ---
269
-
270
- ## Skills Integration
271
-
272
- Works alongside:
273
- - **planning-skill**: Captures API requirements in plan
274
- - **api-contract-skill**: Defines contracts before implementation
275
- - **design-spec-skill**: Documents API design decisions
276
- - **docs-skill**: Updates README and API docs
277
-
278
- ---
279
-
280
- ## Common Patterns
281
-
282
- ### Pattern: API Versioning
283
-
284
- ```
285
- OLD (v1)
286
- GET /api/users
287
-
288
- NEW (v2)
289
- GET /api/v2/users
290
-
291
- Contract update:
292
- - Keep v1 endpoint
293
- - Mark as deprecated
294
- - Point to v2 docs
295
- - Set removal date
296
- ```
297
-
298
- ### Pattern: Endpoint Evolution
299
-
300
- ```
301
- Phase 1: New parameter added
302
- POST /api/resource → POST /api/resource?newParam=true
303
- Contract: Mark parameter as optional
304
-
305
- Phase 2: Parameter required
306
- POST /api/resource?newParam=true
307
- Contract: Mark parameter as required
308
-
309
- Phase 3: Old behavior removed
310
- POST /api/resource → now requires newParam
311
- Contract: Break version, update contract
312
-
313
- Clients get: 2 quarters to migrate
314
- ```
315
-
316
- ### Pattern: Error Code Addition
317
-
318
- ```
319
- OLD
320
- POST /api/payment
321
- Error: 400 Bad Request
322
-
323
- NEW
324
- POST /api/payment
325
- Errors:
326
- - 400 Bad Request
327
- - 402 Payment Required (NEW)
328
- - 429 Too Many Requests (NEW)
329
-
330
- Contract: Document all codes with examples
331
- ```
332
-
333
- ---
334
-
335
- ## Acceptance Checklist
336
-
337
- - [ ] All endpoints extracted from code
338
- - [ ] Request/response schemas defined
339
- - [ ] HTTP methods correct
340
- - [ ] Status codes complete
341
- - [ ] Auth requirements documented
342
- - [ ] Breaking changes identified and marked
343
- - [ ] Test contracts generated
344
- - [ ] All API tests passing
345
- - [ ] Migration guide created (if needed)
346
- - [ ] `.codebase/API_CONTRACTS.md` updated
347
- - [ ] Documentation updated
348
- - [ ] Version number incremented
349
-
350
- ---
351
-
352
- **Last Updated**: 2026-05-30
353
- **Maintained By**: Genesis Harness Team
354
- **Version**: 1.0
1
+ ---
2
+ name: genesis-api-sync
3
+ description: Automatic API contract synchronization. Detects API changes in implementation, updates API_CONTRACTS.md, regenerates test contracts, and maintains backward compatibility documentation. Use after API-related implementation or when contracts drift from actual code.
4
+ ---
5
+
6
+ # API Sync Skill
7
+
8
+ ## Purpose
9
+
10
+ Keep API contracts synchronized with actual implementation. Detect changes, update contracts, regenerate tests, and document breaking changes automatically.
11
+
12
+ ## When to use
13
+
14
+ Use after API-related implementation when:
15
+ - New endpoints added
16
+ - Endpoint behavior changed
17
+ - Request/response schemas modified
18
+ - Error handling updated
19
+ - Authentication/authorization changed
20
+ - Deprecated endpoints need removal
21
+
22
+ ## When NOT to use
23
+
24
+ Do not use for read-only API documentation or when contract-first design hasn't been completed yet.
25
+
26
+ ## Inputs required
27
+
28
+ - Changed implementation files (API routes, controllers, handlers)
29
+ - Current API_CONTRACTS.md file
30
+ - Test suite location
31
+ - Breaking change impact assessment
32
+
33
+ ## Outputs required
34
+
35
+ - Updated API_CONTRACTS.md with all changes
36
+ - Updated API test contracts
37
+ - Test code reflecting new contracts
38
+ - Migration guide for breaking changes (if applicable)
39
+ - Backward compatibility documentation
40
+
41
+ ## Required tests
42
+
43
+ - Contract validation tests (request/response schemas)
44
+ - API integration tests updated
45
+ - Backward compatibility tests (if versioning)
46
+ - Error handling tests
47
+
48
+ ## Required fixtures
49
+
50
+ - Updated endpoint fixtures
51
+ - Request/response examples
52
+ - Error scenario fixtures
53
+ - Edge case payloads
54
+
55
+ ## Required contract updates
56
+
57
+ - API_CONTRACTS.md (primary)
58
+ - Versioning info (if breaking changes)
59
+ - Deprecation notices (if applicable)
60
+ - Migration guide (if breaking changes)
61
+
62
+ ## Required codebase map updates
63
+
64
+ - `.codebase/API_CONTRACTS.md` - complete update
65
+ - `.codebase/CURRENT_STATE.md` - note API changes
66
+ - `.codebase/KNOWN_PROBLEMS.md` - document migration issues
67
+ - `.codebase/EVOLUTION_PLAN.md` - next API phases
68
+
69
+ ## Token saving rules
70
+
71
+ Extract schemas programmatically; don't paste entire files. Focus on deltas from previous contracts. Link to test fixtures rather than duplicating examples.
72
+
73
+ ## Acceptance criteria
74
+
75
+ - API contracts match actual implementation
76
+ - All endpoints documented with schemas
77
+ - Breaking changes clearly marked
78
+ - Test contracts generated and passing
79
+ - Migration paths documented for breaking changes
80
+ - No contract drift validation passing
81
+
82
+ ## Common mistakes
83
+
84
+ - Skipping breaking change documentation
85
+ - Not updating test contracts in parallel
86
+ - Leaving old endpoints undocumented
87
+ - Forgetting error response contracts
88
+ - Not validating backward compatibility
89
+
90
+ ## Recovery workflow
91
+
92
+ If contracts drift or sync fails:
93
+ 1. Read current API_CONTRACTS.md
94
+ 2. Extract actual endpoint schemas from implementation
95
+ 3. Identify changes and breaking status
96
+ 4. Update contracts with full changelog
97
+ 5. Regenerate test contracts
98
+ 6. Validate all tests pass
99
+ 7. Document migration guide if needed
100
+
101
+ ---
102
+
103
+ ## Workflow: API Change Detection & Sync
104
+
105
+ ### Step 1: Detect API Changes
106
+
107
+ Identify which files contain API code:
108
+
109
+ ```
110
+ Scan for:
111
+ ├─ src/api/**
112
+ ├─ src/**/route.ts, routes.ts
113
+ ├─ src/**/controller.ts
114
+ ├─ src/**/endpoint.ts
115
+ └─ src/**/handler.ts
116
+ ```
117
+
118
+ For each file, extract:
119
+ - HTTP method (GET, POST, PUT, DELETE, PATCH)
120
+ - Route/path
121
+ - Request schema (params, query, body)
122
+ - Response schema (success, error)
123
+ - Status codes
124
+ - Authentication requirements
125
+ - Rate limiting or other middleware
126
+
127
+ ### Step 2: Compare Against Current Contract
128
+
129
+ ```
130
+ For each endpoint:
131
+ New? → Add to contract
132
+ Modified? → Mark change and version
133
+ Deleted? → Mark as deprecated
134
+ Unchanged? → Keep as-is
135
+ ```
136
+
137
+ ### Step 3: Generate Updated Contracts
138
+
139
+ ```json
140
+ {
141
+ "endpoints": [
142
+ {
143
+ "id": "endpoint-id",
144
+ "method": "POST",
145
+ "path": "/api/v1/resource",
146
+ "description": "Create a new resource",
147
+ "version": "1.0",
148
+ "breaking_changes_from": [],
149
+ "request": {
150
+ "body": { /* schema */ },
151
+ "query": { /* schema */ },
152
+ "headers": { /* required headers */ }
153
+ },
154
+ "responses": {
155
+ "200": { /* success schema */ },
156
+ "400": { /* error schema */ },
157
+ "401": { /* auth error */ }
158
+ },
159
+ "auth_required": true,
160
+ "rate_limit": "100/hour"
161
+ }
162
+ ]
163
+ }
164
+ ```
165
+
166
+ ### Step 4: Mark Breaking Changes
167
+
168
+ If changes break existing clients:
169
+
170
+ ```markdown
171
+ ## Breaking Changes in v2.0
172
+
173
+ ### Changed: POST /api/v1/resource
174
+ - Old: Returns `id`, `name`, `created_at`
175
+ - New: Returns `resourceId`, `title`, `timestamp`
176
+ - Impact: Clients expecting `id` field will break
177
+ - Migration: Map `resourceId` → `id` in client code
178
+ - Deadline: Migrate by [date], v1 endpoints removed [date]
179
+ ```
180
+
181
+ ### Step 5: Generate Test Contracts
182
+
183
+ Automatically create test schemas:
184
+
185
+ ```javascript
186
+ // tests/contracts/api.test.ts
187
+ import { apiContracts } from '.codebase/API_CONTRACTS.md'
188
+
189
+ describe('API Contracts', () => {
190
+ apiContracts.endpoints.forEach(endpoint => {
191
+ it(`${endpoint.method} ${endpoint.path}`, async () => {
192
+ const response = await request(endpoint.method, endpoint.path)
193
+ validateSchema(response, endpoint.responses)
194
+ })
195
+ })
196
+ })
197
+ ```
198
+
199
+ ### Step 6: Document Migration Path
200
+
201
+ If breaking changes exist:
202
+
203
+ ```markdown
204
+ ## Migration Guide
205
+
206
+ ### From v1.0 → v2.0
207
+
208
+ #### Step 1: Update request payloads
209
+ ```
210
+ // OLD
211
+ POST /api/v1/resource
212
+ { "name": "Test" }
213
+
214
+ // NEW
215
+ POST /api/v2/resource
216
+ { "title": "Test" }
217
+ ```
218
+
219
+ #### Step 2: Update response parsing
220
+ ```
221
+ // OLD
222
+ const id = data.id
223
+
224
+ // NEW
225
+ const id = data.resourceId
226
+ ```
227
+
228
+ #### Step 3: Timeline
229
+ - June 1: v2 available alongside v1
230
+ - July 1: Clients should migrate
231
+ - August 1: v1 endpoints deprecated
232
+ - September 1: v1 endpoints removed
233
+ ```
234
+
235
+ ---
236
+
237
+ ## Usage in Workflow
238
+
239
+ ### During Feature Implementation
240
+
241
+ ```bash
242
+ # 1. Implement API changes
243
+ # 2. Write tests with new contract
244
+ # 3. Run tests - should pass
245
+
246
+ # 4. After tests pass, sync contracts:
247
+ invoke api-sync-skill
248
+
249
+ # Parameters:
250
+ - changed_files: ["src/api/users.ts", "src/routes/auth.ts"]
251
+ - contract_file: ".codebase/API_CONTRACTS.md"
252
+ - breaking_changes: true/false
253
+ - version_bump: "major/minor/patch"
254
+ ```
255
+
256
+ ### After Sync Completed
257
+
258
+ ```
259
+ ✓ API_CONTRACTS.md updated
260
+ ✓ Breaking changes documented
261
+ ✓ Test contracts generated
262
+ ✓ Migration guide created
263
+ ✓ All tests still passing
264
+
265
+ → Ready to merge
266
+ ```
267
+
268
+ ---
269
+
270
+ ## Skills Integration
271
+
272
+ Works alongside:
273
+ - **planning-skill**: Captures API requirements in plan
274
+ - **api-contract-skill**: Defines contracts before implementation
275
+ - **design-spec-skill**: Documents API design decisions
276
+ - **docs-skill**: Updates README and API docs
277
+
278
+ ---
279
+
280
+ ## Common Patterns
281
+
282
+ ### Pattern: API Versioning
283
+
284
+ ```
285
+ OLD (v1)
286
+ GET /api/users
287
+
288
+ NEW (v2)
289
+ GET /api/v2/users
290
+
291
+ Contract update:
292
+ - Keep v1 endpoint
293
+ - Mark as deprecated
294
+ - Point to v2 docs
295
+ - Set removal date
296
+ ```
297
+
298
+ ### Pattern: Endpoint Evolution
299
+
300
+ ```
301
+ Phase 1: New parameter added
302
+ POST /api/resource → POST /api/resource?newParam=true
303
+ Contract: Mark parameter as optional
304
+
305
+ Phase 2: Parameter required
306
+ POST /api/resource?newParam=true
307
+ Contract: Mark parameter as required
308
+
309
+ Phase 3: Old behavior removed
310
+ POST /api/resource → now requires newParam
311
+ Contract: Break version, update contract
312
+
313
+ Clients get: 2 quarters to migrate
314
+ ```
315
+
316
+ ### Pattern: Error Code Addition
317
+
318
+ ```
319
+ OLD
320
+ POST /api/payment
321
+ Error: 400 Bad Request
322
+
323
+ NEW
324
+ POST /api/payment
325
+ Errors:
326
+ - 400 Bad Request
327
+ - 402 Payment Required (NEW)
328
+ - 429 Too Many Requests (NEW)
329
+
330
+ Contract: Document all codes with examples
331
+ ```
332
+
333
+ ---
334
+
335
+ ## Acceptance Checklist
336
+
337
+ - [ ] All endpoints extracted from code
338
+ - [ ] Request/response schemas defined
339
+ - [ ] HTTP methods correct
340
+ - [ ] Status codes complete
341
+ - [ ] Auth requirements documented
342
+ - [ ] Breaking changes identified and marked
343
+ - [ ] Test contracts generated
344
+ - [ ] All API tests passing
345
+ - [ ] Migration guide created (if needed)
346
+ - [ ] `.codebase/API_CONTRACTS.md` updated
347
+ - [ ] Documentation updated
348
+ - [ ] Version number incremented
349
+
350
+ ---
351
+
352
+ **Last Updated**: 2026-05-30
353
+ **Maintained By**: Genesis Harness Team
354
+ **Version**: 1.0