@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.
Files changed (51) hide show
  1. package/AGENTS.md +303 -0
  2. package/CHANGELOG.md +23 -0
  3. package/CITATION.cff +21 -0
  4. package/CODE_OF_CONDUCT.md +13 -0
  5. package/CONTRIBUTING.md +27 -0
  6. package/LICENSE +21 -0
  7. package/README.md +159 -2
  8. package/SECURITY.md +25 -0
  9. package/dist/cli.js +40 -0
  10. package/dist/content.js +71 -0
  11. package/dist/filesystem.js +83 -0
  12. package/dist/installer.js +243 -0
  13. package/dist/layout.js +42 -0
  14. package/dist/transaction.js +143 -0
  15. package/docs/ai-and-llm.md +1312 -0
  16. package/docs/architecture.md +1007 -0
  17. package/docs/cost-engineering.md +1322 -0
  18. package/docs/data.md +993 -0
  19. package/docs/governance.md +1744 -0
  20. package/docs/mobile-and-web.md +1362 -0
  21. package/docs/observability.md +1345 -0
  22. package/docs/platforms-and-applications.md +1581 -0
  23. package/docs/privacy.md +566 -0
  24. package/docs/quality-and-testing.md +1278 -0
  25. package/docs/scalability.md +1012 -0
  26. package/docs/security.md +373 -0
  27. package/handbook/claude-plugin.md +31 -0
  28. package/handbook/compatibility.md +27 -0
  29. package/handbook/recovery.md +29 -0
  30. package/handbook/releasing.md +50 -0
  31. package/handbook/security-review.md +41 -0
  32. package/handbook/signing.md +18 -0
  33. package/handbook/validation.md +50 -0
  34. package/package.json +65 -4
  35. package/scripts/content-baseline.json +25 -0
  36. package/skills/engineering-architecture-review/SKILL.md +1531 -0
  37. package/skills/engineering-cost-estimate/SKILL.md +1599 -0
  38. package/skills/engineering-database-review/SKILL.md +1364 -0
  39. package/skills/engineering-privacy-check/SKILL.md +1295 -0
  40. package/skills/engineering-safe-implementation/SKILL.md +1502 -0
  41. package/skills/engineering-security-standards-check/SKILL.md +1112 -0
  42. package/src/cli.ts +45 -0
  43. package/src/content.ts +82 -0
  44. package/src/filesystem.ts +94 -0
  45. package/src/installer.ts +280 -0
  46. package/src/layout.ts +70 -0
  47. package/src/transaction.ts +167 -0
  48. package/templates/ADR.md +1302 -0
  49. package/templates/AUDIT_REPORT.md +1693 -0
  50. package/templates/EXCEPTIONS.md +647 -0
  51. package/templates/PROJECT_AGENTS.md +868 -0
