@atlashub/smartstack-cli 1.16.0 → 1.17.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.
@@ -103,24 +103,50 @@ echo "Backup: $BACKUP_DIR"
103
103
 
104
104
  ---
105
105
 
106
- ## STEP 4: Récupérer ModelSnapshot de la Branche Parente (CRUCIAL)
106
+ ## STEP 4: Récupérer Migrations ET Snapshot de la Branche Parente (CRUCIAL)
107
107
 
108
108
  ```bash
109
109
  # Sauvegarder snapshot actuel
110
110
  cp "$MIGRATIONS_DIR"/*ModelSnapshot.cs "$BACKUP_DIR/"
111
111
 
112
- # Récupérer le snapshot de la branche parente
112
+ # Récupérer TOUTES les migrations de la branche parente
113
113
  git fetch origin "$BASE_BRANCH" --quiet
114
+
115
+ # 1. Récupérer le ModelSnapshot
114
116
  git checkout "origin/$BASE_BRANCH" -- "$MIGRATIONS_DIR"/*ModelSnapshot.cs
115
117
 
116
- echo "ModelSnapshot récupéré depuis: origin/$BASE_BRANCH"
118
+ # 2. Récupérer les fichiers de migration de la branche parente
119
+ # (pour ne pas perdre les migrations déjà présentes sur develop/main)
120
+ for base_mig in $BASE_MIGRATIONS; do
121
+ base_file=$(basename "$base_mig")
122
+ base_name="${base_file%.cs}"
123
+
124
+ # Récupérer le fichier migration ET son Designer
125
+ git checkout "origin/$BASE_BRANCH" -- "$MIGRATIONS_DIR/${base_name}.cs" 2>/dev/null || true
126
+ git checkout "origin/$BASE_BRANCH" -- "$MIGRATIONS_DIR/${base_name}.Designer.cs" 2>/dev/null || true
127
+ done
128
+
129
+ echo "Récupéré depuis origin/$BASE_BRANCH:"
130
+ echo " - ModelSnapshot"
131
+ echo " - $(echo "$BASE_MIGRATIONS" | wc -l) migrations"
117
132
  ```
118
133
 
119
134
  **Pourquoi c'est crucial:**
120
135
  - Le snapshot de `$BASE_BRANCH` contient l'état VALIDÉ et COMPLET
136
+ - Les **migrations existantes** de `$BASE_BRANCH` doivent être conservées
121
137
  - Les migrations parallèles sur d'autres branches sont incluses
122
138
  - Évite la perte d'information de schéma (cf. [Bokio best practices](https://www.bokio.se/engineering-blog/how-to-squash-ef-core-migrations/))
123
139
 
140
+ **Résultat attendu:**
141
+ ```
142
+ feature/* après squash:
143
+ ├── Core_v1_9_0_001_InitialSchema.cs ← De develop (conservé)
144
+ ├── Core_v1_9_0_001_InitialSchema.Designer.cs
145
+ ├── core_v1.0.0_001_FeatureConsolidated.cs ← Squash de la feature
146
+ ├── core_v1.0.0_001_FeatureConsolidated.Designer.cs
147
+ └── CoreDbContextModelSnapshot.cs ← De develop
148
+ ```
149
+
124
150
  ---
125
151
 
126
152
  ## STEP 5: Supprimer Migrations de la Branche (pas celles héritées)
@@ -139,29 +165,48 @@ echo "Supprimé: ${#BRANCH_ONLY_MIGRATIONS[@]} migrations"
139
165
 
140
166
  ## STEP 6: Créer Migration Consolidée
141
167
 
