@smartsoft001/pro-claude-plugins 0.2.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 (198) hide show
  1. package/.claude-plugin/marketplace.json +26 -0
  2. package/README.md +56 -0
  3. package/package.json +14 -0
  4. package/plugins/flow/.claude-plugin/README.md +91 -0
  5. package/plugins/flow/.claude-plugin/merge-permissions.js +115 -0
  6. package/plugins/flow/.claude-plugin/plugin.json +5 -0
  7. package/plugins/flow/.claude-plugin/settings.template.json +86 -0
  8. package/plugins/flow/agents/angular-component-scaffolder.md +176 -0
  9. package/plugins/flow/agents/angular-directive-builder.md +154 -0
  10. package/plugins/flow/agents/angular-guard-builder.md +244 -0
  11. package/plugins/flow/agents/angular-jest-test-writer.md +475 -0
  12. package/plugins/flow/agents/angular-pipe-builder.md +170 -0
  13. package/plugins/flow/agents/angular-resolver-builder.md +287 -0
  14. package/plugins/flow/agents/angular-service-builder.md +162 -0
  15. package/plugins/flow/agents/angular-signal-state-builder.md +340 -0
  16. package/plugins/flow/agents/angular-test-diagnostician.md +279 -0
  17. package/plugins/flow/agents/angular-testbed-configurator.md +315 -0
  18. package/plugins/flow/agents/arch-scaffolder.md +278 -0
  19. package/plugins/flow/agents/e2e-data-testid-injector.md +195 -0
  20. package/plugins/flow/agents/e2e-project-scaffolder.md +194 -0
  21. package/plugins/flow/agents/e2e-test-writer.md +357 -0
  22. package/plugins/flow/agents/shared-agent-evolver.md +294 -0
  23. package/plugins/flow/agents/shared-build-verifier.md +160 -0
  24. package/plugins/flow/agents/shared-config-updater.md +310 -0
  25. package/plugins/flow/agents/shared-coverage-enforcer.md +184 -0
  26. package/plugins/flow/agents/shared-error-handler.md +217 -0
  27. package/plugins/flow/agents/shared-file-creator.md +344 -0
  28. package/plugins/flow/agents/shared-impl-orchestrator.md +312 -0
  29. package/plugins/flow/agents/shared-impl-reporter.md +368 -0
  30. package/plugins/flow/agents/shared-impl-teammate.md +201 -0
  31. package/plugins/flow/agents/shared-linear-subtask-iterator.md +337 -0
  32. package/plugins/flow/agents/shared-logic-implementer.md +244 -0
  33. package/plugins/flow/agents/shared-maia-api.md +26 -0
  34. package/plugins/flow/agents/shared-parallelization-analyzer.md +343 -0
  35. package/plugins/flow/agents/shared-performance-validator.md +168 -0
  36. package/plugins/flow/agents/shared-plan-perspective.md +271 -0
  37. package/plugins/flow/agents/shared-project-standardizer.md +205 -0
  38. package/plugins/flow/agents/shared-report-synthesizer.md +188 -0
  39. package/plugins/flow/agents/shared-review-teammate.md +189 -0
  40. package/plugins/flow/agents/shared-security-scanner.md +186 -0
  41. package/plugins/flow/agents/shared-style-enforcer.md +230 -0
  42. package/plugins/flow/agents/shared-subtask-dependency-analyzer.md +189 -0
  43. package/plugins/flow/agents/shared-tdd-developer.md +350 -0
  44. package/plugins/flow/agents/shared-team-coordinator.md +192 -0
  45. package/plugins/flow/agents/shared-test-fixer.md +186 -0
  46. package/plugins/flow/agents/shared-test-runner.md +191 -0
  47. package/plugins/flow/agents/shared-ui-classifier.md +263 -0
  48. package/plugins/flow/agents/shared-verification-orchestrator.md +194 -0
  49. package/plugins/flow/agents/shared-verification-runner.md +140 -0
  50. package/plugins/flow/agents/ui-a11y-validator.md +305 -0
  51. package/plugins/flow/agents/ui-screenshot-reporter.md +329 -0
  52. package/plugins/flow/agents/ui-web-designer.md +214 -0
  53. package/plugins/flow/scripts/compute-session-tokens.sh +39 -0
  54. package/plugins/flow/skills/a11y-audit/SKILL.md +214 -0
  55. package/plugins/flow/skills/angular-patterns/SKILL.md +191 -0
  56. package/plugins/flow/skills/browser-capture/SKILL.md +238 -0
  57. package/plugins/flow/skills/commit/SKILL.md +259 -0
  58. package/plugins/flow/skills/debug-helper/SKILL.md +375 -0
  59. package/plugins/flow/skills/impl/SKILL.md +992 -0
  60. package/plugins/flow/skills/karpathy-guidelines/SKILL.md +72 -0
  61. package/plugins/flow/skills/linear-suggestion/SKILL.md +132 -0
  62. package/plugins/flow/skills/maia-files-delete/SKILL.md +59 -0
  63. package/plugins/flow/skills/maia-files-upload/SKILL.md +57 -0
  64. package/plugins/flow/skills/nx-conventions/SKILL.md +326 -0
  65. package/plugins/flow/skills/plan/SKILL.md +1033 -0
  66. package/plugins/flow/skills/push/SKILL.md +759 -0
  67. package/plugins/flow/skills/review/SKILL.md +443 -0
  68. package/plugins/flow/skills/test-e2e/SKILL.md +164 -0
  69. package/plugins/flow/skills/test-unit/SKILL.md +456 -0
  70. package/plugins/flow-external/.claude-plugin/README.md +146 -0
  71. package/plugins/flow-external/.claude-plugin/merge-permissions.js +94 -0
  72. package/plugins/flow-external/.claude-plugin/plugin.json +5 -0
  73. package/plugins/flow-external/.claude-plugin/settings.template.json +78 -0
  74. package/plugins/flow-external/agents/angular-component-scaffolder.md +271 -0
  75. package/plugins/flow-external/agents/angular-directive-builder.md +134 -0
  76. package/plugins/flow-external/agents/angular-guard-builder.md +73 -0
  77. package/plugins/flow-external/agents/angular-pipe-builder.md +90 -0
  78. package/plugins/flow-external/agents/angular-resolver-builder.md +79 -0
  79. package/plugins/flow-external/agents/angular-service-builder.md +168 -0
  80. package/plugins/flow-external/agents/angular-state-builder.md +263 -0
  81. package/plugins/flow-external/agents/shared-build-verifier.md +67 -0
  82. package/plugins/flow-external/agents/shared-impl-orchestrator.md +90 -0
  83. package/plugins/flow-external/agents/shared-impl-reporter.md +135 -0
  84. package/plugins/flow-external/agents/shared-linear-subtask-iterator.md +70 -0
  85. package/plugins/flow-external/agents/shared-ui-classifier.md +38 -0
  86. package/plugins/flow-external/agents/ui-web-designer.md +203 -0
  87. package/plugins/flow-external/scripts/compute-session-tokens.sh +39 -0
  88. package/plugins/flow-external/skills/a11y-audit/SKILL.md +97 -0
  89. package/plugins/flow-external/skills/angular-cli-conventions/SKILL.md +268 -0
  90. package/plugins/flow-external/skills/angular-patterns/SKILL.md +182 -0
  91. package/plugins/flow-external/skills/browser-capture/SKILL.md +74 -0
  92. package/plugins/flow-external/skills/commit/SKILL.md +114 -0
  93. package/plugins/flow-external/skills/debug-helper/SKILL.md +135 -0
  94. package/plugins/flow-external/skills/impl/SKILL.md +218 -0
  95. package/plugins/flow-external/skills/karpathy-guidelines/SKILL.md +72 -0
  96. package/plugins/flow-external/skills/linear-suggestion/SKILL.md +62 -0
  97. package/plugins/flow-external/skills/maia-files-delete/SKILL.md +34 -0
  98. package/plugins/flow-external/skills/maia-files-upload/SKILL.md +41 -0
  99. package/plugins/flow-external/skills/plan/SKILL.md +334 -0
  100. package/plugins/flow-external/skills/push/SKILL.md +232 -0
  101. package/plugins/flow-legacy/.claude-plugin/README.md +143 -0
  102. package/plugins/flow-legacy/.claude-plugin/merge-permissions.js +94 -0
  103. package/plugins/flow-legacy/.claude-plugin/plugin.json +5 -0
  104. package/plugins/flow-legacy/.claude-plugin/settings.template.json +79 -0
  105. package/plugins/flow-legacy/agents/angular-component-scaffolder.md +327 -0
  106. package/plugins/flow-legacy/agents/angular-directive-builder.md +253 -0
  107. package/plugins/flow-legacy/agents/angular-guard-builder.md +326 -0
  108. package/plugins/flow-legacy/agents/angular-pipe-builder.md +238 -0
  109. package/plugins/flow-legacy/agents/angular-resolver-builder.md +339 -0
  110. package/plugins/flow-legacy/agents/angular-service-builder.md +271 -0
  111. package/plugins/flow-legacy/agents/angular-state-builder.md +480 -0
  112. package/plugins/flow-legacy/agents/shared-impl-orchestrator.md +174 -0
  113. package/plugins/flow-legacy/agents/shared-impl-reporter.md +232 -0
  114. package/plugins/flow-legacy/agents/shared-linear-subtask-iterator.md +198 -0
  115. package/plugins/flow-legacy/agents/shared-tdd-developer.md +307 -0
  116. package/plugins/flow-legacy/agents/shared-test-runner.md +133 -0
  117. package/plugins/flow-legacy/agents/shared-ui-classifier.md +145 -0
  118. package/plugins/flow-legacy/scripts/compute-session-tokens.sh +39 -0
  119. package/plugins/flow-legacy/skills/a11y-audit/SKILL.md +214 -0
  120. package/plugins/flow-legacy/skills/angular-patterns/SKILL.md +346 -0
  121. package/plugins/flow-legacy/skills/browser-capture/SKILL.md +238 -0
  122. package/plugins/flow-legacy/skills/commit/SKILL.md +215 -0
  123. package/plugins/flow-legacy/skills/debug-helper/SKILL.md +395 -0
  124. package/plugins/flow-legacy/skills/impl/SKILL.md +710 -0
  125. package/plugins/flow-legacy/skills/karpathy-guidelines/SKILL.md +72 -0
  126. package/plugins/flow-legacy/skills/linear-suggestion/SKILL.md +132 -0
  127. package/plugins/flow-legacy/skills/maia-files-delete/SKILL.md +59 -0
  128. package/plugins/flow-legacy/skills/maia-files-upload/SKILL.md +57 -0
  129. package/plugins/flow-legacy/skills/nx-conventions/SKILL.md +368 -0
  130. package/plugins/flow-legacy/skills/plan/SKILL.md +742 -0
  131. package/plugins/flow-legacy/skills/push/SKILL.md +645 -0
  132. package/plugins/flow-legacy/skills/test-unit/SKILL.md +500 -0
  133. package/plugins/smart-pro/.claude-plugin/README.md +115 -0
  134. package/plugins/smart-pro/.claude-plugin/merge-permissions.js +129 -0
  135. package/plugins/smart-pro/.claude-plugin/plugin.json +5 -0
  136. package/plugins/smart-pro/.claude-plugin/settings.template.json +94 -0
  137. package/plugins/smart-pro/agents/angular-components/AGENT.md +214 -0
  138. package/plugins/smart-pro/hooks/CONFIG.md +198 -0
  139. package/plugins/smart-pro/hooks/README.md +139 -0
  140. package/plugins/smart-pro/hooks/audit_logger.py +107 -0
  141. package/plugins/smart-pro/hooks/auto_format.sh +11 -0
  142. package/plugins/smart-pro/hooks/hooks.json +79 -0
  143. package/plugins/smart-pro/hooks/safety_validator.py +129 -0
  144. package/plugins/smart-pro/hooks/sensitive_file_blocker.py +58 -0
  145. package/plugins/smart-pro/hooks/skill_validator.py +220 -0
  146. package/plugins/smart-pro/skills/angular-components-action-panel/SKILL.md +159 -0
  147. package/plugins/smart-pro/skills/angular-components-avatar/SKILL.md +142 -0
  148. package/plugins/smart-pro/skills/angular-components-badge/SKILL.md +110 -0
  149. package/plugins/smart-pro/skills/angular-components-breadcrumbs/SKILL.md +91 -0
  150. package/plugins/smart-pro/skills/angular-components-button/SKILL.md +146 -0
  151. package/plugins/smart-pro/skills/angular-components-button-group/SKILL.md +121 -0
  152. package/plugins/smart-pro/skills/angular-components-calendar/SKILL.md +78 -0
  153. package/plugins/smart-pro/skills/angular-components-card/SKILL.md +110 -0
  154. package/plugins/smart-pro/skills/angular-components-card-heading/SKILL.md +105 -0
  155. package/plugins/smart-pro/skills/angular-components-command-palette/SKILL.md +168 -0
  156. package/plugins/smart-pro/skills/angular-components-container/SKILL.md +93 -0
  157. package/plugins/smart-pro/skills/angular-components-description-list/SKILL.md +102 -0
  158. package/plugins/smart-pro/skills/angular-components-details/SKILL.md +70 -0
  159. package/plugins/smart-pro/skills/angular-components-divider/SKILL.md +110 -0
  160. package/plugins/smart-pro/skills/angular-components-drawer/SKILL.md +136 -0
  161. package/plugins/smart-pro/skills/angular-components-dropdown/SKILL.md +131 -0
  162. package/plugins/smart-pro/skills/angular-components-empty-state/SKILL.md +103 -0
  163. package/plugins/smart-pro/skills/angular-components-feed/SKILL.md +110 -0
  164. package/plugins/smart-pro/skills/angular-components-form/SKILL.md +77 -0
  165. package/plugins/smart-pro/skills/angular-components-grid-list/SKILL.md +91 -0
  166. package/plugins/smart-pro/skills/angular-components-input/SKILL.md +118 -0
  167. package/plugins/smart-pro/skills/angular-components-list/SKILL.md +75 -0
  168. package/plugins/smart-pro/skills/angular-components-list-container/SKILL.md +106 -0
  169. package/plugins/smart-pro/skills/angular-components-media-object/SKILL.md +133 -0
  170. package/plugins/smart-pro/skills/angular-components-modal/SKILL.md +159 -0
  171. package/plugins/smart-pro/skills/angular-components-multi-column-layout/SKILL.md +84 -0
  172. package/plugins/smart-pro/skills/angular-components-navbar/SKILL.md +93 -0
  173. package/plugins/smart-pro/skills/angular-components-notification/SKILL.md +147 -0
  174. package/plugins/smart-pro/skills/angular-components-page/SKILL.md +162 -0
  175. package/plugins/smart-pro/skills/angular-components-page-heading/SKILL.md +96 -0
  176. package/plugins/smart-pro/skills/angular-components-paging/SKILL.md +86 -0
  177. package/plugins/smart-pro/skills/angular-components-progress-bars/SKILL.md +94 -0
  178. package/plugins/smart-pro/skills/angular-components-searchbar/SKILL.md +113 -0
  179. package/plugins/smart-pro/skills/angular-components-section-heading/SKILL.md +156 -0
  180. package/plugins/smart-pro/skills/angular-components-select-menu/SKILL.md +101 -0
  181. package/plugins/smart-pro/skills/angular-components-sidebar-layout/SKILL.md +121 -0
  182. package/plugins/smart-pro/skills/angular-components-sidebar-navigation/SKILL.md +80 -0
  183. package/plugins/smart-pro/skills/angular-components-sign-in-form/SKILL.md +91 -0
  184. package/plugins/smart-pro/skills/angular-components-stacked-layout/SKILL.md +114 -0
  185. package/plugins/smart-pro/skills/angular-components-stacked-list/SKILL.md +93 -0
  186. package/plugins/smart-pro/skills/angular-components-stats/SKILL.md +87 -0
  187. package/plugins/smart-pro/skills/angular-components-table/SKILL.md +98 -0
  188. package/plugins/smart-pro/skills/angular-components-tabs/SKILL.md +99 -0
  189. package/plugins/smart-pro/skills/angular-components-textarea/SKILL.md +111 -0
  190. package/plugins/smart-pro/skills/angular-components-toggle/SKILL.md +109 -0
  191. package/plugins/smart-pro/skills/angular-components-vertical-navigation/SKILL.md +139 -0
  192. package/plugins/smart-pro/skills/audit-log/SKILL.md +82 -0
  193. package/plugins/smart-pro/skills/format-code/SKILL.md +46 -0
  194. package/plugins/smart-pro/skills/project-conventions/SKILL.md +90 -0
  195. package/plugins/smart-pro/skills/safety-check/SKILL.md +0 -0
  196. package/src/index.d.ts +6 -0
  197. package/src/index.js +7 -0
  198. package/src/index.js.map +1 -0