@@ -0,0 +1,1012 @@
1
+
2
+ # Global Scalability and Performance Engineering Standards
3
+
4
+ ## 1. Mission
5
+
6
+ Design, develop, validate and operate software capable of evolving toward millions of users while preserving security, privacy, data integrity, reliability, maintainability and cost efficiency.
7
+
8
+ These standards apply to new and existing production applications.
9
+
10
+ Supported environments include:
11
+
12
+ - Web applications.
13
+ - Native iOS applications.
14
+ - Native Android applications.
15
+ - Cross-platform mobile applications.
16
+ - SaaS platforms.
17
+ - Backend APIs.
18
+ - AI-powered applications.
19
+ - Realtime systems.
20
+ - Database systems.
21
+ - Serverless infrastructure.
22
+ - Containerized applications.
23
+ - Kubernetes.
24
+ - Cloud, hybrid and on-premises infrastructure.
25
+
26
+ These standards are cloud-agnostic, provider-neutral and technology-independent.
27
+
28
+ No specific architecture, framework, database, cloud provider or orchestration platform is mandatory.
29
+
30
+ Never claim scalability without supporting evidence.
31
+
32
+ ## 2. Fundamental Scalability Principle
33
+
34
+ Design for future growth.
35
+
36
+ Provision for current demand.
37
+
38
+ Scale according to measured requirements.
39
+
40
+ Do not confuse architectural scalability with current infrastructure capacity.
41
+
42
+ Do not introduce expensive infrastructure merely because an application may eventually have millions of users.
43
+
44
+ Prefer the simplest architecture capable of meeting verified requirements with a credible evolution path.
45
+
46
+ Security, correctness and data integrity must not be sacrificed for throughput or lower costs.
47
+
48
+ ## 3. Capacity Planning
49
+
50
+ For significant architectural decisions, evaluate scenarios including:
51
+
52
+ - 10,000 users.
53
+ - 100,000 users.
54
+ - 1,000,000 users.
55
+ - 5,000,000 users.
56
+ - 10,000,000 users.
57
+
58
+ These are planning scenarios, not assumed workload requirements.
59
+
60
+ Distinguish:
61
+
62
+ - Registered users.
63
+ - Monthly active users (MAU).
64
+ - Daily active users (DAU).
65
+ - Peak concurrent users.
66
+ - Active sessions.
67
+ - Requests per second (RPS).
68
+ - Transactions per second (TPS).
69
+ - Database reads and writes.
70
+ - Concurrent realtime connections.
71
+ - AI requests per minute.
72
+ - Storage growth.
73
+ - Network bandwidth.
74
+
75
+ Document assumptions explicitly.
76
+
77
+ Never derive infrastructure sizing from registered-user count alone.
78
+
79
+ ## 4. Workload Modeling
80
+
81
+ Before making scalability recommendations, identify:
82
+
83
+ 1. Expected user behavior.
84
+ 2. Frequently accessed features.
85
+ 3. Peak traffic periods.
86
+ 4. Request distribution.
87
+ 5. Read/write ratios.
88
+ 6. Average and maximum payload sizes.
89
+ 7. Background processing requirements.
90
+ 8. Realtime communication needs.
91
+ 9. External API dependencies.
92
+ 10. Geographic distribution.
93
+ 11. Availability requirements.
94
+ 12. Growth assumptions.
95
+
96
+ Model normal, peak and exceptional workloads.
97
+
98
+ Identify which assumptions are measured and which are estimated.
99
+
100
+ ## 5. Performance Objectives
101
+
102
+ Define measurable performance targets appropriate to the application.
103
+
104
+ Evaluate:
105
+
106
+ - Response latency.
107
+ - p50 latency.
108
+ - p95 latency.
109
+ - p99 latency.
110
+ - Throughput.
111
+ - Error rate.
112
+ - Time to first byte.
113
+ - Frontend rendering performance.
114
+ - Mobile startup time.
115
+ - Database query latency.
116
+ - Background job completion time.
117
+ - Realtime message latency.
118
+ - Resource utilization.
119
+
120
+ Performance targets must reflect user needs and product requirements.
121
+
122
+ Do not impose arbitrary latency targets without justification.
123
+
124
+ ## 6. Architecture for Growth
125
+
126
+ Evaluate architectural choices according to workload and operational complexity.
127
+
128
+ Possible approaches include:
129
+
130
+ - Modular monoliths.
131
+ - Stateless backend services.
132
+ - Managed application hosting.
133
+ - Serverless functions.
134
+ - Containers.
135
+ - Kubernetes.
136
+ - Background workers.
137
+ - Event-driven processing.
138
+ - Distributed services.
139
+ - Hybrid architectures.
140
+
141
+ Prefer modular simplicity.
142
+
143
+ Do not assume microservices are necessary for millions of users.
144
+
145
+ Separate independent scaling requirements only when justified.
146
+
147
+ Document architectural evolution thresholds.
148
+
149
+ ## 7. Vertical and Horizontal Scaling
150
+
151
+ Evaluate vertical scaling when it provides an efficient solution.
152
+
153
+ Consider:
154
+
155
+ - CPU.
156
+ - Memory.
157
+ - Storage throughput.
158
+ - Database capacity.
159
+ - Resource limits.
160
+ - Cost increases.
161
+
162
+ Evaluate horizontal scaling when workloads can be distributed appropriately.
163
+
164
+ Consider:
165
+
166
+ - Stateless application instances.
167
+ - Load balancing.
168
+ - Shared state.
169
+ - Session management.
170
+ - Database capacity.
171
+ - Distributed coordination.
172
+ - Network overhead.
173
+ - Operational complexity.
174
+
175
+ Never assume horizontal scaling automatically solves database or external service bottlenecks.
176
+
177
+ ## 8. Stateless Application Design
178
+
179
+ Prefer stateless request processing where appropriate.
180
+
181
+ Avoid storing critical session state only in individual application instances.
182
+
183
+ Use suitable external state mechanisms where necessary.
184
+
185
+ Design requests to tolerate execution on different instances.
186
+
187
+ Manage authentication and session consistency securely.
188
+
189
+ Do not introduce distributed state systems unnecessarily.
190
+
191
+ ## 9. Load Balancing
192
+
193
+ Evaluate load balancing according to expected traffic.
194
+
195
+ Consider:
196
+
197
+ - Request distribution.
198
+ - Health checks.
199
+ - Failover.
200
+ - Connection handling.
201
+ - Geographic routing.
202
+ - TLS termination.
203
+ - Session requirements.
204
+ - Cost.
205
+
206
+ Avoid single points of failure where availability requirements justify redundancy.
207
+
208
+ Validate behavior during instance failure and scaling events.
209
+
210
+ ## 10. Database Scalability
211
+
212
+ Evaluate:
213
+
214
+ - Query plans.
215
+ - Index effectiveness.
216
+ - Read/write ratios.
217
+ - Database connections.
218
+ - Connection pooling.
219
+ - Transaction duration.
220
+ - Lock contention.
221
+ - Replication.
222
+ - Read replicas.
223
+ - Partitioning.
224
+ - Storage growth.
225
+ - Backup duration.
226
+ - Recovery time.
227
+
228
+ Identify the actual database technology before recommending optimizations.
229
+
230
+ Apply provider-specific requirements only when relevant.
231
+
232
+ Consult docs/data.md for detailed database standards.
233
+
234
+ Never recommend sharding without strong evidence that simpler approaches are insufficient.
235
+
236
+ ## 11. Supabase Scalability
237
+
238
+ For applications using Supabase, evaluate:
239
+
240
+ - Database compute utilization.
241
+ - Query performance.
242
+ - Connection pooling.
243
+ - RLS query efficiency.
244
+ - Authentication usage.
245
+ - Storage and bandwidth.
246
+ - Edge Function usage.
247
+ - Realtime subscriptions.
248
+ - Message volume.
249
+ - Concurrent connections.
250
+ - Provider quotas.
251
+ - Available scaling options.
252
+ - Operational costs.
253
+
254
+ Verify current Supabase limits and pricing.
255
+
256
+ Never assume Supabase has unlimited capacity.
257
+
258
+ Never assume changing providers is necessary without evidence.
259
+
260
+ ## 12. AWS, Azure and GCP Scalability
261
+
262
+ Support scalability planning across:
263
+
264
+ ### Amazon Web Services
265
+
266
+ Evaluate relevant services such as:
267
+
268
+ - EC2.
269
+ - ECS.
270
+ - EKS.
271
+ - AWS Lambda.
272
+ - Application Load Balancer.
273
+ - RDS and Aurora.
274
+ - DynamoDB.
275
+ - S3.
276
+ - CloudFront.
277
+
278
+ ### Microsoft Azure
279
+
280
+ Evaluate relevant services such as:
281
+
282
+ - Azure App Service.
283
+ - Azure Functions.
284
+ - Azure Kubernetes Service.
285
+ - Azure Virtual Machines.
286
+ - Azure Load Balancer.
287
+ - Azure SQL.
288
+ - Cosmos DB.
289
+ - Azure Front Door.
290
+ - Azure Storage.
291
+
292
+ ### Google Cloud Platform
293
+
294
+ Evaluate relevant services such as:
295
+
296
+ - Cloud Run.
297
+ - Google Kubernetes Engine.
298
+ - Compute Engine.
299
+ - Cloud Functions or equivalent current services.
300
+ - Cloud Load Balancing.
301
+ - Cloud SQL.
302
+ - AlloyDB.
303
+ - Firestore.
304
+ - Cloud CDN.
305
+ - Cloud Storage.
306
+
307
+ These examples do not establish preferred providers.
308
+
309
+ Verify current product capabilities, quotas and pricing before recommending specific architectures.
310
+
311
+ ## 13. Kubernetes Scalability
312
+
313
+ Kubernetes is optional.
314
+
315
+ Do not recommend Kubernetes solely because the application targets millions of users.
316
+
317
+ Before adopting Kubernetes:
318
+
319
+ 1. Identify scaling requirements.
320
+ 2. Evaluate workload characteristics.
321
+ 3. Compare simpler alternatives.
322
+ 4. Assess team operational capabilities.
323
+ 5. Evaluate reliability needs.
324
+ 6. Assess security implications.
325
+ 7. Estimate total operating costs.
326
+ 8. Document the architectural decision.
327
+ 9. Obtain explicit human approval.
328
+
329
+ When Kubernetes is used, evaluate:
330
+
331
+ - Horizontal Pod Autoscaling.
332
+ - Vertical Pod Autoscaling.
333
+ - Node autoscaling.
334
+ - Cluster capacity.
335
+ - CPU and memory requests.
336
+ - Resource limits.
337
+ - Resource quotas.
338
+ - Workload scheduling.
339
+ - Pod disruption budgets.
340
+ - Readiness probes.
341
+ - Liveness probes.
342
+ - Startup probes.
343
+ - Rolling updates.
344
+ - Workload isolation.
345
+ - Load balancing.
346
+ - Storage dependencies.
347
+ - Monitoring and alerting.
348
+
349
+ Validate autoscaling behavior under realistic demand.
350
+
351
+ Kubernetes does not automatically make application code scalable.
352
+
353
+ ## 14. Kubernetes Autoscaling
354
+
355
+ Define appropriate autoscaling metrics.
356
+
357
+ Consider:
358
+
359
+ - CPU utilization.
360
+ - Memory pressure.
361
+ - Requests per second.
362
+ - Queue depth.
363
+ - Custom application metrics.
364
+ - External metrics.
365
+ - Scaling latency.
366
+ - Startup time.
367
+ - Minimum and maximum replicas.
368
+ - Node provisioning time.
369
+
370
+ Avoid scaling decisions based solely on one resource metric when workload characteristics require more.
371
+
372
+ Prevent uncontrolled scaling and excessive infrastructure costs.
373
+
374
+ Define limits and alerts.
375
+
376
+ Evaluate whether scale-down behavior preserves availability and data integrity.
377
+
378
+ ## 15. Serverless Scalability
379
+
380
+ Evaluate serverless architectures where appropriate.
381
+
382
+ Consider:
383
+
384
+ - Concurrency limits.
385
+ - Cold starts.
386
+ - Execution time limits.
387
+ - Memory and CPU allocation.
388
+ - Database connection pressure.
389
+ - External API limits.
390
+ - Background workload suitability.
391
+ - Retry behavior.
392
+ - Regional availability.
393
+ - Request and execution costs.
394
+
395
+ Use concurrency limits to protect dependent services.
396
+
397
+ Do not assume serverless is always cheaper or automatically scalable without constraints.
398
+
399
+ Evaluate sustained workloads separately from intermittent workloads.
400
+
401
+ ## 16. Caching Strategy
402
+
403
+ Use caching based on measured or modeled demand.
404
+
405
+ Consider:
406
+
407
+ - Application caching.
408
+ - Database query caching.
409
+ - CDN caching.
410
+ - Object caching.
411
+ - In-memory caching.
412
+ - Distributed caching.
413
+
414
+ Define:
415
+
416
+ - Cache keys.
417
+ - Expiration.
418
+ - Invalidation.
419
+ - Consistency.
420
+ - Authorization.
421
+ - Tenant isolation.
422
+ - Memory requirements.
423
+ - Cost.
424
+ - Failure behavior.
425
+
426
+ Never allow shared caches to expose private information across users.
427
+
428
+ Do not cache critical data without understanding consistency implications.
429
+
430
+ ## 17. CDN and Global Delivery
431
+
432
+ Evaluate content delivery networks for geographically distributed users.
433
+
434
+ Consider:
435
+
436
+ - Static assets.
437
+ - Image delivery.
438
+ - Video delivery.
439
+ - Cache behavior.
440
+ - Edge locations.
441
+ - Origin protection.
442
+ - Geographic latency.
443
+ - Bandwidth costs.
444
+ - Cache invalidation.
445
+ - Privacy and data residency.
446
+
447
+ Do not expose confidential information through public CDN caches.
448
+
449
+ Verify whether cross-region and egress costs are justified.
450
+
451
+ ## 18. Background Processing
452
+
453
+ Move expensive or long-running operations out of synchronous request paths when justified.
454
+
455
+ Consider:
456
+
457
+ - Queues.
458
+ - Background workers.
459
+ - Scheduled jobs.
460
+ - Event processing.
461
+ - Batch processing.
462
+
463
+ Define:
464
+
465
+ - Delivery guarantees.
466
+ - Retry policies.
467
+ - Idempotency.
468
+ - Job priority.
469
+ - Timeout behavior.
470
+ - Failure handling.
471
+ - Dead-letter mechanisms.
472
+ - Monitoring.
473
+ - Cost.
474
+
475
+ Never assume background jobs execute exactly once.
476
+
477
+ ## 19. Realtime Scalability
478
+
479
+ For messaging, collaboration, notifications and live updates, evaluate:
480
+
481
+ - Concurrent connections.
482
+ - Message rate.
483
+ - Fan-out.
484
+ - Subscription authorization.
485
+ - Delivery guarantees.
486
+ - Ordering.
487
+ - Duplicate events.
488
+ - Reconnection.
489
+ - Presence.
490
+ - Network interruptions.
491
+ - Mobile background behavior.
492
+ - Infrastructure limits.
493
+ - Cost per message and connection.
494
+
495
+ Use backpressure and resource limits where appropriate.
496
+
497
+ Do not assume realtime systems scale linearly.
498
+
499
+ ## 20. AI Workload Scalability
500
+
501
+ For applications using AI models or agents, evaluate:
502
+
503
+ - Request concurrency.
504
+ - Model rate limits.
505
+ - Token throughput.
506
+ - Inference latency.
507
+ - Context length.
508
+ - Tool execution.
509
+ - Retrieval performance.
510
+ - Vector database capacity.
511
+ - Queueing.
512
+ - Timeouts.
513
+ - Retries.
514
+ - Model fallback.
515
+ - Cost per AI operation.
516
+
517
+ Prevent uncontrolled loops and retry amplification.
518
+
519
+ Define per-user and per-tenant budgets where appropriate.
520
+
521
+ Avoid unnecessary repeated inference.
522
+
523
+ Never sacrifice privacy or authorization for faster AI responses.
524
+
525
+ ## 21. API Scalability
526
+
527
+ For API services, evaluate:
528
+
529
+ - Request throughput.
530
+ - Authentication overhead.
531
+ - Authorization performance.
532
+ - Serialization costs.
533
+ - Payload size.
534
+ - Pagination.
535
+ - Rate limiting.
536
+ - Request quotas.
537
+ - Request timeouts.
538
+ - Retry policies.
539
+ - Idempotency.
540
+ - Dependency latency.
541
+ - Backend capacity.
542
+
543
+ Avoid unnecessary synchronous dependency chains.
544
+
545
+ Ensure API scaling does not overwhelm databases or external providers.
546
+
547
+ ## 22. Rate Limiting and Quotas
548
+
549
+ Implement appropriate protection against excessive usage.
550
+
551
+ Consider:
552
+
553
+ - Per-user limits.
554
+ - Per-tenant limits.
555
+ - Per-IP limits where appropriate.
556
+ - API-key limits.
557
+ - Authentication endpoint protection.
558
+ - AI token budgets.
559
+ - External API quotas.
560
+ - Storage limits.
561
+ - Background job limits.
562
+
563
+ Define fair-use policies where required.
564
+
565
+ Use resource-aware throttling to protect downstream services.
566
+
567
+ Avoid exposing sensitive information through rate-limit behavior.
568
+
569
+ ## 23. Backpressure and Load Shedding
570
+
571
+ Design systems to handle overload safely.
572
+
573
+ Consider:
574
+
575
+ - Bounded queues.
576
+ - Concurrency limits.
577
+ - Admission control.
578
+ - Request prioritization.
579
+ - Load shedding.
580
+ - Graceful degradation.
581
+ - Retry-after responses.
582
+ - Circuit breakers.
583
+
584
+ Protect critical functions during traffic spikes.
585
+
586
+ Prevent retry storms.
587
+
588
+ Never allow unlimited queue growth to exhaust system resources.
589
+
590
+ ## 24. Reliability and Fault Tolerance
591
+
592
+ Design for foreseeable failures.
593
+
594
+ Evaluate:
595
+
596
+ - Instance failures.
597
+ - Database outages.
598
+ - Network partitions.
599
+ - External API failures.
600
+ - Queue failures.
601
+ - Resource exhaustion.
602
+ - Region outages.
603
+ - Dependency degradation.
604
+ - Deployment failures.
605
+
606
+ Use appropriate:
607
+
608
+ - Timeouts.
609
+ - Bounded retries.
610
+ - Exponential backoff with jitter.
611
+ - Circuit breakers.
612
+ - Bulkheads.
613
+ - Failover.
614
+ - Graceful degradation.
615
+ - Recovery procedures.
616
+
617
+ Test failure handling where feasible.
618
+
619
+ ## 25. High Availability
620
+
621
+ Define availability requirements according to business impact.
622
+
623
+ Evaluate:
624
+
625
+ - Redundancy.
626
+ - Failure domains.
627
+ - Availability zones.
628
+ - Regional architecture.
629
+ - Database high availability.
630
+ - Load balancing.
631
+ - Failover.
632
+ - Deployment strategies.
633
+ - Operational monitoring.
634
+
635
+ Do not implement expensive multi-region infrastructure without justified requirements.
636
+
637
+ Do not claim high availability without supporting architecture and operational evidence.
638
+
639
+ ## 26. Disaster Recovery
640
+
641
+ Define appropriate:
642
+
643
+ - Recovery Point Objective (RPO).
644
+ - Recovery Time Objective (RTO).
645
+ - Backup strategies.
646
+ - Restoration procedures.
647
+ - Failover procedures.
648
+ - Recovery responsibilities.
649
+ - Incident communication.
650
+
651
+ Test restoration and recovery.
652
+
653
+ Estimate recovery performance under realistic data volumes.
654
+
655
+ A backup alone does not establish recovery readiness.
656
+
657
+ ## 27. Web Client Performance
658
+
659
+ Evaluate relevant web metrics such as:
660
+
661
+ - Largest Contentful Paint.
662
+ - Interaction to Next Paint.
663
+ - Cumulative Layout Shift.
664
+ - JavaScript bundle size.
665
+ - Network request volume.
666
+ - Rendering performance.
667
+ - Memory consumption.
668
+ - Accessibility impact.
669
+ - Mobile browser performance.
670
+
671
+ Use code splitting and lazy loading where justified.
672
+
673
+ Avoid loading unnecessary libraries and assets.
674
+
675
+ Measure real user experience when suitable telemetry is available.
676
+
677
+ ## 28. iOS Performance
678
+
679
+ Evaluate:
680
+
681
+ - Cold and warm startup.
682
+ - UI responsiveness.
683
+ - Main-thread blocking.
684
+ - Memory usage.
685
+ - Battery consumption.
686
+ - Network activity.
687
+ - Background execution.
688
+ - Image and video processing.
689
+ - Local storage.
690
+ - Offline behavior.
691
+ - Synchronization.
692
+ - Crash rates.
693
+
694
+ Respect platform lifecycle constraints.
695
+
696
+ Do not use excessive polling or background work.
697
+
698
+ Validate performance on representative devices.
699
+
700
+ ## 29. Android Performance
701
+
702
+ Evaluate:
703
+
704
+ - Cold and warm startup.
705
+ - UI responsiveness.
706
+ - ANR rates.
707
+ - Memory consumption.
708
+ - Battery usage.
709
+ - Background restrictions.
710
+ - Network efficiency.
711
+ - Offline handling.
712
+ - Data synchronization.
713
+ - Crash rates.
714
+ - Device variability.
715
+
716
+ Avoid unnecessary wakeups, polling and background processing.
717
+
718
+ Test on representative hardware and operating system versions.
719
+
720
+ ## 30. Network Resilience
721
+
722
+ Design for mobile and unreliable network environments.
723
+
724
+ Consider:
725
+
726
+ - Slow connections.
727
+ - Connection loss.
728
+ - Request timeouts.
729
+ - Offline operation.
730
+ - Request duplication.
731
+ - Retry behavior.
732
+ - Synchronization conflicts.
733
+ - Large payloads.
734
+ - Battery impact.
735
+
736
+ Use appropriate data compression and request batching where justified.
737
+
738
+ Ensure retries do not duplicate critical business operations.
739
+
740
+ ## 31. Observability
741
+
742
+ Monitor scalability indicators such as:
743
+
744
+ - Request throughput.
745
+ - p95 and p99 latency.
746
+ - Error rates.
747
+ - CPU and memory.
748
+ - Database utilization.
749
+ - Connection saturation.
750
+ - Queue depth.
751
+ - Cache hit rates.
752
+ - External dependency latency.
753
+ - Realtime connection counts.
754
+ - Cost per operation.
755
+
756
+ Use structured telemetry with appropriate privacy protections.
757
+
758
+ Define actionable alerts.
759
+
760
+ Avoid unnecessary high-cardinality metrics and excessive observability costs.
761
+
762
+ ## 32. Load Testing
763
+
764
+ Use appropriate load-testing tools for the actual stack.
765
+
766
+ Possible tools include:
767
+
768
+ - k6.
769
+ - Locust.
770
+ - JMeter.
771
+ - Gatling.
772
+ - Provider-native performance tools.
773
+
774
+ Tool selection must follow project requirements.
775
+
776
+ Define realistic workloads.
777
+
778
+ Use synthetic or authorized test data.
779
+
780
+ Never run uncontrolled load tests against production.
781
+
782
+ Require explicit approval for production performance tests.
783
+
784
+ ## 33. Performance Test Types
785
+
786
+ Evaluate relevant tests including:
787
+
788
+ - Baseline tests.
789
+ - Load tests.
790
+ - Stress tests.
791
+ - Spike tests.
792
+ - Soak tests.
793
+ - Scalability tests.
794
+ - Failure recovery tests.
795
+ - Concurrency tests.
796
+ - Capacity tests.
797
+
798
+ Select tests according to actual risk and architecture.
799
+
800
+ Record environment, workload, results and limitations.
801
+
802
+ ## 34. Capacity Validation
803
+
804
+ For each significant capacity claim, report:
805
+
806
+ - Environment.
807
+ - Infrastructure configuration.
808
+ - Dataset size.
809
+ - Workload model.
810
+ - Concurrent users.
811
+ - Request rate.
812
+ - Latency.
813
+ - Error rate.
814
+ - Resource consumption.
815
+ - Database utilization.
816
+ - External dependencies.
817
+ - Operational cost.
818
+
819
+ Distinguish laboratory results from verified production capacity.
820
+
821
+ Do not extrapolate indefinitely from small-scale tests.
822
+
823
+ ## 35. Scaling Thresholds
824
+
825
+ Define explicit conditions for architectural evolution.
826
+
827
+ Examples:
828
+
829
+ - Sustained resource saturation.
830
+ - Database connection exhaustion.
831
+ - Increasing p95 latency.
832
+ - Excessive queue delays.
833
+ - Rising error rates.
834
+ - Realtime connection limits.
835
+ - Operational costs exceeding approved budgets.
836
+ - Unacceptable recovery times.
837
+
838
+ Do not use arbitrary thresholds without context.
839
+
840
+ Document the technical and financial justification for each major scaling decision.
841
+
842
+ ## 36. Cost-Aware Scalability
843
+
844
+ Every significant scaling proposal must consider total cost of ownership.
845
+
846
+ Evaluate:
847
+
848
+ - Compute.
849
+ - Database resources.
850
+ - Storage.
851
+ - Network bandwidth.
852
+ - CDN.
853
+ - Managed services.
854
+ - Kubernetes clusters.
855
+ - Serverless execution.
856
+ - AI inference.
857
+ - Third-party APIs.
858
+ - Monitoring.
859
+ - Backup and recovery.
860
+ - Operational maintenance.
861
+
862
+ Compare cost per active user and business operation.
863
+
864
+ Evaluate current and projected workloads.
865
+
866
+ Use verified pricing and explicit assumptions.
867
+
868
+ Do not assume larger infrastructure automatically delivers better value.
869
+
870
+ Consult docs/cost-engineering.md for detailed cost requirements.
871
+
872
+ ## 37. Kubernetes Cost Controls
873
+
874
+ For Kubernetes workloads, evaluate:
875
+
876
+ - Control plane charges where applicable.
877
+ - Worker node utilization.
878
+ - CPU and memory requests.
879
+ - Overprovisioning.
880
+ - Autoscaling behavior.
881
+ - Persistent storage.
882
+ - Load balancers.
883
+ - Cross-zone traffic.
884
+ - Network egress.
885
+ - Logging and monitoring.
886
+ - Backup and recovery.
887
+ - Operational complexity.
888
+
889
+ Establish resource quotas, budgets and monitoring.
890
+
891
+ Compare managed Kubernetes against simpler deployment models.
892
+
893
+ Never scale without assessing cost implications.
894
+
895
+ ## 38. Security During Scaling
896
+
897
+ Scaling must preserve security controls.
898
+
899
+ Evaluate:
900
+
901
+ - Authentication consistency.
902
+ - Authorization enforcement.
903
+ - Tenant isolation.
904
+ - Rate limiting.
905
+ - Network isolation.
906
+ - Workload identity.
907
+ - Secret management.
908
+ - Data encryption.
909
+ - Audit logging.
910
+ - Abuse prevention.
911
+ - Supply-chain security.
912
+
913
+ Never weaken security policies to improve performance.
914
+
915
+ Consult docs/security.md where relevant.
916
+
917
+ ## 39. Privacy During Scaling
918
+
919
+ Evaluate how scaling affects:
920
+
921
+ - Data residency.
922
+ - Geographic replication.
923
+ - Personal data transfers.
924
+ - Third-party processors.
925
+ - Logging.
926
+ - Data retention.
927
+ - Sensitive information exposure.
928
+ - Backup locations.
929
+ - User rights.
930
+
931
+ Never replicate personal information into new regions without reviewing the legal and technical implications.
932
+
933
+ Consult docs/privacy.md.
934
+
935
+ ## 40. Existing Production Application Audits
936
+
937
+ For existing systems:
938
+
939
+ 1. Inspect the actual repository.
940
+ 2. Identify current deployment architecture.
941
+ 3. Review existing performance evidence.
942
+ 4. Map critical workloads.
943
+ 5. Identify potential bottlenecks.
944
+ 6. Evaluate infrastructure limits.
945
+ 7. Assess operational costs.
946
+ 8. Review availability and recovery.
947
+ 9. Identify confirmed scaling risks.
948
+ 10. Recommend minimal improvements.
949
+ 11. Define validation tests.
950
+ 12. Present a prioritized roadmap.
951
+ 13. Wait for human approval.
952
+
953
+ The initial assessment must be read-only.
954
+
955
+ Do not change infrastructure, production settings, databases or application code during the audit.
956
+
957
+ Do not claim to have measured live production performance unless genuine operational measurements were available.
958
+
959
+ ## 41. Safe Scaling Changes
960
+
961
+ Before implementing significant scaling changes:
962
+
963
+ - Establish baseline behavior.
964
+ - Identify affected components.
965
+ - Define measurable objectives.
966
+ - Assess compatibility.
967
+ - Review security and data integrity.
968
+ - Estimate operational costs.
969
+ - Define regression tests.
970
+ - Define load tests.
971
+ - Create rollback procedures.
972
+ - Obtain explicit approval.
973
+
974
+ Use gradual rollout, feature flags, canary deployment or other appropriate strategies where justified.
975
+
976
+ Do not implement broad architectural rewrites merely to increase theoretical capacity.
977
+
978
+ ## 42. Scalability Definition of Done
979
+
980
+ For significant scalability work:
981
+
982
+ - Workload assumptions documented.
983
+ - Performance objectives defined.
984
+ - Architecture evaluated.
985
+ - Bottlenecks identified through evidence.
986
+ - Security reviewed.
987
+ - Data integrity preserved.
988
+ - Operational costs evaluated.
989
+ - Appropriate tests executed.
990
+ - Results and limitations documented.
991
+ - Monitoring prepared.
992
+ - Rollback procedures defined.
993
+ - Human approval obtained.
994
+
995
+ Never declare an architecture scalable merely because it uses Kubernetes, containers, cloud services or microservices.
996
+
997
+ ## 43. Final Scalability Principles
998
+
999
+ Design for millions of users.
1000
+ Provision for actual demand.
1001
+ Scale based on evidence.
1002
+ Prefer architectural simplicity.
1003
+ Protect security and privacy.
1004
+ Preserve data integrity.
1005
+ Measure performance.
1006
+ Validate concurrency.
1007
+ Test realistic workloads.
1008
+ Control infrastructure and API costs.
1009
+ Avoid unnecessary Kubernetes or microservices.
1010
+ Maintain backward compatibility.
1011
+ Plan for failure and recovery.
1012
+ Require approval for significant changes.