@nextsparkjs/ai-workflow 0.1.0-beta.100

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 (272) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +115 -0
  3. package/claude/_docs/workflows-optimizations.md +359 -0
  4. package/claude/agents/api-tester.md +634 -0
  5. package/claude/agents/architecture-supervisor.md +1351 -0
  6. package/claude/agents/backend-developer.md +997 -0
  7. package/claude/agents/backend-validator.md +417 -0
  8. package/claude/agents/bdd-docs-writer.md +737 -0
  9. package/claude/agents/block-developer.md +677 -0
  10. package/claude/agents/code-reviewer.md +1432 -0
  11. package/claude/agents/db-developer.md +721 -0
  12. package/claude/agents/db-validator.md +407 -0
  13. package/claude/agents/demo-video-generator.md +493 -0
  14. package/claude/agents/documentation-writer.md +1268 -0
  15. package/claude/agents/frontend-developer.md +1234 -0
  16. package/claude/agents/frontend-validator.md +777 -0
  17. package/claude/agents/functional-validator.md +630 -0
  18. package/claude/agents/mock-analyst.md +387 -0
  19. package/claude/agents/product-manager.md +963 -0
  20. package/claude/agents/qa-automation.md +1762 -0
  21. package/claude/agents/release-manager.md +634 -0
  22. package/claude/agents/selectors-translator.md +262 -0
  23. package/claude/agents/unit-test-writer.md +785 -0
  24. package/claude/agents/visual-comparator.md +329 -0
  25. package/claude/agents/workflow-maintainer.md +352 -0
  26. package/claude/commands/do/README.md +88 -0
  27. package/claude/commands/do/create-api.md +64 -0
  28. package/claude/commands/do/create-entity.md +66 -0
  29. package/claude/commands/do/create-migration.md +64 -0
  30. package/claude/commands/do/create-plugin.md +56 -0
  31. package/claude/commands/do/create-theme.md +70 -0
  32. package/claude/commands/do/mock-data.md +67 -0
  33. package/claude/commands/do/reset-db.md +71 -0
  34. package/claude/commands/do/setup-scheduled-action.md +75 -0
  35. package/claude/commands/do/sync-code-review.md +117 -0
  36. package/claude/commands/do/update-selectors.md +112 -0
  37. package/claude/commands/do/use-skills.md +90 -0
  38. package/claude/commands/do/validate-blocks.md +69 -0
  39. package/claude/commands/how-to/README.md +261 -0
  40. package/claude/commands/how-to/add-metadata.md +692 -0
  41. package/claude/commands/how-to/add-taxonomies.md +806 -0
  42. package/claude/commands/how-to/add-translations.md +571 -0
  43. package/claude/commands/how-to/create-api.md +577 -0
  44. package/claude/commands/how-to/create-block.md +575 -0
  45. package/claude/commands/how-to/create-child-entities.md +771 -0
  46. package/claude/commands/how-to/create-entity.md +597 -0
  47. package/claude/commands/how-to/create-migrations.md +605 -0
  48. package/claude/commands/how-to/create-plugin.md +654 -0
  49. package/claude/commands/how-to/customize-app.md +481 -0
  50. package/claude/commands/how-to/customize-dashboard.md +553 -0
  51. package/claude/commands/how-to/customize-theme.md +438 -0
  52. package/claude/commands/how-to/define-features-flows.md +632 -0
  53. package/claude/commands/how-to/deploy.md +507 -0
  54. package/claude/commands/how-to/handle-file-uploads.md +746 -0
  55. package/claude/commands/how-to/implement-search.md +1001 -0
  56. package/claude/commands/how-to/install-plugins.md +352 -0
  57. package/claude/commands/how-to/manage-test-coverage.md +984 -0
  58. package/claude/commands/how-to/run-tests.md +400 -0
  59. package/claude/commands/how-to/set-app-languages.md +601 -0
  60. package/claude/commands/how-to/set-plans-and-permissions.md +575 -0
  61. package/claude/commands/how-to/set-scheduled-actions.md +527 -0
  62. package/claude/commands/how-to/set-user-roles-and-permissions.md +550 -0
  63. package/claude/commands/how-to/setup-authentication.md +388 -0
  64. package/claude/commands/how-to/setup-claude-code.md +440 -0
  65. package/claude/commands/how-to/setup-database.md +274 -0
  66. package/claude/commands/how-to/setup-email-providers.md +598 -0
  67. package/claude/commands/how-to/setup-mobile-dev.md +627 -0
  68. package/claude/commands/how-to/start.md +500 -0
  69. package/claude/commands/how-to/use-devtools.md +639 -0
  70. package/claude/commands/how-to/use-superadmin.md +622 -0
  71. package/claude/commands/session/README.md +193 -0
  72. package/claude/commands/session/block-create.md +190 -0
  73. package/claude/commands/session/block-list.md +203 -0
  74. package/claude/commands/session/block-update.md +192 -0
  75. package/claude/commands/session/block-validate.md +218 -0
  76. package/claude/commands/session/changelog.md +115 -0
  77. package/claude/commands/session/close.md +225 -0
  78. package/claude/commands/session/commit.md +174 -0
  79. package/claude/commands/session/db-entity.md +206 -0
  80. package/claude/commands/session/db-fix.md +212 -0
  81. package/claude/commands/session/db-sample.md +206 -0
  82. package/claude/commands/session/demo.md +178 -0
  83. package/claude/commands/session/doc-bdd.md +207 -0
  84. package/claude/commands/session/doc-feature.md +218 -0
  85. package/claude/commands/session/doc-read.md +225 -0
  86. package/claude/commands/session/execute.md +204 -0
  87. package/claude/commands/session/explain.md +202 -0
  88. package/claude/commands/session/fix-bug.md +210 -0
  89. package/claude/commands/session/fix-build.md +182 -0
  90. package/claude/commands/session/fix-test.md +189 -0
  91. package/claude/commands/session/pending.md +232 -0
  92. package/claude/commands/session/refine.md +188 -0
  93. package/claude/commands/session/resume.md +192 -0
  94. package/claude/commands/session/review.md +192 -0
  95. package/claude/commands/session/scope-change.md +181 -0
  96. package/claude/commands/session/start-blocks.md +347 -0
  97. package/claude/commands/session/start.md +604 -0
  98. package/claude/commands/session/status.md +169 -0
  99. package/claude/commands/session/test-fix.md +221 -0
  100. package/claude/commands/session/test-run.md +203 -0
  101. package/claude/commands/session/test-write.md +242 -0
  102. package/claude/commands/session/validate.md +162 -0
  103. package/claude/config/context.json +40 -0
  104. package/claude/config/github.json +69 -0
  105. package/claude/config/github.schema.json +106 -0
  106. package/claude/config/team.json +46 -0
  107. package/claude/config/team.schema.json +106 -0
  108. package/claude/config/workspace.json +43 -0
  109. package/claude/config/workspace.schema.json +75 -0
  110. package/claude/skills/README.md +228 -0
  111. package/claude/skills/accessibility/SKILL.md +573 -0
  112. package/claude/skills/api-bypass-layers/SKILL.md +550 -0
  113. package/claude/skills/asana-integration/SKILL.md +499 -0
  114. package/claude/skills/better-auth/SKILL.md +666 -0
  115. package/claude/skills/billing-subscriptions/SKILL.md +660 -0
  116. package/claude/skills/block-decision-matrix/SKILL.md +359 -0
  117. package/claude/skills/clickup-integration/SKILL.md +434 -0
  118. package/claude/skills/core-theme-responsibilities/SKILL.md +485 -0
  119. package/claude/skills/create-plugin/SKILL.md +425 -0
  120. package/claude/skills/create-theme/SKILL.md +331 -0
  121. package/claude/skills/cypress-api/SKILL.md +511 -0
  122. package/claude/skills/cypress-api/scripts/generate-api-controller.py +329 -0
  123. package/claude/skills/cypress-api/scripts/generate-api-test.py +930 -0
  124. package/claude/skills/cypress-e2e/SKILL.md +526 -0
  125. package/claude/skills/cypress-e2e/scripts/extract-selectors.py +383 -0
  126. package/claude/skills/cypress-e2e/scripts/generate-uat-test.py +788 -0
  127. package/claude/skills/cypress-selectors/SKILL.md +309 -0
  128. package/claude/skills/cypress-selectors/scripts/extract-missing.py +243 -0
  129. package/claude/skills/cypress-selectors/scripts/generate-block-selectors.py +283 -0
  130. package/claude/skills/cypress-selectors/scripts/validate-selectors.py +145 -0
  131. package/claude/skills/database-migrations/SKILL.md +335 -0
  132. package/claude/skills/database-migrations/scripts/generate-sample-data.py +284 -0
  133. package/claude/skills/database-migrations/scripts/validate-migration.py +323 -0
  134. package/claude/skills/design-system/SKILL.md +682 -0
  135. package/claude/skills/documentation/SKILL.md +540 -0
  136. package/claude/skills/entity-api/SKILL.md +482 -0
  137. package/claude/skills/entity-system/SKILL.md +635 -0
  138. package/claude/skills/entity-system/scripts/generate-child-migration.py +298 -0
  139. package/claude/skills/entity-system/scripts/generate-metas-migration.py +233 -0
  140. package/claude/skills/entity-system/scripts/generate-migration.py +382 -0
  141. package/claude/skills/entity-system/scripts/generate-sample-data.py +418 -0
  142. package/claude/skills/entity-system/scripts/scaffold-entity.py +661 -0
  143. package/claude/skills/github/SKILL.md +467 -0
  144. package/claude/skills/i18n-nextintl/SKILL.md +302 -0
  145. package/claude/skills/i18n-nextintl/scripts/add-translation.py +243 -0
  146. package/claude/skills/i18n-nextintl/scripts/extract-hardcoded.py +246 -0
  147. package/claude/skills/i18n-nextintl/scripts/validate-translations.py +260 -0
  148. package/claude/skills/impact-analysis/SKILL.md +203 -0
  149. package/claude/skills/jest-unit/SKILL.md +306 -0
  150. package/claude/skills/jest-unit/references/component-testing.md +371 -0
  151. package/claude/skills/jest-unit/references/mocking-patterns.md +380 -0
  152. package/claude/skills/jest-unit/references/service-hook-testing.md +454 -0
  153. package/claude/skills/jira-integration/SKILL.md +539 -0
  154. package/claude/skills/media-library/SKILL.md +743 -0
  155. package/claude/skills/mock-analysis/SKILL.md +276 -0
  156. package/claude/skills/monorepo-architecture/SKILL.md +162 -0
  157. package/claude/skills/nextjs-api-development/SKILL.md +364 -0
  158. package/claude/skills/nextjs-api-development/scripts/generate-crud-tests.py +456 -0
  159. package/claude/skills/nextjs-api-development/scripts/scaffold-endpoint.py +481 -0
  160. package/claude/skills/nextjs-api-development/scripts/validate-api.py +283 -0
  161. package/claude/skills/notion-integration/SKILL.md +641 -0
  162. package/claude/skills/npm-development-workflow/SKILL.md +480 -0
  163. package/claude/skills/page-builder-blocks/SKILL.md +530 -0
  164. package/claude/skills/page-builder-blocks/scripts/scaffold-block.py +444 -0
  165. package/claude/skills/permissions-system/SKILL.md +619 -0
  166. package/claude/skills/plugins/SKILL.md +340 -0
  167. package/claude/skills/plugins/references/plugin-templates.md +414 -0
  168. package/claude/skills/plugins/references/plugin-testing.md +353 -0
  169. package/claude/skills/plugins/references/plugin-types.md +198 -0
  170. package/claude/skills/plugins/scripts/scaffold-plugin.py +443 -0
  171. package/claude/skills/pom-patterns/SKILL.md +452 -0
  172. package/claude/skills/pom-patterns/scripts/generate-pom.py +392 -0
  173. package/claude/skills/rate-limiting/SKILL.md +342 -0
  174. package/claude/skills/react-best-practices/AGENTS.md +2410 -0
  175. package/claude/skills/react-best-practices/README.md +123 -0
  176. package/claude/skills/react-best-practices/SKILL.md +125 -0
  177. package/claude/skills/react-best-practices/metadata.json +15 -0
  178. package/claude/skills/react-best-practices/rules/_sections.md +46 -0
  179. package/claude/skills/react-best-practices/rules/_template.md +28 -0
  180. package/claude/skills/react-best-practices/rules/advanced-event-handler-refs.md +55 -0
  181. package/claude/skills/react-best-practices/rules/advanced-use-latest.md +49 -0
  182. package/claude/skills/react-best-practices/rules/async-api-routes.md +38 -0
  183. package/claude/skills/react-best-practices/rules/async-defer-await.md +80 -0
  184. package/claude/skills/react-best-practices/rules/async-dependencies.md +36 -0
  185. package/claude/skills/react-best-practices/rules/async-parallel.md +28 -0
  186. package/claude/skills/react-best-practices/rules/async-suspense-boundaries.md +99 -0
  187. package/claude/skills/react-best-practices/rules/bundle-barrel-imports.md +59 -0
  188. package/claude/skills/react-best-practices/rules/bundle-conditional.md +31 -0
  189. package/claude/skills/react-best-practices/rules/bundle-defer-third-party.md +49 -0
  190. package/claude/skills/react-best-practices/rules/bundle-dynamic-imports.md +35 -0
  191. package/claude/skills/react-best-practices/rules/bundle-preload.md +50 -0
  192. package/claude/skills/react-best-practices/rules/client-event-listeners.md +74 -0
  193. package/claude/skills/react-best-practices/rules/client-localstorage-schema.md +71 -0
  194. package/claude/skills/react-best-practices/rules/client-passive-event-listeners.md +48 -0
  195. package/claude/skills/react-best-practices/rules/client-swr-dedup.md +56 -0
  196. package/claude/skills/react-best-practices/rules/js-batch-dom-css.md +82 -0
  197. package/claude/skills/react-best-practices/rules/js-cache-function-results.md +80 -0
  198. package/claude/skills/react-best-practices/rules/js-cache-property-access.md +28 -0
  199. package/claude/skills/react-best-practices/rules/js-cache-storage.md +70 -0
  200. package/claude/skills/react-best-practices/rules/js-combine-iterations.md +32 -0
  201. package/claude/skills/react-best-practices/rules/js-early-exit.md +50 -0
  202. package/claude/skills/react-best-practices/rules/js-hoist-regexp.md +45 -0
  203. package/claude/skills/react-best-practices/rules/js-index-maps.md +37 -0
  204. package/claude/skills/react-best-practices/rules/js-length-check-first.md +49 -0
  205. package/claude/skills/react-best-practices/rules/js-min-max-loop.md +82 -0
  206. package/claude/skills/react-best-practices/rules/js-set-map-lookups.md +24 -0
  207. package/claude/skills/react-best-practices/rules/js-tosorted-immutable.md +57 -0
  208. package/claude/skills/react-best-practices/rules/rendering-activity.md +26 -0
  209. package/claude/skills/react-best-practices/rules/rendering-animate-svg-wrapper.md +47 -0
  210. package/claude/skills/react-best-practices/rules/rendering-conditional-render.md +40 -0
  211. package/claude/skills/react-best-practices/rules/rendering-content-visibility.md +38 -0
  212. package/claude/skills/react-best-practices/rules/rendering-hoist-jsx.md +46 -0
  213. package/claude/skills/react-best-practices/rules/rendering-hydration-no-flicker.md +82 -0
  214. package/claude/skills/react-best-practices/rules/rendering-svg-precision.md +28 -0
  215. package/claude/skills/react-best-practices/rules/rerender-defer-reads.md +39 -0
  216. package/claude/skills/react-best-practices/rules/rerender-dependencies.md +45 -0
  217. package/claude/skills/react-best-practices/rules/rerender-derived-state.md +29 -0
  218. package/claude/skills/react-best-practices/rules/rerender-functional-setstate.md +74 -0
  219. package/claude/skills/react-best-practices/rules/rerender-lazy-state-init.md +58 -0
  220. package/claude/skills/react-best-practices/rules/rerender-memo.md +44 -0
  221. package/claude/skills/react-best-practices/rules/rerender-transitions.md +40 -0
  222. package/claude/skills/react-best-practices/rules/server-after-nonblocking.md +73 -0
  223. package/claude/skills/react-best-practices/rules/server-cache-lru.md +41 -0
  224. package/claude/skills/react-best-practices/rules/server-cache-react.md +76 -0
  225. package/claude/skills/react-best-practices/rules/server-parallel-fetching.md +83 -0
  226. package/claude/skills/react-best-practices/rules/server-serialization.md +38 -0
  227. package/claude/skills/react-patterns/SKILL.md +688 -0
  228. package/claude/skills/registry-system/SKILL.md +331 -0
  229. package/claude/skills/scheduled-actions/SKILL.md +671 -0
  230. package/claude/skills/scope-enforcement/SKILL.md +542 -0
  231. package/claude/skills/scope-enforcement/scripts/validate-scope.py +357 -0
  232. package/claude/skills/server-actions/SKILL.md +493 -0
  233. package/claude/skills/service-layer/SKILL.md +587 -0
  234. package/claude/skills/session-management/SKILL.md +266 -0
  235. package/claude/skills/session-management/scripts/create-session.py +166 -0
  236. package/claude/skills/session-management/scripts/iteration-close.sh +105 -0
  237. package/claude/skills/session-management/scripts/iteration-init.sh +180 -0
  238. package/claude/skills/session-management/scripts/session-archive.sh +87 -0
  239. package/claude/skills/session-management/scripts/session-close.sh +133 -0
  240. package/claude/skills/session-management/scripts/session-init.sh +225 -0
  241. package/claude/skills/session-management/scripts/session-list.sh +163 -0
  242. package/claude/skills/session-management/scripts/split-plan.sh +116 -0
  243. package/claude/skills/shadcn-components/SKILL.md +586 -0
  244. package/claude/skills/shadcn-theming/SKILL.md +446 -0
  245. package/claude/skills/suspense-loading/SKILL.md +280 -0
  246. package/claude/skills/tailwind-theming/SKILL.md +507 -0
  247. package/claude/skills/tanstack-query/SKILL.md +608 -0
  248. package/claude/skills/test-coverage/SKILL.md +239 -0
  249. package/claude/skills/web-design-guidelines/SKILL.md +39 -0
  250. package/claude/skills/zod-validation/SKILL.md +537 -0
  251. package/claude/templates/blocks/progress.md +86 -0
  252. package/claude/templates/iteration/changes.md +61 -0
  253. package/claude/templates/iteration/progress.md +55 -0
  254. package/claude/templates/log.md +31 -0
  255. package/claude/templates/story/context.md +77 -0
  256. package/claude/templates/story/pendings.md +37 -0
  257. package/claude/templates/story/plan.md +299 -0
  258. package/claude/templates/story/requirements.md +109 -0
  259. package/claude/templates/story/scope.json +10 -0
  260. package/claude/templates/story/tests.md +91 -0
  261. package/claude/templates/task/progress.md +58 -0
  262. package/claude/templates/task/requirements.md +54 -0
  263. package/claude/workflows/README.md +154 -0
  264. package/claude/workflows/blocks.md +614 -0
  265. package/claude/workflows/story.md +1207 -0
  266. package/claude/workflows/task.md +927 -0
  267. package/claude/workflows/tweak.md +527 -0
  268. package/cursor/.gitkeep +0 -0
  269. package/package.json +35 -0
  270. package/scripts/postinstall.mjs +198 -0
  271. package/scripts/setup.mjs +282 -0
  272. package/scripts/sync.mjs +209 -0
