@umacloud/knowledge 1.0.16 → 1.0.18

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 (123) hide show
  1. package/00-governance/governance-capabilities.md +1 -1
  2. package/00-governance/knowledge-map.md +4 -6
  3. package/ai/01-standards/app-runtime-model-configurable.md +76 -0
  4. package/ai/agent-evaluation-benchmark.md +4 -6
  5. package/ai/ai-agent-memory-context-management.md +4 -6
  6. package/ai/ai-cost-capacity-optimization-playbook.md +4 -6
  7. package/ai/ai-data-security-and-compliance-playbook.md +4 -6
  8. package/ai/ai-domain-index-and-checklist.md +4 -6
  9. package/ai/ai-governance-maturity-model.md +4 -6
  10. package/ai/ai-model-selection-and-routing-strategy.md +4 -6
  11. package/ai/ai-observability-and-oncall-runbook.md +4 -6
  12. package/ai/ai-rag-engineering-playbook.md +4 -6
  13. package/ai/ai-red-team-and-safety-evaluation.md +4 -6
  14. package/ai/ai-release-readiness-and-rollback-gate.md +4 -6
  15. package/ai/llm-agent-engineering-deep-dive.md +4 -6
  16. package/ai/prompt-and-tool-guardrails.md +4 -6
  17. package/architecture/02-playbooks/migration-playbook.md +0 -4
  18. package/architecture/02-playbooks/system-design-playbook.md +0 -4
  19. package/architecture/adr-template-and-examples.md +4 -6
  20. package/architecture/api-gateway-deep-dive.md +1 -1
  21. package/architecture/distributed-transactions.md +1 -1
  22. package/architecture/microservices-complete.md +1 -1
  23. package/architecture/service-governance.md +1 -1
  24. package/architecture/system-architecture-deep-dive.md +4 -6
  25. package/backend/01-standards/cjk-in-exports-and-documents.md +107 -0
  26. package/backend/01-standards/django-complete.md +2 -2
  27. package/backend/01-standards/nestjs-complete.md +23 -23
  28. package/cicd/cicd-blueprint-deep-dive.md +4 -6
  29. package/cloud-native/01-standards/container-security.md +0 -4
  30. package/cloud-native/01-standards/kubernetes-complete.md +0 -4
  31. package/cloud-native/02-playbooks/gitops-with-argocd.md +0 -4
  32. package/cloud-native/02-playbooks/k8s-troubleshooting-playbook.md +2 -6
  33. package/cloud-native/02-playbooks/multicloud-governance.md +0 -4
  34. package/cloud-native/02-playbooks/serverless-patterns.md +0 -4
  35. package/cloud-native/02-playbooks/service-mesh-playbook.md +0 -4
  36. package/cloud-native/03-checklists/container-security-checklist.md +0 -4
  37. package/cloud-native/03-checklists/k8s-production-readiness-checklist.md +0 -4
  38. package/cloud-native/04-antipatterns/container-antipatterns.md +0 -4
  39. package/cloud-native/04-antipatterns/k8s-antipatterns.md +0 -4
  40. package/cloud-native/05-cases/case-k8s-migration.md +0 -4
  41. package/cloud-native/05-cases/case-k8s-scaling.md +0 -4
  42. package/cloud-native/05-cases/case-k8s-security-incident.md +0 -4
  43. package/cloud-native/06-glossary/cloud-native-glossary.md +0 -4
  44. package/data/01-standards/elasticsearch-complete.md +2 -2
  45. package/data/01-standards/postgresql-complete.md +8 -8
  46. package/data/01-standards/redis-complete.md +11 -11
  47. package/data/data-governance-and-modeling-deep-dive.md +4 -6
  48. package/data-engineering/01-standards/kafka-complete.md +22 -22
  49. package/design/ui-full-lifecycle-cross-platform-playbook.md +1 -1
  50. package/design/ux-system-deep-dive.md +4 -6
  51. package/design-systems/00-craft-rules.md +1 -1
  52. package/design-systems/bold-geometric.md +1 -1
  53. package/design-systems/brutalist-bold.md +1 -1
  54. package/design-systems/editorial-clean.md +1 -1
  55. package/design-systems/glass-aurora.md +1 -1
  56. package/design-systems/modern-minimal.md +1 -1
  57. package/design-systems/premium-luxury.md +1 -1
  58. package/design-systems/soft-warm.md +1 -1
  59. package/design-systems/tech-utility.md +1 -1
  60. package/development/00-governance/document-template.md +3 -3
  61. package/development/01-standards/golang-complete.md +2 -2
  62. package/development/01-standards/python-design-patterns.md +2 -2
  63. package/development/01-standards/typescript-advanced-types.md +2 -2
  64. package/development/09-maturity/quarterly-audit-template.md +3 -5
  65. package/development/11-ui-excellence/ui-aesthetic-system.md +3 -5
  66. package/development/13-implementation-assets/knowledge-gates-execution.md +3 -5
  67. package/development/api-contract-and-versioning-guide.md +4 -6
  68. package/development/api-governance-complete.md +4 -6
  69. package/development/backend-engineering-complete.md +4 -6
  70. package/development/concurrency-reliability-complete.md +4 -6
  71. package/development/database-engineering-complete.md +4 -6
  72. package/development/engineering-effectiveness-complete.md +4 -6
  73. package/development/engineering-standards-deep-dive.md +4 -6
  74. package/development/frontend-engineering-complete.md +4 -6
  75. package/development/performance-capacity-complete.md +4 -6
  76. package/development/refactor-migration-complete.md +4 -6
  77. package/development/refactoring-and-techdebt-playbook.md +4 -6
  78. package/development/security-in-development-complete.md +4 -6
  79. package/devops/01-standards/docker-complete.md +2 -2
  80. package/devops/01-standards/terraform-complete.md +3 -3
  81. package/frontend/01-standards/i18n-and-localization.md +1 -1
  82. package/frontend/01-standards/react-hooks-complete.md +33 -33
  83. package/frontend/01-standards/vue3-complete.md +2 -2
  84. package/high-quality-engineering-playbook.md +4 -6
  85. package/incident/02-playbooks/chaos-engineering-playbook.md +0 -4
  86. package/incident/postmortem-and-response-deep-dive.md +4 -6
  87. package/mobile/01-standards/flutter-complete.md +2 -7
  88. package/mobile/01-standards/react-native-complete.md +2 -7
  89. package/mobile/02-playbooks/mobile-performance.md +2 -8
  90. package/mobile/03-checklists/mobile-release-checklist.md +2 -4
  91. package/mobile/04-antipatterns/mobile-antipatterns.md +2 -4
  92. package/operations/01-standards/prometheus-monitoring-complete.md +2 -2
  93. package/operations/aiops-anomaly-detection.md +4 -8
  94. package/operations/capacity-planning.md +4 -8
  95. package/operations/chaos-engineering.md +4 -8
  96. package/operations/incident-command-system.md +4 -6
  97. package/operations/observability-complete.md +4 -8
  98. package/operations/slo-sli-playbook.md +4 -8
  99. package/operations/sre-operations-deep-dive.md +4 -6
  100. package/package.json +1 -1
  101. package/product/feature-prioritization-framework.md +97 -35
  102. package/product/kpi-and-metric-tree.md +69 -26
  103. package/product/product-discovery-and-prd-deep-dive.md +4 -6
  104. package/security/01-standards/owasp-top10-complete.md +2 -2
  105. package/security/02-playbooks/incident-response-security-playbook.md +0 -4
  106. package/security/02-playbooks/penetration-testing-playbook.md +0 -4
  107. package/security/compliance-automation.md +1 -1
  108. package/security/container-security.md +1 -1
  109. package/security/devsecops-complete.md +1 -1
  110. package/security/sast-dast-sca.md +1 -1
  111. package/security/secrets-management.md +1 -1
  112. package/security/security-architecture-deep-dive.md +4 -6
  113. package/security/threat-modeling-stride-playbook.md +4 -6
  114. package/seed-templates/auth-system.md +1 -1
  115. package/seed-templates/blog-content.md +1 -1
  116. package/seed-templates/dashboard.md +1 -1
  117. package/seed-templates/docs-site.md +1 -1
  118. package/seed-templates/e-commerce.md +1 -1
  119. package/seed-templates/saas-landing.md +1 -1
  120. package/seed-templates/settings-page.md +1 -1
  121. package/testing/02-playbooks/e2e-testing-playbook.md +0 -4
  122. package/testing/risk-based-test-matrix.md +75 -25
  123. package/testing/testing-strategy-deep-dive.md +4 -6
