@atlashub/smartstack-cli 1.4.0 → 1.5.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 (66) hide show
  1. package/.documentation/agents.html +8 -4
  2. package/.documentation/apex.html +8 -4
  3. package/.documentation/business-analyse.html +833 -406
  4. package/.documentation/commands.html +8 -4
  5. package/.documentation/css/styles.css +153 -15
  6. package/.documentation/efcore.html +8 -4
  7. package/.documentation/gitflow.html +795 -230
  8. package/.documentation/hooks.html +8 -4
  9. package/.documentation/index.html +13 -9
  10. package/.documentation/installation.html +23 -19
  11. package/.documentation/ralph-loop.html +530 -0
  12. package/.documentation/test-web.html +8 -4
  13. package/README.md +52 -10
  14. package/dist/index.js +813 -283
  15. package/dist/index.js.map +1 -1
  16. package/package.json +1 -1
  17. package/templates/agents/efcore/conflicts.md +44 -17
  18. package/templates/agents/efcore/db-status.md +27 -6
  19. package/templates/agents/efcore/scan.md +43 -13
  20. package/templates/commands/ai-prompt.md +315 -315
  21. package/templates/commands/application/create.md +362 -362
  22. package/templates/commands/controller/create.md +216 -216
  23. package/templates/commands/controller.md +59 -0
  24. package/templates/commands/create/agent.md +138 -0
  25. package/templates/commands/create/command.md +166 -0
  26. package/templates/commands/create/hook.md +234 -0
  27. package/templates/commands/create/plugin.md +329 -0
  28. package/templates/commands/create/project.md +507 -0
  29. package/templates/commands/create/skill.md +199 -0
  30. package/templates/commands/create.md +220 -0
  31. package/templates/commands/documentation/module.md +202 -202
  32. package/templates/commands/efcore/_env-check.md +153 -153
  33. package/templates/commands/efcore/conflicts.md +109 -192
  34. package/templates/commands/efcore/db-status.md +101 -89
  35. package/templates/commands/efcore/migration.md +23 -11
  36. package/templates/commands/efcore/scan.md +115 -119
  37. package/templates/commands/efcore.md +54 -6
  38. package/templates/commands/feature-full.md +267 -267
  39. package/templates/commands/gitflow/11-finish.md +145 -11
  40. package/templates/commands/gitflow/13-sync.md +216 -216
  41. package/templates/commands/gitflow/14-rebase.md +251 -251
  42. package/templates/commands/gitflow/2-status.md +120 -10
  43. package/templates/commands/gitflow/3-commit.md +150 -0
  44. package/templates/commands/gitflow/7-pull-request.md +134 -5
  45. package/templates/commands/gitflow/9-merge.md +142 -1
  46. package/templates/commands/implement.md +663 -663
  47. package/templates/commands/init.md +562 -0
  48. package/templates/commands/mcp-integration.md +330 -0
  49. package/templates/commands/notification.md +129 -129
  50. package/templates/commands/validate.md +233 -0
  51. package/templates/commands/workflow.md +193 -193
  52. package/templates/skills/ai-prompt/SKILL.md +778 -778
  53. package/templates/skills/application/SKILL.md +563 -563
  54. package/templates/skills/application/templates-backend.md +450 -450
  55. package/templates/skills/application/templates-frontend.md +531 -531
  56. package/templates/skills/application/templates-i18n.md +520 -520
  57. package/templates/skills/application/templates-seed.md +647 -647
  58. package/templates/skills/controller/SKILL.md +240 -240
  59. package/templates/skills/controller/postman-templates.md +614 -614
  60. package/templates/skills/controller/templates.md +1468 -1468
  61. package/templates/skills/documentation/SKILL.md +133 -133
  62. package/templates/skills/documentation/templates.md +476 -476
  63. package/templates/skills/feature-full/SKILL.md +838 -838
  64. package/templates/skills/notification/SKILL.md +555 -555
  65. package/templates/skills/ui-components/SKILL.md +870 -870
  66. package/templates/skills/workflow/SKILL.md +582 -582
@@ -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 | |