@@ -0,0 +1,485 @@
1
+ ---
2
+ name: core-theme-responsibilities
3
+ description: |
4
+ Core/Theme/Plugin responsibility assignment system for this application.
5
+ Covers dependency direction, responsibility assignment rules, common anti-patterns, and validation.
6
+ **CRITICAL SKILL** - Read before creating any technical plan involving core and theme/plugin interaction.
7
+ See also: `monorepo-architecture` skill for package distribution and dependency management.
8
+ allowed-tools: Read, Glob, Grep
9
+ version: 2.0.0
10
+ ---
11
+
12
+ # Core/Theme/Plugin Responsibilities Skill
13
+
14
+ Patterns for correctly assigning responsibilities between Core, Theme, and Plugin components.
15
+
16
+ ## The Fundamental Principle
17
+
18
+ **"CORE ORCHESTRATES, EXTENSIONS REGISTER"**
19
+
20
+ - **Core**: Provides mechanisms, initialization, processing, orchestration
21
+ - **Theme/Plugin**: Provides configuration, data, UI customization
22
+
23
+ ## Architecture Overview
24
+
25
+ ```
26
+ RESPONSIBILITY FLOW:
27
+
28
+ ┌─────────────────────────────────────────────────────────────────────────────┐
29
+ │ DEPENDENCY DIRECTION │
30
+ ├─────────────────────────────────────────────────────────────────────────────┤
31
+ │ │
32
+ │ ┌─────────────────────┐ │
33
+ │ │ CORE │ │
34
+ │ │ (Orchestration) │ │
35
+ │ │ - Initialization │ │
36
+ │ │ - Processing │ │
37
+ │ │ - Services │ │
38
+ │ │ - Types/Interfaces │ │
39
+ │ └──────────▲──────────┘ │
40
+ │ │ │
41
+ │ ┌────────────────┼────────────────┐ │
42
+ │ │ │ │ │
43
+ │ ▼ ▼ ▼ │
44
+ │ ┌─────────────┐ ┌─────────────┐ ┌─────────────┐ │
45
+ │ │ THEME │ │ PLUGIN │ │ PLUGIN │ │
46
+ │ │ (Data) │◄──│ (Data) │ │ (Data) │ │
47
+ │ │ - Config │ │ - Config │ │ - Config │ │
48
+ │ │ - Handlers │ │ - Handlers │ │ - Handlers │ │
49
+ │ │ - UI │ │ - Logic* │ │ - Logic* │ │
50
+ │ └─────────────┘ └─────────────┘ └─────────────┘ │
51
+ │ │
52
+ │ * Plugins can have self-contained logic that doesn't require Core import │
53
+ │ │
54
+ └─────────────────────────────────────────────────────────────────────────────┘
55
+
56
+ IMPORT RULES:
57
+
58
+ ✅ ALLOWED: ❌ PROHIBITED:
59
+ ───────────────────────────────────── ─────────────────────────────────
60
+ • Core → Core • Core → Theme
61
+ • Theme → Core • Core → Plugin
62
+ • Plugin → Core • Theme → other Theme
63
+ • Theme → Plugin
64
+ • Theme → same Theme
65
+ • Plugin → same Plugin
66
+ • Plugin → other Plugin (allowed!)
67
+ ```
68
+
69
+ ## When to Use This Skill
70
+
71
+ - **Planning new features** that span core and theme/plugin
72
+ - **Reviewing architectural plans** for responsibility assignment errors
73
+ - **Debugging import loops** caused by wrong responsibility placement
74
+ - **Creating extension systems** (scheduled actions, hooks, handlers)
75
+
76
+ ## Development Context Awareness
77
+
78
+ **CRITICAL:** Before applying patterns from this skill, check `.claude/config/context.json` to understand the development environment.
79
+
80
+ ### Context Detection
81
+
82
+ ```typescript
83
+ const context = await Read('.claude/config/context.json')
84
+
85
+ if (context.context === 'monorepo') {
86
+ // Full access to core/, themes/, plugins/
87
+ // You ARE developing the NextSpark framework
88
+ } else if (context.context === 'consumer') {
89
+ // Core is READ-ONLY (installed via npm)
90
+ // You are developing an APPLICATION using NextSpark
91
+ }
92
+ ```
93
+
94
+ ### Two Development Contexts
95
+
96
+ ```
97
+ ┌─────────────────────────────────────────────────────────────────┐
98
+ │ MONOREPO CONTEXT │
99
+ │ (Developing NextSpark Framework) │
100
+ ├─────────────────────────────────────────────────────────────────┤
101
+ │ • context.json: { "context": "monorepo" } │
102
+ │ • CAN create/modify in core/ │
103
+ │ • CAN create/modify in any theme │
104
+ │ • Focus: Abstract, reusable patterns for the platform │
105
+ │ • Examples: core/services/, core/migrations/, core/entities/ │
106
+ └─────────────────────────────────────────────────────────────────┘
107
+
108
+ ┌─────────────────────────────────────────────────────────────────┐
109
+ │ CONSUMER CONTEXT │
110
+ │ (Building App with NextSpark) │
111
+ ├─────────────────────────────────────────────────────────────────┤
112
+ │ • context.json: { "context": "consumer" } │
113
+ │ • Core is READ-ONLY (in node_modules/) │
114
+ │ • CAN ONLY create in active theme and plugins │
115
+ │ • Focus: Project-specific features │
116
+ │ • Examples: contents/themes/{theme}/services/ │
117
+ └─────────────────────────────────────────────────────────────────┘
118
+ ```
119
+
120
+ ### Path Translation Rules
121
+
122
+ When a skill or pattern shows a `core/` path, translate based on context:
123
+
124
+ | Pattern Shows | Monorepo Creates In | Consumer Creates In |
125
+ |---------------|--------------------|--------------------|
126
+ | `core/lib/services/` | `core/lib/services/` | `contents/themes/{theme}/services/` |
127
+ | `core/migrations/` | `core/migrations/` | `contents/themes/{theme}/migrations/` |
128
+ | `core/entities/` | `core/entities/` | `contents/themes/{theme}/entities/` |
129
+ | `core/components/` | `core/components/` | `contents/themes/{theme}/components/` |
130
+ | `core/hooks/` | `core/hooks/` | `contents/themes/{theme}/hooks/` |
131
+ | `core/lib/` | `core/lib/` | `contents/themes/{theme}/lib/` |
132
+
133
+ ### Consumer Context Rules
134
+
135
+ In consumer context (`context.context === "consumer"`):
136
+
137
+ 1. **Core is READ-ONLY** - Never attempt to create/modify in `core/`
138
+ 2. **Use existing core services** - Import and use, don't duplicate
139
+ 3. **Extend, don't replace** - Create theme-specific extensions
140
+ 4. **Theme migrations run after core** - Use sequence numbers 1001+
141
+
142
+ ### When Consumer Needs Core Functionality
143
+
144
+ If you discover that a feature truly requires core changes:
145
+
146
+ ```markdown
147
+ ## Core Enhancement Request
148
+
149
+ **Feature:** [What you need]
150
+ **Why Core:** [Why it can't be in theme]
151
+ **Proposed Solution:** [How core could support this]
152
+
153
+ **Workaround (if possible):**
154
+ [Temporary theme-based solution]
155
+ ```
156
+
157
+ Document this and either:
158
+ 1. Implement a workaround in theme
159
+ 2. Request the enhancement upstream to NextSpark
160
+
161
+ ---
162
+
163
+ ## Responsibility Assignment Rules
164
+
165
+ ### Quick Decision Table
166
+
167
+ | Question | Answer | Responsibility |
168
+ |----------|--------|----------------|
169
+ | Does Core need to call this function? | YES | **CORE** |
170
+ | Is it system initialization? | YES | **CORE** |
171
+ | Does it process data from multiple sources? | YES | **CORE** |
172
+ | Does it orchestrate a workflow? | YES | **CORE** |
173
+ | Does it define shared interfaces/types? | YES | **CORE** |
174
+ | Is it theme-specific configuration? | YES | **THEME** |
175
+ | Is it data for a registry? | YES | **THEME/PLUGIN** |
176
+ | Is it UI or visual components? | YES | **THEME** (or CORE base) |
177
+
178
+ ### Detailed Responsibility Matrix
179
+
180
+ | Functionality Type | Core | Theme | Plugin | Notes |
181
+ |--------------------|:----:|:-----:|:------:|-------|
182
+ | **Feature initialization** | ✅ | ❌ | ❌ | Core ALWAYS initializes |
183
+ | **Data processing** | ✅ | ❌ | ❌ | Core processes, extensions provide data |
184
+ | **Workflow orchestration** | ✅ | ❌ | ❌ | Core controls the flow |
185
+ | **Type/interface definitions** | ✅ | ❌ | ❌ | Contracts live in Core |
186
+ | **Services with business logic** | ✅ | ❌ | ⚠️ | Plugin only if self-contained |
187
+ | **Build scripts** | ✅ | ❌ | ❌ | Only Core generates registries |
188
+ | **Feature configuration** | ❌ | ✅ | ✅ | Data-only configs |
189
+ | **Registry data** | ❌ | ✅ | ✅ | Imported only by build script |
190
+ | **Handlers/Callbacks** | ❌ | ✅ | ✅ | Registered, not executed directly |
191
+ | **UI components** | Base | ✅ | ✅ | Core provides base, extensions extend |
192
+ | **Styles/CSS** | Base | ✅ | ❌ | Theme controls presentation |
193
+ | **Functionality extensions** | ❌ | ✅ | ✅ | Register via registry |
194
+
195
+ ## Common Anti-Patterns
196
+
197
+ ### Anti-Pattern 1: Initialization in Theme
198
+
199
+ ```typescript
200
+ // ❌ INCORRECT - Initialization in Theme
201
+ // contents/themes/default/scheduled-actions/init.ts
202
+ export function initializeScheduledActions() {
203
+ const actions = loadThemeActions()
204
+ actions.forEach(action => schedule(action))
205
+ }
206
+
207
+ // core/lib/startup.ts
208
+ import { initializeScheduledActions } from '@/contents/themes/default/...'
209
+ // ^^^ PROHIBITED - Core cannot import from Theme
210
+
211
+ // ✅ CORRECT - Initialization in Core
212
+ // core/lib/scheduled-actions/init.ts
213
+ import { SCHEDULED_ACTIONS_REGISTRY } from '@/core/lib/registries'
214
+
215
+ export function initializeScheduledActions() {
216
+ // Core reads from registry (data-only)
217
+ const actions = Object.values(SCHEDULED_ACTIONS_REGISTRY)
218
+ actions.forEach(action => scheduleAction(action))
219
+ }
220
+
221
+ // contents/themes/default/config/scheduled-actions.ts
222
+ export const THEME_SCHEDULED_ACTIONS = [
223
+ { slug: 'daily-report', cron: '0 9 * * *' }
224
+ ]
225
+ // ^^^ This is DATA, imported only by build script
226
+ ```
227
+
228
+ ### Anti-Pattern 2: Functions in Registry
229
+
230
+ ```typescript
231
+ // ❌ INCORRECT - Functions in Registry
232
+ export const HANDLERS_REGISTRY = {
233
+ 'process-payment': async (data) => {
234
+ // Processing logic
235
+ await chargeCard(data.cardId, data.amount)
236
+ }
237
+ }
238
+
239
+ // ✅ CORRECT - References in Registry, logic in Services
240
+ // Registry (data-only)
241
+ export const HANDLERS_REGISTRY = {
242
+ 'process-payment': {
243
+ slug: 'process-payment',
244
+ handlerPath: 'billing/process-payment',
245
+ description: 'Process a payment'
246
+ }
247
+ }
248
+
249
+ // Service (logic)
250
+ // core/lib/services/handler.service.ts
251
+ import { HANDLER_IMPLEMENTATIONS } from '@/core/lib/registries/handler-implementations'
252
+
253
+ export class HandlerService {
254
+ static async execute(slug: string, data: unknown) {
255
+ const handler = HANDLER_IMPLEMENTATIONS[slug]
256
+ return handler(data)
257
+ }
258
+ }
259
+ ```
260
+
261
+ ### Anti-Pattern 3: Core Importing from Theme
262
+
263
+ ```typescript
264
+ // ❌ INCORRECT - Core importing from Theme
265
+ // core/lib/billing/plans.ts
266
+ import { CUSTOM_PLANS } from '@/contents/themes/default/config/plans'
267
+
268
+ export function getPlan(slug: string) {
269
+ return PLANS[slug] || CUSTOM_PLANS[slug]
270
+ }
271
+
272
+ // ✅ CORRECT - Core reads from unified registry
273
+ // core/lib/billing/plans.ts
274
+ import { BILLING_REGISTRY } from '@/core/lib/registries/billing-registry'
275
+
276
+ export function getPlan(slug: string) {
277
+ return BILLING_REGISTRY.plans[slug]
278
+ }
279
+
280
+ // The build script combines core plans + theme plans into BILLING_REGISTRY
281
+ ```
282
+
283
+ ### Anti-Pattern 4: Theme Processing Data
284
+
285
+ ```typescript
286
+ // ❌ INCORRECT - Theme processing data
287
+ // contents/themes/default/lib/scheduled-actions/processor.ts
288
+ export async function processScheduledActions() {
289
+ const actions = await db.query.scheduledActions.findMany()
290
+ for (const action of actions) {
291
+ await executeAction(action)
292
+ }
293
+ }
294
+
295
+ // ✅ CORRECT - Core processes, Theme configures
296
+ // core/lib/scheduled-actions/processor.ts (CORE)
297
+ export async function processScheduledActions() {
298
+ const actions = await db.query.scheduledActions.findMany()
299
+ for (const action of actions) {
300
+ await executeAction(action)
301
+ }
302
+ }
303
+
304
+ // contents/themes/default/config/scheduled-actions.ts (THEME - data only)
305
+ export const themeScheduledActions = {
306
+ 'cleanup-expired': { cron: '0 0 * * *', enabled: true }
307
+ }
308
+ ```
309
+
310
+ ## Correct Patterns
311
+
312
+ ### Pattern 1: Extension Points
313
+
314
+ ```typescript
315
+ // PATTERN: Core defines extension points, Theme/Plugin register
316
+
317
+ // 1. Core defines types and mechanism
318
+ // core/lib/hooks/types.ts
319
+ export interface HookDefinition {
320
+ slug: string
321
+ event: string
322
+ priority: number
323
+ }
324
+
325
+ // core/lib/hooks/service.ts
326
+ import { HOOKS_REGISTRY } from '@/core/lib/registries/hooks-registry'
327
+
328
+ export class HooksService {
329
+ static trigger(event: string, data: unknown) {
330
+ const hooks = Object.values(HOOKS_REGISTRY)
331
+ .filter(h => h.event === event)
332
+ .sort((a, b) => b.priority - a.priority)
333
+
334
+ for (const hook of hooks) {
335
+ const handler = this.getHandler(hook.slug)
336
+ handler(data)
337
+ }
338
+ }
339
+ }
340
+
341
+ // 2. Theme registers hooks (DATA)
342
+ // contents/themes/default/config/hooks.ts
343
+ export const THEME_HOOKS: HookDefinition[] = [
344
+ { slug: 'log-user-login', event: 'user.login', priority: 10 }
345
+ ]
346
+
347
+ // 3. Theme provides handlers (registered via registry)
348
+ // contents/themes/default/handlers/hooks/log-user-login.ts
349
+ export const logUserLoginHandler = async (data: UserLoginEvent) => {
350
+ console.log(`User logged in: ${data.userId}`)
351
+ }
352
+ // This handler is imported by build script → HANDLER_IMPLEMENTATIONS registry
353
+ ```
354
+
355
+ ### Pattern 2: Feature Configuration
356
+
357
+ ```typescript
358
+ // PATTERN: Core provides feature, Theme configures
359
+
360
+ // 1. Core defines the feature with defaults
361
+ // core/lib/features/notifications.ts
362
+ import { NOTIFICATIONS_CONFIG_REGISTRY } from '@/core/lib/registries'
363
+
364
+ const DEFAULT_CONFIG = {
365
+ emailEnabled: true,
366
+ pushEnabled: false,
367
+ channels: ['email']
368
+ }
369
+
370
+ export function getNotificationConfig() {
371
+ // Merge: defaults ← theme config
372
+ return {
373
+ ...DEFAULT_CONFIG,
374
+ ...NOTIFICATIONS_CONFIG_REGISTRY.themeConfig
375
+ }
376
+ }
377
+
378
+ // 2. Theme provides specific configuration
379
+ // contents/themes/default/config/notifications.ts
380
+ export const themeNotificationsConfig = {
381
+ pushEnabled: true,
382
+ channels: ['email', 'push', 'sms']
383
+ }
384
+ ```
385
+
386
+ ### Pattern 3: Handler Registration
387
+
388
+ ```typescript
389
+ // PATTERN: Theme provides handlers, Core executes them
390
+
391
+ // 1. Theme defines handlers (functions, but registered)
392
+ // contents/themes/default/handlers/scheduled/send-daily-report.ts
393
+ import type { ScheduledHandler } from '@/core/lib/scheduled-actions/types'
394
+
395
+ export const sendDailyReportHandler: ScheduledHandler = async (context) => {
396
+ const users = await context.db.query.users.findMany()
397
+ for (const user of users) {
398
+ await sendEmail(user.email, 'Daily Report', generateReport())
399
+ }
400
+ }
401
+
402
+ // 2. Build script generates implementations registry
403
+ // core/lib/registries/scheduled-handler-implementations.ts (AUTO-GENERATED)
404
+ import { sendDailyReportHandler } from '@/contents/themes/default/handlers/scheduled/send-daily-report'
405
+
406
+ export const SCHEDULED_HANDLER_IMPLEMENTATIONS = {
407
+ 'send-daily-report': sendDailyReportHandler
408
+ }
409
+
410
+ // 3. Core executes handlers from registry
411
+ // core/lib/scheduled-actions/executor.ts
412
+ import { SCHEDULED_HANDLER_IMPLEMENTATIONS } from '@/core/lib/registries'
413
+
414
+ export async function executeScheduledAction(action: ScheduledAction) {
415
+ const handler = SCHEDULED_HANDLER_IMPLEMENTATIONS[action.handlerSlug]
416
+ if (!handler) throw new Error(`Handler not found: ${action.handlerSlug}`)
417
+ await handler({ db, action })
418
+ }
419
+ ```
420
+
421
+ ## Triple-Check Validation
422
+
423
+ ### Before Creating Any Plan
424
+
425
+ ```markdown
426
+ ## RESPONSIBILITIES CHECKLIST (MANDATORY)
427
+
428
+ ### 1. Function Identification
429
+ For each function/component, answer:
430
+
431
+ | Function | Who calls it? | What does it do? | Location |
432
+ |----------|---------------|------------------|----------|
433
+ | `initFeature()` | Core startup | Initializes | CORE |
434
+ | `processData()` | Core service | Processes | CORE |
435
+ | `featureConfig` | Build script | Data | THEME |
436
+
437
+ ### 2. Import Verification
438
+ - [ ] Does Core import from Theme? → ❌ REDESIGN
439
+ - [ ] Does Core import from Plugin? → ❌ REDESIGN
440
+ - [ ] Does Theme import from another Theme? → ❌ REDESIGN
441
+ - [ ] Does Plugin import from another Plugin? → ✅ ALLOWED (use peerDependencies)
442
+
443
+ ### 3. Registry Verification
444
+ - [ ] Are registries DATA-ONLY? → ✅
445
+ - [ ] Are there functions in registries? → ❌ Extract to Services
446
+
447
+ ### 4. Responsibility Verification
448
+ - [ ] Initialization → In Core? ✅
449
+ - [ ] Processing → In Core? ✅
450
+ - [ ] Orchestration → In Core? ✅
451
+ - [ ] Configuration → In Theme/Plugin? ✅
452
+ - [ ] UI → In Theme? ✅
453
+ ```
454
+
455
+ ### Red Flags (Warning Signs)
456
+
457
+ If the plan contains any of these, **STOP AND REDESIGN**:
458
+
459
+ 1. **"Theme will initialize..."** → Core must initialize
460
+ 2. **"Core will import from theme..."** → Prohibited
461
+ 3. **"Registry will contain handler functions..."** → Data-only
462
+ 4. **"Theme will process the data..."** → Core processes
463
+ 5. **"Plugin will orchestrate..."** → Core orchestrates (unless self-contained)
464
+
465
+ ## Checklist
466
+
467
+ Before finalizing any architectural plan:
468
+
469
+ - [ ] Core does not import from Theme or Plugin
470
+ - [ ] Theme does not import from another Theme
471
+ - [ ] Plugin does not import from another Plugin
472
+ - [ ] Initialization is in Core
473
+ - [ ] Processing is in Core
474
+ - [ ] Orchestration is in Core
475
+ - [ ] Registries are DATA-ONLY
476
+ - [ ] Theme/Plugin only provide configuration and registered handlers
477
+ - [ ] Build script is the only one that imports from contents/
478
+
479
+ ## Related Skills
480
+
481
+ - **`monorepo-architecture`** - CRITICAL: Package hierarchy, dependency rules, Model B distribution
482
+ - `registry-system` - Data-only registry patterns
483
+ - `scope-enforcement` - Path-level scope validation
484
+ - `service-layer` - Service patterns in Core
485
+ - `plugins` - Plugin development patterns