168
+ **OBLIGATOIRE: Utiliser le MCP pour le nommage conforme**
169
+
142
170
  ```bash
143
- # Nommage selon contexte
171
+ # Construire la description selon le contexte
144
172
  case "$BRANCH_TYPE" in
145
173
  feature)
146
- BRANCH_NAME=$(echo "$CURRENT_BRANCH" | sed 's|feature/||')
147
- MIGRATION_NAME="Feature_${BRANCH_NAME}_Consolidated"
174
+ BRANCH_NAME=$(echo "$CURRENT_BRANCH" | sed 's|feature/||' | sed 's/-/ /g')
175
+ DESCRIPTION="${BRANCH_NAME} Consolidated"
148
176
  ;;
149
177
  release)
150
- VERSION=$(echo "$CURRENT_BRANCH" | sed 's|release/||' | tr '.' '_')
151
- MIGRATION_NAME="Release_${VERSION}_Initial"
178
+ VERSION=$(echo "$CURRENT_BRANCH" | sed 's|release/||')
179
+ DESCRIPTION="Release ${VERSION} Initial"
152
180
  ;;
153
181
  hotfix)
154
- VERSION=$(echo "$CURRENT_BRANCH" | sed 's|hotfix/||' | tr '.' '_')
155
- MIGRATION_NAME="Hotfix_${VERSION}_Fix"
182
+ VERSION=$(echo "$CURRENT_BRANCH" | sed 's|hotfix/||')
183
+ DESCRIPTION="Hotfix ${VERSION} Fix"
156
184
  ;;
157
185
  develop)
158
- MIGRATION_NAME="Develop_Consolidated_$(date +%Y%m%d)"
186
+ DESCRIPTION="Develop Consolidated"
159
187
  ;;
160
188
  *)
161
- MIGRATION_NAME="Consolidated_$(date +%Y%m%d_%H%M%S)"
189
+ DESCRIPTION="Consolidated"
162
190
  ;;
163
191
  esac
192
+ ```
164
193
 
194
+ **Appel MCP OBLIGATOIRE:**
195
+
196
+ ```javascript
197
+ // Utiliser le MCP pour obtenir le nom conforme
198
+ mcp__smartstack__suggest_migration({
199
+ description: DESCRIPTION, // Ex: "multitenant Consolidated"
200
+ context: "core" // ou "extensions" selon le projet
201
+ })
202
+
203
+ // Résultat: core_v1.0.0_001_MultitenantConsolidated
204
+ ```
205
+
206
+ **Puis créer la migration:**
207
+
208
+ ```bash
209
+ # MIGRATION_NAME = résultat du MCP (ex: core_v1.0.0_001_MultitenantConsolidated)
165
210
  dotnet ef migrations add "$MIGRATION_NAME" \
166
211
  --project "$INFRA_PROJECT" \
167
212
  --startup-project "$STARTUP_PROJECT" \
@@ -169,6 +214,8 @@ dotnet ef migrations add "$MIGRATION_NAME" \
169
214
  --verbose
170
215
  ```
171
216
 
217
+ > **Convention:** `{context}_v{version}_{sequence}_{Description}` - Jamais de nom hardcodé
218
+
172
219
  ---
173
220
 
174
221
  ## STEP 7: Validation
@@ -192,11 +239,19 @@ dotnet ef migrations script --no-build --idempotent > /dev/null
192
239
 
193
240
  ```
194
241
  SQUASH - {CURRENT_BRANCH}
195
- Base: {BASE_BRANCH} (snapshot récupéré)
196
- Backup: {BACKUP_DIR}
197
- Avant: {MIGRATION_COUNT} migrations
198
- Apres: 1 migration ({MIGRATION_NAME})
199
- Conformite: EF Core CLI, Pas de .sql, Snapshot parent
242
+ Base: {BASE_BRANCH}
243
+ Backup: {BACKUP_DIR}
244
+
245
+ Récupéré de {BASE_BRANCH}:
246
+ - ModelSnapshot
247
+ - {BASE_MIGRATION_COUNT} migrations (conservées)
248
+
249
+ Consolidé:
250
+ - Avant: {MIGRATION_COUNT} migrations (propres à la branche)
251
+ - Après: 1 migration ({MIGRATION_NAME})
252
+
253
+ Total final: {BASE_MIGRATION_COUNT + 1} migrations
254
+ Conformité: MCP suggest_migration, EF Core CLI, Snapshot parent
200
255
 
201
256
  Prochains: /efcore:db-reset, /efcore:db-deploy, /gitflow:3-commit
202
257
  ```
