@atlashub/smartstack-cli 1.14.3 → 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.
- package/dist/index.js +74897 -1477
- package/dist/index.js.map +1 -1
- package/package.json +5 -1
- package/templates/agents/efcore/migration.md +37 -25
- package/templates/agents/efcore/rebase-snapshot.md +32 -12
- package/templates/agents/efcore/squash.md +14 -4
- package/templates/agents/mcp-healthcheck.md +161 -0
- package/templates/commands/efcore/_shared.md +117 -0
- package/templates/commands/efcore/db-deploy.md +32 -4
- package/templates/commands/efcore/db-reset.md +38 -2
- package/templates/commands/efcore/db-status.md +24 -6
- package/templates/commands/efcore/migration.md +57 -9
- package/templates/commands/efcore/rebase-snapshot.md +56 -3
- package/templates/commands/efcore/squash.md +72 -17
- package/templates/hooks/mcp-check.md +64 -0
- package/templates/skills/application/SKILL.md +50 -4
- package/templates/skills/application/steps/step-00-init.md +153 -0
- package/templates/skills/application/steps/step-01-navigation.md +144 -0
- package/templates/skills/application/steps/step-02-permissions.md +159 -0
- package/templates/skills/application/steps/step-03-roles.md +158 -0
- package/templates/skills/application/steps/step-04-backend.md +202 -0
- package/templates/skills/application/steps/step-05-frontend.md +218 -0
- package/templates/skills/application/steps/step-06-migration.md +190 -0
- package/templates/skills/gitflow/steps/step-commit.md +25 -20
- package/templates/skills/gitflow/steps/step-start.md +9 -0
- package/templates/skills/mcp/SKILL.md +246 -0
- package/templates/skills/review-code/SKILL.md +77 -0
- package/templates/skills/review-code/references/smartstack-conventions.md +302 -0
|
@@ -0,0 +1,246 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: mcp
|
|
3
|
+
description: |
|
|
4
|
+
MCP server management and health check for SmartStack.
|
|
5
|
+
Use this skill when:
|
|
6
|
+
- User wants to check MCP status
|
|
7
|
+
- User mentions "mcp", "healthcheck", "mcp status"
|
|
8
|
+
- Before any MCP-dependent operation fails
|
|
9
|
+
- After MCP configuration changes
|
|
10
|
+
Subcommands: healthcheck, tools
|
|
11
|
+
---
|
|
12
|
+
|
|
13
|
+
# Skill MCP SmartStack
|
|
14
|
+
|
|
15
|
+
Manages MCP server connectivity and health verification.
|
|
16
|
+
|
|
17
|
+
## SUBCOMMANDS
|
|
18
|
+
|
|
19
|
+
| Command | Description |
|
|
20
|
+
|---------|-------------|
|
|
21
|
+
| `/mcp:healthcheck` | Full MCP health check with version verification |
|
|
22
|
+
| `/mcp:tools` | List all available MCP tools with descriptions |
|
|
23
|
+
|
|
24
|
+
---
|
|
25
|
+
|
|
26
|
+
## /mcp:healthcheck
|
|
27
|
+
|
|
28
|
+
Performs a complete MCP health check and updates the cache.
|
|
29
|
+
|
|
30
|
+
### Workflow
|
|
31
|
+
|
|
32
|
+
```
|
|
33
|
+
┌─────────────────────────────────────────────────────────────┐
|
|
34
|
+
│ MCP HEALTH CHECK │
|
|
35
|
+
├─────────────────────────────────────────────────────────────┤
|
|
36
|
+
│ 1. Test MCP Connectivity │
|
|
37
|
+
│ └─▶ Call mcp__smartstack__validate_conventions │
|
|
38
|
+
│ │
|
|
39
|
+
│ 2. Get MCP Version │
|
|
40
|
+
│ └─▶ Read SmartStack.mcp/package.json │
|
|
41
|
+
│ │
|
|
42
|
+
│ 3. List Available Tools │
|
|
43
|
+
│ └─▶ Enumerate mcp__smartstack__* tools │
|
|
44
|
+
│ │
|
|
45
|
+
│ 4. Update Cache │
|
|
46
|
+
│ └─▶ Write .claude/mcp-status.json │
|
|
47
|
+
└─────────────────────────────────────────────────────────────┘
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
### Step 1: Test Connectivity
|
|
51
|
+
|
|
52
|
+
Call MCP with minimal parameters:
|
|
53
|
+
|
|
54
|
+
```
|
|
55
|
+
mcp__smartstack__validate_conventions({
|
|
56
|
+
checks: ["tables"]
|
|
57
|
+
})
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
**Expected:** Response without connection error
|
|
61
|
+
|
|
62
|
+
**On failure:**
|
|
63
|
+
```
|
|
64
|
+
❌ MCP CONNECTION FAILED
|
|
65
|
+
Error: <error_message>
|
|
66
|
+
|
|
67
|
+
Actions:
|
|
68
|
+
1. Verify MCP is configured in Claude Code settings
|
|
69
|
+
2. Check SmartStack.mcp path: D:\01 - projets\SmartStack.mcp
|
|
70
|
+
3. Restart Claude Code
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
### Step 2: Get Version
|
|
74
|
+
|
|
75
|
+
```bash
|
|
76
|
+
# Read MCP version
|
|
77
|
+
cat "D:\01 - projets\SmartStack.mcp\package.json" | grep '"version"'
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
### Step 3: List Tools
|
|
81
|
+
|
|
82
|
+
Verify these critical tools are available:
|
|
83
|
+
|
|
84
|
+
| Tool | Purpose |
|
|
85
|
+
|------|---------|
|
|
86
|
+
| `validate_conventions` | Convention validation |
|
|
87
|
+
| `scaffold_extension` | Code generation |
|
|
88
|
+
| `suggest_migration` | Migration naming |
|
|
89
|
+
| `check_migrations` | Conflict detection |
|
|
90
|
+
| `generate_permissions` | RBAC generation |
|
|
91
|
+
|
|
92
|
+
### Step 4: Update Cache
|
|
93
|
+
|
|
94
|
+
Write to `.claude/mcp-status.json`:
|
|
95
|
+
|
|
96
|
+
```json
|
|
97
|
+
{
|
|
98
|
+
"lastCheck": "<ISO_DATE>",
|
|
99
|
+
"mcpVersion": "<VERSION>",
|
|
100
|
+
"mcpPath": "D:\\01 - projets\\SmartStack.mcp",
|
|
101
|
+
"status": "ok",
|
|
102
|
+
"toolsAvailable": [
|
|
103
|
+
"validate_conventions",
|
|
104
|
+
"scaffold_extension",
|
|
105
|
+
"suggest_migration",
|
|
106
|
+
"check_migrations",
|
|
107
|
+
"generate_permissions"
|
|
108
|
+
]
|
|
109
|
+
}
|
|
110
|
+
```
|
|
111
|
+
|
|
112
|
+
### Output Format
|
|
113
|
+
|
|
114
|
+
**Success:**
|
|
115
|
+
```
|
|
116
|
+
MCP HEALTH CHECK ✓
|
|
117
|
+
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
|
118
|
+
Status : OK
|
|
119
|
+
Version : 1.5.0
|
|
120
|
+
Path : D:\01 - projets\SmartStack.mcp
|
|
121
|
+
Tools : 12 available
|
|
122
|
+
Cache : Updated (.claude/mcp-status.json)
|
|
123
|
+
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
|
124
|
+
Next check : in 7 days (auto)
|
|
125
|
+
```
|
|
126
|
+
|
|
127
|
+
**Warning (update available):**
|
|
128
|
+
```
|
|
129
|
+
MCP HEALTH CHECK ⚠️
|
|
130
|
+
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
|
131
|
+
Status : UPDATE AVAILABLE
|
|
132
|
+
Current : 1.4.0
|
|
133
|
+
Latest : 1.5.0
|
|
134
|
+
Action : cd SmartStack.mcp && git pull
|
|
135
|
+
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
|
136
|
+
```
|
|
137
|
+
|
|
138
|
+
**Error:**
|
|
139
|
+
```
|
|
140
|
+
MCP HEALTH CHECK ❌
|
|
141
|
+
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
|
142
|
+
Status : ERROR
|
|
143
|
+
Issue : MCP server not responding
|
|
144
|
+
|
|
145
|
+
Troubleshooting:
|
|
146
|
+
1. Check Claude Code MCP configuration
|
|
147
|
+
2. Verify path: D:\01 - projets\SmartStack.mcp
|
|
148
|
+
3. Run: cd SmartStack.mcp && npm install
|
|
149
|
+
4. Restart Claude Code
|
|
150
|
+
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
|
151
|
+
```
|
|
152
|
+
|
|
153
|
+
---
|
|
154
|
+
|
|
155
|
+
## Cache File
|
|
156
|
+
|
|
157
|
+
**Location:** `.claude/mcp-status.json`
|
|
158
|
+
|
|
159
|
+
**Structure:**
|
|
160
|
+
```json
|
|
161
|
+
{
|
|
162
|
+
"lastCheck": "2024-01-15T10:30:00.000Z",
|
|
163
|
+
"mcpVersion": "1.5.0",
|
|
164
|
+
"mcpPath": "D:\\01 - projets\\SmartStack.mcp",
|
|
165
|
+
"status": "ok" | "error",
|
|
166
|
+
"toolsAvailable": ["tool1", "tool2", ...],
|
|
167
|
+
"errors": ["error1", ...] // only if status = error
|
|
168
|
+
}
|
|
169
|
+
```
|
|
170
|
+
|
|
171
|
+
**Validity:** 7 days
|
|
172
|
+
|
|
173
|
+
---
|
|
174
|
+
|
|
175
|
+
## Integration with Hook
|
|
176
|
+
|
|
177
|
+
The `mcp-check` hook automatically:
|
|
178
|
+
1. Reads this cache before any `mcp__smartstack__*` call
|
|
179
|
+
2. Displays warning if cache > 7 days
|
|
180
|
+
3. Blocks if last status was "error"
|
|
181
|
+
|
|
182
|
+
This skill provides the **full check** that the hook references.
|
|
183
|
+
|
|
184
|
+
---
|
|
185
|
+
|
|
186
|
+
## /mcp:tools
|
|
187
|
+
|
|
188
|
+
Lists all available MCP tools with their descriptions.
|
|
189
|
+
|
|
190
|
+
### Core Tools (6)
|
|
191
|
+
| Tool | Description |
|
|
192
|
+
|------|-------------|
|
|
193
|
+
| `validate_conventions` | Validate SmartStack conventions (tables, migrations, services, namespaces, controllers) |
|
|
194
|
+
| `check_migrations` | Analyze EF Core migrations for conflicts and ordering issues |
|
|
195
|
+
| `scaffold_extension` | Generate code: feature, entity, service, controller, component, dto, validator, repository |
|
|
196
|
+
| `api_docs` | Get API documentation from Swagger/OpenAPI or controller files |
|
|
197
|
+
| `suggest_migration` | Suggest migration name following SmartStack conventions |
|
|
198
|
+
| `generate_permissions` | Generate RBAC permissions (HasData for PermissionConfiguration.cs) |
|
|
199
|
+
|
|
200
|
+
### Test Tools (4)
|
|
201
|
+
| Tool | Description |
|
|
202
|
+
|------|-------------|
|
|
203
|
+
| `scaffold_tests` | Generate test files for entities, services, controllers |
|
|
204
|
+
| `analyze_test_coverage` | Analyze test coverage and identify missing tests |
|
|
205
|
+
| `validate_test_conventions` | Validate test naming and structure conventions |
|
|
206
|
+
| `suggest_test_scenarios` | Suggest test scenarios based on code analysis |
|
|
207
|
+
|
|
208
|
+
### Frontend Tools (5)
|
|
209
|
+
| Tool | Description |
|
|
210
|
+
|------|-------------|
|
|
211
|
+
| `scaffold_routes` | Generate frontend routes from backend NavRoute attributes |
|
|
212
|
+
| `validate_frontend_routes` | Validate frontend routes match backend NavRoutes |
|
|
213
|
+
| `scaffold_api_client` | Generate TypeScript API client with React Query hooks |
|
|
214
|
+
| `scaffold_frontend_extension` | Generate frontend extension infrastructure (types, slots, contexts) |
|
|
215
|
+
| `analyze_extension_points` | Analyze React components for extension points |
|
|
216
|
+
|
|
217
|
+
### Output Format
|
|
218
|
+
|
|
219
|
+
```
|
|
220
|
+
MCP TOOLS REFERENCE
|
|
221
|
+
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
|
222
|
+
|
|
223
|
+
CORE TOOLS (6)
|
|
224
|
+
validate_conventions Validate SmartStack conventions
|
|
225
|
+
check_migrations Analyze EF Core migrations
|
|
226
|
+
scaffold_extension Generate code (entity, service, etc.)
|
|
227
|
+
api_docs Get API documentation
|
|
228
|
+
suggest_migration Suggest migration name
|
|
229
|
+
generate_permissions Generate RBAC permissions
|
|
230
|
+
|
|
231
|
+
TEST TOOLS (4)
|
|
232
|
+
scaffold_tests Generate test files
|
|
233
|
+
analyze_test_coverage Analyze test coverage
|
|
234
|
+
validate_test_conventions Validate test conventions
|
|
235
|
+
suggest_test_scenarios Suggest test scenarios
|
|
236
|
+
|
|
237
|
+
FRONTEND TOOLS (5)
|
|
238
|
+
scaffold_routes Generate frontend routes
|
|
239
|
+
validate_frontend_routes Validate route alignment
|
|
240
|
+
scaffold_api_client Generate TypeScript API client
|
|
241
|
+
scaffold_frontend_extension Generate extension infrastructure
|
|
242
|
+
analyze_extension_points Analyze React extension points
|
|
243
|
+
|
|
244
|
+
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
|
245
|
+
Total: 15 tools available
|
|
246
|
+
```
|
|
@@ -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>
|