@enki-dev-expert/global-engineering-standards 0.0.0-stage → 0.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/AGENTS.md +303 -0
- package/CHANGELOG.md +23 -0
- package/CITATION.cff +21 -0
- package/CODE_OF_CONDUCT.md +13 -0
- package/CONTRIBUTING.md +27 -0
- package/LICENSE +21 -0
- package/README.md +159 -2
- package/SECURITY.md +25 -0
- package/dist/cli.js +40 -0
- package/dist/content.js +71 -0
- package/dist/filesystem.js +83 -0
- package/dist/installer.js +243 -0
- package/dist/layout.js +42 -0
- package/dist/transaction.js +143 -0
- package/docs/ai-and-llm.md +1312 -0
- package/docs/architecture.md +1007 -0
- package/docs/cost-engineering.md +1322 -0
- package/docs/data.md +993 -0
- package/docs/governance.md +1744 -0
- package/docs/mobile-and-web.md +1362 -0
- package/docs/observability.md +1345 -0
- package/docs/platforms-and-applications.md +1581 -0
- package/docs/privacy.md +566 -0
- package/docs/quality-and-testing.md +1278 -0
- package/docs/scalability.md +1012 -0
- package/docs/security.md +373 -0
- package/handbook/claude-plugin.md +31 -0
- package/handbook/compatibility.md +27 -0
- package/handbook/recovery.md +29 -0
- package/handbook/releasing.md +50 -0
- package/handbook/security-review.md +41 -0
- package/handbook/signing.md +18 -0
- package/handbook/validation.md +50 -0
- package/package.json +65 -4
- package/scripts/content-baseline.json +25 -0
- package/skills/engineering-architecture-review/SKILL.md +1531 -0
- package/skills/engineering-cost-estimate/SKILL.md +1599 -0
- package/skills/engineering-database-review/SKILL.md +1364 -0
- package/skills/engineering-privacy-check/SKILL.md +1295 -0
- package/skills/engineering-safe-implementation/SKILL.md +1502 -0
- package/skills/engineering-security-standards-check/SKILL.md +1112 -0
- package/src/cli.ts +45 -0
- package/src/content.ts +82 -0
- package/src/filesystem.ts +94 -0
- package/src/installer.ts +280 -0
- package/src/layout.ts +70 -0
- package/src/transaction.ts +167 -0
- package/templates/ADR.md +1302 -0
- package/templates/AUDIT_REPORT.md +1693 -0
- package/templates/EXCEPTIONS.md +647 -0
- package/templates/PROJECT_AGENTS.md +868 -0
|
@@ -0,0 +1,1364 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: engineering-database-review
|
|
3
|
+
description: Design, audit, secure, optimize and validate database systems using the Global Engineering Standards. Use for database architecture, SQL and NoSQL reviews, schema design, data integrity, multi-tenant isolation, indexing, query performance, migrations, backups, disaster recovery, scalability, cloud databases and autonomous database implementation.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Engineering Database Review
|
|
7
|
+
|
|
8
|
+
## 1. Purpose
|
|
9
|
+
|
|
10
|
+
Provide a consistent and evidence-based workflow for database engineering.
|
|
11
|
+
|
|
12
|
+
This skill supports:
|
|
13
|
+
|
|
14
|
+
- Database architecture and selection.
|
|
15
|
+
- SQL and NoSQL database reviews.
|
|
16
|
+
- Schema design.
|
|
17
|
+
- Data modeling.
|
|
18
|
+
- Data integrity.
|
|
19
|
+
- Transactions.
|
|
20
|
+
- Access control.
|
|
21
|
+
- Multi-tenant isolation.
|
|
22
|
+
- Query optimization.
|
|
23
|
+
- Index management.
|
|
24
|
+
- Schema migrations.
|
|
25
|
+
- Backup and recovery.
|
|
26
|
+
- Database security.
|
|
27
|
+
- Database scalability.
|
|
28
|
+
- Managed database services.
|
|
29
|
+
- Cloud database portability.
|
|
30
|
+
- Cost optimization.
|
|
31
|
+
- Database testing.
|
|
32
|
+
- Autonomous database implementation.
|
|
33
|
+
|
|
34
|
+
The objective is to build reliable, maintainable, secure and cost-efficient data systems that can evolve with real business requirements.
|
|
35
|
+
|
|
36
|
+
Protect existing data.
|
|
37
|
+
|
|
38
|
+
Never treat database access as permission to modify or delete production records.
|
|
39
|
+
|
|
40
|
+
## 2. Global Engineering Standards
|
|
41
|
+
|
|
42
|
+
The Global Engineering Standards repository is located at:
|
|
43
|
+
|
|
44
|
+
~/engineering-standards/
|
|
45
|
+
|
|
46
|
+
Primary reference:
|
|
47
|
+
|
|
48
|
+
~/engineering-standards/docs/data.md
|
|
49
|
+
|
|
50
|
+
Additional references when relevant:
|
|
51
|
+
|
|
52
|
+
- docs/security.md
|
|
53
|
+
- docs/privacy.md
|
|
54
|
+
- docs/architecture.md
|
|
55
|
+
- docs/scalability.md
|
|
56
|
+
- docs/cost-engineering.md
|
|
57
|
+
- docs/quality-and-testing.md
|
|
58
|
+
- docs/observability.md
|
|
59
|
+
- docs/ai-and-llm.md
|
|
60
|
+
- docs/governance.md
|
|
61
|
+
- docs/mobile-and-web.md
|
|
62
|
+
- docs/platforms-and-applications.md
|
|
63
|
+
|
|
64
|
+
Resolve these references relative to the engineering-standards repository.
|
|
65
|
+
|
|
66
|
+
Apply standards according to the project's actual architecture.
|
|
67
|
+
|
|
68
|
+
Do not load every document when only a subset is relevant.
|
|
69
|
+
|
|
70
|
+
## 3. When to Use This Skill
|
|
71
|
+
|
|
72
|
+
Use for tasks involving:
|
|
73
|
+
|
|
74
|
+
- Database selection.
|
|
75
|
+
- Database schema design.
|
|
76
|
+
- Table or collection design.
|
|
77
|
+
- SQL queries.
|
|
78
|
+
- NoSQL queries.
|
|
79
|
+
- ORM configuration.
|
|
80
|
+
- Database performance.
|
|
81
|
+
- Indexing.
|
|
82
|
+
- Database migrations.
|
|
83
|
+
- Transaction processing.
|
|
84
|
+
- Backup strategies.
|
|
85
|
+
- Recovery planning.
|
|
86
|
+
- Multi-tenant systems.
|
|
87
|
+
- Data retention.
|
|
88
|
+
- Data deletion.
|
|
89
|
+
- Database access security.
|
|
90
|
+
- Data-intensive AI systems.
|
|
91
|
+
- Scalability planning.
|
|
92
|
+
- Database cost estimation.
|
|
93
|
+
|
|
94
|
+
Also use when building database-dependent functionality in Autonomous Build Mode.
|
|
95
|
+
|
|
96
|
+
Do not assume every application requires a remote database.
|
|
97
|
+
|
|
98
|
+
## 4. Supported Database Technologies
|
|
99
|
+
|
|
100
|
+
Work with relevant database technologies, including:
|
|
101
|
+
|
|
102
|
+
- PostgreSQL.
|
|
103
|
+
- MySQL.
|
|
104
|
+
- MariaDB.
|
|
105
|
+
- SQLite.
|
|
106
|
+
- Microsoft SQL Server.
|
|
107
|
+
- Oracle Database.
|
|
108
|
+
- MongoDB.
|
|
109
|
+
- Redis.
|
|
110
|
+
- DynamoDB.
|
|
111
|
+
- Azure Cosmos DB.
|
|
112
|
+
- Google Cloud Firestore.
|
|
113
|
+
- Firebase Realtime Database.
|
|
114
|
+
- Supabase PostgreSQL.
|
|
115
|
+
- Cloud SQL.
|
|
116
|
+
- Amazon RDS and Aurora.
|
|
117
|
+
- Managed document databases.
|
|
118
|
+
- Search engines.
|
|
119
|
+
- Vector databases.
|
|
120
|
+
- Time-series databases.
|
|
121
|
+
- Graph databases.
|
|
122
|
+
- Embedded databases.
|
|
123
|
+
|
|
124
|
+
This list is illustrative, not mandatory or exhaustive.
|
|
125
|
+
|
|
126
|
+
Evaluate the actual database capabilities and requirements.
|
|
127
|
+
|
|
128
|
+
Do not impose PostgreSQL, MongoDB, Supabase, Firebase or another provider on every project.
|
|
129
|
+
|
|
130
|
+
## 5. Operating Modes
|
|
131
|
+
|
|
132
|
+
Support:
|
|
133
|
+
|
|
134
|
+
- Supervised Mode.
|
|
135
|
+
- Autonomous Build Mode.
|
|
136
|
+
|
|
137
|
+
Supervised Mode is the default.
|
|
138
|
+
|
|
139
|
+
Autonomous Build Mode requires explicit user authorization.
|
|
140
|
+
|
|
141
|
+
Both modes must preserve:
|
|
142
|
+
|
|
143
|
+
- Data integrity.
|
|
144
|
+
- Security.
|
|
145
|
+
- Privacy.
|
|
146
|
+
- Reliability.
|
|
147
|
+
- Scalability.
|
|
148
|
+
- Cost discipline.
|
|
149
|
+
- Honest validation.
|
|
150
|
+
|
|
151
|
+
Consult docs/governance.md.
|
|
152
|
+
|
|
153
|
+
## 6. Supervised Mode
|
|
154
|
+
|
|
155
|
+
For an existing database system:
|
|
156
|
+
|
|
157
|
+
1. Identify the authorized scope.
|
|
158
|
+
2. Inspect relevant schemas and source code.
|
|
159
|
+
3. Review application data flows.
|
|
160
|
+
4. Evaluate current safeguards.
|
|
161
|
+
5. Identify confirmed problems.
|
|
162
|
+
6. Distinguish hypotheses from evidence.
|
|
163
|
+
7. Assess proposed changes.
|
|
164
|
+
8. Evaluate migration risks.
|
|
165
|
+
9. Recommend minimal effective improvements.
|
|
166
|
+
10. Obtain required approval before significant changes.
|
|
167
|
+
|
|
168
|
+
A default audit of a production database is read-only.
|
|
169
|
+
|
|
170
|
+
Do not execute data-changing statements during read-only assessment.
|
|
171
|
+
|
|
172
|
+
## 7. Autonomous Build Mode
|
|
173
|
+
|
|
174
|
+
When explicitly authorized to build a complete application:
|
|
175
|
+
|
|
176
|
+
1. Identify data requirements.
|
|
177
|
+
2. Select an appropriate database architecture.
|
|
178
|
+
3. Design entities and relationships.
|
|
179
|
+
4. Define data invariants.
|
|
180
|
+
5. Implement authorized local schemas.
|
|
181
|
+
6. Write necessary database access logic.
|
|
182
|
+
7. Create migration files.
|
|
183
|
+
8. Implement authorization and isolation.
|
|
184
|
+
9. Add data integrity tests.
|
|
185
|
+
10. Validate queries and transactions.
|
|
186
|
+
11. Review performance.
|
|
187
|
+
12. Correct identified defects.
|
|
188
|
+
13. Document deployment requirements.
|
|
189
|
+
14. Continue independent authorized tasks.
|
|
190
|
+
15. Consolidate human actions at handoff.
|
|
191
|
+
|
|
192
|
+
Do not interrupt for every ordinary local schema or query change.
|
|
193
|
+
|
|
194
|
+
Autonomous Build Mode does not authorize destructive production operations.
|
|
195
|
+
|
|
196
|
+
## 8. Scope and Authorization
|
|
197
|
+
|
|
198
|
+
Before database operations, establish:
|
|
199
|
+
|
|
200
|
+
- Project repository.
|
|
201
|
+
- Database engine.
|
|
202
|
+
- Environment.
|
|
203
|
+
- Connection scope.
|
|
204
|
+
- Available permissions.
|
|
205
|
+
- Data sensitivity.
|
|
206
|
+
- Approved operations.
|
|
207
|
+
- Protected resources.
|
|
208
|
+
- Backup requirements.
|
|
209
|
+
|
|
210
|
+
Treat production, staging and local development environments separately.
|
|
211
|
+
|
|
212
|
+
Do not assume a database URL grants permission to modify its contents.
|
|
213
|
+
|
|
214
|
+
## 9. Initial Database Assessment
|
|
215
|
+
|
|
216
|
+
Inspect relevant authorized information:
|
|
217
|
+
|
|
218
|
+
- Schema definitions.
|
|
219
|
+
- Migration files.
|
|
220
|
+
- ORM models.
|
|
221
|
+
- Database clients.
|
|
222
|
+
- Query builders.
|
|
223
|
+
- Stored procedures.
|
|
224
|
+
- Access policies.
|
|
225
|
+
- Index definitions.
|
|
226
|
+
- Test data.
|
|
227
|
+
- Backup documentation.
|
|
228
|
+
- Database configuration.
|
|
229
|
+
- Application data access code.
|
|
230
|
+
|
|
231
|
+
Prefer repository and configuration analysis before live database access.
|
|
232
|
+
|
|
233
|
+
Do not expose credentials.
|
|
234
|
+
|
|
235
|
+
## 10. Data Requirements
|
|
236
|
+
|
|
237
|
+
Identify:
|
|
238
|
+
|
|
239
|
+
- Core entities.
|
|
240
|
+
- Relationships.
|
|
241
|
+
- Business rules.
|
|
242
|
+
- Read patterns.
|
|
243
|
+
- Write patterns.
|
|
244
|
+
- Expected data volume.
|
|
245
|
+
- Retention requirements.
|
|
246
|
+
- Query latency targets.
|
|
247
|
+
- Consistency requirements.
|
|
248
|
+
- Availability requirements.
|
|
249
|
+
- Regulatory constraints.
|
|
250
|
+
|
|
251
|
+
Do not invent critical business rules.
|
|
252
|
+
|
|
253
|
+
Document assumptions requiring validation.
|
|
254
|
+
|
|
255
|
+
## 11. Database Selection
|
|
256
|
+
|
|
257
|
+
Evaluate possible solutions according to:
|
|
258
|
+
|
|
259
|
+
- Data model.
|
|
260
|
+
- Transaction requirements.
|
|
261
|
+
- Query complexity.
|
|
262
|
+
- Operational maturity.
|
|
263
|
+
- Ecosystem compatibility.
|
|
264
|
+
- Scaling needs.
|
|
265
|
+
- Security controls.
|
|
266
|
+
- Hosting options.
|
|
267
|
+
- Portability.
|
|
268
|
+
- Total cost.
|
|
269
|
+
- Team capabilities.
|
|
270
|
+
- Recovery requirements.
|
|
271
|
+
|
|
272
|
+
Select the simplest suitable solution.
|
|
273
|
+
|
|
274
|
+
Do not select a database solely because it is popular.
|
|
275
|
+
|
|
276
|
+
## 12. Relational Data Modeling
|
|
277
|
+
|
|
278
|
+
For relational systems:
|
|
279
|
+
|
|
280
|
+
- Define meaningful entities.
|
|
281
|
+
- Select appropriate primary keys.
|
|
282
|
+
- Model relationships explicitly.
|
|
283
|
+
- Use foreign keys where supported and appropriate.
|
|
284
|
+
- Apply suitable constraints.
|
|
285
|
+
- Avoid unnecessary duplication.
|
|
286
|
+
- Consider normalization.
|
|
287
|
+
- Introduce denormalization only with clear justification.
|
|
288
|
+
|
|
289
|
+
Align schema design with business invariants.
|
|
290
|
+
|
|
291
|
+
## 13. NoSQL Data Modeling
|
|
292
|
+
|
|
293
|
+
For document, key-value and other NoSQL systems:
|
|
294
|
+
|
|
295
|
+
- Identify access patterns.
|
|
296
|
+
- Define document or item boundaries.
|
|
297
|
+
- Evaluate consistency guarantees.
|
|
298
|
+
- Avoid unbounded document growth.
|
|
299
|
+
- Consider indexing limitations.
|
|
300
|
+
- Define update atomicity.
|
|
301
|
+
- Plan for schema evolution.
|
|
302
|
+
- Evaluate query costs.
|
|
303
|
+
|
|
304
|
+
Do not assume NoSQL automatically provides greater scalability.
|
|
305
|
+
|
|
306
|
+
## 14. Data Integrity
|
|
307
|
+
|
|
308
|
+
Protect critical invariants using appropriate mechanisms.
|
|
309
|
+
|
|
310
|
+
Examples:
|
|
311
|
+
|
|
312
|
+
- Primary key constraints.
|
|
313
|
+
- Unique constraints.
|
|
314
|
+
- Foreign keys.
|
|
315
|
+
- Check constraints.
|
|
316
|
+
- Transaction boundaries.
|
|
317
|
+
- Version checks.
|
|
318
|
+
- Atomic updates.
|
|
319
|
+
- Server-side validation.
|
|
320
|
+
|
|
321
|
+
Do not rely exclusively on client-side checks.
|
|
322
|
+
|
|
323
|
+
Do not use AI-generated decisions as substitutes for deterministic data constraints.
|
|
324
|
+
|
|
325
|
+
## 15. Transactions
|
|
326
|
+
|
|
327
|
+
Evaluate:
|
|
328
|
+
|
|
329
|
+
- Transaction atomicity.
|
|
330
|
+
- Isolation level.
|
|
331
|
+
- Consistency.
|
|
332
|
+
- Durability.
|
|
333
|
+
- Concurrent updates.
|
|
334
|
+
- Deadlocks.
|
|
335
|
+
- Rollback behavior.
|
|
336
|
+
- Retry handling.
|
|
337
|
+
|
|
338
|
+
Use transactions for operations requiring coordinated data changes.
|
|
339
|
+
|
|
340
|
+
Avoid unnecessarily long transactions.
|
|
341
|
+
|
|
342
|
+
Document transaction boundaries for important workflows.
|
|
343
|
+
|
|
344
|
+
## 16. Concurrency Control
|
|
345
|
+
|
|
346
|
+
Review relevant:
|
|
347
|
+
|
|
348
|
+
- Optimistic locking.
|
|
349
|
+
- Pessimistic locking.
|
|
350
|
+
- Atomic operations.
|
|
351
|
+
- Unique constraints.
|
|
352
|
+
- Idempotency keys.
|
|
353
|
+
- Version columns.
|
|
354
|
+
- Compare-and-swap mechanisms.
|
|
355
|
+
- Distributed coordination.
|
|
356
|
+
|
|
357
|
+
Test race conditions where feasible.
|
|
358
|
+
|
|
359
|
+
Do not assume operations are safe merely because they work sequentially.
|
|
360
|
+
|
|
361
|
+
## 17. Idempotency
|
|
362
|
+
|
|
363
|
+
For repeatable or retried operations:
|
|
364
|
+
|
|
365
|
+
- Identify duplicate execution risks.
|
|
366
|
+
- Define idempotency boundaries.
|
|
367
|
+
- Use stable request identifiers where appropriate.
|
|
368
|
+
- Store processing status safely.
|
|
369
|
+
- Consider transaction interactions.
|
|
370
|
+
- Define retry behavior.
|
|
371
|
+
|
|
372
|
+
Important examples may include:
|
|
373
|
+
|
|
374
|
+
- Payments.
|
|
375
|
+
- Reservations.
|
|
376
|
+
- Inventory changes.
|
|
377
|
+
- Claim processing.
|
|
378
|
+
- Webhook handling.
|
|
379
|
+
- Background jobs.
|
|
380
|
+
|
|
381
|
+
Ensure retries do not accidentally duplicate consequential actions.
|
|
382
|
+
|
|
383
|
+
## 18. Data Types and Precision
|
|
384
|
+
|
|
385
|
+
Choose data types according to actual requirements.
|
|
386
|
+
|
|
387
|
+
Consider:
|
|
388
|
+
|
|
389
|
+
- Numeric precision.
|
|
390
|
+
- Currency handling.
|
|
391
|
+
- Date and time representation.
|
|
392
|
+
- Time zones.
|
|
393
|
+
- Unicode.
|
|
394
|
+
- Identifiers.
|
|
395
|
+
- Boolean semantics.
|
|
396
|
+
- Large text.
|
|
397
|
+
- Binary storage.
|
|
398
|
+
|
|
399
|
+
Avoid floating-point arithmetic for monetary values when exact decimal handling is required.
|
|
400
|
+
|
|
401
|
+
Do not silently truncate data.
|
|
402
|
+
|
|
403
|
+
## 19. Data Validation
|
|
404
|
+
|
|
405
|
+
Validate important data at trusted boundaries.
|
|
406
|
+
|
|
407
|
+
Consider:
|
|
408
|
+
|
|
409
|
+
- Required values.
|
|
410
|
+
- Valid ranges.
|
|
411
|
+
- Format requirements.
|
|
412
|
+
- Referential consistency.
|
|
413
|
+
- Domain-specific constraints.
|
|
414
|
+
- State transitions.
|
|
415
|
+
- Ownership.
|
|
416
|
+
|
|
417
|
+
Application validation and database constraints should complement each other.
|
|
418
|
+
|
|
419
|
+
## 20. Authentication and Database Access
|
|
420
|
+
|
|
421
|
+
Review how application identities access the database.
|
|
422
|
+
|
|
423
|
+
Consider:
|
|
424
|
+
|
|
425
|
+
- Database roles.
|
|
426
|
+
- Application service accounts.
|
|
427
|
+
- Credential scopes.
|
|
428
|
+
- Connection pooling.
|
|
429
|
+
- Administrative clients.
|
|
430
|
+
- Read-only accounts.
|
|
431
|
+
- Privileged operations.
|
|
432
|
+
|
|
433
|
+
Apply least privilege.
|
|
434
|
+
|
|
435
|
+
Do not expose privileged database credentials in browser or mobile applications.
|
|
436
|
+
|
|
437
|
+
## 21. Authorization
|
|
438
|
+
|
|
439
|
+
Enforce appropriate authorization for:
|
|
440
|
+
|
|
441
|
+
- Reading records.
|
|
442
|
+
- Creating records.
|
|
443
|
+
- Updating records.
|
|
444
|
+
- Deleting records.
|
|
445
|
+
- Exporting data.
|
|
446
|
+
- Administrative operations.
|
|
447
|
+
- Background processing.
|
|
448
|
+
- File metadata access.
|
|
449
|
+
|
|
450
|
+
Never trust a client-supplied owner or tenant identifier without verification.
|
|
451
|
+
|
|
452
|
+
Authentication is not sufficient without resource authorization.
|
|
453
|
+
|
|
454
|
+
## 22. Multi-Tenant Isolation
|
|
455
|
+
|
|
456
|
+
For multi-tenant systems, evaluate:
|
|
457
|
+
|
|
458
|
+
- Tenant identity.
|
|
459
|
+
- Tenant-aware queries.
|
|
460
|
+
- Row-level security.
|
|
461
|
+
- Database-per-tenant patterns.
|
|
462
|
+
- Schema-per-tenant patterns.
|
|
463
|
+
- Shared-table designs.
|
|
464
|
+
- Administrative exceptions.
|
|
465
|
+
- Cache isolation.
|
|
466
|
+
- Background job isolation.
|
|
467
|
+
- Search index isolation.
|
|
468
|
+
|
|
469
|
+
Select isolation according to requirements and risk.
|
|
470
|
+
|
|
471
|
+
Test cross-tenant access using controlled fixtures.
|
|
472
|
+
|
|
473
|
+
Do not retrieve real data belonging to another tenant merely to test isolation.
|
|
474
|
+
|
|
475
|
+
## 23. Row-Level Security
|
|
476
|
+
|
|
477
|
+
Where supported and appropriate:
|
|
478
|
+
|
|
479
|
+
- Define clear policies.
|
|
480
|
+
- Validate authenticated identity.
|
|
481
|
+
- Restrict access by tenant or owner.
|
|
482
|
+
- Review bypass roles.
|
|
483
|
+
- Review privileged service clients.
|
|
484
|
+
- Test read and write policies.
|
|
485
|
+
- Verify administrative boundaries.
|
|
486
|
+
|
|
487
|
+
RLS is not a substitute for secure application architecture.
|
|
488
|
+
|
|
489
|
+
Do not assume every database engine supports the same RLS mechanisms.
|
|
490
|
+
|
|
491
|
+
## 24. SQL Injection Prevention
|
|
492
|
+
|
|
493
|
+
Use parameterized statements or safe query-builder APIs.
|
|
494
|
+
|
|
495
|
+
Avoid constructing executable SQL from untrusted text.
|
|
496
|
+
|
|
497
|
+
Review:
|
|
498
|
+
|
|
499
|
+
- Dynamic queries.
|
|
500
|
+
- Search filters.
|
|
501
|
+
- Sorting parameters.
|
|
502
|
+
- Raw SQL.
|
|
503
|
+
- Stored procedure inputs.
|
|
504
|
+
- Identifier interpolation.
|
|
505
|
+
|
|
506
|
+
Apply allowlists where SQL identifiers must be selected dynamically.
|
|
507
|
+
|
|
508
|
+
Do not concatenate arbitrary user input into executable queries.
|
|
509
|
+
|
|
510
|
+
## 25. NoSQL Query Security
|
|
511
|
+
|
|
512
|
+
Review:
|
|
513
|
+
|
|
514
|
+
- Operator injection.
|
|
515
|
+
- Dynamic filters.
|
|
516
|
+
- Document ownership.
|
|
517
|
+
- Aggregation pipelines.
|
|
518
|
+
- Untrusted query objects.
|
|
519
|
+
- Access-control enforcement.
|
|
520
|
+
|
|
521
|
+
Validate input structures.
|
|
522
|
+
|
|
523
|
+
Do not allow clients to provide unrestricted database query expressions.
|
|
524
|
+
|
|
525
|
+
## 26. Index Design
|
|
526
|
+
|
|
527
|
+
Review indexes according to actual access patterns.
|
|
528
|
+
|
|
529
|
+
Evaluate:
|
|
530
|
+
|
|
531
|
+
- Filter columns.
|
|
532
|
+
- Join keys.
|
|
533
|
+
- Sort order.
|
|
534
|
+
- Selectivity.
|
|
535
|
+
- Compound indexes.
|
|
536
|
+
- Unique indexes.
|
|
537
|
+
- Partial indexes.
|
|
538
|
+
- Covering indexes.
|
|
539
|
+
- Write amplification.
|
|
540
|
+
- Storage costs.
|
|
541
|
+
|
|
542
|
+
Do not create indexes indiscriminately.
|
|
543
|
+
|
|
544
|
+
Measure effects when possible.
|
|
545
|
+
|
|
546
|
+
## 27. Query Performance
|
|
547
|
+
|
|
548
|
+
Analyze relevant:
|
|
549
|
+
|
|
550
|
+
- Query plans.
|
|
551
|
+
- Full table scans.
|
|
552
|
+
- N+1 queries.
|
|
553
|
+
- Excessive joins.
|
|
554
|
+
- Large payloads.
|
|
555
|
+
- Missing pagination.
|
|
556
|
+
- Slow aggregations.
|
|
557
|
+
- Repeated queries.
|
|
558
|
+
- Unnecessary data transfer.
|
|
559
|
+
|
|
560
|
+
Use engine-appropriate tools.
|
|
561
|
+
|
|
562
|
+
Avoid unbounded expensive diagnostic queries against production.
|
|
563
|
+
|
|
564
|
+
## 28. Query Plan Analysis
|
|
565
|
+
|
|
566
|
+
Use safe inspection tools where available.
|
|
567
|
+
|
|
568
|
+
For relational databases, consider EXPLAIN and engine-specific plan inspection.
|
|
569
|
+
|
|
570
|
+
Understand that some analysis modes may execute the query.
|
|
571
|
+
|
|
572
|
+
Do not run potentially costly or data-changing diagnostic statements on production without suitable authorization.
|
|
573
|
+
|
|
574
|
+
Document actual plan evidence.
|
|
575
|
+
|
|
576
|
+
## 29. Pagination
|
|
577
|
+
|
|
578
|
+
Choose pagination according to workload.
|
|
579
|
+
|
|
580
|
+
Consider:
|
|
581
|
+
|
|
582
|
+
- Offset pagination.
|
|
583
|
+
- Cursor pagination.
|
|
584
|
+
- Keyset pagination.
|
|
585
|
+
- Stable ordering.
|
|
586
|
+
- Authorization-aware filtering.
|
|
587
|
+
- Maximum result size.
|
|
588
|
+
|
|
589
|
+
Avoid returning unbounded datasets from public APIs.
|
|
590
|
+
|
|
591
|
+
Do not expose sensitive records through pagination bugs.
|
|
592
|
+
|
|
593
|
+
## 30. Caching
|
|
594
|
+
|
|
595
|
+
Evaluate caching when justified by measured or credible workload.
|
|
596
|
+
|
|
597
|
+
Consider:
|
|
598
|
+
|
|
599
|
+
- Cache keys.
|
|
600
|
+
- Tenant isolation.
|
|
601
|
+
- Expiration.
|
|
602
|
+
- Invalidation.
|
|
603
|
+
- Data sensitivity.
|
|
604
|
+
- Memory usage.
|
|
605
|
+
- Consistency requirements.
|
|
606
|
+
- Cache stampedes.
|
|
607
|
+
|
|
608
|
+
Never cache private data under keys shared across unauthorized users.
|
|
609
|
+
|
|
610
|
+
Do not introduce Redis or another cache automatically when it adds no meaningful value.
|
|
611
|
+
|
|
612
|
+
## 31. Connection Management
|
|
613
|
+
|
|
614
|
+
Review:
|
|
615
|
+
|
|
616
|
+
- Connection pools.
|
|
617
|
+
- Connection limits.
|
|
618
|
+
- Serverless concurrency.
|
|
619
|
+
- Timeouts.
|
|
620
|
+
- Idle connections.
|
|
621
|
+
- Authentication.
|
|
622
|
+
- Database proxies.
|
|
623
|
+
- Resource exhaustion.
|
|
624
|
+
|
|
625
|
+
Use appropriate pooling strategies.
|
|
626
|
+
|
|
627
|
+
Avoid excessive connection counts.
|
|
628
|
+
|
|
629
|
+
## 32. Read and Write Workloads
|
|
630
|
+
|
|
631
|
+
Identify:
|
|
632
|
+
|
|
633
|
+
- Read-heavy workloads.
|
|
634
|
+
- Write-heavy workloads.
|
|
635
|
+
- Batch processing.
|
|
636
|
+
- Reporting.
|
|
637
|
+
- Analytics.
|
|
638
|
+
- Transactional workloads.
|
|
639
|
+
- Search workloads.
|
|
640
|
+
|
|
641
|
+
Avoid optimizing one workload at the expense of essential correctness.
|
|
642
|
+
|
|
643
|
+
## 33. Horizontal and Vertical Scaling
|
|
644
|
+
|
|
645
|
+
Evaluate:
|
|
646
|
+
|
|
647
|
+
- Instance sizing.
|
|
648
|
+
- Connection limits.
|
|
649
|
+
- Storage throughput.
|
|
650
|
+
- Read replicas.
|
|
651
|
+
- Partitioning.
|
|
652
|
+
- Sharding.
|
|
653
|
+
- Caching.
|
|
654
|
+
- Queue-based processing.
|
|
655
|
+
- Workload separation.
|
|
656
|
+
|
|
657
|
+
Start with the simplest architecture that satisfies measured requirements.
|
|
658
|
+
|
|
659
|
+
Do not introduce distributed complexity prematurely.
|
|
660
|
+
|
|
661
|
+
## 34. High Availability
|
|
662
|
+
|
|
663
|
+
Review relevant:
|
|
664
|
+
|
|
665
|
+
- Redundancy.
|
|
666
|
+
- Replication.
|
|
667
|
+
- Failover.
|
|
668
|
+
- Availability targets.
|
|
669
|
+
- Network dependencies.
|
|
670
|
+
- Regional risks.
|
|
671
|
+
- Operational monitoring.
|
|
672
|
+
|
|
673
|
+
Distinguish high availability from backup and disaster recovery.
|
|
674
|
+
|
|
675
|
+
Replication does not guarantee recovery from accidental deletion.
|
|
676
|
+
|
|
677
|
+
## 35. Partitioning and Sharding
|
|
678
|
+
|
|
679
|
+
Consider partitioning and sharding only when requirements justify them.
|
|
680
|
+
|
|
681
|
+
Evaluate:
|
|
682
|
+
|
|
683
|
+
- Data access patterns.
|
|
684
|
+
- Partition keys.
|
|
685
|
+
- Query routing.
|
|
686
|
+
- Rebalancing.
|
|
687
|
+
- Tenant distribution.
|
|
688
|
+
- Cross-partition transactions.
|
|
689
|
+
- Operational complexity.
|
|
690
|
+
- Cost.
|
|
691
|
+
|
|
692
|
+
Do not claim sharding is required solely because an application may eventually have millions of users.
|
|
693
|
+
|
|
694
|
+
## 36. Database Migrations
|
|
695
|
+
|
|
696
|
+
Before schema changes:
|
|
697
|
+
|
|
698
|
+
1. Inspect existing migration history.
|
|
699
|
+
2. Understand current data structures.
|
|
700
|
+
3. Identify dependent services.
|
|
701
|
+
4. Evaluate compatibility.
|
|
702
|
+
5. Assess data-loss risk.
|
|
703
|
+
6. Prepare migration files.
|
|
704
|
+
7. Define test strategy.
|
|
705
|
+
8. Define recovery options.
|
|
706
|
+
9. Obtain necessary approval.
|
|
707
|
+
10. Verify execution results.
|
|
708
|
+
|
|
709
|
+
Do not treat a migration file as evidence that the migration was successfully applied.
|
|
710
|
+
|
|
711
|
+
## 37. Expand-and-Contract Migrations
|
|
712
|
+
|
|
713
|
+
For compatibility-sensitive changes, consider:
|
|
714
|
+
|
|
715
|
+
- Additive schema changes.
|
|
716
|
+
- Dual-read or dual-write strategies where justified.
|
|
717
|
+
- Backfills.
|
|
718
|
+
- Application compatibility.
|
|
719
|
+
- Phased rollout.
|
|
720
|
+
- Old schema retirement.
|
|
721
|
+
|
|
722
|
+
Avoid unnecessary downtime.
|
|
723
|
+
|
|
724
|
+
Document cases where a migration cannot be rolled back safely.
|
|
725
|
+
|
|
726
|
+
## 38. Data Backfills
|
|
727
|
+
|
|
728
|
+
For large data changes:
|
|
729
|
+
|
|
730
|
+
- Estimate affected volume.
|
|
731
|
+
- Use bounded batches.
|
|
732
|
+
- Consider lock duration.
|
|
733
|
+
- Protect transaction integrity.
|
|
734
|
+
- Monitor progress.
|
|
735
|
+
- Provide restartability.
|
|
736
|
+
- Plan recovery.
|
|
737
|
+
- Define verification criteria.
|
|
738
|
+
|
|
739
|
+
Do not perform uncontrolled production backfills.
|
|
740
|
+
|
|
741
|
+
Require authorization for production data modification.
|
|
742
|
+
|
|
743
|
+
## 39. Destructive Operations
|
|
744
|
+
|
|
745
|
+
Treat the following as high risk when applied to important data:
|
|
746
|
+
|
|
747
|
+
- DROP TABLE.
|
|
748
|
+
- TRUNCATE.
|
|
749
|
+
- Unbounded DELETE.
|
|
750
|
+
- Unbounded UPDATE.
|
|
751
|
+
- Destructive schema migrations.
|
|
752
|
+
- Bulk record replacement.
|
|
753
|
+
- Database reset.
|
|
754
|
+
- Storage destruction.
|
|
755
|
+
|
|
756
|
+
Do not perform these operations on production without explicit, action-specific authorization and appropriate safeguards.
|
|
757
|
+
|
|
758
|
+
Autonomous Build Mode does not override this restriction.
|
|
759
|
+
|
|
760
|
+
## 40. Development and Test Databases
|
|
761
|
+
|
|
762
|
+
Use isolated development and test environments where possible.
|
|
763
|
+
|
|
764
|
+
Prefer:
|
|
765
|
+
|
|
766
|
+
- Local databases.
|
|
767
|
+
- Ephemeral test containers.
|
|
768
|
+
- Synthetic records.
|
|
769
|
+
- Minimal fixtures.
|
|
770
|
+
- Transactional test cleanup.
|
|
771
|
+
- Dedicated testing credentials.
|
|
772
|
+
|
|
773
|
+
Never point routine automated tests at production databases.
|
|
774
|
+
|
|
775
|
+
Validate environment configuration before data-changing tests.
|
|
776
|
+
|
|
777
|
+
## 41. Backup Strategy
|
|
778
|
+
|
|
779
|
+
Evaluate backup requirements according to:
|
|
780
|
+
|
|
781
|
+
- Data importance.
|
|
782
|
+
- Recovery point objectives.
|
|
783
|
+
- Recovery time objectives.
|
|
784
|
+
- Business continuity.
|
|
785
|
+
- Retention obligations.
|
|
786
|
+
- Storage location.
|
|
787
|
+
- Encryption.
|
|
788
|
+
- Cost.
|
|
789
|
+
|
|
790
|
+
Document what is actually backed up.
|
|
791
|
+
|
|
792
|
+
Do not assume backups exist merely because the database is managed.
|
|
793
|
+
|
|
794
|
+
## 42. Recovery Validation
|
|
795
|
+
|
|
796
|
+
A backup is useful only if recovery is achievable.
|
|
797
|
+
|
|
798
|
+
Assess:
|
|
799
|
+
|
|
800
|
+
- Restoration procedures.
|
|
801
|
+
- Recovery credentials.
|
|
802
|
+
- Dependency requirements.
|
|
803
|
+
- Backup integrity.
|
|
804
|
+
- Restoration time.
|
|
805
|
+
- Data completeness.
|
|
806
|
+
- Application compatibility.
|
|
807
|
+
|
|
808
|
+
Test restoration in an authorized, isolated environment where feasible.
|
|
809
|
+
|
|
810
|
+
Do not claim tested recovery without an actual recovery exercise.
|
|
811
|
+
|
|
812
|
+
## 43. Disaster Recovery
|
|
813
|
+
|
|
814
|
+
Evaluate:
|
|
815
|
+
|
|
816
|
+
- Regional failures.
|
|
817
|
+
- Provider outages.
|
|
818
|
+
- Credential loss.
|
|
819
|
+
- Data corruption.
|
|
820
|
+
- Accidental deletion.
|
|
821
|
+
- Ransomware scenarios.
|
|
822
|
+
- Configuration loss.
|
|
823
|
+
- Operational dependencies.
|
|
824
|
+
|
|
825
|
+
Choose recovery measures proportionate to business requirements.
|
|
826
|
+
|
|
827
|
+
## 44. Data Retention
|
|
828
|
+
|
|
829
|
+
Define retention according to legitimate business, operational and legal requirements.
|
|
830
|
+
|
|
831
|
+
Consider:
|
|
832
|
+
|
|
833
|
+
- User records.
|
|
834
|
+
- Transaction records.
|
|
835
|
+
- Logs.
|
|
836
|
+
- Audit trails.
|
|
837
|
+
- Backups.
|
|
838
|
+
- Temporary data.
|
|
839
|
+
- AI embeddings.
|
|
840
|
+
- Uploaded files.
|
|
841
|
+
|
|
842
|
+
Do not invent retention periods.
|
|
843
|
+
|
|
844
|
+
Do not delete records subject to applicable preservation obligations.
|
|
845
|
+
|
|
846
|
+
Consult docs/privacy.md.
|
|
847
|
+
|
|
848
|
+
## 45. Data Deletion
|
|
849
|
+
|
|
850
|
+
For deletion workflows:
|
|
851
|
+
|
|
852
|
+
- Verify authority.
|
|
853
|
+
- Identify dependent records.
|
|
854
|
+
- Respect referential integrity.
|
|
855
|
+
- Consider cascading effects.
|
|
856
|
+
- Evaluate backups.
|
|
857
|
+
- Consider external copies.
|
|
858
|
+
- Preserve required audit evidence.
|
|
859
|
+
- Apply valid retention exceptions.
|
|
860
|
+
|
|
861
|
+
Do not claim complete deletion without appropriate verification.
|
|
862
|
+
|
|
863
|
+
## 46. Encryption
|
|
864
|
+
|
|
865
|
+
Evaluate:
|
|
866
|
+
|
|
867
|
+
- Encryption in transit.
|
|
868
|
+
- Encryption at rest.
|
|
869
|
+
- Application-level encryption.
|
|
870
|
+
- Key management.
|
|
871
|
+
- Credential protection.
|
|
872
|
+
- Backup encryption.
|
|
873
|
+
- Rotation.
|
|
874
|
+
|
|
875
|
+
Use established cryptographic implementations.
|
|
876
|
+
|
|
877
|
+
Encryption does not replace authorization or tenant isolation.
|
|
878
|
+
|
|
879
|
+
## 47. Audit Trails
|
|
880
|
+
|
|
881
|
+
For sensitive operations, consider recording:
|
|
882
|
+
|
|
883
|
+
- Actor identity.
|
|
884
|
+
- Operation type.
|
|
885
|
+
- Affected resource.
|
|
886
|
+
- Timestamp.
|
|
887
|
+
- Authorized context.
|
|
888
|
+
- Outcome.
|
|
889
|
+
|
|
890
|
+
Avoid unnecessary personal data in logs.
|
|
891
|
+
|
|
892
|
+
Protect audit record integrity.
|
|
893
|
+
|
|
894
|
+
## 48. Observability
|
|
895
|
+
|
|
896
|
+
Review database monitoring:
|
|
897
|
+
|
|
898
|
+
- Query latency.
|
|
899
|
+
- Error rates.
|
|
900
|
+
- Connection utilization.
|
|
901
|
+
- CPU.
|
|
902
|
+
- Memory.
|
|
903
|
+
- Storage growth.
|
|
904
|
+
- Replication lag.
|
|
905
|
+
- Lock contention.
|
|
906
|
+
- Backup status.
|
|
907
|
+
- Recovery indicators.
|
|
908
|
+
|
|
909
|
+
Avoid collecting excessive sensitive query payloads.
|
|
910
|
+
|
|
911
|
+
Consult docs/observability.md.
|
|
912
|
+
|
|
913
|
+
## 49. Database Cost Engineering
|
|
914
|
+
|
|
915
|
+
Evaluate:
|
|
916
|
+
|
|
917
|
+
- Compute.
|
|
918
|
+
- Storage.
|
|
919
|
+
- Read and write operations.
|
|
920
|
+
- Backups.
|
|
921
|
+
- Replication.
|
|
922
|
+
- Data transfer.
|
|
923
|
+
- Index storage.
|
|
924
|
+
- Connection infrastructure.
|
|
925
|
+
- Monitoring.
|
|
926
|
+
- Provisioned versus usage-based billing.
|
|
927
|
+
|
|
928
|
+
Separate measured spending from projections.
|
|
929
|
+
|
|
930
|
+
Do not invent provider pricing.
|
|
931
|
+
|
|
932
|
+
Consult docs/cost-engineering.md.
|
|
933
|
+
|
|
934
|
+
## 50. Cloud Provider Independence
|
|
935
|
+
|
|
936
|
+
Support appropriate solutions across:
|
|
937
|
+
|
|
938
|
+
- AWS.
|
|
939
|
+
- Azure.
|
|
940
|
+
- Google Cloud.
|
|
941
|
+
- Supabase.
|
|
942
|
+
- Firebase.
|
|
943
|
+
- Self-hosted environments.
|
|
944
|
+
- Other managed providers.
|
|
945
|
+
|
|
946
|
+
Evaluate vendor dependencies.
|
|
947
|
+
|
|
948
|
+
Consider:
|
|
949
|
+
|
|
950
|
+
- Data export.
|
|
951
|
+
- Schema portability.
|
|
952
|
+
- Migration complexity.
|
|
953
|
+
- Proprietary features.
|
|
954
|
+
- Operational maturity.
|
|
955
|
+
- Pricing.
|
|
956
|
+
|
|
957
|
+
Do not sacrifice important functionality merely to avoid every vendor-specific feature.
|
|
958
|
+
|
|
959
|
+
## 51. Kubernetes and Databases
|
|
960
|
+
|
|
961
|
+
If Kubernetes is used:
|
|
962
|
+
|
|
963
|
+
- Evaluate whether the database should run inside or outside the cluster.
|
|
964
|
+
- Review persistent volumes.
|
|
965
|
+
- Review storage classes.
|
|
966
|
+
- Consider recovery.
|
|
967
|
+
- Assess operator maturity.
|
|
968
|
+
- Protect secrets.
|
|
969
|
+
- Review network restrictions.
|
|
970
|
+
- Assess operational costs.
|
|
971
|
+
|
|
972
|
+
Do not assume databases should run in Kubernetes.
|
|
973
|
+
|
|
974
|
+
Prefer managed services when they provide justified operational benefits.
|
|
975
|
+
|
|
976
|
+
## 52. Serverless Database Considerations
|
|
977
|
+
|
|
978
|
+
Evaluate:
|
|
979
|
+
|
|
980
|
+
- Connection pooling.
|
|
981
|
+
- Cold starts.
|
|
982
|
+
- Concurrent requests.
|
|
983
|
+
- Connection limits.
|
|
984
|
+
- Transaction behavior.
|
|
985
|
+
- Usage-based costs.
|
|
986
|
+
- Regional latency.
|
|
987
|
+
- Provider quotas.
|
|
988
|
+
|
|
989
|
+
Do not assume serverless automatically means cheaper or more scalable.
|
|
990
|
+
|
|
991
|
+
## 53. Mobile and Offline Data
|
|
992
|
+
|
|
993
|
+
For mobile or offline-first applications:
|
|
994
|
+
|
|
995
|
+
- Define local storage scope.
|
|
996
|
+
- Encrypt sensitive local data where appropriate.
|
|
997
|
+
- Plan synchronization.
|
|
998
|
+
- Resolve conflicts.
|
|
999
|
+
- Handle retries.
|
|
1000
|
+
- Support offline queues.
|
|
1001
|
+
- Protect credentials.
|
|
1002
|
+
- Consider device loss.
|
|
1003
|
+
|
|
1004
|
+
Do not assume client-side cached data is authoritative.
|
|
1005
|
+
|
|
1006
|
+
Consult docs/mobile-and-web.md.
|
|
1007
|
+
|
|
1008
|
+
## 54. Desktop and Embedded Databases
|
|
1009
|
+
|
|
1010
|
+
For desktop and local applications:
|
|
1011
|
+
|
|
1012
|
+
- Review database file permissions.
|
|
1013
|
+
- Protect local credentials.
|
|
1014
|
+
- Handle upgrades.
|
|
1015
|
+
- Plan migrations.
|
|
1016
|
+
- Consider concurrent access.
|
|
1017
|
+
- Verify corruption recovery.
|
|
1018
|
+
- Support secure backups.
|
|
1019
|
+
- Respect operating-system constraints.
|
|
1020
|
+
|
|
1021
|
+
SQLite or another embedded database may be appropriate when it meets requirements.
|
|
1022
|
+
|
|
1023
|
+
Consult docs/platforms-and-applications.md.
|
|
1024
|
+
|
|
1025
|
+
## 55. Game Data Systems
|
|
1026
|
+
|
|
1027
|
+
For game applications, consider:
|
|
1028
|
+
|
|
1029
|
+
- Player profiles.
|
|
1030
|
+
- Save data.
|
|
1031
|
+
- Multiplayer state.
|
|
1032
|
+
- Match history.
|
|
1033
|
+
- Inventory.
|
|
1034
|
+
- Virtual economy.
|
|
1035
|
+
- Leaderboards.
|
|
1036
|
+
- Anti-cheat integrity.
|
|
1037
|
+
- Concurrent updates.
|
|
1038
|
+
|
|
1039
|
+
Use server-authoritative controls for security-sensitive multiplayer and economic operations.
|
|
1040
|
+
|
|
1041
|
+
Do not trust client-submitted balances or ownership states.
|
|
1042
|
+
|
|
1043
|
+
## 56. AI and Vector Databases
|
|
1044
|
+
|
|
1045
|
+
For RAG and AI systems, evaluate:
|
|
1046
|
+
|
|
1047
|
+
- Document ownership.
|
|
1048
|
+
- Vector store access.
|
|
1049
|
+
- Embedding metadata.
|
|
1050
|
+
- Tenant isolation.
|
|
1051
|
+
- Retrieval authorization.
|
|
1052
|
+
- Index lifecycle.
|
|
1053
|
+
- Data deletion propagation.
|
|
1054
|
+
- Model dependency.
|
|
1055
|
+
- Retrieval latency.
|
|
1056
|
+
- Inference and storage costs.
|
|
1057
|
+
|
|
1058
|
+
A semantic match does not establish access authorization.
|
|
1059
|
+
|
|
1060
|
+
Protect private document embeddings and associated metadata.
|
|
1061
|
+
|
|
1062
|
+
Consult docs/ai-and-llm.md.
|
|
1063
|
+
|
|
1064
|
+
## 57. Data Import and Export
|
|
1065
|
+
|
|
1066
|
+
For import and export workflows:
|
|
1067
|
+
|
|
1068
|
+
- Validate file structure.
|
|
1069
|
+
- Verify authorization.
|
|
1070
|
+
- Restrict scope.
|
|
1071
|
+
- Consider batch limits.
|
|
1072
|
+
- Prevent duplicate processing.
|
|
1073
|
+
- Handle partial failures.
|
|
1074
|
+
- Protect sensitive fields.
|
|
1075
|
+
- Maintain auditability.
|
|
1076
|
+
|
|
1077
|
+
Do not export real production data without appropriate authorization.
|
|
1078
|
+
|
|
1079
|
+
## 58. Database Testing Strategy
|
|
1080
|
+
|
|
1081
|
+
Select relevant tests:
|
|
1082
|
+
|
|
1083
|
+
- Schema validation.
|
|
1084
|
+
- Constraint tests.
|
|
1085
|
+
- Transaction tests.
|
|
1086
|
+
- Authorization tests.
|
|
1087
|
+
- Tenant isolation tests.
|
|
1088
|
+
- Migration tests.
|
|
1089
|
+
- Query correctness tests.
|
|
1090
|
+
- Concurrency tests.
|
|
1091
|
+
- Retention tests.
|
|
1092
|
+
- Recovery tests.
|
|
1093
|
+
- Performance tests.
|
|
1094
|
+
|
|
1095
|
+
Use appropriate isolated environments.
|
|
1096
|
+
|
|
1097
|
+
Do not claim tests passed without execution.
|
|
1098
|
+
|
|
1099
|
+
## 59. Migration Testing
|
|
1100
|
+
|
|
1101
|
+
When relevant:
|
|
1102
|
+
|
|
1103
|
+
1. Apply migrations to a safe test database.
|
|
1104
|
+
2. Confirm expected schema.
|
|
1105
|
+
3. Test application compatibility.
|
|
1106
|
+
4. Test important queries.
|
|
1107
|
+
5. Evaluate data preservation.
|
|
1108
|
+
6. Test rollback where genuinely possible.
|
|
1109
|
+
7. Record failures.
|
|
1110
|
+
8. Correct migration defects.
|
|
1111
|
+
|
|
1112
|
+
Do not automatically execute tested migrations in production.
|
|
1113
|
+
|
|
1114
|
+
## 60. Performance Testing
|
|
1115
|
+
|
|
1116
|
+
Use representative workload assumptions.
|
|
1117
|
+
|
|
1118
|
+
Consider:
|
|
1119
|
+
|
|
1120
|
+
- Query latency.
|
|
1121
|
+
- Database throughput.
|
|
1122
|
+
- Concurrent operations.
|
|
1123
|
+
- Index efficiency.
|
|
1124
|
+
- Storage behavior.
|
|
1125
|
+
- Connection exhaustion.
|
|
1126
|
+
- Lock contention.
|
|
1127
|
+
|
|
1128
|
+
Avoid intrusive performance testing of live systems without permission.
|
|
1129
|
+
|
|
1130
|
+
Do not claim support for a specific user count without relevant evidence.
|
|
1131
|
+
|
|
1132
|
+
## 61. Database Review Findings
|
|
1133
|
+
|
|
1134
|
+
For material findings, record:
|
|
1135
|
+
|
|
1136
|
+
- Finding ID.
|
|
1137
|
+
- Category.
|
|
1138
|
+
- Affected component.
|
|
1139
|
+
- Severity.
|
|
1140
|
+
- Confidence.
|
|
1141
|
+
- Verification status.
|
|
1142
|
+
- Evidence.
|
|
1143
|
+
- Business impact.
|
|
1144
|
+
- Data integrity risk.
|
|
1145
|
+
- Security impact.
|
|
1146
|
+
- Recommended remediation.
|
|
1147
|
+
- Migration impact.
|
|
1148
|
+
- Testing requirements.
|
|
1149
|
+
- Required approvals.
|
|
1150
|
+
|
|
1151
|
+
Distinguish confirmed defects from hypotheses.
|
|
1152
|
+
|
|
1153
|
+
## 62. Severity Assessment
|
|
1154
|
+
|
|
1155
|
+
Possible classifications:
|
|
1156
|
+
|
|
1157
|
+
- Critical.
|
|
1158
|
+
- High.
|
|
1159
|
+
- Medium.
|
|
1160
|
+
- Low.
|
|
1161
|
+
- Informational.
|
|
1162
|
+
|
|
1163
|
+
Consider:
|
|
1164
|
+
|
|
1165
|
+
- Data loss potential.
|
|
1166
|
+
- Security exposure.
|
|
1167
|
+
- Availability impact.
|
|
1168
|
+
- Business impact.
|
|
1169
|
+
- Affected users.
|
|
1170
|
+
- Likelihood.
|
|
1171
|
+
- Existing safeguards.
|
|
1172
|
+
|
|
1173
|
+
Do not inflate severity without evidence.
|
|
1174
|
+
|
|
1175
|
+
## 63. Database Remediation
|
|
1176
|
+
|
|
1177
|
+
For significant corrections:
|
|
1178
|
+
|
|
1179
|
+
1. Identify root cause.
|
|
1180
|
+
2. Select the minimal effective change.
|
|
1181
|
+
3. Assess data impact.
|
|
1182
|
+
4. Review security.
|
|
1183
|
+
5. Evaluate compatibility.
|
|
1184
|
+
6. Prepare migration if needed.
|
|
1185
|
+
7. Define tests.
|
|
1186
|
+
8. Define recovery.
|
|
1187
|
+
9. Obtain required authorization.
|
|
1188
|
+
10. Implement within scope.
|
|
1189
|
+
11. Validate results.
|
|
1190
|
+
12. Report remaining risks.
|
|
1191
|
+
|
|
1192
|
+
Avoid unnecessary complete database rewrites.
|
|
1193
|
+
|
|
1194
|
+
## 64. Autonomous Database Corrections
|
|
1195
|
+
|
|
1196
|
+
In Autonomous Build Mode, authorized local changes may include:
|
|
1197
|
+
|
|
1198
|
+
- Creating schema definitions.
|
|
1199
|
+
- Adding constraints.
|
|
1200
|
+
- Writing query logic.
|
|
1201
|
+
- Adding indexes.
|
|
1202
|
+
- Preparing migrations.
|
|
1203
|
+
- Creating local test databases.
|
|
1204
|
+
- Adding test fixtures.
|
|
1205
|
+
- Correcting ORM models.
|
|
1206
|
+
- Improving authorization checks.
|
|
1207
|
+
- Testing data integrity.
|
|
1208
|
+
|
|
1209
|
+
Do not require repeated approval for each ordinary authorized change.
|
|
1210
|
+
|
|
1211
|
+
Do not infer permission to alter production databases.
|
|
1212
|
+
|
|
1213
|
+
## 65. Protected Database Operations
|
|
1214
|
+
|
|
1215
|
+
Require specific authorization before:
|
|
1216
|
+
|
|
1217
|
+
- Production schema migration.
|
|
1218
|
+
- Production data updates.
|
|
1219
|
+
- Production data deletion.
|
|
1220
|
+
- Bulk data exports.
|
|
1221
|
+
- Privileged database access changes.
|
|
1222
|
+
- Live backup restoration.
|
|
1223
|
+
- Disabling production constraints.
|
|
1224
|
+
- Removing audit controls.
|
|
1225
|
+
- Changing database billing plans.
|
|
1226
|
+
- Moving live data between providers.
|
|
1227
|
+
|
|
1228
|
+
Document risks and recovery plans.
|
|
1229
|
+
|
|
1230
|
+
Respect platform permission mechanisms.
|
|
1231
|
+
|
|
1232
|
+
## 66. Database Exceptions
|
|
1233
|
+
|
|
1234
|
+
When a standard cannot reasonably be met:
|
|
1235
|
+
|
|
1236
|
+
- Identify the requirement.
|
|
1237
|
+
- Explain the limitation.
|
|
1238
|
+
- Evaluate alternatives.
|
|
1239
|
+
- Assess risks.
|
|
1240
|
+
- Define compensating controls.
|
|
1241
|
+
- Request appropriate approval.
|
|
1242
|
+
- Document review conditions.
|
|
1243
|
+
|
|
1244
|
+
Use:
|
|
1245
|
+
|
|
1246
|
+
~/engineering-standards/templates/EXCEPTIONS.md
|
|
1247
|
+
|
|
1248
|
+
An AI agent cannot approve its own exception.
|
|
1249
|
+
|
|
1250
|
+
## 67. Architecture Decisions
|
|
1251
|
+
|
|
1252
|
+
For significant database architecture decisions, document:
|
|
1253
|
+
|
|
1254
|
+
- Business context.
|
|
1255
|
+
- Data requirements.
|
|
1256
|
+
- Alternatives.
|
|
1257
|
+
- Consistency.
|
|
1258
|
+
- Security.
|
|
1259
|
+
- Scalability.
|
|
1260
|
+
- Operational complexity.
|
|
1261
|
+
- Total cost.
|
|
1262
|
+
- Migration implications.
|
|
1263
|
+
- Risks.
|
|
1264
|
+
|
|
1265
|
+
Use:
|
|
1266
|
+
|
|
1267
|
+
~/engineering-standards/templates/ADR.md
|
|
1268
|
+
|
|
1269
|
+
An ADR does not grant permission for protected operations.
|
|
1270
|
+
|
|
1271
|
+
## 68. Database Audit Reporting
|
|
1272
|
+
|
|
1273
|
+
For significant reviews, use:
|
|
1274
|
+
|
|
1275
|
+
~/engineering-standards/templates/AUDIT_REPORT.md
|
|
1276
|
+
|
|
1277
|
+
Include:
|
|
1278
|
+
|
|
1279
|
+
- Scope.
|
|
1280
|
+
- Technology.
|
|
1281
|
+
- Confirmed findings.
|
|
1282
|
+
- Unverified concerns.
|
|
1283
|
+
- Evidence.
|
|
1284
|
+
- Risks.
|
|
1285
|
+
- Recommendations.
|
|
1286
|
+
- Expected migration impact.
|
|
1287
|
+
- Tests actually executed.
|
|
1288
|
+
- Remaining limitations.
|
|
1289
|
+
- Required human approvals.
|
|
1290
|
+
|
|
1291
|
+
Do not present unexecuted changes as completed.
|
|
1292
|
+
|
|
1293
|
+
## 69. Database Definition of Done
|
|
1294
|
+
|
|
1295
|
+
For significant database functionality:
|
|
1296
|
+
|
|
1297
|
+
- Requirements identified.
|
|
1298
|
+
- Data model reviewed.
|
|
1299
|
+
- Business invariants protected.
|
|
1300
|
+
- Authentication and authorization considered.
|
|
1301
|
+
- Tenant isolation implemented where needed.
|
|
1302
|
+
- Transactions correct.
|
|
1303
|
+
- Queries validated.
|
|
1304
|
+
- Relevant indexes evaluated.
|
|
1305
|
+
- Migration compatibility considered.
|
|
1306
|
+
- Data retention assessed.
|
|
1307
|
+
- Recovery requirements understood.
|
|
1308
|
+
- Performance requirements evaluated.
|
|
1309
|
+
- Costs considered.
|
|
1310
|
+
- Relevant tests executed.
|
|
1311
|
+
- Actual results recorded.
|
|
1312
|
+
- Protected actions authorized.
|
|
1313
|
+
- Remaining risks documented.
|
|
1314
|
+
|
|
1315
|
+
Do not claim production readiness based solely on successful local schema creation.
|
|
1316
|
+
|
|
1317
|
+
## 70. Final Reporting
|
|
1318
|
+
|
|
1319
|
+
Report:
|
|
1320
|
+
|
|
1321
|
+
1. Database technology and scope.
|
|
1322
|
+
2. Architecture decisions.
|
|
1323
|
+
3. Schema or query changes.
|
|
1324
|
+
4. Data integrity controls.
|
|
1325
|
+
5. Security and isolation measures.
|
|
1326
|
+
6. Performance considerations.
|
|
1327
|
+
7. Scalability strategy.
|
|
1328
|
+
8. Migration status.
|
|
1329
|
+
9. Tests performed.
|
|
1330
|
+
10. Tests not performed.
|
|
1331
|
+
11. Backup and recovery readiness.
|
|
1332
|
+
12. Cost implications.
|
|
1333
|
+
13. Outstanding risks.
|
|
1334
|
+
14. Required human actions.
|
|
1335
|
+
|
|
1336
|
+
Clearly distinguish local implementation from production deployment.
|
|
1337
|
+
|
|
1338
|
+
## 71. Final Database Engineering Principles
|
|
1339
|
+
|
|
1340
|
+
Protect data integrity.
|
|
1341
|
+
Preserve important business invariants.
|
|
1342
|
+
Enforce database access authorization.
|
|
1343
|
+
Maintain strict tenant isolation.
|
|
1344
|
+
Use appropriate transactions.
|
|
1345
|
+
Validate concurrent operations.
|
|
1346
|
+
Prevent injection vulnerabilities.
|
|
1347
|
+
Design indexes according to access patterns.
|
|
1348
|
+
Optimize queries using evidence.
|
|
1349
|
+
Avoid unbounded database operations.
|
|
1350
|
+
Preserve existing production data.
|
|
1351
|
+
Treat migrations as potentially risky.
|
|
1352
|
+
Never run destructive production changes without authorization.
|
|
1353
|
+
Maintain appropriate backup and recovery plans.
|
|
1354
|
+
Test restoration where feasible.
|
|
1355
|
+
Design for credible scalability.
|
|
1356
|
+
Avoid unnecessary distributed complexity.
|
|
1357
|
+
Choose database technology according to requirements.
|
|
1358
|
+
Evaluate cloud and managed services without vendor bias.
|
|
1359
|
+
Control database infrastructure costs.
|
|
1360
|
+
Apply privacy and retention requirements.
|
|
1361
|
+
Protect AI retrieval data and embeddings.
|
|
1362
|
+
Support authorized autonomous development.
|
|
1363
|
+
Never fabricate verification results.
|
|
1364
|
+
Document remaining risks honestly.
|