@@ -188,27 +188,32 @@ EOF
188
188
  COMMIT_HASH=$(git rev-parse --short HEAD)
189
189
  ```
190
190
 
191
- ### 7. Auto-Push (based on config)
191
+ ### 7. Push to Remote (ALWAYS ASK USER)
192
+
193
+ **MANDATORY: Always ask user before pushing commits:**
194
+
195
+ ```yaml
196
+ AskUserQuestion:
197
+ header: "Push"
198
+ question: "Push commit to origin/$CURRENT?"
199
+ options:
200
+ - label: "Yes, push now"
201
+ description: "git push origin $CURRENT"
202
+ - label: "No, later"
203
+ description: "Keep commit local for now"
204
+ ```
192
205
 
206
+ **If user chooses "Yes":**
193
207
  ```bash
194
- PUSH_MODE=$(grep -oP '"afterCommit":\s*"\K[^"]+' .claude/gitflow/config.json 2>/dev/null || echo "ask")
195
-
196
- case "$PUSH_MODE" in
197
- always)
198
- git push origin $CURRENT
199
- PUSHED="yes"
200
- ;;
201
- worktree)
202
- # Push if in worktree
203
- [ -n "$(git worktree list | grep $(pwd))" ] && git push origin $CURRENT && PUSHED="yes"
204
- ;;
205
- ask)
206
- # Ask user
207
- ;;
208
- never)
209
- PUSHED="no"
210
- ;;
211
- esac
208
+ git push origin $CURRENT
209
+ PUSHED="yes"
210
+ echo "✅ Pushed to origin/$CURRENT"
211
+ ```
212
+
213
+ **If user chooses "No":**
214
+ ```bash
215
+ PUSHED="no"
216
+ echo "⏸️ Commit kept local. Push later with: git push origin $CURRENT"
212
217
  ```
213
218
 
214
219
  ### 8. Summary
@@ -248,7 +253,7 @@ esac
248
253
  - Migrations validated (if present)
249
254
  - Destructive operations confirmed
250
255
  - Commit created with proper message
251
- - Pushed (if configured)
256
+ - **Push: ALWAYS ask user (never automatic)**
252
257
 
253
258
  ## NEXT STEP:
254
259
 
@@ -152,6 +152,14 @@ git checkout "$BASE_BRANCH" && git pull origin "$BASE_BRANCH"
152
152
  git checkout -b "$FULL_BRANCH"
153
153
  ```
154
154
 
155
+ ### 6b. Push Branch to Remote (AUTOMATIC)
156
+
157
+ **ALWAYS push immediately after branch creation:**
158
+ ```bash
159
+ git push -u origin "$FULL_BRANCH"
160
+ echo "✅ Branch pushed to origin/$FULL_BRANCH"
161
+ ```
162
+
155
163
  ### 7. Create Local Environment Config (Backend + Frontend)
156
164
 
157
165
  **Detect project structure:**
@@ -323,6 +331,7 @@ EOF
323
331
  ## SUCCESS CRITERIA:
324
332
 
325
333
  - Branch created from correct base
334
+ - **Branch pushed to remote (AUTOMATIC)**
326
335
  - Worktree set up (if enabled)
327
336
  - Backend local config created: `appsettings.Local.json` (if .NET API detected)
328
337
  - Frontend local config created: `.env.local` + `npm run local` script (if web project detected)
@@ -7,8 +7,83 @@ description: This skill should be used when the user asks to "review code", "rev
7
7
  Provide expert-level code review guidance that focuses on high-impact issues: security vulnerabilities, logic errors, maintainability problems, and architectural concerns. Skip nitpicks and style issues that should be automated.
8
8
 
9
9
  Based on research from Google, Microsoft, OWASP, and academic studies on code review effectiveness.