@@ -2,7 +2,7 @@
2
2
  id: soft-warm
3
3
  title: Soft Warm
4
4
  domain: design-systems
5
- category: soft-warm.md
5
+ category: design-systems
6
6
  difficulty: intermediate
7
7
  tags: [borders, color, component, design-systems, palette, patterns, radius, soft]
8
8
  quality_score: 70
@@ -2,7 +2,7 @@
2
2
  id: tech-utility
3
3
  title: Tech Utility
4
4
  domain: design-systems
5
- category: tech-utility.md
5
+ category: design-systems
6
6
  difficulty: intermediate
7
7
  tags: [color, component, design-systems, motion, palette, patterns, spacing, tech]
8
8
  quality_score: 70
@@ -1,14 +1,14 @@
1
1
  ---
2
2
  id: document-template
3
- title: document-template
3
+ title: 知识库标准文档模板
4
4
  domain: development
5
5
  category: 00-governance
6
6
  difficulty: intermediate
7
- tags: [development, document, template, 失败模式, 执行步骤, 检查清单, 目标, 适用范围]
7
+ tags: [文档模板, template, 知识库, 写作规范, standard, governance, development]
8
8
  quality_score: 70
9
9
  last_updated: 2026-06-15
10
10
  ---
11
- # document-template
11
+ # 知识库标准文档模板
12
12
 
