@atlashub/smartstack-cli 1.5.1 → 1.5.3

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 (147) hide show
  1. package/.documentation/css/styles.css +2168 -2168
  2. package/.documentation/js/app.js +794 -794
  3. package/config/default-config.json +86 -86
  4. package/config/settings.json +53 -53
  5. package/config/settings.local.example.json +16 -16
  6. package/dist/index.js +0 -0
  7. package/dist/index.js.map +1 -1
  8. package/package.json +88 -88
  9. package/templates/agents/action.md +36 -36
  10. package/templates/agents/efcore/conflicts.md +84 -84
  11. package/templates/agents/efcore/db-deploy.md +51 -51
  12. package/templates/agents/efcore/db-reset.md +59 -59
  13. package/templates/agents/efcore/db-seed.md +56 -56
  14. package/templates/agents/efcore/db-status.md +64 -64
  15. package/templates/agents/efcore/migration.md +85 -85
  16. package/templates/agents/efcore/rebase-snapshot.md +62 -62
  17. package/templates/agents/efcore/scan.md +90 -90
  18. package/templates/agents/efcore/squash.md +67 -67
  19. package/templates/agents/explore-codebase.md +65 -65
  20. package/templates/agents/explore-docs.md +97 -97
  21. package/templates/agents/fix-grammar.md +49 -49
  22. package/templates/agents/gitflow/abort.md +45 -45
  23. package/templates/agents/gitflow/cleanup.md +85 -85
  24. package/templates/agents/gitflow/commit.md +40 -40
  25. package/templates/agents/gitflow/exec.md +48 -48
  26. package/templates/agents/gitflow/finish.md +92 -92
  27. package/templates/agents/gitflow/init.md +139 -139
  28. package/templates/agents/gitflow/merge.md +62 -62
  29. package/templates/agents/gitflow/plan.md +42 -42
  30. package/templates/agents/gitflow/pr.md +78 -78
  31. package/templates/agents/gitflow/review.md +49 -49
  32. package/templates/agents/gitflow/start.md +61 -61
  33. package/templates/agents/gitflow/status.md +32 -32
  34. package/templates/agents/snipper.md +36 -36
  35. package/templates/agents/websearch.md +46 -46
  36. package/templates/commands/_resources/formatting-guide.md +124 -124
  37. package/templates/commands/ai-prompt.md +315 -315
  38. package/templates/commands/apex/1-analyze.md +100 -100
  39. package/templates/commands/apex/2-plan.md +145 -145
  40. package/templates/commands/apex/3-execute.md +171 -171
  41. package/templates/commands/apex/4-examine.md +116 -116
  42. package/templates/commands/apex/5-tasks.md +209 -209
  43. package/templates/commands/apex.md +76 -76
  44. package/templates/commands/application/create.md +362 -362
  45. package/templates/commands/application/templates-backend.md +463 -463
  46. package/templates/commands/application/templates-frontend.md +517 -517
  47. package/templates/commands/application/templates-i18n.md +478 -478
  48. package/templates/commands/application/templates-seed.md +362 -362
  49. package/templates/commands/application.md +303 -303
  50. package/templates/commands/business-analyse/0-orchestrate.md +640 -640
  51. package/templates/commands/business-analyse/1-init.md +269 -269
  52. package/templates/commands/business-analyse/2-discover.md +520 -520
  53. package/templates/commands/business-analyse/3-analyse.md +408 -408
  54. package/templates/commands/business-analyse/4-specify.md +598 -598
  55. package/templates/commands/business-analyse/5-validate.md +326 -326
  56. package/templates/commands/business-analyse/6-handoff.md +746 -746
  57. package/templates/commands/business-analyse/7-doc-html.md +602 -602
  58. package/templates/commands/business-analyse/bug.md +325 -325
  59. package/templates/commands/business-analyse/change-request.md +368 -368
  60. package/templates/commands/business-analyse/hotfix.md +200 -200
  61. package/templates/commands/business-analyse.md +640 -640
  62. package/templates/commands/controller/create.md +216 -216
  63. package/templates/commands/controller/postman-templates.md +528 -528
  64. package/templates/commands/controller/templates.md +600 -600
  65. package/templates/commands/controller.md +337 -337
  66. package/templates/commands/create/agent.md +138 -138
  67. package/templates/commands/create/command.md +166 -166
  68. package/templates/commands/create/hook.md +234 -234
  69. package/templates/commands/create/plugin.md +329 -329
  70. package/templates/commands/create/project.md +507 -507
  71. package/templates/commands/create/skill.md +199 -199
  72. package/templates/commands/create.md +220 -220
  73. package/templates/commands/debug.md +95 -95
  74. package/templates/commands/documentation/module.md +202 -202
  75. package/templates/commands/documentation/templates.md +432 -432
  76. package/templates/commands/documentation.md +190 -190
  77. package/templates/commands/efcore/_env-check.md +153 -153
  78. package/templates/commands/efcore/conflicts.md +186 -186
  79. package/templates/commands/efcore/db-deploy.md +193 -193
  80. package/templates/commands/efcore/db-reset.md +426 -426
  81. package/templates/commands/efcore/db-seed.md +326 -326
  82. package/templates/commands/efcore/db-status.md +226 -226
  83. package/templates/commands/efcore/migration.md +400 -400
  84. package/templates/commands/efcore/rebase-snapshot.md +264 -264
  85. package/templates/commands/efcore/scan.md +198 -198
  86. package/templates/commands/efcore/squash.md +298 -298
  87. package/templates/commands/efcore.md +224 -224
  88. package/templates/commands/epct.md +69 -69
  89. package/templates/commands/explain.md +186 -186
  90. package/templates/commands/explore.md +45 -45
  91. package/templates/commands/feature-full.md +267 -267
  92. package/templates/commands/gitflow/1-init.md +1038 -1038
  93. package/templates/commands/gitflow/10-start.md +768 -768
  94. package/templates/commands/gitflow/11-finish.md +457 -457
  95. package/templates/commands/gitflow/12-cleanup.md +276 -276
  96. package/templates/commands/gitflow/13-sync.md +216 -216
  97. package/templates/commands/gitflow/14-rebase.md +251 -251
  98. package/templates/commands/gitflow/2-status.md +277 -277
  99. package/templates/commands/gitflow/3-commit.md +344 -344
  100. package/templates/commands/gitflow/4-plan.md +145 -145
  101. package/templates/commands/gitflow/5-exec.md +147 -147
  102. package/templates/commands/gitflow/6-abort.md +344 -344
  103. package/templates/commands/gitflow/7-pull-request.md +453 -355
  104. package/templates/commands/gitflow/8-review.md +240 -176
  105. package/templates/commands/gitflow/9-merge.md +451 -365
  106. package/templates/commands/gitflow.md +128 -128
  107. package/templates/commands/implement.md +663 -663
  108. package/templates/commands/init.md +567 -567
  109. package/templates/commands/mcp-integration.md +330 -330
  110. package/templates/commands/notification.md +129 -129
  111. package/templates/commands/oneshot.md +57 -57
  112. package/templates/commands/quick-search.md +72 -72
  113. package/templates/commands/ralph-loop/cancel-ralph.md +18 -18
  114. package/templates/commands/ralph-loop/help.md +126 -126
  115. package/templates/commands/ralph-loop/ralph-loop.md +18 -18
  116. package/templates/commands/review.md +106 -106
  117. package/templates/commands/utils/test-web-config.md +160 -160
  118. package/templates/commands/utils/test-web.md +151 -151
  119. package/templates/commands/validate.md +233 -233
  120. package/templates/commands/workflow.md +193 -193
  121. package/templates/gitflow/config.json +138 -138
  122. package/templates/hooks/ef-migration-check.md +139 -139
  123. package/templates/hooks/hooks.json +25 -25
  124. package/templates/hooks/stop-hook.sh +177 -177
  125. package/templates/skills/ai-prompt/SKILL.md +778 -778
  126. package/templates/skills/application/SKILL.md +563 -563
  127. package/templates/skills/application/templates-backend.md +450 -450
  128. package/templates/skills/application/templates-frontend.md +531 -531
  129. package/templates/skills/application/templates-i18n.md +520 -520
  130. package/templates/skills/application/templates-seed.md +647 -647
  131. package/templates/skills/business-analyse/SKILL.md +191 -191
  132. package/templates/skills/business-analyse/questionnaire.md +283 -283
  133. package/templates/skills/business-analyse/templates-frd.md +477 -477
  134. package/templates/skills/business-analyse/templates-react.md +580 -580
  135. package/templates/skills/controller/SKILL.md +240 -240
  136. package/templates/skills/controller/postman-templates.md +614 -614
  137. package/templates/skills/controller/templates.md +1468 -1468
  138. package/templates/skills/documentation/SKILL.md +133 -133
  139. package/templates/skills/documentation/templates.md +476 -476
  140. package/templates/skills/feature-full/SKILL.md +838 -838
  141. package/templates/skills/notification/SKILL.md +555 -555
  142. package/templates/skills/ui-components/SKILL.md +870 -870
  143. package/templates/skills/workflow/SKILL.md +582 -582
  144. package/templates/test-web/api-health.json +38 -38
  145. package/templates/test-web/minimal.json +19 -19
  146. package/templates/test-web/npm-package.json +46 -46
  147. package/templates/test-web/seo-check.json +54 -54