10
+
11
+ **For SmartStack projects**: Automatically validates SmartStack-specific conventions via MCP.
10
12
  </objective>
11
13
 
14
+ <smartstack_integration>
15
+ ## SmartStack Project Detection & MCP Validation
16
+
17
+ **CRITICAL**: Before starting any code review, detect if this is a SmartStack project and run MCP validation.
18
+
19
+ <detection>
20
+ **Detect SmartStack project by checking for ANY of these:**
21
+ - `.claude/mcp-status.json` exists
22
+ - `SmartStack.Domain/` or `SmartStack.Application/` directories
23
+ - `*.sln` file containing "SmartStack"
24
+ - `package.json` with `@smartstack/` dependencies
25
+ </detection>
26
+
27
+ <mcp_validation>
28
+ **If SmartStack detected, run MCP validation FIRST:**
29
+
30
+ 1. **Validate conventions** (BLOCKING issues):
31
+ ```
32
+ mcp__smartstack__validate_conventions
33
+ checks: ["all"]
34
+ ```
35
+
36
+ 2. **Validate security** (when available):
37
+ ```
38
+ mcp__smartstack__validate_security
39
+ checks: ["all"]
40
+ ```
41
+
42
+ 3. **Analyze code quality** (when available):
43
+ ```
44
+ mcp__smartstack__analyze_code_quality
45
+ metrics: ["all"]
46
+ ```
47
+
48
+ 4. **Validate test conventions**:
49
+ ```
50
+ mcp__smartstack__validate_test_conventions
51
+ checks: ["all"]
52
+ ```
53
+ </mcp_validation>
54
+
55
+ <mcp_checks>
56
+ **SmartStack-specific checks via MCP:**
57
+
58
+ | Category | MCP Tool | What it validates |
59
+ |----------|----------|-------------------|
60
+ | **Tables** | `validate_conventions` | Préfixes (auth_, nav_, cfg_), schemas (core/extensions) |
61
+ | **Migrations** | `validate_conventions` | Nommage `{context}_v{version}_{sequence}_{Description}` |
62
+ | **Services** | `validate_conventions` | Interfaces I*Service |
63
+ | **Entities** | `validate_conventions` | ITenantEntity, factory methods, private constructors |
64
+ | **Controllers** | `validate_conventions` | [NavRoute] attributes, route format |
65
+ | **Multi-tenant** | `validate_conventions` | TenantId isolation, no cross-tenant access |
66
+ | **Tests** | `validate_test_conventions` | Naming, structure, patterns AAA |
67
+ </mcp_checks>
68
+
69
+ <output_integration>
70
+ **Merge MCP results into review output:**
71
+
72
+ ```markdown
73
+ ## SmartStack Conventions (via MCP)
74
+
75
+ | Severity | Issue | Location | Fix |
76
+ |----------|-------|----------|-----|
77
+ | BLOCKING | {MCP error} | `file:line` | {MCP suggestion} |
78
+ | WARNING | {MCP warning} | `file:line` | {MCP suggestion} |
79
+ ```
80
+
81
+ **Priority mapping:**
82
+ - MCP errors → `[BLOCKING]`
83
+ - MCP warnings → `[SUGGESTION]`
84
+ </output_integration>
85
+ </smartstack_integration>
86
+
12
87
  <quick_start>
13
88
  <review_priority>
14
89
  **Priority order**: Security > Correctness > Maintainability > Performance
@@ -207,6 +282,7 @@ A good code review:
207
282
  - Avoids nitpicks on style/formatting
208
283
  - Completes in reasonable time (<4 hours for small PRs)
209
284
  - **[React/Next.js]** Includes Vercel best practices review when applicable
285
+ - **[SmartStack]** Runs MCP validation and integrates results into review output
210
286
  </success_criteria>
211
287
 
212
288
  <reference_guides>
@@ -216,4 +292,5 @@ For detailed guidance and patterns:
216
292
  - **`references/clean-code-principles.md`** - SOLID principles, naming conventions, function design, code smell detection