@@ -0,0 +1,287 @@
1
+ ---
2
+ name: angular-resolver-builder
3
+ description: Create Angular functional resolvers. Use when building route resolvers for data preloading.
4
+ tools: Read, Write, Glob, Grep
5
+ skills: karpathy-guidelines
6
+ model: sonnet
7
+ color: '#DD0031'
8
+ ---
9
+
10
+ You are an expert at creating Angular functional resolvers following modern patterns.
11
+
12
+ ## Primary Responsibility
13
+
14
+ Create Angular resolvers using the modern functional approach for route data preloading.
15
+
16
+ ## When to Use
17
+
18
+ - Preloading data before route activation
19
+ - Fetching required resources for components
20
+ - Handling loading states during navigation
21
+
22
+ ## Project-Specific Patterns
23
+
24
+ This project uses:
25
+
26
+ - **Functional resolvers** (not class-based)
27
+ - **`inject()`** for dependency injection inside resolver functions
28
+ - **`toSignal()`** for accessing resolved data in components
29
+ - **`catchError()`** for error handling with redirects
30
+
31
+ ## Resolver Templates
32
+
33
+ ### Basic Resolver
34
+
35
+ ```typescript
36
+ import { inject } from '@angular/core';
37
+ import { ResolveFn } from '@angular/router';
38
+
39
+ import { DataService } from './data.service';
40
+ import { Data } from './data.model';
41
+
42
+ export const dataResolver: ResolveFn<Data[]> = (route, state) => {
43
+ const dataService = inject(DataService);
44
+
45
+ return dataService.getAll();
46
+ };
47
+ ```
48
+
49
+ ### Resolver with Route Params
50
+
51
+ ```typescript
52
+ import { inject } from '@angular/core';
53
+ import { ResolveFn, Router } from '@angular/router';
54
+ import { catchError, of } from 'rxjs';
55
+
56
+ import { ItemService } from './item.service';
57
+ import { Item } from './item.model';
58
+
59
+ export const itemResolver: ResolveFn<Item | null> = (route, state) => {
60
+ const itemService = inject(ItemService);
61
+ const router = inject(Router);
62
+
63
+ const id = route.paramMap.get('id');
64
+
65
+ if (!id) {
66
+ router.navigate(['/items']);
67
+ return of(null);
68
+ }
69
+
70
+ return itemService.getById(id).pipe(
71
+ catchError((error) => {
72
+ console.error('Failed to load item:', error);
73
+ router.navigate(['/items']);
74
+ return of(null);
75
+ }),
76
+ );
77
+ };
78
+ ```
79
+
80
+ ### Resolver with Multiple Dependencies
81
+
82
+ ```typescript
83
+ import { inject } from '@angular/core';
84
+ import { ResolveFn } from '@angular/router';
85
+ import { forkJoin, map } from 'rxjs';
86
+
87
+ import { UserService } from './user.service';
88
+ import { SettingsService } from './settings.service';
89
+
90
+ export interface ProfileData {
91
+ user: User;
92
+ settings: UserSettings;
93
+ }
94
+
95
+ export const profileResolver: ResolveFn<ProfileData> = (route, state) => {
96
+ const userService = inject(UserService);
97
+ const settingsService = inject(SettingsService);
98
+
99
+ const userId = route.paramMap.get('userId')!;
100
+
101
+ return forkJoin({
102
+ user: userService.getById(userId),
103
+ settings: settingsService.getByUserId(userId),
104
+ });
105
+ };
106
+ ```
107
+
108
+ ### Resolver with Query Params
109
+
110
+ ```typescript
111
+ import { inject } from '@angular/core';
112
+ import { ResolveFn } from '@angular/router';
113
+
114
+ import { SearchService } from './search.service';
115
+ import { SearchResult } from './search.model';
116
+
117
+ export const searchResolver: ResolveFn<SearchResult[]> = (route, state) => {
118
+ const searchService = inject(SearchService);
119
+
120
+ const query = route.queryParamMap.get('q') || '';
121
+ const page = parseInt(route.queryParamMap.get('page') || '1', 10);
122
+ const limit = parseInt(route.queryParamMap.get('limit') || '10', 10);
123
+
124
+ return searchService.search({
125
+ query,
126
+ page,
127
+ limit,
128
+ });
129
+ };
130
+ ```
131
+
132
+ ### Resolver with Default Value
133
+
134
+ ```typescript
135
+ import { inject } from '@angular/core';
136
+ import { ResolveFn } from '@angular/router';
137
+ import { catchError, of } from 'rxjs';
138
+
139
+ import { ConfigService } from './config.service';
140
+ import { AppConfig, DEFAULT_CONFIG } from './config.model';
141
+
142
+ export const configResolver: ResolveFn<AppConfig> = (route, state) => {
143
+ const configService = inject(ConfigService);
144
+
145
+ return configService.getConfig().pipe(
146
+ catchError((error) => {
147
+ console.warn('Using default config:', error);
148
+ return of(DEFAULT_CONFIG);
149
+ }),
150
+ );
151
+ };
152
+ ```
153
+
154
+ ## Route Configuration
155
+
156
+ ```typescript
157
+ const routes: Routes = [
158
+ {
159
+ path: 'items',
160
+ component: ItemListComponent,
161
+ resolve: {
162
+ items: itemsResolver,
163
+ },
164
+ },
165
+ {
166
+ path: 'items/:id',
167
+ component: ItemDetailComponent,
168
+ resolve: {
169
+ item: itemResolver,
170
+ },
171
+ },
172
+ {
173
+ path: 'profile/:userId',
174
+ component: ProfileComponent,
175
+ resolve: {
176
+ profile: profileResolver,
177
+ },
178
+ },
179
+ ];
180
+ ```
181
+
182
+ ## Accessing Resolved Data
183
+
184
+ ### In Component
185
+
186
+ ```typescript
187
+ @Component({...})
188
+ export class ItemDetailComponent {
189
+ private readonly route = inject(ActivatedRoute);
190
+
191
+ // Using toSignal
192
+ readonly item = toSignal(
193
+ this.route.data.pipe(map(data => data['item'] as Item))
194
+ );
195
+
196
+ // Or with async pipe in template
197
+ readonly data$ = this.route.data;
198
+ }
199
+ ```
200
+
201
+ ### In Template
202
+
203
+ ```html
204
+ @if (item(); as item) {
205
+ <h1>{{ item.name }}</h1>
206
+ <p>{{ item.description }}</p>
207
+ }
208
+ ```
209
+
210
+ ## Error Handling Strategies
211
+
212
+ ### Redirect on Error
213
+
214
+ ```typescript
215
+ catchError((error) => {
216
+ router.navigate(['/error']);
217
+ return of(null);
218
+ });
219
+ ```
220
+
221
+ ### Return Empty/Default
222
+
223
+ ```typescript
224
+ catchError((error) => {
225
+ return of([]);
226
+ });
227
+ ```
228
+
229
+ ### Throw and Handle in Component
230
+
231
+ ```typescript
232
+ // Let error propagate - handle in error boundary
233
+ ```
234
+
235
+ ## Checklist
236
+
237
+ - [ ] Uses functional resolver pattern
238
+ - [ ] Uses `inject()` for dependencies
239
+ - [ ] Handles null/missing params
240
+ - [ ] Implements error handling
241
+ - [ ] Returns Observable or Promise
242
+ - [ ] Test file created
243
+
244
+ ## Output Format
245
+
246
+ ````markdown
247
+ ## Resolver Created
248
+
249
+ ### File
250
+
251
+ `item.resolver.ts`
252
+
253
+ ### Type
254
+
255
+ `ResolveFn<Item | null>`
256
+
257
+ ### Route Param
258
+
259
+ `id` (from URL path)
260
+
261
+ ### Dependencies
262
+
263
+ - ItemService
264
+ - Router
265
+
266
+ ### Route Configuration
267
+
268
+ ```typescript
269
+ {
270
+ path: 'items/:id',
271
+ component: ItemDetailComponent,
272
+ resolve: { item: itemResolver },
273
+ }
274
+ ```
275
+ ````
276
+
277
+ ### Component Access
278
+
279
+ ```typescript
280
+ readonly item = toSignal(
281
+ this.route.data.pipe(map(data => data['item']))
282
+ );
283
+ ```
284
+
285
+ ```
286
+
287
+ ```
@@ -0,0 +1,162 @@
1
+ ---
2
+ name: angular-service-builder
3
+ description: Create Angular injectable services with signals and modern patterns. Use when building services for data management and business logic.
4
+ tools: Read, Write, Glob, Grep
5
+ skills: karpathy-guidelines
6
+ model: sonnet
7
+ color: '#DD0031'
8
+ ---
9
+
10
+ You are an expert at creating Angular services following modern best practices.
11
+
12
+ ## Primary Responsibility
13
+
14
+ Create Angular services using modern patterns including signals for reactive state and `inject()` for dependency injection.
15
+
16
+ ## When to Use
17
+
18
+ - Creating new Angular services
19
+ - Building data access services
20
+ - Implementing state management with signals
21
+
22
+ ## Project-Specific Patterns
23
+
24
+ This project uses:
25
+
26
+ - **`@Injectable({ providedIn: 'root' })`** for root-level services
27
+ - **`@Injectable()`** (without providedIn) for module-scoped services
28
+ - **`signal()`** for reactive state
29
+ - **`.asReadonly()`** to expose signals publicly
30
+ - **`inject()`** for DI (not constructor)
31
+
32
+ ## Service Templates
33
+
34
+ ### Root-Level Service with Signals
35
+
36
+ ```typescript
37
+ import { Injectable, signal } from '@angular/core';
38
+
39
+ export interface ModalConfig {
40
+ title?: string;
41
+ message: string;
42
+ confirmText?: string;
43
+ cancelText?: string;
44
+ }
45
+
46
+ @Injectable({
47
+ providedIn: 'root',
48
+ })
49
+ export class ModalService {
50
+ // Private signals
51
+ private readonly _isOpen = signal(false);
52
+ private readonly _config = signal<ModalConfig | null>(null);
53
+
54
+ // Public readonly signals
55
+ readonly isOpen = this._isOpen.asReadonly();
56
+ readonly config = this._config.asReadonly();
57
+
58
+ open(config: ModalConfig): void {
59
+ this._config.set(config);
60
+ this._isOpen.set(true);
61
+ }
62
+
63
+ close(): void {
64
+ this._isOpen.set(false);
65
+ this._config.set(null);
66
+ }
67
+ }
68
+ ```
69
+
70
+ ### Service with inject()
71
+
72
+ ```typescript
73
+ import { inject, Injectable, PLATFORM_ID } from '@angular/core';
74
+ import { isPlatformBrowser } from '@angular/common';
75
+ import { TranslateService } from '@ngx-translate/core';
76
+
77
+ @Injectable({ providedIn: 'root' })
78
+ export class LocalStorageService {
79
+ private readonly translateService = inject(TranslateService);
80
+ private readonly platformId = inject(PLATFORM_ID);
81
+
82
+ initLang(forceLang?: string): void {
83
+ if (isPlatformBrowser(this.platformId)) {
84
+ const savedLang = localStorage.getItem('LANGUAGE');
85
+ const lang = forceLang ?? savedLang ?? 'pl';
86
+ this.translateService.use(lang);
87
+ }
88
+ }
89
+
90
+ saveLanguagePreference(lang: string): void {
91
+ if (typeof localStorage !== 'undefined') {
92
+ localStorage.setItem('LANGUAGE', lang);
93
+ }
94
+ }
95
+ }
96
+ ```
97
+
98
+ ### Data Service extending base
99
+
100
+ ```typescript
101
+ import { Injectable } from '@angular/core';
102
+ import { CrudBaseService } from '@smartsoft001/pro-angular';
103
+ import { firstValueFrom } from 'rxjs';
104
+
105
+ import { environment } from '@msr/angular';
106
+ import { FeatureModel } from '@msr/feature/domain';
107
+
108
+ @Injectable()
109
+ export class FeatureService extends CrudBaseService<FeatureModel> {
110
+ getUrlNameForDetails(): string {
111
+ return 'feature';
112
+ }
113
+
114
+ protected override getBaseListUrl(
115
+ page: number,
116
+ filter: { limit: number; searchText?: string },
117
+ ): string {
118
+ let url = `${this.config.apiUrl}feature/search/page/${page}?maxPerPage=${filter.limit}`;
119
+ if (filter.searchText) {
120
+ url += `&q=${encodeURIComponent(filter.searchText)}`;
121
+ }
122
+ return url;
123
+ }
124
+
125
+ getUrlNameForList(): string {
126
+ return '';
127
+ }
128
+ }
129
+ ```
130
+
131
+ ## Checklist
132
+
133
+ - [ ] Uses `@Injectable({ providedIn: 'root' })` for root services
134
+ - [ ] Uses `inject()` for DI (not constructor)
135
+ - [ ] Uses `signal()` for reactive state
136
+ - [ ] Uses `.asReadonly()` for public signals
137
+ - [ ] Private signals prefixed with `_`
138
+ - [ ] SSR-safe (checks `isPlatformBrowser` for browser APIs)
139
+
140
+ ## Output Format
141
+
142
+ ```markdown
143
+ ## Service Created
144
+
145
+ ### File
146
+
147
+ `feature.service.ts`
148
+
149
+ ### API
150
+
151
+ | Method | Parameters | Returns | Description |
152
+ | ------- | --------------------- | ------- | ------------ |
153
+ | `open` | `config: ModalConfig` | `void` | Opens modal |
154
+ | `close` | - | `void` | Closes modal |
155
+
156
+ ### Signals
157
+
158
+ | Signal | Type | Description |
159
+ | -------- | ----------------------------- | ---------------- |
160
+ | `isOpen` | `Signal<boolean>` | Modal open state |
161
+ | `config` | `Signal<ModalConfig \| null>` | Current config |
162
+ ```