front-end-dev-standards 1.0.0 → 1.1.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/package.json +1 -1
- package/scripts/validate-package.js +10 -5
- package/standards//342/232/241 performance.md" +138 -0
- package/standards//360/237/205/260/357/270/217 angular.md" +571 -0
- package/standards//360/237/216/250 ui-ux.md" +391 -0
- package/standards//360/237/223/232 documentation.md" +127 -0
- package/standards//360/237/224/214 api-standards.md" +201 -0
- package/standards//360/237/224/220 security.md" +432 -0
- package/standards//360/237/232/200 ci-cd.md" +134 -0
- package/standards//360/237/244/226 ai-development.md" +142 -0
- package/standards//360/237/247/221/342/200/215/360/237/222/273 coding-style.md" +765 -0
- package/standards//360/237/247/252 testing.md" +399 -0
- package/standards//360/237/247/261 architecture.md" +654 -0
- package/standards/angular.md +0 -234
- package/standards/architecture.md +0 -263
- package/standards/coding-style.md +0 -223
- package/standards/security.md +0 -6
- package/standards/testing.md +0 -244
|
@@ -0,0 +1,432 @@
|
|
|
1
|
+
# Security Standards
|
|
2
|
+
|
|
3
|
+
Version: 1.0
|
|
4
|
+
Applies To: All Frontend Applications
|
|
5
|
+
Compliance: OWASP Top 10, Secure SDLC
|
|
6
|
+
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
# 1. Security Principles
|
|
10
|
+
|
|
11
|
+
## Core Principles
|
|
12
|
+
|
|
13
|
+
1. Secure by Default
|
|
14
|
+
2. Least Privilege
|
|
15
|
+
3. Defense in Depth
|
|
16
|
+
4. Zero Trust
|
|
17
|
+
5. Fail Securely
|
|
18
|
+
6. Never Trust User Input
|
|
19
|
+
7. Protect Sensitive Data
|
|
20
|
+
8. Security is Everyone's Responsibility
|
|
21
|
+
|
|
22
|
+
---
|
|
23
|
+
|
|
24
|
+
# 2. Secrets Management
|
|
25
|
+
|
|
26
|
+
## Never Commit
|
|
27
|
+
|
|
28
|
+
❌ API Keys
|
|
29
|
+
|
|
30
|
+
❌ JWT Tokens
|
|
31
|
+
|
|
32
|
+
❌ Client Secrets
|
|
33
|
+
|
|
34
|
+
❌ Database Credentials
|
|
35
|
+
|
|
36
|
+
❌ Encryption Keys
|
|
37
|
+
|
|
38
|
+
❌ Private Certificates
|
|
39
|
+
|
|
40
|
+
Example:
|
|
41
|
+
|
|
42
|
+
```typescript
|
|
43
|
+
const API_KEY = 'secret';
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
Forbidden.
|
|
47
|
+
|
|
48
|
+
---
|
|
49
|
+
|
|
50
|
+
## Allowed
|
|
51
|
+
|
|
52
|
+
```typescript
|
|
53
|
+
export const environment = {
|
|
54
|
+
apiBaseUrl: '',
|
|
55
|
+
};
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
Secrets must come from:
|
|
59
|
+
|
|
60
|
+
* CI/CD Variables
|
|
61
|
+
* Secret Manager
|
|
62
|
+
* Vault
|
|
63
|
+
* Environment Injection
|
|
64
|
+
|
|
65
|
+
---
|
|
66
|
+
|
|
67
|
+
# 3. Authentication Standards
|
|
68
|
+
|
|
69
|
+
## Requirements
|
|
70
|
+
|
|
71
|
+
All authenticated requests must:
|
|
72
|
+
|
|
73
|
+
* Use HTTPS
|
|
74
|
+
* Use Secure Tokens
|
|
75
|
+
* Expire Sessions
|
|
76
|
+
* Support Logout
|
|
77
|
+
|
|
78
|
+
---
|
|
79
|
+
|
|
80
|
+
## Token Storage
|
|
81
|
+
|
|
82
|
+
Preferred:
|
|
83
|
+
|
|
84
|
+
```text
|
|
85
|
+
HttpOnly Secure Cookies
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
Avoid:
|
|
89
|
+
|
|
90
|
+
```typescript
|
|
91
|
+
localStorage
|
|
92
|
+
sessionStorage
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
for sensitive tokens.
|
|
96
|
+
|
|
97
|
+
---
|
|
98
|
+
|
|
99
|
+
# 4. Authorization Standards
|
|
100
|
+
|
|
101
|
+
Never trust UI permissions.
|
|
102
|
+
|
|
103
|
+
Bad:
|
|
104
|
+
|
|
105
|
+
```typescript
|
|
106
|
+
if (user.isAdmin) {
|
|
107
|
+
deleteEmployee();
|
|
108
|
+
}
|
|
109
|
+
```
|
|
110
|
+
|
|
111
|
+
Server must validate authorization.
|
|
112
|
+
|
|
113
|
+
Frontend permissions are UX only.
|
|
114
|
+
|
|
115
|
+
---
|
|
116
|
+
|
|
117
|
+
# 5. Input Validation
|
|
118
|
+
|
|
119
|
+
Treat all input as untrusted.
|
|
120
|
+
|
|
121
|
+
Validate:
|
|
122
|
+
|
|
123
|
+
* Forms
|
|
124
|
+
* Query Params
|
|
125
|
+
* Route Params
|
|
126
|
+
* API Responses
|
|
127
|
+
* File Uploads
|
|
128
|
+
|
|
129
|
+
Example:
|
|
130
|
+
|
|
131
|
+
```typescript
|
|
132
|
+
if (!employeeId) {
|
|
133
|
+
return;
|
|
134
|
+
}
|
|
135
|
+
```
|
|
136
|
+
|
|
137
|
+
---
|
|
138
|
+
|
|
139
|
+
# 6. XSS Prevention
|
|
140
|
+
|
|
141
|
+
## Never
|
|
142
|
+
|
|
143
|
+
```typescript
|
|
144
|
+
element.innerHTML = value;
|
|
145
|
+
```
|
|
146
|
+
|
|
147
|
+
```typescript
|
|
148
|
+
document.write(value);
|
|
149
|
+
```
|
|
150
|
+
|
|
151
|
+
---
|
|
152
|
+
|
|
153
|
+
## Avoid
|
|
154
|
+
|
|
155
|
+
```typescript
|
|
156
|
+
bypassSecurityTrustHtml()
|
|
157
|
+
```
|
|
158
|
+
|
|
159
|
+
Requires security review.
|
|
160
|
+
|
|
161
|
+
---
|
|
162
|
+
|
|
163
|
+
## Use
|
|
164
|
+
|
|
165
|
+
Angular template binding:
|
|
166
|
+
|
|
167
|
+
```html
|
|
168
|
+
{{ employeeName }}
|
|
169
|
+
```
|
|
170
|
+
|
|
171
|
+
Angular automatically sanitizes output.
|
|
172
|
+
|
|
173
|
+
---
|
|
174
|
+
|
|
175
|
+
# 7. CSRF Protection
|
|
176
|
+
|
|
177
|
+
All state-changing requests must support:
|
|
178
|
+
|
|
179
|
+
* CSRF Tokens
|
|
180
|
+
* SameSite Cookies
|
|
181
|
+
* Backend Validation
|
|
182
|
+
|
|
183
|
+
---
|
|
184
|
+
|
|
185
|
+
# 8. API Security
|
|
186
|
+
|
|
187
|
+
All APIs must:
|
|
188
|
+
|
|
189
|
+
* Use HTTPS
|
|
190
|
+
* Validate Authentication
|
|
191
|
+
* Validate Authorization
|
|
192
|
+
* Rate Limit Sensitive Endpoints
|
|
193
|
+
|
|
194
|
+
Never expose internal API URLs.
|
|
195
|
+
|
|
196
|
+
---
|
|
197
|
+
|
|
198
|
+
# 9. File Upload Security
|
|
199
|
+
|
|
200
|
+
Validate:
|
|
201
|
+
|
|
202
|
+
* File Type
|
|
203
|
+
* File Extension
|
|
204
|
+
* File Size
|
|
205
|
+
|
|
206
|
+
Example:
|
|
207
|
+
|
|
208
|
+
```typescript
|
|
209
|
+
const allowedTypes = [
|
|
210
|
+
'image/png',
|
|
211
|
+
'image/jpeg',
|
|
212
|
+
];
|
|
213
|
+
```
|
|
214
|
+
|
|
215
|
+
Reject executable files.
|
|
216
|
+
|
|
217
|
+
---
|
|
218
|
+
|
|
219
|
+
# 10. Dependency Security
|
|
220
|
+
|
|
221
|
+
Run regularly:
|
|
222
|
+
|
|
223
|
+
```bash
|
|
224
|
+
npm audit
|
|
225
|
+
```
|
|
226
|
+
|
|
227
|
+
```bash
|
|
228
|
+
npm outdated
|
|
229
|
+
```
|
|
230
|
+
|
|
231
|
+
Critical vulnerabilities must be fixed immediately.
|
|
232
|
+
|
|
233
|
+
---
|
|
234
|
+
|
|
235
|
+
# 11. Third Party Libraries
|
|
236
|
+
|
|
237
|
+
Before adding:
|
|
238
|
+
|
|
239
|
+
✓ Active Maintenance
|
|
240
|
+
|
|
241
|
+
✓ Security Review
|
|
242
|
+
|
|
243
|
+
✓ License Review
|
|
244
|
+
|
|
245
|
+
✓ Community Adoption
|
|
246
|
+
|
|
247
|
+
Avoid abandoned packages.
|
|
248
|
+
|
|
249
|
+
---
|
|
250
|
+
|
|
251
|
+
# 12. Logging Security
|
|
252
|
+
|
|
253
|
+
Never log:
|
|
254
|
+
|
|
255
|
+
* Passwords
|
|
256
|
+
* Tokens
|
|
257
|
+
* SSNs
|
|
258
|
+
* Personal Data
|
|
259
|
+
|
|
260
|
+
Forbidden:
|
|
261
|
+
|
|
262
|
+
```typescript
|
|
263
|
+
console.log(user.password);
|
|
264
|
+
```
|
|
265
|
+
|
|
266
|
+
---
|
|
267
|
+
|
|
268
|
+
# 13. Sensitive Data Protection
|
|
269
|
+
|
|
270
|
+
Sensitive data includes:
|
|
271
|
+
|
|
272
|
+
* Personal Information
|
|
273
|
+
* Payroll Data
|
|
274
|
+
* Banking Details
|
|
275
|
+
* Tax Information
|
|
276
|
+
|
|
277
|
+
Never store sensitive data unnecessarily.
|
|
278
|
+
|
|
279
|
+
---
|
|
280
|
+
|
|
281
|
+
# 14. Browser Storage Rules
|
|
282
|
+
|
|
283
|
+
Allowed:
|
|
284
|
+
|
|
285
|
+
```typescript
|
|
286
|
+
theme
|
|
287
|
+
language
|
|
288
|
+
uiPreferences
|
|
289
|
+
```
|
|
290
|
+
|
|
291
|
+
Avoid:
|
|
292
|
+
|
|
293
|
+
```typescript
|
|
294
|
+
tokens
|
|
295
|
+
passwords
|
|
296
|
+
salaryData
|
|
297
|
+
```
|
|
298
|
+
|
|
299
|
+
---
|
|
300
|
+
|
|
301
|
+
# 15. Security Headers
|
|
302
|
+
|
|
303
|
+
Backend should enable:
|
|
304
|
+
|
|
305
|
+
* CSP
|
|
306
|
+
* HSTS
|
|
307
|
+
* X-Frame-Options
|
|
308
|
+
* X-Content-Type-Options
|
|
309
|
+
* Referrer-Policy
|
|
310
|
+
|
|
311
|
+
Frontend must be compatible.
|
|
312
|
+
|
|
313
|
+
---
|
|
314
|
+
|
|
315
|
+
# 16. Route Security
|
|
316
|
+
|
|
317
|
+
Protected routes require:
|
|
318
|
+
|
|
319
|
+
```typescript
|
|
320
|
+
canActivate: [authGuard]
|
|
321
|
+
```
|
|
322
|
+
|
|
323
|
+
Never rely on hidden menu items.
|
|
324
|
+
|
|
325
|
+
---
|
|
326
|
+
|
|
327
|
+
# 17. Error Handling
|
|
328
|
+
|
|
329
|
+
Never expose:
|
|
330
|
+
|
|
331
|
+
```typescript
|
|
332
|
+
stackTrace
|
|
333
|
+
databaseError
|
|
334
|
+
sqlError
|
|
335
|
+
```
|
|
336
|
+
|
|
337
|
+
Users should see:
|
|
338
|
+
|
|
339
|
+
```typescript
|
|
340
|
+
'Something went wrong.'
|
|
341
|
+
```
|
|
342
|
+
|
|
343
|
+
Detailed errors go to logs.
|
|
344
|
+
|
|
345
|
+
---
|
|
346
|
+
|
|
347
|
+
# 18. Secure Coding Rules
|
|
348
|
+
|
|
349
|
+
Never use:
|
|
350
|
+
|
|
351
|
+
```typescript
|
|
352
|
+
eval()
|
|
353
|
+
```
|
|
354
|
+
|
|
355
|
+
```typescript
|
|
356
|
+
new Function()
|
|
357
|
+
```
|
|
358
|
+
|
|
359
|
+
```typescript
|
|
360
|
+
setTimeout(string)
|
|
361
|
+
```
|
|
362
|
+
|
|
363
|
+
---
|
|
364
|
+
|
|
365
|
+
# 19. CI/CD Security Gates
|
|
366
|
+
|
|
367
|
+
Pull Requests must pass:
|
|
368
|
+
|
|
369
|
+
✓ Lint
|
|
370
|
+
|
|
371
|
+
✓ Tests
|
|
372
|
+
|
|
373
|
+
✓ Security Scan
|
|
374
|
+
|
|
375
|
+
✓ Dependency Audit
|
|
376
|
+
|
|
377
|
+
✓ Code Review
|
|
378
|
+
|
|
379
|
+
---
|
|
380
|
+
|
|
381
|
+
# 20. AI Generated Code Security
|
|
382
|
+
|
|
383
|
+
AI-generated code must not:
|
|
384
|
+
|
|
385
|
+
✗ Hardcode Secrets
|
|
386
|
+
|
|
387
|
+
✗ Disable Security Checks
|
|
388
|
+
|
|
389
|
+
✗ Bypass Sanitization
|
|
390
|
+
|
|
391
|
+
✗ Store Tokens in Local Storage
|
|
392
|
+
|
|
393
|
+
✗ Use Unsafe DOM Manipulation
|
|
394
|
+
|
|
395
|
+
---
|
|
396
|
+
|
|
397
|
+
# 21. Security Review Checklist
|
|
398
|
+
|
|
399
|
+
Before Release:
|
|
400
|
+
|
|
401
|
+
□ No secrets committed
|
|
402
|
+
|
|
403
|
+
□ HTTPS only
|
|
404
|
+
|
|
405
|
+
□ Auth validated
|
|
406
|
+
|
|
407
|
+
□ Permissions validated
|
|
408
|
+
|
|
409
|
+
□ Inputs validated
|
|
410
|
+
|
|
411
|
+
□ XSS reviewed
|
|
412
|
+
|
|
413
|
+
□ Dependencies scanned
|
|
414
|
+
|
|
415
|
+
□ Error messages sanitized
|
|
416
|
+
|
|
417
|
+
□ Logs reviewed
|
|
418
|
+
|
|
419
|
+
□ Security testing completed
|
|
420
|
+
|
|
421
|
+
---
|
|
422
|
+
|
|
423
|
+
# 22. Security Incident Response
|
|
424
|
+
|
|
425
|
+
When vulnerability is discovered:
|
|
426
|
+
|
|
427
|
+
1. Assess severity
|
|
428
|
+
2. Notify engineering lead
|
|
429
|
+
3. Patch immediately
|
|
430
|
+
4. Verify fix
|
|
431
|
+
5. Document incident
|
|
432
|
+
6. Conduct postmortem
|
|
@@ -0,0 +1,134 @@
|
|
|
1
|
+
# CI/CD Standards
|
|
2
|
+
|
|
3
|
+
Version: 1.0
|
|
4
|
+
Goal: Reliable, Automated, Secure Delivery Pipeline
|
|
5
|
+
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
# 1. Pipeline Principles
|
|
9
|
+
|
|
10
|
+
1. Every Commit is Verifiable
|
|
11
|
+
2. No Manual Deployments
|
|
12
|
+
3. Quality Gates Must Pass
|
|
13
|
+
4. Fail Fast
|
|
14
|
+
5. Secure by Default
|
|
15
|
+
|
|
16
|
+
---
|
|
17
|
+
|
|
18
|
+
# 2. Branch Strategy
|
|
19
|
+
|
|
20
|
+
```text
|
|
21
|
+
main → production
|
|
22
|
+
develop → integration
|
|
23
|
+
feature/* → development
|
|
24
|
+
hotfix/* → urgent fixes
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
---
|
|
28
|
+
|
|
29
|
+
# 3. Pipeline Stages
|
|
30
|
+
|
|
31
|
+
```text
|
|
32
|
+
Lint → Test → Build → Security Scan → Deploy
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
---
|
|
36
|
+
|
|
37
|
+
# 4. Quality Gates
|
|
38
|
+
|
|
39
|
+
Required before merge:
|
|
40
|
+
|
|
41
|
+
✓ Lint passed
|
|
42
|
+
✓ Unit tests passed
|
|
43
|
+
✓ Integration tests passed
|
|
44
|
+
✓ Coverage threshold met
|
|
45
|
+
|
|
46
|
+
---
|
|
47
|
+
|
|
48
|
+
# 5. Build Standards
|
|
49
|
+
|
|
50
|
+
* Production build must be optimized
|
|
51
|
+
* Source maps disabled in production
|
|
52
|
+
* Environment-specific builds required
|
|
53
|
+
|
|
54
|
+
---
|
|
55
|
+
|
|
56
|
+
# 6. Deployment Strategy
|
|
57
|
+
|
|
58
|
+
Supported:
|
|
59
|
+
|
|
60
|
+
✓ Blue-Green Deployment
|
|
61
|
+
✓ Rolling Deployment
|
|
62
|
+
|
|
63
|
+
Avoid:
|
|
64
|
+
|
|
65
|
+
❌ Manual FTP deployments
|
|
66
|
+
|
|
67
|
+
---
|
|
68
|
+
|
|
69
|
+
# 7. Environment Strategy
|
|
70
|
+
|
|
71
|
+
| Environment | Purpose |
|
|
72
|
+
| ----------- | -------------- |
|
|
73
|
+
| Dev | Development |
|
|
74
|
+
| QA | Testing |
|
|
75
|
+
| Staging | Pre-production |
|
|
76
|
+
| Prod | Live |
|
|
77
|
+
|
|
78
|
+
---
|
|
79
|
+
|
|
80
|
+
# 8. Secrets Management
|
|
81
|
+
|
|
82
|
+
Never store secrets in:
|
|
83
|
+
|
|
84
|
+
❌ Code
|
|
85
|
+
❌ Git
|
|
86
|
+
|
|
87
|
+
Use:
|
|
88
|
+
|
|
89
|
+
✓ CI secrets vault
|
|
90
|
+
✓ Environment variables
|
|
91
|
+
|
|
92
|
+
---
|
|
93
|
+
|
|
94
|
+
# 9. Rollback Strategy
|
|
95
|
+
|
|
96
|
+
Every deployment must support rollback.
|
|
97
|
+
|
|
98
|
+
---
|
|
99
|
+
|
|
100
|
+
# 10. Security Scanning
|
|
101
|
+
|
|
102
|
+
Must include:
|
|
103
|
+
|
|
104
|
+
✓ Dependency scan
|
|
105
|
+
✓ SAST scan
|
|
106
|
+
✓ Vulnerability checks
|
|
107
|
+
|
|
108
|
+
---
|
|
109
|
+
|
|
110
|
+
# 11. Performance Checks
|
|
111
|
+
|
|
112
|
+
Build must verify:
|
|
113
|
+
|
|
114
|
+
* Bundle size limits
|
|
115
|
+
* Lighthouse score thresholds
|
|
116
|
+
|
|
117
|
+
---
|
|
118
|
+
|
|
119
|
+
# 12. Approval Rules
|
|
120
|
+
|
|
121
|
+
Production deploy requires:
|
|
122
|
+
|
|
123
|
+
✓ At least 1 reviewer
|
|
124
|
+
✓ Successful pipeline
|
|
125
|
+
|
|
126
|
+
---
|
|
127
|
+
|
|
128
|
+
# 13. AI Pipeline Rules
|
|
129
|
+
|
|
130
|
+
AI-generated code must pass:
|
|
131
|
+
|
|
132
|
+
✓ Tests
|
|
133
|
+
✓ Lint
|
|
134
|
+
✓ Security scan
|
|
@@ -0,0 +1,142 @@
|
|
|
1
|
+
# AI Development Standards
|
|
2
|
+
|
|
3
|
+
Version: 1.0
|
|
4
|
+
Goal: Safe, Controlled, High-Quality AI-Assisted Development
|
|
5
|
+
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
# 1. AI Usage Principles
|
|
9
|
+
|
|
10
|
+
1. AI is a Developer Assistant, Not an Architect
|
|
11
|
+
2. Human Review is Mandatory
|
|
12
|
+
3. Security Overrides AI Suggestions
|
|
13
|
+
4. Architecture Rules Always Apply
|
|
14
|
+
5. No Blind Copy-Paste
|
|
15
|
+
|
|
16
|
+
---
|
|
17
|
+
|
|
18
|
+
# 2. Allowed AI Usage
|
|
19
|
+
|
|
20
|
+
AI can generate:
|
|
21
|
+
|
|
22
|
+
✓ Components
|
|
23
|
+
✓ Services
|
|
24
|
+
✓ Tests
|
|
25
|
+
✓ DTOs
|
|
26
|
+
✓ Boilerplate code
|
|
27
|
+
|
|
28
|
+
---
|
|
29
|
+
|
|
30
|
+
# 3. Restricted AI Usage
|
|
31
|
+
|
|
32
|
+
AI must NOT autonomously decide:
|
|
33
|
+
|
|
34
|
+
❌ Architecture changes
|
|
35
|
+
❌ Security logic
|
|
36
|
+
❌ Authentication flow
|
|
37
|
+
❌ Authorization rules
|
|
38
|
+
❌ Database structure
|
|
39
|
+
|
|
40
|
+
---
|
|
41
|
+
|
|
42
|
+
# 4. Code Review Rules for AI Code
|
|
43
|
+
|
|
44
|
+
All AI-generated code must be checked for:
|
|
45
|
+
|
|
46
|
+
✓ Type safety
|
|
47
|
+
✓ Security compliance
|
|
48
|
+
✓ Performance impact
|
|
49
|
+
✓ Architecture compliance
|
|
50
|
+
|
|
51
|
+
---
|
|
52
|
+
|
|
53
|
+
# 5. Prompt Standards
|
|
54
|
+
|
|
55
|
+
Good prompt:
|
|
56
|
+
|
|
57
|
+
```text
|
|
58
|
+
Generate Angular standalone component using signals
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
Bad prompt:
|
|
62
|
+
|
|
63
|
+
```text
|
|
64
|
+
Build entire app
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
---
|
|
68
|
+
|
|
69
|
+
# 6. AI Security Rules
|
|
70
|
+
|
|
71
|
+
AI must NOT generate:
|
|
72
|
+
|
|
73
|
+
❌ Hardcoded secrets
|
|
74
|
+
❌ Unsafe DOM manipulation
|
|
75
|
+
❌ eval usage
|
|
76
|
+
❌ bypassSecurityTrustHtml without review
|
|
77
|
+
|
|
78
|
+
---
|
|
79
|
+
|
|
80
|
+
# 7. AI Architecture Rules
|
|
81
|
+
|
|
82
|
+
AI must follow:
|
|
83
|
+
|
|
84
|
+
✓ Feature-based architecture
|
|
85
|
+
✓ Standalone components
|
|
86
|
+
✓ Signal-based state
|
|
87
|
+
|
|
88
|
+
---
|
|
89
|
+
|
|
90
|
+
# 8. AI Testing Rules
|
|
91
|
+
|
|
92
|
+
AI-generated tests must:
|
|
93
|
+
|
|
94
|
+
✓ Cover success + failure
|
|
95
|
+
✓ Use factories
|
|
96
|
+
✓ Avoid implementation details
|
|
97
|
+
|
|
98
|
+
---
|
|
99
|
+
|
|
100
|
+
# 9. AI Performance Rules
|
|
101
|
+
|
|
102
|
+
AI must:
|
|
103
|
+
|
|
104
|
+
✓ Avoid heavy computations in templates
|
|
105
|
+
✓ Use computed signals
|
|
106
|
+
✓ Avoid unnecessary subscriptions
|
|
107
|
+
|
|
108
|
+
---
|
|
109
|
+
|
|
110
|
+
# 10. AI Anti Patterns
|
|
111
|
+
|
|
112
|
+
Never accept AI output with:
|
|
113
|
+
|
|
114
|
+
❌ any types
|
|
115
|
+
❌ constructor injection
|
|
116
|
+
❌ NgModules
|
|
117
|
+
❌ inline API URLs
|
|
118
|
+
❌ console.log in production
|
|
119
|
+
|
|
120
|
+
---
|
|
121
|
+
|
|
122
|
+
# 11. AI Review Checklist
|
|
123
|
+
|
|
124
|
+
Before accepting AI code:
|
|
125
|
+
|
|
126
|
+
□ Type-safe
|
|
127
|
+
□ Secure
|
|
128
|
+
□ Performant
|
|
129
|
+
□ Testable
|
|
130
|
+
□ Architecture compliant
|
|
131
|
+
|
|
132
|
+
---
|
|
133
|
+
|
|
134
|
+
# 12. Definition of Safe AI Code
|
|
135
|
+
|
|
136
|
+
AI code is safe when:
|
|
137
|
+
|
|
138
|
+
✓ Reviewed
|
|
139
|
+
✓ Typed
|
|
140
|
+
✓ Secure
|
|
141
|
+
✓ Tested
|
|
142
|
+
✓ Aligned with standards
|