217
293
  - **`references/feedback-patterns.md`** - Valuable vs wasteful feedback patterns, communication strategies, priority labeling
218
294
  - **`references/code-quality-metrics.md`** - Complexity calculations, maintainability index, measurement techniques
295
+ - **`references/smartstack-conventions.md`** - SmartStack-specific conventions, MCP integration, multi-tenant patterns
219
296
  </reference_guides>
@@ -0,0 +1,302 @@
1
+ <overview>
2
+ SmartStack-specific conventions and patterns. This reference is used when reviewing SmartStack projects to ensure compliance with the architecture and security standards.
3
+
4
+ **IMPORTANT**: All convention validation MUST be delegated to the MCP SmartStack tools. This file documents what to look for; the MCP validates automatically.
5
+ </overview>
6
+
7
+ <mcp_tools>
8
+ ## MCP SmartStack Tools for Code Review
9
+
10
+ | Tool | Purpose | When to use |
11
+ |------|---------|-------------|
12
+ | `mcp__smartstack__validate_conventions` | Validate all SmartStack conventions | Always run first |
13
+ | `mcp__smartstack__validate_test_conventions` | Validate test patterns | When tests are in scope |
14
+ | `mcp__smartstack__validate_security` | Security-specific checks | Security-focused reviews |
15
+ | `mcp__smartstack__analyze_code_quality` | Code metrics analysis | Quality-focused reviews |
16
+ | `mcp__smartstack__check_migrations` | EF Core migration conflicts | When migrations are modified |
17
+ </mcp_tools>
18
+
19
+ <architecture>
20
+ ## SmartStack Architecture (Clean Architecture)
21
+
22
+ ```
23
+ SmartStack/
24
+ ├── SmartStack.Domain/ # Entities, Value Objects, Domain Events
25
+ ├── SmartStack.Application/ # Services, DTOs, Commands/Queries
26
+ ├── SmartStack.Infrastructure/ # EF Core, External services
27
+ ├── SmartStack.Api/ # Controllers, Middleware
28
+ └── SmartStack.Web/ # React frontend
29
+ ```
30
+
31
+ **Dependency rule**: Dependencies point inward only (Api → Application → Domain).
32
+ </architecture>
33
+
34
+ <entities>
35
+ ## Entity Conventions
36
+
37
+ <tenant_aware>
38
+ **Tenant-aware entities** (most business entities):
39
+ ```csharp
40
+ public class Order : BaseEntity, ITenantEntity
41
+ {
42
+ public Guid TenantId { get; private set; }
43
+
44
+ private Order() { } // EF Core constructor
45
+
46
+ public static Order Create(Guid tenantId, ...)
47
+ {
48
+ return new Order { TenantId = tenantId, ... };
49
+ }
50
+ }
51
+ ```
52
+
53
+ **Requirements:**
54
+ - [ ] Implements `ITenantEntity`
55
+ - [ ] Has `TenantId` property
56
+ - [ ] Private parameterless constructor
57
+ - [ ] Static `Create()` factory method with `tenantId` as first parameter
58
+ </tenant_aware>
59
+
60
+ <system_entity>
61
+ **System entities** (platform-level, no tenant):
62
+ ```csharp
63
+ public class Permission : SystemEntity
64
+ {
65
+ private Permission() { }
66
+
67
+ public static Permission Create(...)
68
+ {
69
+ return new Permission { ... };
70
+ }
71
+ }
72
+ ```
73
+
74
+ **Requirements:**
75
+ - [ ] Inherits from `SystemEntity`
76
+ - [ ] NO `TenantId` property
77
+ - [ ] Private parameterless constructor
78
+ - [ ] Static `Create()` factory method
79
+ </system_entity>
80
+ </entities>
81
+
82
+ <tables>
83
+ ## Table Naming Conventions
84
+
85
+ **Schema**: All tables MUST specify schema explicitly.
86
+ ```csharp
87
+ builder.ToTable("auth_users", SchemaConstants.Core);
88
+ ```
89
+
90
+ **Prefixes by domain:**
91
+ | Prefix | Domain | Examples |
92
+ |--------|--------|----------|
93
+ | `auth_` | Authentication | auth_users, auth_roles |
94
+ | `nav_` | Navigation | nav_menus, nav_routes |
95
+ | `cfg_` | Configuration | cfg_settings, cfg_features |
96
+ | `ai_` | AI/Prompts | ai_prompts, ai_models |
97
+ | `ntf_` | Notifications | ntf_templates, ntf_logs |
98
+ | `wkf_` | Workflows | wkf_definitions, wkf_instances |
99
+ | `doc_` | Documents | doc_files, doc_versions |
100
+ | `tkt_` | Tickets/Support | tkt_tickets, tkt_comments |
101
+
102
+ **Schemas:**
103
+ - `core` (SchemaConstants.Core): SmartStack platform tables
104
+ - `extensions` (SchemaConstants.Extensions): Client-specific tables
105
+ </tables>
106
+
107
+ <migrations>
108
+ ## Migration Naming
109
+
110
+ **Format**: `{context}_v{version}_{sequence}_{Description}.cs`
111
+
112
+ **Examples:**
113
+ - `core_v1.0.0_001_CreateAuthUsers.cs`
114
+ - `core_v1.2.0_001_AddUserProfiles.cs`
115
+ - `extensions_v1.0.0_001_CreateClientOrders.cs`
116
+
117
+ **Rules:**
118
+ - [ ] Context: `core` or `extensions`
119
+ - [ ] Version: semver format (1.0.0)
120
+ - [ ] Sequence: 3-digit padded (001, 002)
121
+ - [ ] Description: PascalCase, descriptive
122
+ </migrations>
123
+
124
+ <controllers>
125
+ ## Controller Conventions
126
+
127
+ **NavRoute attribute** (preferred):
128
+ ```csharp
129
+ [ApiController]
130
+ [NavRoute("platform.administration.users")]
131
+ public class UsersController : ControllerBase
132
+ {
133
+ // Routes generated from NavRoute: /api/platform/administration/users
134
+ }
135
+ ```
136
+
137
+ **NavRoute format:**
138
+ - Lowercase only
139
+ - Dot-separated hierarchy
140
+ - Minimum 2 levels: `context.application`
141
+ - Full path: `context.application.module`
142
+
143
+ **Examples:**
144
+ - `platform.administration.users`
145
+ - `platform.administration.roles`
146
+ - `business.crm.contacts`
147
+ - `personal.myspace.dashboard`
148
+ </controllers>
149
+
150
+ <services>
151
+ ## Service Conventions
152
+
153
+ **Interface pattern:**
154
+ ```csharp
155
+ // Interface
156
+ public interface IUserService
157
+ {
158
+ Task<UserDto> GetByIdAsync(Guid id, CancellationToken ct);
159
+ Task<UserDto> CreateAsync(CreateUserDto dto, CancellationToken ct);
160
+ }
161
+
162
+ // Implementation
163
+ public class UserService : IUserService
164
+ {
165
+ // ...
166
+ }
167
+ ```
168
+
169
+ **Requirements:**
170
+ - [ ] Interface named `I{Name}Service`
171
+ - [ ] Implementation named `{Name}Service`
172
+ - [ ] All methods async with CancellationToken
173
+ - [ ] Return DTOs, not entities
174
+ </services>
175
+
176
+ <security>
177
+ ## SmartStack Security Patterns
178
+
179
+ <multi_tenant>
180
+ **Multi-tenant isolation:**
181
+ - ALL queries MUST filter by TenantId (automatic via EF Core global filters)
182
+ - NEVER expose TenantId in URLs
183
+ - NEVER allow cross-tenant data access
184
+ - Create methods MUST require tenantId parameter
185
+
186
+ **Check for violations:**
187
+ ```csharp
188
+ // BAD: No tenant filter
189
+ var users = await _context.Users.ToListAsync();
190
+
191
+ // GOOD: Tenant filter applied (via global filter or explicit)
192
+ var users = await _context.Users
193
+ .Where(u => u.TenantId == _tenantId)
194
+ .ToListAsync();
195
+ ```
196
+ </multi_tenant>
197
+
198
+ <authorization>
199
+ **RBAC with NavRoute:**
200
+ - Controllers use `[NavRoute]` for automatic permission mapping
201
+ - Permissions follow NavRoute pattern: `{navroute}.{action}`
202
+ - Actions: `read`, `create`, `update`, `delete`, `*` (wildcard)
203
+
204
+ **Example permissions:**
205
+ - `platform.administration.users.read`
206
+ - `platform.administration.users.create`
207
+ - `platform.administration.users.*` (all actions)
208
+ </authorization>
209
+
210
+ <input_validation>
211
+ **FluentValidation:**
212
+ ```csharp
213
+ public class CreateUserDtoValidator : AbstractValidator<CreateUserDto>
214
+ {
215
+ public CreateUserDtoValidator()
216
+ {
217
+ RuleFor(x => x.Email)
218
+ .NotEmpty()
219
+ .EmailAddress()
220
+ .MaximumLength(256);
221
+ }
222
+ }
223
+ ```
224
+ </input_validation>
225
+ </security>
226
+
227
+ <tests>
228
+ ## Test Conventions
229
+
230
+ **Naming pattern:** `{Method}_When{Condition}_Should{Result}`
231
+ ```csharp
232
+ public class UserServiceTests
233
+ {
234
+ [Fact]
235
+ public async Task GetById_WhenUserExists_ShouldReturnUser() { }
236
+
237
+ [Fact]
238
+ public async Task GetById_WhenUserNotFound_ShouldThrowNotFoundException() { }
239
+
240
+ [Fact]
241
+ public async Task Create_WhenValidDto_ShouldCreateAndReturnUser() { }
242
+ }
243
+ ```
244
+
245
+ **Structure:**
246
+ ```
247
+ Tests/
248
+ ├── Unit/
249
+ │ ├── Services/
250
+ │ └── Validators/
251
+ └── Integration/
252
+ └── Controllers/
253
+ ```
254
+
255
+ **Patterns:**
256
+ - [ ] AAA pattern (Arrange, Act, Assert)
257
+ - [ ] FluentAssertions for assertions
258
+ - [ ] Moq for mocking
259
+ - [ ] Tenant isolation tests for all tenant-aware services
260
+ </tests>
261
+
262
+ <review_checklist>
263
+ ## SmartStack Code Review Checklist
264
+
265
+ **Run MCP validation first:**
266
+ ```
267
+ mcp__smartstack__validate_conventions checks: ["all"]
268
+ ```
269
+
270
+ **Then verify manually:**
271
+
272
+ <security_checks>
273
+ ### Security (BLOCKING)
274
+ - [ ] No hardcoded credentials or secrets
275
+ - [ ] TenantId isolation enforced
276
+ - [ ] Authorization on all endpoints
277
+ - [ ] Input validation present
278
+ - [ ] No SQL injection risks (use EF Core properly)
279
+ </security_checks>
280
+
281
+ <architecture_checks>
282
+ ### Architecture (BLOCKING)
283
+ - [ ] Entities use correct base class (BaseEntity/SystemEntity)
284
+ - [ ] Services have interfaces
285
+ - [ ] Controllers use [NavRoute]
286
+ - [ ] Migrations follow naming convention
287
+ </architecture_checks>
288
+
289
+ <quality_checks>
290
+ ### Quality (SUGGESTION)
291
+ - [ ] Tests exist for new functionality
292
+ - [ ] Factory methods used for entity creation
293
+ - [ ] DTOs used for API boundaries
294
+ - [ ] Async methods have CancellationToken
295
+ </quality_checks>
296
+ </review_checklist>
297
+
298
+ <sources>
299
+ - SmartStack Architecture Documentation
300
+ - SmartStack.mcp validation tools
301
+ - Clean Architecture by Robert C. Martin
302
+ </sources>