specialist-agent 2.13.0 → 3.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (329) hide show
  1. package/LICENSE +1 -1
  2. package/README.md +36 -206
  3. package/dist/catalog.json +16677 -0
  4. package/dist/hw-worker.mjs +288 -0
  5. package/dist/icones/icone.ico +0 -0
  6. package/dist/icones/icone.png +0 -0
  7. package/dist/interface/assets/figtree-latin-400-normal-g7Dtegnw.woff2 +0 -0
  8. package/dist/interface/assets/figtree-latin-500-normal-BWnGEVsr.woff2 +0 -0
  9. package/dist/interface/assets/figtree-latin-600-normal-Cv_xCTDl.woff2 +0 -0
  10. package/dist/interface/assets/figtree-latin-700-normal-th6qEP7c.woff2 +0 -0
  11. package/dist/interface/assets/figtree-latin-ext-400-normal-CXAzuTZb.woff2 +0 -0
  12. package/dist/interface/assets/figtree-latin-ext-500-normal-Du0rIuHj.woff2 +0 -0
  13. package/dist/interface/assets/figtree-latin-ext-600-normal-DJlfifZj.woff2 +0 -0
  14. package/dist/interface/assets/figtree-latin-ext-700-normal-CS4sQkGV.woff2 +0 -0
  15. package/dist/interface/assets/index-BltVv7tb.js +24 -0
  16. package/dist/interface/assets/index-Cpa6kApK.css +1 -0
  17. package/dist/interface/assets/jetbrains-mono-latin-400-normal-V6pRDFza.woff2 +0 -0
  18. package/dist/interface/assets/jetbrains-mono-latin-500-normal-BWZEU5yA.woff2 +0 -0
  19. package/dist/interface/assets/jetbrains-mono-latin-600-normal-C8RAYTDA.woff2 +0 -0
  20. package/dist/interface/assets/jetbrains-mono-latin-ext-400-normal-Bc8Ftmh3.woff2 +0 -0
  21. package/dist/interface/assets/jetbrains-mono-latin-ext-500-normal-Cut-4mMH.woff2 +0 -0
  22. package/dist/interface/assets/jetbrains-mono-latin-ext-600-normal-BfB_LPfz.woff2 +0 -0
  23. package/dist/interface/assets/unbounded-latin-500-normal-4slEIF53.woff2 +0 -0
  24. package/dist/interface/assets/unbounded-latin-700-normal-CaoNriVp.woff2 +0 -0
  25. package/dist/interface/assets/unbounded-latin-ext-500-normal-BTIpesyw.woff2 +0 -0
  26. package/dist/interface/assets/unbounded-latin-ext-700-normal-BLzWLLjG.woff2 +0 -0
  27. package/dist/interface/icones/apple-touch-icon.png +0 -0
  28. package/dist/interface/icones/favicon-32.png +0 -0
  29. package/dist/interface/icones/icone-192.png +0 -0
  30. package/dist/interface/icones/icone-512.png +0 -0
  31. package/dist/interface/icones/icone-mascara-512.png +0 -0
  32. package/dist/interface/index.html +19 -0
  33. package/dist/interface/manifest.webmanifest +19 -0
  34. package/dist/interface/sw.js +64 -0
  35. package/dist/licencas/BRAND.md +22 -0
  36. package/dist/licencas/LICENSE-CONTENT.md +44 -0
  37. package/dist/licencas/OFL-Figtree.txt +93 -0
  38. package/dist/licencas/OFL-JetBrainsMono.txt +93 -0
  39. package/dist/licencas/OFL-Unbounded.txt +93 -0
  40. package/dist/licencas/TERCEIROS.txt +104 -0
  41. package/dist/specialist-agent.mjs +14515 -0
  42. package/dist/usage-worker.mjs +1077 -0
  43. package/package.json +34 -58
  44. package/.claude-plugin/marketplace.json +0 -52
  45. package/.claude-plugin/plugin.json +0 -37
  46. package/.codex/INSTALL.md +0 -145
  47. package/.cursor-plugin/marketplace.json +0 -52
  48. package/.cursor-plugin/plugin.json +0 -37
  49. package/.opencode/INSTALL.md +0 -127
  50. package/.opencode/opencode.json +0 -186
  51. package/agents/analyst-lite.md +0 -48
  52. package/agents/analyst.md +0 -396
  53. package/agents/api-lite.md +0 -43
  54. package/agents/api.md +0 -427
  55. package/agents/architect-lite.md +0 -104
  56. package/agents/architect.md +0 -571
  57. package/agents/autopilot-lite.md +0 -46
  58. package/agents/autopilot.md +0 -196
  59. package/agents/cloud-lite.md +0 -75
  60. package/agents/cloud.md +0 -213
  61. package/agents/data-lite.md +0 -67
  62. package/agents/data.md +0 -306
  63. package/agents/debugger-lite.md +0 -46
  64. package/agents/debugger.md +0 -410
  65. package/agents/deps-lite.md +0 -41
  66. package/agents/deps.md +0 -363
  67. package/agents/designer-lite.md +0 -67
  68. package/agents/designer.md +0 -195
  69. package/agents/devops-lite.md +0 -67
  70. package/agents/devops.md +0 -205
  71. package/agents/docs-lite.md +0 -42
  72. package/agents/docs.md +0 -454
  73. package/agents/executor-lite.md +0 -61
  74. package/agents/executor.md +0 -695
  75. package/agents/explorer-lite.md +0 -55
  76. package/agents/explorer.md +0 -152
  77. package/agents/finance-lite.md +0 -66
  78. package/agents/finance.md +0 -255
  79. package/agents/i18n-lite.md +0 -44
  80. package/agents/i18n.md +0 -594
  81. package/agents/legal-lite.md +0 -113
  82. package/agents/legal.md +0 -302
  83. package/agents/marketing-lite.md +0 -25
  84. package/agents/marketing.md +0 -188
  85. package/agents/memory.md +0 -166
  86. package/agents/orchestrator-lite.md +0 -40
  87. package/agents/orchestrator.md +0 -512
  88. package/agents/pair-lite.md +0 -38
  89. package/agents/pair.md +0 -310
  90. package/agents/perf-lite.md +0 -42
  91. package/agents/perf.md +0 -320
  92. package/agents/planner-lite.md +0 -59
  93. package/agents/planner.md +0 -272
  94. package/agents/product-lite.md +0 -25
  95. package/agents/product.md +0 -195
  96. package/agents/refactor-lite.md +0 -42
  97. package/agents/refactor.md +0 -467
  98. package/agents/ripple-lite.md +0 -106
  99. package/agents/ripple.md +0 -166
  100. package/agents/scout-lite.md +0 -37
  101. package/agents/scout.md +0 -224
  102. package/agents/security-lite.md +0 -66
  103. package/agents/security.md +0 -252
  104. package/agents/sentry-triage-lite.md +0 -54
  105. package/agents/sentry-triage.md +0 -217
  106. package/agents/starter-lite.md +0 -80
  107. package/agents/starter.md +0 -300
  108. package/agents/support-lite.md +0 -24
  109. package/agents/support.md +0 -191
  110. package/agents/tdd-lite.md +0 -43
  111. package/agents/tdd.md +0 -329
  112. package/agents/tester-lite.md +0 -71
  113. package/agents/tester.md +0 -237
  114. package/cli/architectures.mjs +0 -713
  115. package/cli/detect-architecture.mjs +0 -752
  116. package/cli/generate-architecture.mjs +0 -1096
  117. package/cli/index.mjs +0 -1217
  118. package/cli/recommend-architecture.mjs +0 -870
  119. package/hooks/after-review.mjs +0 -130
  120. package/hooks/after-task.mjs +0 -117
  121. package/hooks/before-plan.mjs +0 -155
  122. package/hooks/before-review.mjs +0 -139
  123. package/hooks/hooks.json +0 -66
  124. package/hooks/lifecycle.json +0 -91
  125. package/hooks/native/auto-dispatch.mjs +0 -207
  126. package/hooks/native/auto-format.mjs +0 -176
  127. package/hooks/native/mcp-discovery.mjs +0 -168
  128. package/hooks/native/security-config.json +0 -38
  129. package/hooks/native/security-guard.mjs +0 -323
  130. package/hooks/native/session-context.mjs +0 -179
  131. package/hooks/native/session-end.mjs +0 -42
  132. package/hooks/native/utils.mjs +0 -62
  133. package/hooks/on-error.mjs +0 -129
  134. package/hooks/session-end.mjs +0 -185
  135. package/hooks/session-start.mjs +0 -154
  136. package/packs/angular/ARCHITECTURE.md +0 -814
  137. package/packs/angular/CLAUDE.md +0 -105
  138. package/packs/angular/agents/builder.md +0 -113
  139. package/packs/angular/agents/doctor.md +0 -187
  140. package/packs/angular/agents/migrator.md +0 -101
  141. package/packs/angular/agents/reviewer.md +0 -252
  142. package/packs/angular/agents-lite/builder.md +0 -65
  143. package/packs/angular/agents-lite/doctor.md +0 -64
  144. package/packs/angular/agents-lite/migrator.md +0 -75
  145. package/packs/angular/agents-lite/reviewer.md +0 -69
  146. package/packs/angular/skills/dev-create-component/SKILL.md +0 -56
  147. package/packs/angular/skills/dev-create-injectable/SKILL.md +0 -60
  148. package/packs/angular/skills/dev-create-module/SKILL.md +0 -49
  149. package/packs/angular/skills/dev-create-service/SKILL.md +0 -34
  150. package/packs/angular/skills/dev-create-test/SKILL.md +0 -78
  151. package/packs/angular/skills/dev-generate-types/SKILL.md +0 -37
  152. package/packs/angular/skills/docs-onboard/SKILL.md +0 -42
  153. package/packs/angular/skills/migration-migrate-component/SKILL.md +0 -42
  154. package/packs/angular/skills/migration-migrate-module/SKILL.md +0 -25
  155. package/packs/angular/skills/review-check-architecture/SKILL.md +0 -67
  156. package/packs/angular/skills/review-fix-violations/SKILL.md +0 -43
  157. package/packs/angular/skills/review-review/SKILL.md +0 -43
  158. package/packs/astro/ARCHITECTURE.md +0 -718
  159. package/packs/astro/CLAUDE.md +0 -106
  160. package/packs/astro/agents/builder.md +0 -123
  161. package/packs/astro/agents/doctor.md +0 -200
  162. package/packs/astro/agents/migrator.md +0 -105
  163. package/packs/astro/agents/reviewer.md +0 -253
  164. package/packs/astro/agents-lite/builder.md +0 -71
  165. package/packs/astro/agents-lite/doctor.md +0 -66
  166. package/packs/astro/agents-lite/migrator.md +0 -71
  167. package/packs/astro/agents-lite/reviewer.md +0 -70
  168. package/packs/astro/skills/dev-create-component/SKILL.md +0 -50
  169. package/packs/astro/skills/dev-create-island/SKILL.md +0 -63
  170. package/packs/astro/skills/dev-create-module/SKILL.md +0 -49
  171. package/packs/astro/skills/dev-create-service/SKILL.md +0 -34
  172. package/packs/astro/skills/dev-create-test/SKILL.md +0 -76
  173. package/packs/astro/skills/dev-generate-types/SKILL.md +0 -37
  174. package/packs/astro/skills/docs-onboard/SKILL.md +0 -51
  175. package/packs/astro/skills/migration-migrate-component/SKILL.md +0 -48
  176. package/packs/astro/skills/migration-migrate-module/SKILL.md +0 -25
  177. package/packs/astro/skills/review-check-architecture/SKILL.md +0 -72
  178. package/packs/astro/skills/review-fix-violations/SKILL.md +0 -43
  179. package/packs/astro/skills/review-review/SKILL.md +0 -45
  180. package/packs/nextjs/ARCHITECTURE.md +0 -1033
  181. package/packs/nextjs/CLAUDE.md +0 -106
  182. package/packs/nextjs/agents/builder.md +0 -132
  183. package/packs/nextjs/agents/doctor.md +0 -226
  184. package/packs/nextjs/agents/migrator.md +0 -101
  185. package/packs/nextjs/agents/reviewer.md +0 -243
  186. package/packs/nextjs/agents-lite/builder.md +0 -74
  187. package/packs/nextjs/agents-lite/doctor.md +0 -74
  188. package/packs/nextjs/agents-lite/migrator.md +0 -75
  189. package/packs/nextjs/agents-lite/reviewer.md +0 -73
  190. package/packs/nextjs/skills/dev-create-component/SKILL.md +0 -82
  191. package/packs/nextjs/skills/dev-create-hook/SKILL.md +0 -90
  192. package/packs/nextjs/skills/dev-create-module/SKILL.md +0 -63
  193. package/packs/nextjs/skills/dev-create-service/SKILL.md +0 -35
  194. package/packs/nextjs/skills/dev-create-test/SKILL.md +0 -106
  195. package/packs/nextjs/skills/dev-generate-types/SKILL.md +0 -37
  196. package/packs/nextjs/skills/docs-onboard/SKILL.md +0 -55
  197. package/packs/nextjs/skills/migration-migrate-component/SKILL.md +0 -58
  198. package/packs/nextjs/skills/migration-migrate-module/SKILL.md +0 -25
  199. package/packs/nextjs/skills/review-check-architecture/SKILL.md +0 -101
  200. package/packs/nextjs/skills/review-fix-violations/SKILL.md +0 -48
  201. package/packs/nextjs/skills/review-review/SKILL.md +0 -47
  202. package/packs/nuxt/ARCHITECTURE.md +0 -831
  203. package/packs/nuxt/CLAUDE.md +0 -111
  204. package/packs/nuxt/agents/builder.md +0 -120
  205. package/packs/nuxt/agents/doctor.md +0 -198
  206. package/packs/nuxt/agents/migrator.md +0 -101
  207. package/packs/nuxt/agents/reviewer.md +0 -255
  208. package/packs/nuxt/agents-lite/builder.md +0 -67
  209. package/packs/nuxt/agents-lite/doctor.md +0 -67
  210. package/packs/nuxt/agents-lite/migrator.md +0 -80
  211. package/packs/nuxt/agents-lite/reviewer.md +0 -71
  212. package/packs/nuxt/skills/dev-create-component/SKILL.md +0 -60
  213. package/packs/nuxt/skills/dev-create-composable/SKILL.md +0 -33
  214. package/packs/nuxt/skills/dev-create-module/SKILL.md +0 -49
  215. package/packs/nuxt/skills/dev-create-service/SKILL.md +0 -34
  216. package/packs/nuxt/skills/dev-create-test/SKILL.md +0 -61
  217. package/packs/nuxt/skills/dev-generate-types/SKILL.md +0 -37
  218. package/packs/nuxt/skills/docs-onboard/SKILL.md +0 -49
  219. package/packs/nuxt/skills/migration-migrate-component/SKILL.md +0 -48
  220. package/packs/nuxt/skills/migration-migrate-module/SKILL.md +0 -25
  221. package/packs/nuxt/skills/review-check-architecture/SKILL.md +0 -71
  222. package/packs/nuxt/skills/review-fix-violations/SKILL.md +0 -43
  223. package/packs/nuxt/skills/review-review/SKILL.md +0 -45
  224. package/packs/react/ARCHITECTURE.md +0 -991
  225. package/packs/react/CLAUDE.md +0 -102
  226. package/packs/react/agents/builder.md +0 -113
  227. package/packs/react/agents/doctor.md +0 -203
  228. package/packs/react/agents/migrator.md +0 -101
  229. package/packs/react/agents/reviewer.md +0 -252
  230. package/packs/react/agents-lite/builder.md +0 -65
  231. package/packs/react/agents-lite/doctor.md +0 -64
  232. package/packs/react/agents-lite/migrator.md +0 -74
  233. package/packs/react/agents-lite/reviewer.md +0 -69
  234. package/packs/react/skills/dev-create-component/SKILL.md +0 -53
  235. package/packs/react/skills/dev-create-hook/SKILL.md +0 -78
  236. package/packs/react/skills/dev-create-module/SKILL.md +0 -51
  237. package/packs/react/skills/dev-create-service/SKILL.md +0 -34
  238. package/packs/react/skills/dev-create-test/SKILL.md +0 -92
  239. package/packs/react/skills/dev-generate-types/SKILL.md +0 -37
  240. package/packs/react/skills/docs-onboard/SKILL.md +0 -42
  241. package/packs/react/skills/migration-migrate-component/SKILL.md +0 -44
  242. package/packs/react/skills/migration-migrate-module/SKILL.md +0 -25
  243. package/packs/react/skills/review-check-architecture/SKILL.md +0 -73
  244. package/packs/react/skills/review-fix-violations/SKILL.md +0 -45
  245. package/packs/react/skills/review-review/SKILL.md +0 -44
  246. package/packs/svelte/ARCHITECTURE.md +0 -975
  247. package/packs/svelte/CLAUDE.md +0 -102
  248. package/packs/svelte/agents/builder.md +0 -114
  249. package/packs/svelte/agents/doctor.md +0 -174
  250. package/packs/svelte/agents/migrator.md +0 -101
  251. package/packs/svelte/agents/reviewer.md +0 -238
  252. package/packs/svelte/agents-lite/builder.md +0 -66
  253. package/packs/svelte/agents-lite/doctor.md +0 -67
  254. package/packs/svelte/agents-lite/migrator.md +0 -82
  255. package/packs/svelte/agents-lite/reviewer.md +0 -70
  256. package/packs/svelte/skills/dev-create-component/SKILL.md +0 -77
  257. package/packs/svelte/skills/dev-create-module/SKILL.md +0 -59
  258. package/packs/svelte/skills/dev-create-service/SKILL.md +0 -35
  259. package/packs/svelte/skills/dev-create-store/SKILL.md +0 -94
  260. package/packs/svelte/skills/dev-create-test/SKILL.md +0 -98
  261. package/packs/svelte/skills/dev-generate-types/SKILL.md +0 -37
  262. package/packs/svelte/skills/docs-onboard/SKILL.md +0 -47
  263. package/packs/svelte/skills/migration-migrate-component/SKILL.md +0 -51
  264. package/packs/svelte/skills/migration-migrate-module/SKILL.md +0 -25
  265. package/packs/svelte/skills/review-check-architecture/SKILL.md +0 -79
  266. package/packs/svelte/skills/review-fix-violations/SKILL.md +0 -47
  267. package/packs/svelte/skills/review-review/SKILL.md +0 -45
  268. package/packs/vue/ARCHITECTURE.md +0 -798
  269. package/packs/vue/CLAUDE.md +0 -102
  270. package/packs/vue/agents/builder.md +0 -112
  271. package/packs/vue/agents/doctor.md +0 -185
  272. package/packs/vue/agents/migrator.md +0 -101
  273. package/packs/vue/agents/reviewer.md +0 -249
  274. package/packs/vue/agents-lite/builder.md +0 -65
  275. package/packs/vue/agents-lite/doctor.md +0 -63
  276. package/packs/vue/agents-lite/migrator.md +0 -73
  277. package/packs/vue/agents-lite/reviewer.md +0 -68
  278. package/packs/vue/skills/dev-create-component/SKILL.md +0 -58
  279. package/packs/vue/skills/dev-create-composable/SKILL.md +0 -31
  280. package/packs/vue/skills/dev-create-module/SKILL.md +0 -50
  281. package/packs/vue/skills/dev-create-service/SKILL.md +0 -34
  282. package/packs/vue/skills/dev-create-test/SKILL.md +0 -62
  283. package/packs/vue/skills/dev-generate-types/SKILL.md +0 -37
  284. package/packs/vue/skills/docs-onboard/SKILL.md +0 -42
  285. package/packs/vue/skills/migration-migrate-component/SKILL.md +0 -41
  286. package/packs/vue/skills/migration-migrate-module/SKILL.md +0 -25
  287. package/packs/vue/skills/review-check-architecture/SKILL.md +0 -73
  288. package/packs/vue/skills/review-fix-violations/SKILL.md +0 -42
  289. package/packs/vue/skills/review-review/SKILL.md +0 -43
  290. package/skills/audit/SKILL.md +0 -231
  291. package/skills/autofix/SKILL.md +0 -166
  292. package/skills/autopilot/SKILL.md +0 -286
  293. package/skills/brainstorm/SKILL.md +0 -298
  294. package/skills/checkpoint/SKILL.md +0 -217
  295. package/skills/codereview/SKILL.md +0 -268
  296. package/skills/commit/SKILL.md +0 -150
  297. package/skills/copywriting/SKILL.md +0 -218
  298. package/skills/cro/SKILL.md +0 -234
  299. package/skills/debug/SKILL.md +0 -210
  300. package/skills/design-review/SKILL.md +0 -217
  301. package/skills/discovery/SKILL.md +0 -218
  302. package/skills/estimate/SKILL.md +0 -154
  303. package/skills/finish/SKILL.md +0 -220
  304. package/skills/grill/SKILL.md +0 -270
  305. package/skills/health/SKILL.md +0 -251
  306. package/skills/improve-architecture/SKILL.md +0 -205
  307. package/skills/learn/SKILL.md +0 -260
  308. package/skills/lint/SKILL.md +0 -126
  309. package/skills/migrate-architecture/SKILL.md +0 -242
  310. package/skills/migrate-framework/SKILL.md +0 -172
  311. package/skills/onboard/SKILL.md +0 -168
  312. package/skills/plan/SKILL.md +0 -141
  313. package/skills/prd/SKILL.md +0 -241
  314. package/skills/recall/SKILL.md +0 -112
  315. package/skills/remember/SKILL.md +0 -108
  316. package/skills/seo-audit/SKILL.md +0 -240
  317. package/skills/tdd/SKILL.md +0 -201
  318. package/skills/tutorial/SKILL.md +0 -346
  319. package/skills/verify/SKILL.md +0 -168
  320. package/skills/worktree/SKILL.md +0 -168
  321. package/skills/write-skill/SKILL.md +0 -225
  322. package/templates/autopilot/PROMPT.md +0 -39
  323. package/templates/autopilot/README.md +0 -122
  324. package/templates/autopilot/devcontainer.json +0 -21
  325. package/templates/industry/ecommerce.md +0 -127
  326. package/templates/industry/fintech.md +0 -161
  327. package/templates/industry/saas.md +0 -134
  328. package/templates/session-memory.json +0 -48
  329. package/templates/skill-template/SKILL.md +0 -90