13
13
  ```yaml
14
14
  id: KB-DEV-XXXX
@@ -5,8 +5,8 @@ domain: development
5
5
  category: 01-standards
6
6
  difficulty: intermediate
7
7
  tags: [complete, development, golang, 并发模型, 性能优化, 接口设计, 标准库精选, 核心语法]
8
- quality_score: 70
9
- last_updated: 2026-06-15
8
+ quality_score: 91
9
+ last_updated: 2026-06-29
10
10
  ---
11
11
  # Go 语言完整工程指南
12
12
 
@@ -5,8 +5,8 @@ domain: development
5
5
  category: 01-standards
6
6
  difficulty: intermediate
7
7
  tags: [agent, checklist, design, development, patterns, python, python特有模式, 创建型模式]
8
- quality_score: 70
9
- last_updated: 2026-06-15
8
+ quality_score: 92
9
+ last_updated: 2026-06-29
10
10
  ---
11
11
  # Python设计模式完整知识体系
12
12
 
@@ -5,8 +5,8 @@ domain: development
5
5
  category: 01-standards
6
6
  difficulty: intermediate
7
7
  tags: [advanced, development, types, typescript, 与框架集成, 内置工具类型, 基础类型系统回顾, 完整指南]
8
- quality_score: 70
9
- last_updated: 2026-06-15
8
+ quality_score: 91
9
+ last_updated: 2026-06-29
10
10
  ---
11
11
  # TypeScript 高级类型系统完整指南
12
12
 
@@ -1,16 +1,14 @@
1
1
  ---
2
2
  id: quarterly-audit-template
3
- title: quarterly-audit-template
3
+ title: 季度审计模板
4
4
  domain: development
5
5
  category: 09-maturity
6
6
  difficulty: intermediate
7
- tags: [audit, development, quarterly, template, 季度审计模板]
7
+ tags: [审计, audit, 季度审计, 模板, 成熟度, 治理, development]
8
8
  quality_score: 70
9
9
  last_updated: 2026-06-15
10
10
  ---
11
- # quarterly-audit-template
12
-
13
- ## 季度审计模板
11
+ # 季度审计模板
14
12
 
15
13
  ### 审计概览
16
14
  - 审计周期:
@@ -1,16 +1,14 @@
1
1
  ---
2
2
  id: ui-aesthetic-system
3
- title: ui-aesthetic-system
3
+ title: UI美学系统总册
4
4
  domain: development
5
5
  category: 11-ui-excellence
6
6
  difficulty: intermediate
7
- tags: [aesthetic, development, system, ui美学系统总册]
7
+ tags: [ui, 美学系统, aesthetic, 设计系统, 视觉规范, 前端, development]
8
8
  quality_score: 70
9
9
  last_updated: 2026-06-15
10
10
  ---
11
- # ui-aesthetic-system
12
-
13
- ## UI美学系统总册
11
+ # UI美学系统总册
14
12
 
15
13
  ### 目标
16
14
  - 让界面同时满足“好看、好用、好做、可持续演进”。
@@ -1,16 +1,14 @@
1
1
  ---
2
2
  id: knowledge-gates-execution
3
- title: knowledge-gates-execution
3
+ title: 知识门禁执行手册
4
4
  domain: development
5
5
  category: 13-implementation-assets
6
6
  difficulty: intermediate
7
- tags: [development, execution, gates, knowledge, 知识门禁执行手册]
7
+ tags: [知识门禁, gates, 执行, 落地, 治理, development]
8
8
  quality_score: 70
9
9
  last_updated: 2026-06-15
10
10
  ---
11
- # knowledge-gates-execution
12
-
13
- ## 知识门禁执行手册
11
+ # 知识门禁执行手册
14
12
 
15
13
  ### 目标
16
14
  - 把开发知识规则接入发布链路,避免知识与交付脱节。
@@ -1,16 +1,14 @@
1
1
  ---
2
2
  id: api-contract-and-versioning-guide
3
- title: api-contract-and-versioning-guide
3
+ title: API 契约与版本治理指南
4
4
  domain: development
5
- category: api-contract-and-versioning-guide.md
5
+ category: 01-standards
6
6
  difficulty: intermediate
7
- tags: [and, api, contract, development, guide, versioning, 契约与版本治理指南]
7
+ tags: [api, 契约, contract, 版本治理, versioning, 兼容性, development]
8
8
  quality_score: 70
9
9
  last_updated: 2026-06-15
10
10
  ---
11
- # api-contract-and-versioning-guide
12
-
13
- ## API 契约与版本治理指南
11
+ # API 契约与版本治理指南
14
12
 
15
13
  ### 目标
16
14
  - 保证前后端与外部调用方在接口演进中保持稳定兼容。
@@ -1,16 +1,14 @@
1
1
  ---
2
2
  id: api-governance-complete
3
- title: api-governance-complete
3
+ title: API治理完整知识库
4
4
  domain: development
5
- category: api-governance-complete.md
5
+ category: 01-standards
6
6
  difficulty: intermediate
7
- tags: [api, api治理完整知识库, complete, development, governance]
7
+ tags: [api, 治理, governance, 契约优先, 版本, 网关, development]
8
8
  quality_score: 70
9
9
  last_updated: 2026-06-15
10
10
  ---
11
- # api-governance-complete
12
-
13
- ## API治理完整知识库
11
+ # API治理完整知识库
14
12
 
15
13
  ### 1. 契约优先
16
14
  - 接口先定义契约,再进入实现。
@@ -1,16 +1,14 @@
1
1
  ---
2
2
  id: backend-engineering-complete
3
- title: backend-engineering-complete
3
+ title: 后端工程完整知识库
4
4
  domain: development
5
- category: backend-engineering-complete.md
5
+ category: 01-standards
6
6
  difficulty: intermediate
7
- tags: [backend, complete, development, engineering, 后端工程完整知识库]
7
+ tags: [后端, backend, 分层架构, 服务设计, 工程规范, development]
8
8
  quality_score: 70
9
9
  last_updated: 2026-06-15
10
10
  ---
11
- # backend-engineering-complete
12
-
13
- ## 后端工程完整知识库
11
+ # 后端工程完整知识库
14
12
 
15
13
  ### 1. 分层架构
16
14
  - 路由层只做协议适配与参数接收。
@@ -1,16 +1,14 @@
1
1
  ---
2
2
  id: concurrency-reliability-complete
3
- title: concurrency-reliability-complete
3
+ title: 并发与稳定性完整知识库
4
4
  domain: development
5
- category: concurrency-reliability-complete.md
5
+ category: 01-standards
6
6
  difficulty: intermediate
7
- tags: [complete, concurrency, development, reliability, 并发与稳定性完整知识库]
7
+ tags: [并发, concurrency, 稳定性, reliability, 线程, 锁, development]
8
8
  quality_score: 70
9
9
  last_updated: 2026-06-15
10
10
  ---
11
- # concurrency-reliability-complete
12
-
13
- ## 并发与稳定性完整知识库
11
+ # 并发与稳定性完整知识库
14
12
 
15
13
  ### 1. 并发模型
16
14
  - 共享资源必须定义并发访问策略。
@@ -1,16 +1,14 @@
1
1
  ---
2
2
  id: database-engineering-complete
3
- title: database-engineering-complete
3
+ title: 数据库工程完整知识库
4
4
  domain: development
5
- category: database-engineering-complete.md
5
+ category: 01-standards
6
6
  difficulty: intermediate
7
- tags: [complete, database, development, engineering, 数据库工程完整知识库]
7
+ tags: [数据库, database, 数据模型, 索引, 事务, 性能, development]
8
8
  quality_score: 70
9
9
  last_updated: 2026-06-15
10
10
  ---
11
- # database-engineering-complete
12
-
13
- ## 数据库工程完整知识库
11
+ # 数据库工程完整知识库
14
12
 
15
13
  ### 1. 数据模型设计
16
14
  - 核心表必须定义主键、唯一约束、审计字段。
@@ -1,16 +1,14 @@
1
1
  ---
2
2
  id: engineering-effectiveness-complete
3
- title: engineering-effectiveness-complete
3
+ title: 工程效能完整知识库
4
4
  domain: development
5
- category: engineering-effectiveness-complete.md
5
+ category: 01-standards
6
6
  difficulty: intermediate
7
- tags: [complete, development, effectiveness, engineering, 工程效能完整知识库]
7
+ tags: [工程效能, effectiveness, 研发效率, 流程标准化, devex, development]
8
8
  quality_score: 70
9
9
  last_updated: 2026-06-15
10
10
  ---
11
- # engineering-effectiveness-complete
12
-
13
- ## 工程效能完整知识库
11
+ # 工程效能完整知识库
14
12
 
15
13
  ### 1. 流程标准化
16
14
  - 从需求到发布定义统一流程节点。
@@ -1,16 +1,14 @@
1
1
  ---
2
2
  id: engineering-standards-deep-dive
3
- title: engineering-standards-deep-dive
3
+ title: 开发环节深度知识库
4
4
  domain: development
5
- category: engineering-standards-deep-dive.md
5
+ category: 01-standards
6
6
  difficulty: intermediate
7
- tags: [deep, development, dive, engineering, standards, 开发环节深度知识库]
7
+ tags: [工程规范, engineering-standards, 开发规范, 分层, 编码标准, development]
8
8
  quality_score: 70
9
9
  last_updated: 2026-06-15
10
10
  ---
11
- # engineering-standards-deep-dive
12
-
13
- ## 开发环节深度知识库
11
+ # 开发环节深度知识库
14
12
 
15
13
  ### 目标
16
14
  - 让实现质量稳定、可回归、可协作,避免“个人风格驱动”。
@@ -1,16 +1,14 @@
1
1
  ---
2
2
  id: frontend-engineering-complete
3
- title: frontend-engineering-complete
3
+ title: 前端工程完整知识库
4
4
  domain: development
5
- category: frontend-engineering-complete.md
5
+ category: 01-standards
6
6
  difficulty: intermediate
7
- tags: [complete, development, engineering, frontend, 前端工程完整知识库]
7
+ tags: [前端, frontend, 组件化, 模块边界, 工程规范, development]
8
8
  quality_score: 70
9
9
  last_updated: 2026-06-15
10
10
  ---
11
- # frontend-engineering-complete
12
-
13
- ## 前端工程完整知识库
11
+ # 前端工程完整知识库
14
12
 
15
13
  ### 1. 分层与模块边界
16
14
  - 页面层负责编排,组件层负责复用,服务层负责数据访问。
@@ -1,16 +1,14 @@
1
1
  ---
2
2
  id: performance-capacity-complete
3
- title: performance-capacity-complete
3
+ title: 性能与容量完整知识库
4
4
  domain: development
5
- category: performance-capacity-complete.md
5
+ category: 01-standards
6
6
  difficulty: intermediate
7
- tags: [capacity, complete, development, performance, 性能与容量完整知识库]
7
+ tags: [性能, performance, 容量, capacity, 性能预算, 压测, development]
8
8
  quality_score: 70
9
9
  last_updated: 2026-06-15
10
10
  ---
11
- # performance-capacity-complete
12
-
13
- ## 性能与容量完整知识库
11
+ # 性能与容量完整知识库
14
12
 
15
13
  ### 1. 性能预算
16
14
  - 定义核心接口 P95、P99、吞吐量目标。
@@ -1,16 +1,14 @@
1
1
  ---
2
2
  id: refactor-migration-complete
3
- title: refactor-migration-complete
3
+ title: 重构与迁移完整知识库
4
4
  domain: development
5
- category: refactor-migration-complete.md
5
+ category: 01-standards
6
6
  difficulty: intermediate
7
- tags: [complete, development, migration, refactor, 重构与迁移完整知识库]
7
+ tags: [重构, refactor, 迁移, migration, 技术债, development]
8
8
  quality_score: 70
9
9
  last_updated: 2026-06-15
10
10
  ---
11
- # refactor-migration-complete
12
-
13
- ## 重构与迁移完整知识库
11
+ # 重构与迁移完整知识库
14
12
 
15
13
  ### 1. 重构触发条件
16
14
  - 缺陷密度持续偏高。
@@ -1,16 +1,14 @@
1
1
  ---
2
2
  id: refactoring-and-techdebt-playbook
3
- title: refactoring-and-techdebt-playbook
3
+ title: 重构与技术债治理手册
4
4
  domain: development
5
- category: refactoring-and-techdebt-playbook.md
5
+ category: 02-playbooks
6
6
  difficulty: intermediate
7
- tags: [and, development, playbook, refactoring, techdebt, 重构与技术债治理手册]
7
+ tags: [重构, refactoring, 技术债, tech-debt, 治理, development]
8
8
  quality_score: 70
9
9
  last_updated: 2026-06-15
10
10
  ---
11
- # refactoring-and-techdebt-playbook
12
-
13
- ## 重构与技术债治理手册
11
+ # 重构与技术债治理手册
14
12
 
15
13
  ### 目标
16
14
  - 在不影响业务连续性的前提下,持续降低系统复杂度与维护成本。
@@ -1,16 +1,14 @@
1
1
  ---
2
2
  id: security-in-development-complete
3
- title: security-in-development-complete
3
+ title: 开发安全完整知识库
4
4
  domain: development
5
- category: security-in-development-complete.md
5
+ category: 01-standards
6
6
  difficulty: intermediate
7
- tags: [complete, development, security, 开发安全完整知识库]
7
+ tags: [安全, security, 安全左移, 开发安全, 漏洞, development]
8
8
  quality_score: 70
9
9
  last_updated: 2026-06-15
10
10
  ---
11
- # security-in-development-complete
12
-
13
- ## 开发安全完整知识库
11
+ # 开发安全完整知识库
14
12
 
15
13
  ### 1. 安全左移
16
14
  - 在需求与设计阶段完成威胁建模。
@@ -5,8 +5,8 @@ domain: devops
5
5
  category: 01-standards
6
6
  difficulty: intermediate
7
7
  tags: [complete, compose, devops, docker, dockerfile, 实战, 最佳实践, 核心概念]
8
- quality_score: 70
9
- last_updated: 2026-06-15
8
+ quality_score: 90
9
+ last_updated: 2026-06-29
10
10
  ---
11
11
  # Docker 完整指南
12
12
 
@@ -5,8 +5,8 @@ domain: devops
5
5
  category: 01-standards
6
6
  difficulty: intermediate
7
7
  tags: [complete, devops, terraform, 实战配置, 工作流, 核心概念, 概述, 模块设计]
8
- quality_score: 70
9
- last_updated: 2026-06-15
8
+ quality_score: 90
9
+ last_updated: 2026-06-29
10
10
  ---
11
11
  # Terraform 完整指南
12
12
 
@@ -1491,7 +1491,7 @@ jobs:
1491
1491
  uses: actions/github-script@v7
1492
1492
  with:
1493
1493
  script: |
1494
- const output = `#### Terraform Plan 📋
1494
+ const output = `#### Terraform Plan
1495
1495
  \`\`\`
1496
1496
  ${{ steps.plan.outputs.stdout }}
1497
1497
  \`\`\`
@@ -62,4 +62,4 @@ last_updated: 2026-06-19
62
62
  - [ ] locale 检测+切换持久化;后端邮件/通知可本地化;多语言 SEO(hreflang)。
63
63
 
64
64
  ---
65
- **参考**:ICU MessageFormat、`Intl` API、react-i18next/vue-i18n、CLDR 复数规则、RTL 逻辑属性、hreflang
65
+ **参考**:ICU MessageFormat、`Intl` API、react-i18next/vue-i18n、CLDR 复数规则、RTL 逻辑属性、hreflang。数据导出/生成文档(CSV/Excel/PDF)的中文不乱码见 `backend/01-standards/cjk-in-exports-and-documents.md`。
@@ -5,8 +5,8 @@ domain: frontend
5
5
  category: 01-standards
6
6
  difficulty: intermediate
7
7
  tags: [complete, frontend, hooks, react, typescript, 常见陷阱, 性能优化, 最佳实践]
8
- quality_score: 70
9
- last_updated: 2026-06-15
8
+ quality_score: 90
9
+ last_updated: 2026-06-29
10
10
  ---
11
11
  # React Hooks 深度指南
12
12
 
@@ -327,12 +327,12 @@ function Parent() {
327
327
  const [count, setCount] = useState(0);
328
328
  const [text, setText] = useState('');
329
329
 
330
- // 不好:每次渲染都创建新函数
330
+ // [避免] 不好:每次渲染都创建新函数
331
331
  // const handleClick = () => {
332
332
  // console.log('Clicked');
333
333
  // };
334
334
 
335
- // 好:缓存函数引用
335
+ // [推荐] 好:缓存函数引用
336
336
  const handleClick = useCallback(() => {
337
337
  console.log('Clicked');
338
338
  }, []);
@@ -360,12 +360,12 @@ function Parent() {
360
360
  import React, { useState, useMemo } from 'react';
361
361
 
362
362
  function ProductList({ products, filter, sortBy }) {
363
- // 不好:每次渲染都重新计算
363
+ // [避免] 不好:每次渲染都重新计算
364
364
  // const filteredProducts = products
365
365
  // .filter(p => p.name.includes(filter))
366
366
  // .sort((a, b) => a[sortBy] - b[sortBy]);
367
367
 
368
- // 好:缓存计算结果
368
+ // [推荐] 好:缓存计算结果
369
369
  const filteredProducts = useMemo(() => {
370
370
  console.log('重新计算过滤和排序');
371
371
  return products
@@ -837,26 +837,26 @@ function LoginForm() {
837
837
  ### 规则 1: 只在顶层调用 Hooks
838
838
 
839
839
  ```javascript