@@ -1,450 +1,450 @@
1
- # Templates Backend - Application Skill
2
-
3
- > Ces templates génèrent le code C# pour les nouvelles applications/modules.
4
-
5
- ---
6
-
7
- ## TEMPLATE: PERMISSIONS CLASS
8
-
9
- ```csharp
10
- // Ajouter dans src/SmartStack.Application/Common/Authorization/Permissions.cs
11
-
12
- public static class $CONTEXT_PASCAL
13
- {
14
- public const string Access = "$context.$application";
15
-
16
- public static class $MODULE_PASCAL
17
- {
18
- public const string View = "$context.$application.$module.read";
19
- public const string Create = "$context.$application.$module.create";
20
- public const string Update = "$context.$application.$module.update";
21
- public const string Delete = "$context.$application.$module.delete";
22
- public const string Assign = "$context.$application.$module.assign";
23
- public const string Execute = "$context.$application.$module.execute";
24
- }
25
- }
26
- ```
27
-
28
- ### Exemple pour ERP > Sales > Products
29
-
30
- ```csharp
31
- public static class Erp
32
- {
33
- public const string Access = "erp.sales";
34
-
35
- public static class Products
36
- {
37
- public const string View = "erp.sales.products.read";
38
- public const string Create = "erp.sales.products.create";
39
- public const string Update = "erp.sales.products.update";
40
- public const string Delete = "erp.sales.products.delete";
41
- }
42
- }
43
- ```
44
-
45
- ---
46
-
47
- ## TEMPLATE: SERVICE INTERFACE
48
-
49
- ```csharp
50
- // src/SmartStack.Application/Common/Interfaces/I{Module}Service.cs
51
-
52
- using SmartStack.Application.$MODULE_PASCAL.Models;
53
-
54
- namespace SmartStack.Application.Common.Interfaces;
55
-
56
- public interface I$MODULE_PASCALService
57
- {
58
- Task<PagedResult<$ENTITY_PASCALDto>> GetAllAsync(
59
- $ENTITY_PASCALQueryParameters parameters,
60
- CancellationToken cancellationToken = default);
61
-
62
- Task<$ENTITY_PASCALDto?> GetByIdAsync(
63
- Guid id,
64
- CancellationToken cancellationToken = default);
65
-
66
- Task<$ENTITY_PASCALDto> CreateAsync(
67
- Create$ENTITY_PASCALRequest request,
68
- CancellationToken cancellationToken = default);
69
-
70
- Task<$ENTITY_PASCALDto> UpdateAsync(
71
- Guid id,
72
- Update$ENTITY_PASCALRequest request,
73
- CancellationToken cancellationToken = default);
74
-
75
- Task<bool> DeleteAsync(
76
- Guid id,
77
- CancellationToken cancellationToken = default);
78
- }
79
- ```
80
-
81
- ---
82
-
83
- ## TEMPLATE: SERVICE IMPLEMENTATION
84
-
85
- ```csharp
86
- // src/SmartStack.Infrastructure/Services/$MODULE_PASCAL/$MODULE_PASCALService.cs
87
-
88
- using Microsoft.EntityFrameworkCore;
89
- using Microsoft.Extensions.Logging;
90
- using SmartStack.Application.Common.Interfaces;
91
- using SmartStack.Application.$MODULE_PASCAL.Models;
92
- using SmartStack.Domain.$MODULE_PASCAL;
93
-
94
- namespace SmartStack.Infrastructure.Services.$MODULE_PASCAL;
95
-
96
- public class $MODULE_PASCALService : I$MODULE_PASCALService
97
- {
98
- private readonly IApplicationDbContext _context;
99
- private readonly ICurrentUserService _currentUser;
100
- private readonly ILogger<$MODULE_PASCALService> _logger;
101
-
102
- public $MODULE_PASCALService(
103
- IApplicationDbContext context,
104
- ICurrentUserService currentUser,
105
- ILogger<$MODULE_PASCALService> logger)
106
- {
107
- _context = context;
108
- _currentUser = currentUser;
109
- _logger = logger;
110
- }
111
-
112
- public async Task<PagedResult<$ENTITY_PASCALDto>> GetAllAsync(
113
- $ENTITY_PASCALQueryParameters parameters,
114
- CancellationToken cancellationToken = default)
115
- {
116
- var query = _context.$ENTITY_PLURAL
117
- .AsNoTracking();
118
-
119
- // Apply filters
120
- if (!string.IsNullOrWhiteSpace(parameters.SearchTerm))
121
- {
122
- query = query.Where(x =>
123
- x.Name.Contains(parameters.SearchTerm) ||
124
- x.Description.Contains(parameters.SearchTerm));
125
- }
126
-
127
- // Apply sorting
128
- query = parameters.SortColumn?.ToLower() switch
129
- {
130
- "name" => parameters.SortDirection == "desc"
131
- ? query.OrderByDescending(x => x.Name)
132
- : query.OrderBy(x => x.Name),
133
- "createdat" => parameters.SortDirection == "desc"
134
- ? query.OrderByDescending(x => x.CreatedAt)
135
- : query.OrderBy(x => x.CreatedAt),
136
- _ => query.OrderByDescending(x => x.CreatedAt)
137
- };
138
-
139
- var totalCount = await query.CountAsync(cancellationToken);
140
-
141
- var items = await query
142
- .Skip((parameters.Page - 1) * parameters.PageSize)
143
- .Take(parameters.PageSize)
144
- .Select(x => new $ENTITY_PASCALDto
145
- {
146
- Id = x.Id,
147
- Name = x.Name,
148
- Description = x.Description,
149
- IsActive = x.IsActive,
150
- CreatedAt = x.CreatedAt,
151
- UpdatedAt = x.UpdatedAt
152
- })
153
- .ToListAsync(cancellationToken);
154
-
155
- return new PagedResult<$ENTITY_PASCALDto>
156
- {
157
- Items = items,
158
- TotalCount = totalCount,
159
- Page = parameters.Page,
160
- PageSize = parameters.PageSize
161
- };
162
- }
163
-
164
- public async Task<$ENTITY_PASCALDto?> GetByIdAsync(
165
- Guid id,
166
- CancellationToken cancellationToken = default)
167
- {
168
- var entity = await _context.$ENTITY_PLURAL
169
- .AsNoTracking()
170
- .FirstOrDefaultAsync(x => x.Id == id, cancellationToken);
171
-
172
- if (entity == null)
173
- return null;
174
-
175
- return new $ENTITY_PASCALDto
176
- {
177
- Id = entity.Id,
178
- Name = entity.Name,
179
- Description = entity.Description,
180
- IsActive = entity.IsActive,
181
- CreatedAt = entity.CreatedAt,
182
- UpdatedAt = entity.UpdatedAt
183
- };
184
- }
185
-
186
- public async Task<$ENTITY_PASCALDto> CreateAsync(
187
- Create$ENTITY_PASCALRequest request,
188
- CancellationToken cancellationToken = default)
189
- {
190
- var entity = $ENTITY_PASCAL.Create(
191
- request.Name,
192
- request.Description);
193
-
194
- _context.$ENTITY_PLURAL.Add(entity);
195
- await _context.SaveChangesAsync(cancellationToken);
196
-
197
- _logger.LogInformation(
198
- "User {User} created $ENTITY_PASCAL {Id} ({Name})",
199
- _currentUser.Email,
200
- entity.Id,
201
- entity.Name);
202
-
203
- return new $ENTITY_PASCALDto
204
- {
205
- Id = entity.Id,
206
- Name = entity.Name,
207
- Description = entity.Description,
208
- IsActive = entity.IsActive,
209
- CreatedAt = entity.CreatedAt
210
- };
211
- }
212
-
213
- public async Task<$ENTITY_PASCALDto> UpdateAsync(
214
- Guid id,
215
- Update$ENTITY_PASCALRequest request,
216
- CancellationToken cancellationToken = default)
217
- {
218
- var entity = await _context.$ENTITY_PLURAL
219
- .FirstOrDefaultAsync(x => x.Id == id, cancellationToken)
220
- ?? throw new NotFoundException("$ENTITY_PASCAL", id);
221
-
222
- entity.Update(request.Name, request.Description);
223
-
224
- await _context.SaveChangesAsync(cancellationToken);
225
-
226
- _logger.LogInformation(
227
- "User {User} updated $ENTITY_PASCAL {Id} ({Name})",
228
- _currentUser.Email,
229
- entity.Id,
230
- entity.Name);
231
-
232
- return new $ENTITY_PASCALDto
233
- {
234
- Id = entity.Id,
235
- Name = entity.Name,
236
- Description = entity.Description,
237
- IsActive = entity.IsActive,
238
- CreatedAt = entity.CreatedAt,
239
- UpdatedAt = entity.UpdatedAt
240
- };
241
- }
242
-
243
- public async Task<bool> DeleteAsync(
244
- Guid id,
245
- CancellationToken cancellationToken = default)
246
- {
247
- var entity = await _context.$ENTITY_PLURAL
248
- .FirstOrDefaultAsync(x => x.Id == id, cancellationToken);
249
-
250
- if (entity == null)
251
- return false;
252
-
253
- _context.$ENTITY_PLURAL.Remove(entity);
254
- await _context.SaveChangesAsync(cancellationToken);
255
-
256
- _logger.LogWarning(
257
- "User {User} deleted $ENTITY_PASCAL {Id} ({Name})",
258
- _currentUser.Email,
259
- id,
260
- entity.Name);
261
-
262
- return true;
263
- }
264
- }
265
- ```
266
-
267
- ---
268
-
269
- ## TEMPLATE: DTOs
270
-
271
- ```csharp
272
- // src/SmartStack.Application/$MODULE_PASCAL/Models/$ENTITY_PASCALDto.cs
273
-
274
- namespace SmartStack.Application.$MODULE_PASCAL.Models;
275
-
276
- public record $ENTITY_PASCALDto
277
- {
278
- public Guid Id { get; init; }
279
- public string Name { get; init; } = null!;
280
- public string? Description { get; init; }
281
- public bool IsActive { get; init; }
282
- public DateTime CreatedAt { get; init; }
283
- public DateTime? UpdatedAt { get; init; }
284
- }
285
-
286
- public record Create$ENTITY_PASCALRequest
287
- {
288
- public string Name { get; init; } = null!;
289
- public string? Description { get; init; }
290
- }
291
-
292
- public record Update$ENTITY_PASCALRequest
293
- {
294
- public string Name { get; init; } = null!;
295
- public string? Description { get; init; }
296
- }
297
-
298
- public record $ENTITY_PASCALQueryParameters
299
- {
300
- public int Page { get; init; } = 1;
301
- public int PageSize { get; init; } = 10;
302
- public string? SearchTerm { get; init; }
303
- public string? SortColumn { get; init; } = "createdAt";
304
- public string? SortDirection { get; init; } = "desc";
305
- }
306
- ```
307
-
308
- ---
309
-
310
- ## TEMPLATE: DOMAIN ENTITY
311
-
312
- ```csharp
313
- // src/SmartStack.Domain/$MODULE_PASCAL/$ENTITY_PASCAL.cs
314
-
315
- using SmartStack.Domain.Common;
316
-
317
- namespace SmartStack.Domain.$MODULE_PASCAL;
318
-
319
- public class $ENTITY_PASCAL : BaseEntity
320
- {
321
- public string Name { get; private set; } = null!;
322
- public string? Description { get; private set; }
323
- public bool IsActive { get; private set; }
324
-
325
- private $ENTITY_PASCAL() { }
326
-
327
- public static $ENTITY_PASCAL Create(string name, string? description = null)
328
- {
329
- if (string.IsNullOrWhiteSpace(name))
330
- throw new Exceptions.DomainException("Name is required");
331
-
332
- return new $ENTITY_PASCAL
333
- {
334
- Id = Guid.NewGuid(),
335
- Name = name,
336
- Description = description,
337
- IsActive = true,
338
- CreatedAt = DateTime.UtcNow
339
- };
340
- }
341
-
342
- public void Update(string name, string? description)
343
- {
344
- if (string.IsNullOrWhiteSpace(name))
345
- throw new Exceptions.DomainException("Name is required");
346
-
347
- Name = name;
348
- Description = description;
349
- UpdatedAt = DateTime.UtcNow;
350
- }
351
-
352
- public void Activate() => IsActive = true;
353
- public void Deactivate() => IsActive = false;
354
- }
355
- ```
356
-
357
- ---
358
-
359
- ## TEMPLATE: EF CONFIGURATION
360
-
361
- ```csharp
362
- // src/SmartStack.Infrastructure/Persistence/Configurations/$MODULE_PASCAL/$ENTITY_PASCALConfiguration.cs
363
-
364
- using Microsoft.EntityFrameworkCore;
365
- using Microsoft.EntityFrameworkCore.Metadata.Builders;
366
- using SmartStack.Domain.$MODULE_PASCAL;
367
-
368
- namespace SmartStack.Infrastructure.Persistence.Configurations.$MODULE_PASCAL;
369
-
370
- public class $ENTITY_PASCALConfiguration : IEntityTypeConfiguration<$ENTITY_PASCAL>
371
- {
372
- public void Configure(EntityTypeBuilder<$ENTITY_PASCAL> builder)
373
- {
374
- builder.ToTable("$ENTITY_PLURAL", "$SCHEMA");
375
-
376
- builder.HasKey(x => x.Id);
377
-
378
- builder.Property(x => x.Name)
379
- .HasMaxLength(200)
380
- .IsRequired();
381
-
382
- builder.Property(x => x.Description)
383
- .HasMaxLength(1000);
384
-
385
- builder.HasIndex(x => x.Name)
386
- .IsUnique();
387
- }
388
- }
389
- ```
390
-
391
- ---
392
-
393
- ## TEMPLATE: DBCONTEXT UPDATE
394
-
395
- ```csharp
396
- // Ajouter dans IApplicationDbContext.cs
397
- DbSet<$ENTITY_PASCAL> $ENTITY_PLURAL { get; }
398
-
399
- // Ajouter dans ApplicationDbContext.cs
400
- public DbSet<$ENTITY_PASCAL> $ENTITY_PLURAL => Set<$ENTITY_PASCAL>();
401
- ```
402
-
403
- ---
404
-
405
- ## TEMPLATE: DI REGISTRATION
406
-
407
- ```csharp
408
- // Ajouter dans src/SmartStack.Infrastructure/DependencyInjection.cs
409
-
410
- services.AddScoped<I$MODULE_PASCALService, $MODULE_PASCALService>();
411
- ```
412
-
413
- ---
414
-
415
- ## CHAÎNAGE AVEC /controller:create
416
-
417
- Après génération des templates backend, le skill appelle automatiquement :
418
-
419
- ```
420
- /controller:create $AREA $MODULE $ENTITY
421
- ```
422
-
423
- Exemple :
424
- ```
425
- /controller:create Business Products Product
426
- ```
427
-
428
- Cela génère :
429
- - Controller avec CRUD complet
430
- - Endpoints REST
431
- - ProducesResponseType
432
- - Logging approprié
433
- - Tests Postman
434
-
435
- ---
436
-
437
- ## CHECKLIST BACKEND
438
-
439
- | Vérification | Status |
440
- |--------------|--------|
441
- | ☐ Permissions.cs mis à jour | |
442
- | ☐ Service interface créée | |
443
- | ☐ Service implementation créée | |
444
- | ☐ DTOs créés | |
445
- | ☐ Domain entity créée | |
446
- | ☐ EF Configuration créée | |
447
- | ☐ DbContext mis à jour | |
448
- | ☐ DI registration ajoutée | |
449
- | ☐ /controller:create exécuté | |
450
- | ☐ dotnet build réussi | |
1
+ # Templates Backend - Application Skill
2
+
3
+ > Ces templates génèrent le code C# pour les nouvelles applications/modules.
4
+
5
+ ---
6
+
7
+ ## TEMPLATE: PERMISSIONS CLASS
8
+
9
+ ```csharp
10
+ // Ajouter dans src/SmartStack.Application/Common/Authorization/Permissions.cs
11
+
12
+ public static class $CONTEXT_PASCAL
13
+ {
14
+ public const string Access = "$context.$application";
15
+
16
+ public static class $MODULE_PASCAL
17
+ {
18
+ public const string View = "$context.$application.$module.read";
19
+ public const string Create = "$context.$application.$module.create";
20
+ public const string Update = "$context.$application.$module.update";
21
+ public const string Delete = "$context.$application.$module.delete";
22
+ public const string Assign = "$context.$application.$module.assign";
23
+ public const string Execute = "$context.$application.$module.execute";
24
+ }
25
+ }
26
+ ```
27
+
28
+ ### Exemple pour ERP > Sales > Products
29
+
30
+ ```csharp
31
+ public static class Erp
32
+ {
33
+ public const string Access = "erp.sales";
34
+
35
+ public static class Products
36
+ {
37
+ public const string View = "erp.sales.products.read";
38
+ public const string Create = "erp.sales.products.create";
39
+ public const string Update = "erp.sales.products.update";
40
+ public const string Delete = "erp.sales.products.delete";
41
+ }
42
+ }
43
+ ```
44
+
45
+ ---
46
+
47
+ ## TEMPLATE: SERVICE INTERFACE
48
+
49
+ ```csharp
50
+ // src/SmartStack.Application/Common/Interfaces/I{Module}Service.cs
51
+
52
+ using SmartStack.Application.$MODULE_PASCAL.Models;
53
+
54
+ namespace SmartStack.Application.Common.Interfaces;
55
+
56
+ public interface I$MODULE_PASCALService
57
+ {
58
+ Task<PagedResult<$ENTITY_PASCALDto>> GetAllAsync(
59
+ $ENTITY_PASCALQueryParameters parameters,
60
+ CancellationToken cancellationToken = default);
61
+
62
+ Task<$ENTITY_PASCALDto?> GetByIdAsync(
63
+ Guid id,
64
+ CancellationToken cancellationToken = default);
65
+
66
+ Task<$ENTITY_PASCALDto> CreateAsync(
67
+ Create$ENTITY_PASCALRequest request,
68
+ CancellationToken cancellationToken = default);
69
+
70
+ Task<$ENTITY_PASCALDto> UpdateAsync(
71
+ Guid id,
72
+ Update$ENTITY_PASCALRequest request,
73
+ CancellationToken cancellationToken = default);
74
+
75
+ Task<bool> DeleteAsync(
76
+ Guid id,
77
+ CancellationToken cancellationToken = default);
78
+ }
79
+ ```
80
+
81
+ ---
82
+
83
+ ## TEMPLATE: SERVICE IMPLEMENTATION
84
+
85
+ ```csharp
86
+ // src/SmartStack.Infrastructure/Services/$MODULE_PASCAL/$MODULE_PASCALService.cs
87
+
88
+ using Microsoft.EntityFrameworkCore;
89
+ using Microsoft.Extensions.Logging;
90
+ using SmartStack.Application.Common.Interfaces;
91
+ using SmartStack.Application.$MODULE_PASCAL.Models;
92
+ using SmartStack.Domain.$MODULE_PASCAL;
93
+
94
+ namespace SmartStack.Infrastructure.Services.$MODULE_PASCAL;
95
+
96
+ public class $MODULE_PASCALService : I$MODULE_PASCALService
97
+ {
98
+ private readonly IApplicationDbContext _context;
99
+ private readonly ICurrentUserService _currentUser;
100
+ private readonly ILogger<$MODULE_PASCALService> _logger;
101
+
102
+ public $MODULE_PASCALService(
103
+ IApplicationDbContext context,
104
+ ICurrentUserService currentUser,
105
+ ILogger<$MODULE_PASCALService> logger)
106
+ {
107
+ _context = context;
108
+ _currentUser = currentUser;
109
+ _logger = logger;
110
+ }
111
+
112
+ public async Task<PagedResult<$ENTITY_PASCALDto>> GetAllAsync(
113
+ $ENTITY_PASCALQueryParameters parameters,
114
+ CancellationToken cancellationToken = default)
115
+ {
116
+ var query = _context.$ENTITY_PLURAL
117
+ .AsNoTracking();
118
+
119
+ // Apply filters
120
+ if (!string.IsNullOrWhiteSpace(parameters.SearchTerm))
121
+ {
122
+ query = query.Where(x =>
123
+ x.Name.Contains(parameters.SearchTerm) ||
124
+ x.Description.Contains(parameters.SearchTerm));
125
+ }
126
+
127
+ // Apply sorting
128
+ query = parameters.SortColumn?.ToLower() switch
129
+ {
130
+ "name" => parameters.SortDirection == "desc"
131
+ ? query.OrderByDescending(x => x.Name)
132
+ : query.OrderBy(x => x.Name),
133
+ "createdat" => parameters.SortDirection == "desc"
134
+ ? query.OrderByDescending(x => x.CreatedAt)
135
+ : query.OrderBy(x => x.CreatedAt),
136
+ _ => query.OrderByDescending(x => x.CreatedAt)
137
+ };
138
+
139
+ var totalCount = await query.CountAsync(cancellationToken);
140
+
141
+ var items = await query
142
+ .Skip((parameters.Page - 1) * parameters.PageSize)
143
+ .Take(parameters.PageSize)
144
+ .Select(x => new $ENTITY_PASCALDto
145
+ {
146
+ Id = x.Id,
147
+ Name = x.Name,
148
+ Description = x.Description,
149
+ IsActive = x.IsActive,
150
+ CreatedAt = x.CreatedAt,
151
+ UpdatedAt = x.UpdatedAt
152
+ })
153
+ .ToListAsync(cancellationToken);
154
+
155
+ return new PagedResult<$ENTITY_PASCALDto>
156
+ {
157
+ Items = items,
158
+ TotalCount = totalCount,
159
+ Page = parameters.Page,
160
+ PageSize = parameters.PageSize
161
+ };
162
+ }
163
+
164
+ public async Task<$ENTITY_PASCALDto?> GetByIdAsync(
165
+ Guid id,
166
+ CancellationToken cancellationToken = default)
167
+ {
168
+ var entity = await _context.$ENTITY_PLURAL
169
+ .AsNoTracking()
170
+ .FirstOrDefaultAsync(x => x.Id == id, cancellationToken);
171
+
172
+ if (entity == null)
173
+ return null;
174
+
175
+ return new $ENTITY_PASCALDto
176
+ {
177
+ Id = entity.Id,
178
+ Name = entity.Name,
179
+ Description = entity.Description,
180
+ IsActive = entity.IsActive,
181
+ CreatedAt = entity.CreatedAt,
182
+ UpdatedAt = entity.UpdatedAt
183
+ };
184
+ }
185
+
186
+ public async Task<$ENTITY_PASCALDto> CreateAsync(
187
+ Create$ENTITY_PASCALRequest request,
188
+ CancellationToken cancellationToken = default)
189
+ {
190
+ var entity = $ENTITY_PASCAL.Create(
191
+ request.Name,
192
+ request.Description);
193
+
194
+ _context.$ENTITY_PLURAL.Add(entity);
195
+ await _context.SaveChangesAsync(cancellationToken);
196
+
197
+ _logger.LogInformation(
198
+ "User {User} created $ENTITY_PASCAL {Id} ({Name})",
199
+ _currentUser.Email,
200
+ entity.Id,
201
+ entity.Name);
202
+
203
+ return new $ENTITY_PASCALDto
204
+ {
205
+ Id = entity.Id,
206
+ Name = entity.Name,
207
+ Description = entity.Description,
208
+ IsActive = entity.IsActive,
209
+ CreatedAt = entity.CreatedAt
210
+ };
211
+ }
212
+
213
+ public async Task<$ENTITY_PASCALDto> UpdateAsync(
214
+ Guid id,
215
+ Update$ENTITY_PASCALRequest request,
216
+ CancellationToken cancellationToken = default)
217
+ {
218
+ var entity = await _context.$ENTITY_PLURAL
219
+ .FirstOrDefaultAsync(x => x.Id == id, cancellationToken)
220
+ ?? throw new NotFoundException("$ENTITY_PASCAL", id);
221
+
222
+ entity.Update(request.Name, request.Description);
223
+
224
+ await _context.SaveChangesAsync(cancellationToken);
225
+
226
+ _logger.LogInformation(
227
+ "User {User} updated $ENTITY_PASCAL {Id} ({Name})",
228
+ _currentUser.Email,
229
+ entity.Id,
230
+ entity.Name);
231
+
232
+ return new $ENTITY_PASCALDto
233
+ {
234
+ Id = entity.Id,
235
+ Name = entity.Name,
236
+ Description = entity.Description,
237
+ IsActive = entity.IsActive,
238
+ CreatedAt = entity.CreatedAt,
239
+ UpdatedAt = entity.UpdatedAt
240
+ };
241
+ }
242
+
243
+ public async Task<bool> DeleteAsync(
244
+ Guid id,
245
+ CancellationToken cancellationToken = default)
246
+ {
247
+ var entity = await _context.$ENTITY_PLURAL
248
+ .FirstOrDefaultAsync(x => x.Id == id, cancellationToken);
249
+
250
+ if (entity == null)
251
+ return false;
252
+
253
+ _context.$ENTITY_PLURAL.Remove(entity);
254
+ await _context.SaveChangesAsync(cancellationToken);
255
+
256
+ _logger.LogWarning(
257
+ "User {User} deleted $ENTITY_PASCAL {Id} ({Name})",
258
+ _currentUser.Email,
259
+ id,
260
+ entity.Name);
261
+
262
+ return true;
263
+ }
264
+ }
265
+ ```
266
+
267
+ ---
268
+
269
+ ## TEMPLATE: DTOs
270
+
271
+ ```csharp
272
+ // src/SmartStack.Application/$MODULE_PASCAL/Models/$ENTITY_PASCALDto.cs
273
+
274
+ namespace SmartStack.Application.$MODULE_PASCAL.Models;
275
+
276
+ public record $ENTITY_PASCALDto
277
+ {
278
+ public Guid Id { get; init; }
279
+ public string Name { get; init; } = null!;
280
+ public string? Description { get; init; }
281
+ public bool IsActive { get; init; }
282
+ public DateTime CreatedAt { get; init; }
283
+ public DateTime? UpdatedAt { get; init; }
284
+ }
285
+
286
+ public record Create$ENTITY_PASCALRequest
287
+ {
288
+ public string Name { get; init; } = null!;
289
+ public string? Description { get; init; }
290
+ }
291
+
292
+ public record Update$ENTITY_PASCALRequest
293
+ {
294
+ public string Name { get; init; } = null!;
295
+ public string? Description { get; init; }
296
+ }
297
+
298
+ public record $ENTITY_PASCALQueryParameters
299
+ {
300
+ public int Page { get; init; } = 1;
301
+ public int PageSize { get; init; } = 10;
302
+ public string? SearchTerm { get; init; }
303
+ public string? SortColumn { get; init; } = "createdAt";
304
+ public string? SortDirection { get; init; } = "desc";
305
+ }
306
+ ```
307
+
308
+ ---
309
+
310
+ ## TEMPLATE: DOMAIN ENTITY
311
+
312
+ ```csharp
313
+ // src/SmartStack.Domain/$MODULE_PASCAL/$ENTITY_PASCAL.cs
314
+
315
+ using SmartStack.Domain.Common;
316
+
317
+ namespace SmartStack.Domain.$MODULE_PASCAL;
318
+
319
+ public class $ENTITY_PASCAL : BaseEntity
320
+ {
321
+ public string Name { get; private set; } = null!;
322
+ public string? Description { get; private set; }
323
+ public bool IsActive { get; private set; }
324
+
325
+ private $ENTITY_PASCAL() { }
326
+
327
+ public static $ENTITY_PASCAL Create(string name, string? description = null)
328
+ {
329
+ if (string.IsNullOrWhiteSpace(name))
330
+ throw new Exceptions.DomainException("Name is required");
331
+
332
+ return new $ENTITY_PASCAL
333
+ {
334
+ Id = Guid.NewGuid(),
335
+ Name = name,
336
+ Description = description,
337
+ IsActive = true,
338
+ CreatedAt = DateTime.UtcNow
339
+ };
340
+ }
341
+
342
+ public void Update(string name, string? description)
343
+ {
344
+ if (string.IsNullOrWhiteSpace(name))
345
+ throw new Exceptions.DomainException("Name is required");
346
+
347
+ Name = name;
348
+ Description = description;
349
+ UpdatedAt = DateTime.UtcNow;
350
+ }
351
+
352
+ public void Activate() => IsActive = true;
353
+ public void Deactivate() => IsActive = false;
354
+ }
355
+ ```
356
+
357
+ ---
358
+
359
+ ## TEMPLATE: EF CONFIGURATION
360
+
361
+ ```csharp
362
+ // src/SmartStack.Infrastructure/Persistence/Configurations/$MODULE_PASCAL/$ENTITY_PASCALConfiguration.cs
363
+
364
+ using Microsoft.EntityFrameworkCore;
365
+ using Microsoft.EntityFrameworkCore.Metadata.Builders;
366
+ using SmartStack.Domain.$MODULE_PASCAL;
367
+
368
+ namespace SmartStack.Infrastructure.Persistence.Configurations.$MODULE_PASCAL;
369
+
370
+ public class $ENTITY_PASCALConfiguration : IEntityTypeConfiguration<$ENTITY_PASCAL>
371
+ {
372
+ public void Configure(EntityTypeBuilder<$ENTITY_PASCAL> builder)
373
+ {
374
+ builder.ToTable("$ENTITY_PLURAL", "$SCHEMA");
375
+
376
+ builder.HasKey(x => x.Id);
377
+
378
+ builder.Property(x => x.Name)
379
+ .HasMaxLength(200)
380
+ .IsRequired();
381
+
382
+ builder.Property(x => x.Description)
383
+ .HasMaxLength(1000);
384
+
385
+ builder.HasIndex(x => x.Name)
386
+ .IsUnique();
387
+ }
388
+ }
389
+ ```
390
+
391
+ ---
392
+
393
+ ## TEMPLATE: DBCONTEXT UPDATE
394
+
395
+ ```csharp
396
+ // Ajouter dans IApplicationDbContext.cs
397
+ DbSet<$ENTITY_PASCAL> $ENTITY_PLURAL { get; }
398
+
399
+ // Ajouter dans ApplicationDbContext.cs
400
+ public DbSet<$ENTITY_PASCAL> $ENTITY_PLURAL => Set<$ENTITY_PASCAL>();
401
+ ```
402
+
403
+ ---
404
+
405
+ ## TEMPLATE: DI REGISTRATION
406
+
407
+ ```csharp
408
+ // Ajouter dans src/SmartStack.Infrastructure/DependencyInjection.cs
409
+
410
+ services.AddScoped<I$MODULE_PASCALService, $MODULE_PASCALService>();
411
+ ```
412
+
413
+ ---
414
+
415
+ ## CHAÎNAGE AVEC /controller:create
416
+
417
+ Après génération des templates backend, le skill appelle automatiquement :
418
+
419
+ ```
420
+ /controller:create $AREA $MODULE $ENTITY
421
+ ```
422
+
423
+ Exemple :
424
+ ```
425
+ /controller:create Business Products Product
426
+ ```
427
+
428
+ Cela génère :
429
+ - Controller avec CRUD complet
430
+ - Endpoints REST
431
+ - ProducesResponseType
432
+ - Logging approprié
433
+ - Tests Postman
434
+
435
+ ---
436
+
437
+ ## CHECKLIST BACKEND
438
+
439
+ | Vérification | Status |
440
+ |--------------|--------|
441
+ | ☐ Permissions.cs mis à jour | |
442
+ | ☐ Service interface créée | |
443
+ | ☐ Service implementation créée | |
444
+ | ☐ DTOs créés | |
445
+ | ☐ Domain entity créée | |
446
+ | ☐ EF Configuration créée | |
447
+ | ☐ DbContext mis à jour | |
448
+ | ☐ DI registration ajoutée | |
449
+ | ☐ /controller:create exécuté | |
450
+ | ☐ dotnet build réussi | |