@@ -1,814 +0,0 @@
1
- # ARCHITECTURE.md -- Architecture & Patterns Guide
2
-
3
- > This document is the **source of truth** for all subagents.
4
- > Every architectural decision must be documented here.
5
-
6
- ---
7
-
8
- ## 1. Overview
9
-
10
- We are migrating / building an Angular project following a modern, typed, modular architecture:
11
-
12
- | From | To |
13
- |------|----|
14
- | JavaScript | TypeScript (strict) |
15
- | NgModule-based components | Standalone components |
16
- | @Input()/@Output() decorators | input()/output() signal-based I/O |
17
- | Constructor DI | inject() function |
18
- | RxJS BehaviorSubject stores | Signal-based stores (WritableSignal + computed) |
19
- | Manual HTTP / inline transforms | Services + Adapters + HttpClient |
20
- | Scattered try/catch | Centralized error handling via HttpInterceptor |
21
- | Structure by file type | Modular architecture by feature |
22
- | Class-heavy patterns | Functional + signal-based patterns |
23
- | Inconsistent naming | Strict documented conventions |
24
-
25
- ### Core Stack
26
-
27
- - **Angular 17+** with standalone components
28
- - **TypeScript** (strict mode)
29
- - **Angular Signals** for reactive state (signal, computed, effect)
30
- - **HttpClient** for HTTP calls
31
- - **Angular Router** with lazy loading
32
- - **Zod** for runtime validation
33
- - **Jest/Vitest** + **Angular Testing Library** for tests
34
-
35
- ### Data Flow
36
-
37
- ```
38
- Service (HttpClient only) --> Adapter (parse) --> Injectable/Component (orchestrate) --> Component (template)
39
- ```
40
-
41
- ---
42
-
43
- ## 2. Directory Structure (Modular Architecture)
44
-
45
- ```
46
- src/
47
- +-- app/ # Application shell
48
- | +-- app.component.ts
49
- | +-- app.config.ts
50
- | +-- app.routes.ts
51
- | +-- guards/
52
- | +-- interceptors/ # HttpInterceptors (auth, error handling)
53
- |
54
- +-- modules/ # Feature modules (bounded contexts)
55
- | +-- auth/
56
- | | +-- components/
57
- | | +-- services/
58
- | | +-- adapters/
59
- | | +-- stores/
60
- | | +-- types/
61
- | | +-- pages/
62
- | | +-- __tests__/
63
- | | +-- index.ts # Barrel export (public API)
64
- | |
65
- | +-- marketplace/
66
- | | +-- components/
67
- | | | +-- marketplace-list.component.ts
68
- | | | +-- marketplace-card.component.ts
69
- | | | +-- marketplace-filters.component.ts
70
- | | | +-- marketplace-card/ # Sub-components if needed
71
- | | | +-- marketplace-card-header.component.ts
72
- | | | +-- marketplace-card-actions.component.ts
73
- | | +-- services/
74
- | | | +-- marketplace.service.ts
75
- | | +-- adapters/
76
- | | | +-- marketplace.adapter.ts
77
- | | +-- stores/
78
- | | | +-- marketplace.store.ts # Client state only (filters, UI)
79
- | | +-- types/
80
- | | | +-- marketplace.types.ts
81
- | | | +-- marketplace.contracts.ts # Zod schemas / app contracts
82
- | | +-- pages/
83
- | | | +-- marketplace-page.component.ts
84
- | | +-- __tests__/
85
- | | +-- index.ts
86
- | |
87
- | +-- [other-module]/
88
- |
89
- +-- shared/ # Shared across modules
90
- | +-- components/ # Generic components (Button, Modal, Table)
91
- | +-- services/ # Base API client, interceptors
92
- | +-- adapters/ # Shared adapters
93
- | +-- types/ # Global types
94
- | +-- utils/ # Pure functions, no side effects
95
- | +-- helpers/ # Functions with side effects or DOM
96
- | +-- constants/ # Static values
97
- | +-- pipes/ # Angular pipes
98
- | +-- directives/ # Angular directives
99
- |
100
- +-- assets/ # Static assets (images, fonts, global CSS)
101
- ```
102
-
103
- ### Import Rules Between Layers
104
-
105
- ```
106
- modules/auth <-> shared/ OK Module imports from shared
107
- modules/auth --> modules/market NO Module does NOT import from another module
108
- shared/ --> modules/auth NO Shared does NOT import from modules
109
- app/ --> modules/* OK App imports modules (routes, providers)
110
- ```
111
-
112
- If two modules need to share something, move it to `shared/`.
113
-
114
- ---
115
-
116
- ## 3. Naming Conventions
117
-
118
- ### Files and Directories
119
-
120
- | Type | Pattern | Example |
121
- |------|---------|---------|
122
- | Directories | `kebab-case` | `user-settings/` |
123
- | Components | `kebab-case.component.ts` | `user-settings-form.component.ts` |
124
- | Pages | `kebab-case-page.component.ts` | `marketplace-page.component.ts` |
125
- | Services | `kebab-case.service.ts` | `marketplace.service.ts` |
126
- | Adapters | `kebab-case.adapter.ts` | `marketplace.adapter.ts` |
127
- | Stores | `kebab-case.store.ts` | `marketplace.store.ts` |
128
- | Types | `kebab-case.types.ts` | `marketplace.types.ts` |
129
- | Contracts/Schemas | `kebab-case.contracts.ts` | `marketplace.contracts.ts` |
130
- | Utils | `kebab-case.ts` | `format-date.ts` |
131
- | Helpers | `kebab-case.ts` | `clipboard-helper.ts` |
132
- | Tests | `kebab-case.spec.ts` | `marketplace-list.component.spec.ts` |
133
- | Constants | `kebab-case.constants.ts` | `api-endpoints.constants.ts` |
134
- | Pipes | `kebab-case.pipe.ts` | `currency-format.pipe.ts` |
135
- | Directives | `kebab-case.directive.ts` | `click-outside.directive.ts` |
136
- | Guards | `kebab-case.guard.ts` | `auth.guard.ts` |
137
- | Interceptors | `kebab-case.interceptor.ts` | `error-handler.interceptor.ts` |
138
-
139
- ### Code
140
-
141
- | Type | Pattern | Example |
142
- |------|---------|---------|
143
- | Variables / functions | `camelCase` | `getUserById`, `isLoading` |
144
- | Classes / Components | `PascalCase` | `UserProfile`, `MarketplaceListComponent` |
145
- | Enums | `PascalCase` | `UserRole.Admin` |
146
- | Constants | `UPPER_SNAKE_CASE` | `API_BASE_URL`, `MAX_RETRIES` |
147
- | Services | `PascalCase + Service` | `MarketplaceService` |
148
- | Stores | `PascalCase + Store` | `MarketplaceStore` |
149
- | Selectors | `kebab-case` | `'app-marketplace-list'` |
150
- | Event handlers | `handle` + action | `handleSubmit`, `handleDelete` |
151
- | Boolean | `is`/`has`/`can`/`should` | `isLoading`, `hasPermission` |
152
-
153
- ---
154
-
155
- ## 4. Responsibility Layers
156
-
157
- ### 4.1 Services -- Pure HTTP Requests
158
-
159
- Services make **only** the HTTP request via HttpClient. No try/catch, no transformation, no business logic.
160
-
161
- ```typescript
162
- // services/marketplace.service.ts
163
- import { Injectable, inject } from '@angular/core'
164
- import { HttpClient } from '@angular/common/http'
165
- import type {
166
- MarketplaceListResponse,
167
- MarketplaceItemResponse,
168
- CreateMarketplacePayload,
169
- } from '../types/marketplace.types'
170
-
171
- @Injectable({ providedIn: 'root' })
172
- export class MarketplaceService {
173
- private readonly http = inject(HttpClient)
174
- private readonly baseUrl = '/api/marketplace'
175
-
176
- list(params: { page: number; pageSize: number; search?: string }) {
177
- return this.http.get<MarketplaceListResponse>(this.baseUrl, { params: { ...params } })
178
- }
179
-
180
- getById(id: string) {
181
- return this.http.get<MarketplaceItemResponse>(`${this.baseUrl}/${id}`)
182
- }
183
-
184
- create(payload: CreateMarketplacePayload) {
185
- return this.http.post<MarketplaceItemResponse>(this.baseUrl, payload)
186
- }
187
-
188
- delete(id: string) {
189
- return this.http.delete(`${this.baseUrl}/${id}`)
190
- }
191
- }
192
- ```
193
-
194
- **Service Rules:**
195
- - NO try/catch (caller handles errors)
196
- - NO data transformation (adapter does that)
197
- - NO business logic
198
- - NO store or signal access
199
- - YES HttpClient calls with typed request/response
200
- - YES one file per domain/resource
201
- - YES `@Injectable({ providedIn: 'root' })` with `inject()`
202
-
203
- ### 4.2 Adapters -- Contract Parsers
204
-
205
- Adapters transform API data to the application's TypeScript contract (and vice-versa). They are **pure functions** with no side effects.
206
-
207
- ```typescript
208
- // adapters/marketplace.adapter.ts
209
- import type {
210
- MarketplaceListResponse,
211
- MarketplaceItemResponse,
212
- } from '../types/marketplace.types'
213
- import type {
214
- MarketplaceItem,
215
- MarketplaceList,
216
- } from '../types/marketplace.contracts'
217
-
218
- export const marketplaceAdapter = {
219
- /**
220
- * API response -> App contract (inbound)
221
- */
222
- toMarketplaceItem(response: MarketplaceItemResponse): MarketplaceItem {
223
- return {
224
- id: response.uuid,
225
- name: response.name,
226
- vendor: response.vendor_name,
227
- category: response.category_slug,
228
- price: response.price_cents / 100,
229
- isActive: response.status === 'active',
230
- createdAt: new Date(response.created_at),
231
- updatedAt: new Date(response.updated_at),
232
- }
233
- },
234
-
235
- toMarketplaceList(response: MarketplaceListResponse): MarketplaceList {
236
- return {
237
- items: response.results.map(marketplaceAdapter.toMarketplaceItem),
238
- totalItems: response.count,
239
- totalPages: Math.ceil(response.count / response.page_size),
240
- currentPage: response.page,
241
- }
242
- },
243
-
244
- /**
245
- * App contract -> API payload (outbound)
246
- */
247
- toCreatePayload(item: CreateMarketplaceInput): CreateMarketplacePayload {
248
- return {
249
- name: item.name,
250
- vendor_name: item.vendor,
251
- category_slug: item.category,
252
- price_cents: Math.round(item.price * 100),
253
- }
254
- },
255
- }
256
- ```
257
-
258
- **Adapter Rules:**
259
- - YES pure functions (input -> output, no side effects)
260
- - YES two directions: API->App (inbound) and App->API (outbound)
261
- - YES rename fields (snake_case API -> camelCase App)
262
- - YES convert types (string->Date, cents->decimal, status->boolean)
263
- - NO HTTP calls
264
- - NO store/service access
265
- - NO try/catch (failure = wrong type = bug to fix)
266
-
267
- ### 4.3 Types & Contracts
268
-
269
- ```typescript
270
- // types/marketplace.types.ts
271
- // <-- Types that mirror the API exactly as it returns (snake_case)
272
-
273
- export interface MarketplaceItemResponse {
274
- uuid: string
275
- name: string
276
- vendor_name: string
277
- category_slug: string
278
- price_cents: number
279
- status: 'active' | 'inactive' | 'pending'
280
- created_at: string
281
- updated_at: string
282
- }
283
-
284
- export interface MarketplaceListResponse {
285
- count: number
286
- page: number
287
- page_size: number
288
- results: MarketplaceItemResponse[]
289
- }
290
-
291
- export interface CreateMarketplacePayload {
292
- name: string
293
- vendor_name: string
294
- category_slug: string
295
- price_cents: number
296
- }
297
-
298
- // types/marketplace.contracts.ts
299
- // <-- Application contracts (camelCase, correct types)
300
-
301
- export interface MarketplaceItem {
302
- id: string
303
- name: string
304
- vendor: string
305
- category: string
306
- price: number // in currency, not cents
307
- isActive: boolean // derived from status
308
- createdAt: Date
309
- updatedAt: Date
310
- }
311
-
312
- export interface MarketplaceList {
313
- items: MarketplaceItem[]
314
- totalItems: number
315
- totalPages: number
316
- currentPage: number
317
- }
318
-
319
- export interface CreateMarketplaceInput {
320
- name: string
321
- vendor: string
322
- category: string
323
- price: number
324
- }
325
- ```
326
-
327
- ### 4.4 Signal Stores -- Client State Only
328
-
329
- Signal stores manage state that **does not come from the server**: UI state, filters, preferences, auth tokens.
330
-
331
- ```typescript
332
- // stores/marketplace.store.ts
333
- import { Injectable, signal, computed } from '@angular/core'
334
-
335
- @Injectable({ providedIn: 'root' })
336
- export class MarketplaceStore {
337
- // State (private writable signals)
338
- private readonly _selectedCategory = signal<string | null>(null)
339
- private readonly _viewMode = signal<'grid' | 'list'>('grid')
340
- private readonly _searchQuery = signal('')
341
-
342
- // Public read-only signals
343
- readonly selectedCategory = this._selectedCategory.asReadonly()
344
- readonly viewMode = this._viewMode.asReadonly()
345
- readonly searchQuery = this._searchQuery.asReadonly()
346
-
347
- // Computed
348
- readonly hasActiveFilters = computed(() =>
349
- !!this._selectedCategory() || !!this._searchQuery()
350
- )
351
-
352
- // Actions
353
- setCategory(category: string | null) {
354
- this._selectedCategory.set(category)
355
- }
356
-
357
- setViewMode(mode: 'grid' | 'list') {
358
- this._viewMode.set(mode)
359
- }
360
-
361
- setSearchQuery(query: string) {
362
- this._searchQuery.set(query)
363
- }
364
-
365
- clearFilters() {
366
- this._selectedCategory.set(null)
367
- this._searchQuery.set('')
368
- }
369
- }
370
- ```
371
-
372
- **Store Rules:**
373
- - YES client state only (UI, filters, preferences, session)
374
- - YES `@Injectable({ providedIn: 'root' })` with signals
375
- - YES private WritableSignal, public asReadonly()
376
- - YES computed() for derived values
377
- - NO server state (API data is fetched via services and managed locally)
378
- - NO HTTP calls inside stores
379
- - NO complex business logic (services or components handle that)
380
-
381
- ### 4.5 Components -- Standalone with Signals
382
-
383
- ```typescript
384
- // components/marketplace-list.component.ts
385
- import { Component, inject, input, output, signal, computed } from '@angular/core'
386
- import { MarketplaceService } from '../services/marketplace.service'
387
- import { marketplaceAdapter } from '../adapters/marketplace.adapter'
388
- import { MarketplaceStore } from '../stores/marketplace.store'
389
- import { MarketplaceCardComponent } from './marketplace-card.component'
390
- import type { MarketplaceItem } from '../types/marketplace.contracts'
391
-
392
- @Component({
393
- selector: 'app-marketplace-list',
394
- standalone: true,
395
- imports: [MarketplaceCardComponent],
396
- template: `
397
- @if (isLoading()) {
398
- <div>Loading...</div>
399
- } @else if (isEmpty()) {
400
- <div>No items found</div>
401
- } @else {
402
- @for (item of items(); track item.id) {
403
- <app-marketplace-card
404
- [item]="item"
405
- [isSelected]="item.id === selectedId()"
406
- (select)="handleSelect($event)"
407
- />
408
- }
409
- }
410
- `,
411
- })
412
- export class MarketplaceListComponent {
413
- // Inputs / Outputs (signal-based)
414
- readonly categoryFilter = input<string>()
415
- readonly select = output<MarketplaceItem>()
416
-
417
- // Injected dependencies
418
- private readonly service = inject(MarketplaceService)
419
- private readonly store = inject(MarketplaceStore)
420
-
421
- // Local state
422
- readonly page = signal(1)
423
- readonly selectedId = signal<string | null>(null)
424
- readonly items = signal<MarketplaceItem[]>([])
425
- readonly isLoading = signal(false)
426
-
427
- // Computed
428
- readonly isEmpty = computed(() => !this.isLoading() && this.items().length === 0)
429
- readonly isFirstPage = computed(() => this.page() === 1)
430
-
431
- // Handlers
432
- handleSelect(item: MarketplaceItem) {
433
- this.selectedId.set(item.id)
434
- this.select.emit(item)
435
- }
436
-
437
- handlePageChange(newPage: number) {
438
- this.page.set(newPage)
439
- }
440
- }
441
- ```
442
-
443
- ---
444
-
445
- ## 5. Component Patterns
446
-
447
- ### 5.1 Stop Prop Drilling -- Component Composition
448
-
449
- **BAD -- Prop Drilling:**
450
- ```html
451
- <!-- GrandParent passes data through 3 levels -->
452
- <app-parent [user]="user" [theme]="theme" [permissions]="permissions">
453
- <app-child [user]="user" [theme]="theme" [permissions]="permissions">
454
- <app-grandchild [user]="user" [permissions]="permissions" />
455
- </app-child>
456
- </app-parent>
457
- ```
458
-
459
- **GOOD -- Composition with content projection:**
460
- ```typescript
461
- // marketplace-page.component.ts
462
- @Component({
463
- selector: 'app-marketplace-page',
464
- standalone: true,
465
- imports: [PageLayoutComponent, MarketplaceFiltersComponent, MarketplaceListComponent, MarketplaceDetailsComponent],
466
- template: `
467
- <app-page-layout>
468
- <ng-container header>
469
- <app-marketplace-filters />
470
- </ng-container>
471
-
472
- <app-marketplace-list (select)="handleSelect($event)" />
473
-
474
- @if (selectedItem()) {
475
- <ng-container sidebar>
476
- <app-marketplace-details [item]="selectedItem()!" />
477
- </ng-container>
478
- }
479
- </app-page-layout>
480
- `,
481
- })
482
- export class MarketplacePageComponent {
483
- readonly selectedItem = signal<MarketplaceItem | null>(null)
484
-
485
- handleSelect(item: MarketplaceItem) {
486
- this.selectedItem.set(item)
487
- }
488
- }
489
- ```
490
-
491
- **GOOD -- Shared injectable for cross-component state:**
492
- ```typescript
493
- // stores/marketplace-context.store.ts
494
- import { Injectable, signal, computed } from '@angular/core'
495
- import type { MarketplaceItem } from '../types/marketplace.contracts'
496
-
497
- @Injectable()
498
- export class MarketplaceContextStore {
499
- private readonly _selectedItem = signal<MarketplaceItem | null>(null)
500
-
501
- readonly selectedItem = this._selectedItem.asReadonly()
502
- readonly hasSelection = computed(() => this._selectedItem() !== null)
503
-
504
- selectItem(item: MarketplaceItem) {
505
- this._selectedItem.set(item)
506
- }
507
-
508
- clearSelection() {
509
- this._selectedItem.set(null)
510
- }
511
- }
512
-
513
- // Provide in the page component:
514
- @Component({
515
- providers: [MarketplaceContextStore],
516
- // ...
517
- })
518
- export class MarketplacePageComponent {
519
- private readonly context = inject(MarketplaceContextStore)
520
- }
521
- ```
522
-
523
- ### 5.2 Component Hierarchy
524
-
525
- ```
526
- Pages --> Composition, orchestration, provide context
527
- +-- Layout --> Visual structure (content projection)
528
- +-- Features --> Feature logic (services, stores, signals)
529
- +-- Shared --> Pure presentation (inputs in, outputs out)
530
- ```
531
-
532
- | Type | Responsibility | Can have logic? | Can have state? |
533
- |------|---------------|-----------------|-----------------|
534
- | **Pages** | Compose components, provide context | Via services/stores | Yes (signals) |
535
- | **Feature Components** | UI + feature logic | Via services/stores | Yes (signals) |
536
- | **Shared Components** | Generic, reusable UI | Minimal (UI only) | Minimal (local) |
537
-
538
- ---
539
-
540
- ## 6. Utils vs Helpers
541
-
542
- ### Utils -- Pure Functions
543
- - No side effects
544
- - Deterministic input -> output
545
- - Testable without mocks
546
- - No dependency on DOM, browser APIs, or Angular
547
-
548
- ```typescript
549
- // shared/utils/format-date.ts
550
- export function formatDate(date: Date, locale = 'en-US'): string {
551
- return new Intl.DateTimeFormat(locale).format(date)
552
- }
553
-
554
- // shared/utils/currency.ts
555
- export function formatCurrency(value: number, currency = 'USD'): string {
556
- return new Intl.NumberFormat('en-US', { style: 'currency', currency }).format(value)
557
- }
558
-
559
- // shared/utils/string.ts
560
- export function slugify(text: string): string {
561
- return text.toLowerCase().replace(/\s+/g, '-').replace(/[^\w-]/g, '')
562
- }
563
- ```
564
-
565
- ### Helpers -- Functions with Side Effects or DOM
566
- - Interact with browser APIs (clipboard, localStorage, DOM)
567
- - May have side effects
568
- - May need mocks in tests
569
-
570
- ```typescript
571
- // shared/helpers/clipboard-helper.ts
572
- export async function copyToClipboard(text: string): Promise<boolean> {
573
- try {
574
- await navigator.clipboard.writeText(text)
575
- return true
576
- } catch {
577
- return false
578
- }
579
- }
580
-
581
- // shared/helpers/download-helper.ts
582
- export function downloadAsFile(content: string, filename: string): void {
583
- const blob = new Blob([content], { type: 'text/plain' })
584
- const url = URL.createObjectURL(blob)
585
- const a = document.createElement('a')
586
- a.href = url
587
- a.download = filename
588
- a.click()
589
- URL.revokeObjectURL(url)
590
- }
591
-
592
- // shared/helpers/storage-helper.ts
593
- export function getStorageItem<T>(key: string, fallback: T): T {
594
- try {
595
- const item = localStorage.getItem(key)
596
- return item ? (JSON.parse(item) as T) : fallback
597
- } catch {
598
- return fallback
599
- }
600
- }
601
- ```
602
-
603
- ---
604
-
605
- ## 7. Error Handling -- Centralized Pattern
606
-
607
- ### Global HttpInterceptor
608
-
609
- ```typescript
610
- // app/interceptors/error-handler.interceptor.ts
611
- import { HttpInterceptorFn, HttpErrorResponse } from '@angular/common/http'
612
- import { inject } from '@angular/core'
613
- import { Router } from '@angular/router'
614
- import { catchError, throwError } from 'rxjs'
615
-
616
- export const errorHandlerInterceptor: HttpInterceptorFn = (req, next) => {
617
- const router = inject(Router)
618
-
619
- return next(req).pipe(
620
- catchError((error: HttpErrorResponse) => {
621
- // Only redirect on 401 (session expired)
622
- if (error.status === 401) {
623
- router.navigate(['/login'])
624
- }
625
- // DO NOT handle other errors here -- let the caller handle them
626
- return throwError(() => error)
627
- }),
628
- )
629
- }
630
- ```
631
-
632
- ### Service-Level Error Handling (in components)
633
-
634
- ```typescript
635
- // In the component that subscribes:
636
- this.service.delete(id).subscribe({
637
- next: () => {
638
- // success: refresh data, show toast
639
- },
640
- error: (error) => {
641
- // handle error: show toast with parseApiError(error)
642
- },
643
- })
644
- ```
645
-
646
- ### Centralized Error Parser
647
-
648
- ```typescript
649
- // shared/utils/parse-api-error.ts
650
- import { HttpErrorResponse } from '@angular/common/http'
651
-
652
- interface ApiErrorResponse {
653
- message?: string
654
- detail?: string
655
- errors?: Record<string, string[]>
656
- }
657
-
658
- export function parseApiError(error: unknown): string {
659
- if (error instanceof HttpErrorResponse) {
660
- const data = error.error as ApiErrorResponse | undefined
661
- if (data?.message) return data.message
662
- if (data?.detail) return data.detail
663
- if (error.status === 403) return 'Permission denied'
664
- if (error.status === 404) return 'Resource not found'
665
- if (error.status === 500) return 'Internal server error'
666
- }
667
- return 'Unexpected error. Please try again.'
668
- }
669
- ```
670
-
671
- ---
672
-
673
- ## 8. Barrel Exports (index.ts)
674
-
675
- Each module exports only its **public API**:
676
-
677
- ```typescript
678
- // modules/marketplace/index.ts
679
-
680
- // Pages (for the router)
681
- export { MarketplacePageComponent } from './pages/marketplace-page.component'
682
-
683
- // Components reusable by others (rare, avoid)
684
- export { MarketplaceCardComponent } from './components/marketplace-card.component'
685
-
686
- // Types (for consumers that need typing)
687
- export type { MarketplaceItem, MarketplaceList } from './types/marketplace.contracts'
688
-
689
- // DO NOT export:
690
- // - services (internal detail)
691
- // - adapters (internal detail)
692
- // - stores (internal detail)
693
- // - internal components
694
- ```
695
-
696
- ---
697
-
698
- ## 9. SOLID Principles Applied to Angular
699
-
700
- | Principle | Angular Application |
701
- |-----------|---------------------|
702
- | **S**ingle Responsibility | 1 component = 1 responsibility. 1 service = 1 resource. 1 store = 1 domain. |
703
- | **O**pen/Closed | Components extensible via content projection (ng-content) and inputs -- not by internal modification. |
704
- | **L**iskov Substitution | Shared components must work in any context without breaking. |
705
- | **I**nterface Segregation | Specific inputs, not generic objects. `<app-avatar [src]="src" [alt]="alt" />` not `<app-avatar [user]="user" />`. |
706
- | **D**ependency Inversion | Components depend on abstractions (injection tokens), not concrete implementations. Services injected via inject(), never instantiated directly. |
707
-
708
- ### SOLID Examples
709
-
710
- **Single Responsibility:**
711
- ```typescript
712
- // BAD: component doing too much
713
- @Component({ /* ... */ })
714
- export class UserDashboardComponent {
715
- // fetching data, filtering, rendering chart, rendering table, handling forms...
716
- }
717
-
718
- // GOOD: composed from focused components
719
- @Component({
720
- template: `
721
- <app-dashboard-layout>
722
- <app-user-stats />
723
- <app-user-activity-chart />
724
- <app-user-table />
725
- </app-dashboard-layout>
726
- `,
727
- })
728
- export class UserDashboardComponent {}
729
- ```
730
-
731
- **Open/Closed:**
732
- ```typescript
733
- // GOOD: extensible via content projection and inputs
734
- @Component({
735
- selector: 'app-data-table',
736
- template: `
737
- @if (items().length === 0) {
738
- <ng-content select="[empty]" />
739
- } @else {
740
- <table>
741
- <ng-content select="[header]" />
742
- <tbody>
743
- @for (item of items(); track trackFn(item)) {
744
- <ng-content />
745
- }
746
- </tbody>
747
- </table>
748
- }
749
- `,
750
- })
751
- export class DataTableComponent<T> {
752
- readonly items = input.required<T[]>()
753
- readonly trackFn = input.required<(item: T) => unknown>()
754
- }
755
- ```
756
-
757
- **Interface Segregation:**
758
- ```typescript
759
- // BAD: passing entire object when only a few fields are needed
760
- @Component({ /* ... */ })
761
- export class AvatarComponent {
762
- readonly user = input.required<User>() // component only uses name and avatarUrl
763
- }
764
-
765
- // GOOD: specific inputs
766
- @Component({ /* ... */ })
767
- export class AvatarComponent {
768
- readonly src = input.required<string>()
769
- readonly alt = input.required<string>()
770
- readonly size = input<'sm' | 'md' | 'lg'>('md')
771
- }
772
- ```
773
-
774
- ---
775
-
776
- ## 10. Migration Checklist per File
777
-
778
- ### Component (.component.ts)
779
- - [ ] Standalone component (no NgModule)
780
- - [ ] input() / output() signal-based I/O
781
- - [ ] inject() instead of constructor DI
782
- - [ ] No prop drilling (use content projection / shared injectable)
783
- - [ ] < 200 lines total
784
- - [ ] Template < 100 lines
785
- - [ ] No business logic in template
786
- - [ ] Loading / error / empty states
787
- - [ ] OnPush change detection strategy
788
- - [ ] trackBy function for @for loops
789
-
790
- ### Service (.service.ts)
791
- - [ ] HttpClient calls only
792
- - [ ] No try/catch
793
- - [ ] No data transformation
794
- - [ ] Typed request and response
795
- - [ ] inject(HttpClient) instead of constructor
796
- - [ ] `@Injectable({ providedIn: 'root' })`
797
-
798
- ### Adapter (.adapter.ts)
799
- - [ ] Pure functions
800
- - [ ] Inbound (API->App) and Outbound (App->API)
801
- - [ ] Naming conversion (snake_case -> camelCase)
802
- - [ ] Type conversion (string->Date, etc.)
803
-
804
- ### Store (.store.ts)
805
- - [ ] Client state only
806
- - [ ] Private WritableSignal, public asReadonly()
807
- - [ ] computed() for derived values
808
- - [ ] inject() for dependencies
809
- - [ ] No HTTP calls
810
-
811
- ### Types
812
- - [ ] `.types.ts` for API types (raw response)
813
- - [ ] `.contracts.ts` for application contracts
814
- - [ ] No `any`