840
- // 错误:在循环中调用
840
+ // [避免] 错误:在循环中调用
841
841
  function BadComponent({ items }) {
842
842
  items.forEach(item => {
843
843
  const [state, setState] = useState(item); // 错误!
844
844
  });
845
845
  }
846
846
 
847
- // 正确:在顶层调用
847
+ // [推荐] 正确:在顶层调用
848
848
  function GoodComponent({ items }) {
849
849
  const [states, setStates] = useState(items);
850
850
  }
851
851
 
852
- // 错误:在条件语句中调用
852
+ // [避免] 错误:在条件语句中调用
853
853
  function BadComponent({ condition }) {
854
854
  if (condition) {
855
855
  const [value, setValue] = useState(0); // 错误!
856
856
  }
857
857
  }
858
858
 
859
- // 正确:条件逻辑在 Hook 内部
859
+ // [推荐] 正确:条件逻辑在 Hook 内部
860
860
  function GoodComponent({ condition }) {
861
861
  const [value, setValue] = useState(0);
862
862
 
@@ -871,12 +871,12 @@ function GoodComponent({ condition }) {
871
871
  ### 规则 2: 只在 React 函数中调用
872
872
 
873
873
  ```javascript
874
- // 错误:在普通函数中调用
874
+ // [避免] 错误:在普通函数中调用
875
875
  function handleClick() {
876
876
  const [count, setCount] = useState(0); // 错误!
877
877
  }
878
878
 
879
- // 正确:在组件或自定义 Hook 中调用
879
+ // [推荐] 正确:在组件或自定义 Hook 中调用
880
880
  function MyComponent() {
881
881
  const [count, setCount] = useState(0);
882
882
 
@@ -918,12 +918,12 @@ const ChildComponent = memo(({ data, onClick }) => {
918
918
  ### 2. 正确使用依赖数组
919
919
 
920
920
  ```javascript
921
- // 缺少依赖
921
+ // [避免] 缺少依赖
922
922
  useEffect(() => {
923
923
  fetchData(userId);
924
924
  }, []); // 缺少 userId 依赖
925
925
 
926
- // 完整依赖
926
+ // [推荐] 完整依赖
927
927
  useEffect(() => {
928
928
  fetchData(userId);
929
929
  }, [userId]);
@@ -932,7 +932,7 @@ useEffect(() => {
932
932
  ### 3. 避免内联函数和对象
933
933
 
934
934
  ```javascript
935
- // 每次渲染都创建新函数/对象
935
+ // [避免] 每次渲染都创建新函数/对象
936
936
  function Parent() {
937
937
  const [count, setCount] = useState(0);
938
938
 
@@ -944,7 +944,7 @@ function Parent() {
944
944
  );
945
945
  }
946
946
 
947
- // 使用 useCallback 和 useMemo
947
+ // [推荐] 使用 useCallback 和 useMemo
948
948
  function Parent() {
949
949
  const [count, setCount] = useState(0);
950
950
 
@@ -988,7 +988,7 @@ function VirtualizedList({ items }) {
988
988
  ### 陷阱 1: 闭包陷阱
989
989
 
990
990
  ```javascript
991
- // 错误:闭包捕获旧值
991
+ // [避免] 错误:闭包捕获旧值
992
992
  function Counter() {
993
993
  const [count, setCount] = useState(0);
994
994
 
@@ -1000,7 +1000,7 @@ function Counter() {
1000
1000
  }, []);
1001
1001
  }
1002
1002
 
1003
- // 正确:使用函数式更新
1003
+ // [推荐] 正确:使用函数式更新
1004
1004
  function Counter() {
1005
1005
  const [count, setCount] = useState(0);
1006
1006
 
@@ -1015,7 +1015,7 @@ function Counter() {
1015
1015
  }, []);
1016
1016
  }
1017
1017
 
1018
- // 或使用 ref
1018
+ // [推荐] 或使用 ref
1019
1019
  function Counter() {
1020
1020
  const [count, setCount] = useState(0);
1021
1021
  const countRef = useRef(count);
@@ -1034,7 +1034,7 @@ function Counter() {
1034
1034
  ### 陷阱 2: 无限循环
1035
1035
 
1036
1036
  ```javascript
1037
- // 错误:导致无限循环
1037
+ // [避免] 错误:导致无限循环
1038
1038
  function BadComponent() {
1039
1039
  const [items, setItems] = useState([]);
1040
1040
 
@@ -1043,7 +1043,7 @@ function BadComponent() {
1043
1043
  }, [items]); // 依赖 items,导致循环
1044
1044
  }
1045
1045
 
1046
- // 正确:使用函数式更新
1046
+ // [推荐] 正确:使用函数式更新
1047
1047
  function GoodComponent() {
1048
1048
  const [items, setItems] = useState([]);
1049
1049
 
@@ -1056,11 +1056,11 @@ function GoodComponent() {
1056
1056
  ### 陷阱 3: 直接修改状态
1057
1057
 
1058
1058
  ```javascript
1059
- // 错误:直接修改状态
1059
+ // [避免] 错误:直接修改状态
1060
1060
  const [user, setUser] = useState({ name: 'Alice' });
1061
1061
  user.name = 'Bob'; // 不会触发重新渲染
1062
1062
 
1063
- // 正确:创建新对象
1063
+ // [推荐] 正确:创建新对象
1064
1064
  setUser({ ...user, name: 'Bob' });
1065
1065
  ```
1066
1066
 
@@ -1068,16 +1068,16 @@ setUser({ ...user, name: 'Bob' });
1068
1068
 
1069
1069
  ## 最佳实践
1070
1070
 
1071
- 1. **✅ 使用函数式更新**: `setCount(prev => prev + 1)`
1072
- 2. **✅ 保持依赖数组完整**: 使用 eslint-plugin-react-hooks
1073
- 3. **✅ 拆分复杂状态**: 多个 useState 而非一个巨大对象
1074
- 4. **✅ 自定义 Hook 复用逻辑**: 避免复制粘贴
1075
- 5. **✅ 命名规范**: use 开头的自定义 Hook
1076
- 6. **✅ 合理使用 useMemo/useCallback**: 不要过度优化
1077
- 7. **✅ 错误边界**: 处理渲染错误
1078
- 8. **✅ 清理副作用**: useEffect 返回清理函数
1079
- 9. **✅ 测试 Hooks**: 使用 @testing-library/react-hooks
1080
- 10. **✅ TypeScript 支持**: 为 Hook 添加类型
1071
+ 1. **[推荐] 使用函数式更新**: `setCount(prev => prev + 1)`
1072
+ 2. **[推荐] 保持依赖数组完整**: 使用 eslint-plugin-react-hooks
1073
+ 3. **[推荐] 拆分复杂状态**: 多个 useState 而非一个巨大对象
1074
+ 4. **[推荐] 自定义 Hook 复用逻辑**: 避免复制粘贴
1075
+ 5. **[推荐] 命名规范**: use 开头的自定义 Hook
1076
+ 6. **[推荐] 合理使用 useMemo/useCallback**: 不要过度优化
1077
+ 7. **[推荐] 错误边界**: 处理渲染错误
1078
+ 8. **[推荐] 清理副作用**: useEffect 返回清理函数
1079
+ 9. **[推荐] 测试 Hooks**: 使用 @testing-library/react-hooks
1080
+ 10. **[推荐] TypeScript 支持**: 为 Hook 添加类型
1081
1081
 
1082
1082
  ---
1083
1083
 
@@ -5,8 +5,8 @@ domain: frontend
5
5
  category: 01-standards
6
6
  difficulty: intermediate
7
7
  tags: [complete, frontend, pinia, router, vue3, 响应式系统原理, 性能优化, 概述]
8
- quality_score: 70
9
- last_updated: 2026-06-15
8
+ quality_score: 91
9
+ last_updated: 2026-06-29
10
10
  ---
11
11
  # Vue 3 完整知识体系
12
12