@umacloud/knowledge 1.0.16 → 1.0.17
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/00-governance/governance-capabilities.md +1 -1
- package/00-governance/knowledge-map.md +4 -6
- package/ai/01-standards/app-runtime-model-configurable.md +76 -0
- package/ai/agent-evaluation-benchmark.md +4 -6
- package/ai/ai-agent-memory-context-management.md +4 -6
- package/ai/ai-cost-capacity-optimization-playbook.md +4 -6
- package/ai/ai-data-security-and-compliance-playbook.md +4 -6
- package/ai/ai-domain-index-and-checklist.md +4 -6
- package/ai/ai-governance-maturity-model.md +4 -6
- package/ai/ai-model-selection-and-routing-strategy.md +4 -6
- package/ai/ai-observability-and-oncall-runbook.md +4 -6
- package/ai/ai-rag-engineering-playbook.md +4 -6
- package/ai/ai-red-team-and-safety-evaluation.md +4 -6
- package/ai/ai-release-readiness-and-rollback-gate.md +4 -6
- package/ai/llm-agent-engineering-deep-dive.md +4 -6
- package/ai/prompt-and-tool-guardrails.md +4 -6
- package/architecture/02-playbooks/migration-playbook.md +0 -4
- package/architecture/02-playbooks/system-design-playbook.md +0 -4
- package/architecture/adr-template-and-examples.md +4 -6
- package/architecture/api-gateway-deep-dive.md +1 -1
- package/architecture/distributed-transactions.md +1 -1
- package/architecture/microservices-complete.md +1 -1
- package/architecture/service-governance.md +1 -1
- package/architecture/system-architecture-deep-dive.md +4 -6
- package/backend/01-standards/cjk-in-exports-and-documents.md +107 -0
- package/backend/01-standards/django-complete.md +2 -2
- package/backend/01-standards/nestjs-complete.md +23 -23
- package/cicd/cicd-blueprint-deep-dive.md +4 -6
- package/cloud-native/01-standards/container-security.md +0 -4
- package/cloud-native/01-standards/kubernetes-complete.md +0 -4
- package/cloud-native/02-playbooks/gitops-with-argocd.md +0 -4
- package/cloud-native/02-playbooks/k8s-troubleshooting-playbook.md +2 -6
- package/cloud-native/02-playbooks/multicloud-governance.md +0 -4
- package/cloud-native/02-playbooks/serverless-patterns.md +0 -4
- package/cloud-native/02-playbooks/service-mesh-playbook.md +0 -4
- package/cloud-native/03-checklists/container-security-checklist.md +0 -4
- package/cloud-native/03-checklists/k8s-production-readiness-checklist.md +0 -4
- package/cloud-native/04-antipatterns/container-antipatterns.md +0 -4
- package/cloud-native/04-antipatterns/k8s-antipatterns.md +0 -4
- package/cloud-native/05-cases/case-k8s-migration.md +0 -4
- package/cloud-native/05-cases/case-k8s-scaling.md +0 -4
- package/cloud-native/05-cases/case-k8s-security-incident.md +0 -4
- package/cloud-native/06-glossary/cloud-native-glossary.md +0 -4
- package/data/01-standards/elasticsearch-complete.md +2 -2
- package/data/01-standards/postgresql-complete.md +8 -8
- package/data/01-standards/redis-complete.md +11 -11
- package/data/data-governance-and-modeling-deep-dive.md +4 -6
- package/data-engineering/01-standards/kafka-complete.md +22 -22
- package/design/ui-full-lifecycle-cross-platform-playbook.md +1 -1
- package/design/ux-system-deep-dive.md +4 -6
- package/design-systems/00-craft-rules.md +1 -1
- package/design-systems/bold-geometric.md +1 -1
- package/design-systems/brutalist-bold.md +1 -1
- package/design-systems/editorial-clean.md +1 -1
- package/design-systems/glass-aurora.md +1 -1
- package/design-systems/modern-minimal.md +1 -1
- package/design-systems/premium-luxury.md +1 -1
- package/design-systems/soft-warm.md +1 -1
- package/design-systems/tech-utility.md +1 -1
- package/development/00-governance/document-template.md +3 -3
- package/development/01-standards/golang-complete.md +2 -2
- package/development/01-standards/python-design-patterns.md +2 -2
- package/development/01-standards/typescript-advanced-types.md +2 -2
- package/development/09-maturity/quarterly-audit-template.md +3 -5
- package/development/11-ui-excellence/ui-aesthetic-system.md +3 -5
- package/development/13-implementation-assets/knowledge-gates-execution.md +3 -5
- package/development/api-contract-and-versioning-guide.md +4 -6
- package/development/api-governance-complete.md +4 -6
- package/development/backend-engineering-complete.md +4 -6
- package/development/concurrency-reliability-complete.md +4 -6
- package/development/database-engineering-complete.md +4 -6
- package/development/engineering-effectiveness-complete.md +4 -6
- package/development/engineering-standards-deep-dive.md +4 -6
- package/development/frontend-engineering-complete.md +4 -6
- package/development/performance-capacity-complete.md +4 -6
- package/development/refactor-migration-complete.md +4 -6
- package/development/refactoring-and-techdebt-playbook.md +4 -6
- package/development/security-in-development-complete.md +4 -6
- package/devops/01-standards/docker-complete.md +2 -2
- package/devops/01-standards/terraform-complete.md +3 -3
- package/frontend/01-standards/i18n-and-localization.md +1 -1
- package/frontend/01-standards/react-hooks-complete.md +33 -33
- package/frontend/01-standards/vue3-complete.md +2 -2
- package/high-quality-engineering-playbook.md +4 -6
- package/incident/02-playbooks/chaos-engineering-playbook.md +0 -4
- package/incident/postmortem-and-response-deep-dive.md +4 -6
- package/mobile/01-standards/flutter-complete.md +2 -7
- package/mobile/01-standards/react-native-complete.md +2 -7
- package/mobile/02-playbooks/mobile-performance.md +2 -8
- package/mobile/03-checklists/mobile-release-checklist.md +2 -4
- package/mobile/04-antipatterns/mobile-antipatterns.md +2 -4
- package/operations/01-standards/prometheus-monitoring-complete.md +2 -2
- package/operations/aiops-anomaly-detection.md +4 -8
- package/operations/capacity-planning.md +4 -8
- package/operations/chaos-engineering.md +4 -8
- package/operations/incident-command-system.md +4 -6
- package/operations/observability-complete.md +4 -8
- package/operations/slo-sli-playbook.md +4 -8
- package/operations/sre-operations-deep-dive.md +4 -6
- package/package.json +1 -1
- package/product/feature-prioritization-framework.md +97 -35
- package/product/kpi-and-metric-tree.md +69 -26
- package/product/product-discovery-and-prd-deep-dive.md +4 -6
- package/security/01-standards/owasp-top10-complete.md +2 -2
- package/security/02-playbooks/incident-response-security-playbook.md +0 -4
- package/security/02-playbooks/penetration-testing-playbook.md +0 -4
- package/security/compliance-automation.md +1 -1
- package/security/container-security.md +1 -1
- package/security/devsecops-complete.md +1 -1
- package/security/sast-dast-sca.md +1 -1
- package/security/secrets-management.md +1 -1
- package/security/security-architecture-deep-dive.md +4 -6
- package/security/threat-modeling-stride-playbook.md +4 -6
- package/seed-templates/auth-system.md +1 -1
- package/seed-templates/blog-content.md +1 -1
- package/seed-templates/dashboard.md +1 -1
- package/seed-templates/docs-site.md +1 -1
- package/seed-templates/e-commerce.md +1 -1
- package/seed-templates/saas-landing.md +1 -1
- package/seed-templates/settings-page.md +1 -1
- package/testing/02-playbooks/e2e-testing-playbook.md +0 -4
- package/testing/risk-based-test-matrix.md +75 -25
- package/testing/testing-strategy-deep-dive.md +4 -6
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
---
|
|
2
2
|
id: document-template
|
|
3
|
-
title:
|
|
3
|
+
title: 知识库标准文档模板
|
|
4
4
|
domain: development
|
|
5
5
|
category: 00-governance
|
|
6
6
|
difficulty: intermediate
|
|
7
|
-
tags: [
|
|
7
|
+
tags: [文档模板, template, 知识库, 写作规范, standard, governance, development]
|
|
8
8
|
quality_score: 70
|
|
9
9
|
last_updated: 2026-06-15
|
|
10
10
|
---
|
|
11
|
-
#
|
|
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:
|
|
9
|
-
last_updated: 2026-06-
|
|
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:
|
|
9
|
-
last_updated: 2026-06-
|
|
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:
|
|
9
|
-
last_updated: 2026-06-
|
|
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:
|
|
3
|
+
title: 季度审计模板
|
|
4
4
|
domain: development
|
|
5
5
|
category: 09-maturity
|
|
6
6
|
difficulty: intermediate
|
|
7
|
-
tags: [audit,
|
|
7
|
+
tags: [审计, audit, 季度审计, 模板, 成熟度, 治理, development]
|
|
8
8
|
quality_score: 70
|
|
9
9
|
last_updated: 2026-06-15
|
|
10
10
|
---
|
|
11
|
-
#
|
|
12
|
-
|
|
13
|
-
## 季度审计模板
|
|
11
|
+
# 季度审计模板
|
|
14
12
|
|
|
15
13
|
### 审计概览
|
|
16
14
|
- 审计周期:
|
|
@@ -1,16 +1,14 @@
|
|
|
1
1
|
---
|
|
2
2
|
id: ui-aesthetic-system
|
|
3
|
-
title:
|
|
3
|
+
title: UI美学系统总册
|
|
4
4
|
domain: development
|
|
5
5
|
category: 11-ui-excellence
|
|
6
6
|
difficulty: intermediate
|
|
7
|
-
tags: [
|
|
7
|
+
tags: [ui, 美学系统, aesthetic, 设计系统, 视觉规范, 前端, development]
|
|
8
8
|
quality_score: 70
|
|
9
9
|
last_updated: 2026-06-15
|
|
10
10
|
---
|
|
11
|
-
#
|
|
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:
|
|
3
|
+
title: 知识门禁执行手册
|
|
4
4
|
domain: development
|
|
5
5
|
category: 13-implementation-assets
|
|
6
6
|
difficulty: intermediate
|
|
7
|
-
tags: [
|
|
7
|
+
tags: [知识门禁, gates, 执行, 落地, 治理, development]
|
|
8
8
|
quality_score: 70
|
|
9
9
|
last_updated: 2026-06-15
|
|
10
10
|
---
|
|
11
|
-
#
|
|
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:
|
|
3
|
+
title: API 契约与版本治理指南
|
|
4
4
|
domain: development
|
|
5
|
-
category:
|
|
5
|
+
category: 01-standards
|
|
6
6
|
difficulty: intermediate
|
|
7
|
-
tags: [
|
|
7
|
+
tags: [api, 契约, contract, 版本治理, versioning, 兼容性, development]
|
|
8
8
|
quality_score: 70
|
|
9
9
|
last_updated: 2026-06-15
|
|
10
10
|
---
|
|
11
|
-
#
|
|
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:
|
|
3
|
+
title: API治理完整知识库
|
|
4
4
|
domain: development
|
|
5
|
-
category:
|
|
5
|
+
category: 01-standards
|
|
6
6
|
difficulty: intermediate
|
|
7
|
-
tags: [api,
|
|
7
|
+
tags: [api, 治理, governance, 契约优先, 版本, 网关, development]
|
|
8
8
|
quality_score: 70
|
|
9
9
|
last_updated: 2026-06-15
|
|
10
10
|
---
|
|
11
|
-
#
|
|
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:
|
|
3
|
+
title: 后端工程完整知识库
|
|
4
4
|
domain: development
|
|
5
|
-
category:
|
|
5
|
+
category: 01-standards
|
|
6
6
|
difficulty: intermediate
|
|
7
|
-
tags: [backend,
|
|
7
|
+
tags: [后端, backend, 分层架构, 服务设计, 工程规范, development]
|
|
8
8
|
quality_score: 70
|
|
9
9
|
last_updated: 2026-06-15
|
|
10
10
|
---
|
|
11
|
-
#
|
|
12
|
-
|
|
13
|
-
## 后端工程完整知识库
|
|
11
|
+
# 后端工程完整知识库
|
|
14
12
|
|
|
15
13
|
### 1. 分层架构
|
|
16
14
|
- 路由层只做协议适配与参数接收。
|
|
@@ -1,16 +1,14 @@
|
|
|
1
1
|
---
|
|
2
2
|
id: concurrency-reliability-complete
|
|
3
|
-
title:
|
|
3
|
+
title: 并发与稳定性完整知识库
|
|
4
4
|
domain: development
|
|
5
|
-
category:
|
|
5
|
+
category: 01-standards
|
|
6
6
|
difficulty: intermediate
|
|
7
|
-
tags: [
|
|
7
|
+
tags: [并发, concurrency, 稳定性, reliability, 线程, 锁, development]
|
|
8
8
|
quality_score: 70
|
|
9
9
|
last_updated: 2026-06-15
|
|
10
10
|
---
|
|
11
|
-
#
|
|
12
|
-
|
|
13
|
-
## 并发与稳定性完整知识库
|
|
11
|
+
# 并发与稳定性完整知识库
|
|
14
12
|
|
|
15
13
|
### 1. 并发模型
|
|
16
14
|
- 共享资源必须定义并发访问策略。
|
|
@@ -1,16 +1,14 @@
|
|
|
1
1
|
---
|
|
2
2
|
id: database-engineering-complete
|
|
3
|
-
title:
|
|
3
|
+
title: 数据库工程完整知识库
|
|
4
4
|
domain: development
|
|
5
|
-
category:
|
|
5
|
+
category: 01-standards
|
|
6
6
|
difficulty: intermediate
|
|
7
|
-
tags: [
|
|
7
|
+
tags: [数据库, database, 数据模型, 索引, 事务, 性能, development]
|
|
8
8
|
quality_score: 70
|
|
9
9
|
last_updated: 2026-06-15
|
|
10
10
|
---
|
|
11
|
-
#
|
|
12
|
-
|
|
13
|
-
## 数据库工程完整知识库
|
|
11
|
+
# 数据库工程完整知识库
|
|
14
12
|
|
|
15
13
|
### 1. 数据模型设计
|
|
16
14
|
- 核心表必须定义主键、唯一约束、审计字段。
|
|
@@ -1,16 +1,14 @@
|
|
|
1
1
|
---
|
|
2
2
|
id: engineering-effectiveness-complete
|
|
3
|
-
title:
|
|
3
|
+
title: 工程效能完整知识库
|
|
4
4
|
domain: development
|
|
5
|
-
category:
|
|
5
|
+
category: 01-standards
|
|
6
6
|
difficulty: intermediate
|
|
7
|
-
tags: [
|
|
7
|
+
tags: [工程效能, effectiveness, 研发效率, 流程标准化, devex, development]
|
|
8
8
|
quality_score: 70
|
|
9
9
|
last_updated: 2026-06-15
|
|
10
10
|
---
|
|
11
|
-
#
|
|
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:
|
|
3
|
+
title: 开发环节深度知识库
|
|
4
4
|
domain: development
|
|
5
|
-
category:
|
|
5
|
+
category: 01-standards
|
|
6
6
|
difficulty: intermediate
|
|
7
|
-
tags: [
|
|
7
|
+
tags: [工程规范, engineering-standards, 开发规范, 分层, 编码标准, development]
|
|
8
8
|
quality_score: 70
|
|
9
9
|
last_updated: 2026-06-15
|
|
10
10
|
---
|
|
11
|
-
#
|
|
12
|
-
|
|
13
|
-
## 开发环节深度知识库
|
|
11
|
+
# 开发环节深度知识库
|
|
14
12
|
|
|
15
13
|
### 目标
|
|
16
14
|
- 让实现质量稳定、可回归、可协作,避免“个人风格驱动”。
|
|
@@ -1,16 +1,14 @@
|
|
|
1
1
|
---
|
|
2
2
|
id: frontend-engineering-complete
|
|
3
|
-
title:
|
|
3
|
+
title: 前端工程完整知识库
|
|
4
4
|
domain: development
|
|
5
|
-
category:
|
|
5
|
+
category: 01-standards
|
|
6
6
|
difficulty: intermediate
|
|
7
|
-
tags: [
|
|
7
|
+
tags: [前端, frontend, 组件化, 模块边界, 工程规范, development]
|
|
8
8
|
quality_score: 70
|
|
9
9
|
last_updated: 2026-06-15
|
|
10
10
|
---
|
|
11
|
-
#
|
|
12
|
-
|
|
13
|
-
## 前端工程完整知识库
|
|
11
|
+
# 前端工程完整知识库
|
|
14
12
|
|
|
15
13
|
### 1. 分层与模块边界
|
|
16
14
|
- 页面层负责编排,组件层负责复用,服务层负责数据访问。
|
|
@@ -1,16 +1,14 @@
|
|
|
1
1
|
---
|
|
2
2
|
id: performance-capacity-complete
|
|
3
|
-
title:
|
|
3
|
+
title: 性能与容量完整知识库
|
|
4
4
|
domain: development
|
|
5
|
-
category:
|
|
5
|
+
category: 01-standards
|
|
6
6
|
difficulty: intermediate
|
|
7
|
-
tags: [
|
|
7
|
+
tags: [性能, performance, 容量, capacity, 性能预算, 压测, development]
|
|
8
8
|
quality_score: 70
|
|
9
9
|
last_updated: 2026-06-15
|
|
10
10
|
---
|
|
11
|
-
#
|
|
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:
|
|
3
|
+
title: 重构与迁移完整知识库
|
|
4
4
|
domain: development
|
|
5
|
-
category:
|
|
5
|
+
category: 01-standards
|
|
6
6
|
difficulty: intermediate
|
|
7
|
-
tags: [
|
|
7
|
+
tags: [重构, refactor, 迁移, migration, 技术债, development]
|
|
8
8
|
quality_score: 70
|
|
9
9
|
last_updated: 2026-06-15
|
|
10
10
|
---
|
|
11
|
-
#
|
|
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:
|
|
3
|
+
title: 重构与技术债治理手册
|
|
4
4
|
domain: development
|
|
5
|
-
category:
|
|
5
|
+
category: 02-playbooks
|
|
6
6
|
difficulty: intermediate
|
|
7
|
-
tags: [
|
|
7
|
+
tags: [重构, refactoring, 技术债, tech-debt, 治理, development]
|
|
8
8
|
quality_score: 70
|
|
9
9
|
last_updated: 2026-06-15
|
|
10
10
|
---
|
|
11
|
-
#
|
|
12
|
-
|
|
13
|
-
## 重构与技术债治理手册
|
|
11
|
+
# 重构与技术债治理手册
|
|
14
12
|
|
|
15
13
|
### 目标
|
|
16
14
|
- 在不影响业务连续性的前提下,持续降低系统复杂度与维护成本。
|
|
@@ -1,16 +1,14 @@
|
|
|
1
1
|
---
|
|
2
2
|
id: security-in-development-complete
|
|
3
|
-
title:
|
|
3
|
+
title: 开发安全完整知识库
|
|
4
4
|
domain: development
|
|
5
|
-
category:
|
|
5
|
+
category: 01-standards
|
|
6
6
|
difficulty: intermediate
|
|
7
|
-
tags: [
|
|
7
|
+
tags: [安全, security, 安全左移, 开发安全, 漏洞, development]
|
|
8
8
|
quality_score: 70
|
|
9
9
|
last_updated: 2026-06-15
|
|
10
10
|
---
|
|
11
|
-
#
|
|
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, devops, terraform, 实战配置, 工作流, 核心概念, 概述, 模块设计]
|
|
8
|
-
quality_score:
|
|
9
|
-
last_updated: 2026-06-
|
|
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:
|
|
9
|
-
last_updated: 2026-06-
|
|
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
|
-
//
|
|
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
|
-
//
|
|
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
|
-
//
|
|
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
|
-
//
|
|
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.
|
|
1072
|
-
2.
|
|
1073
|
-
3.
|
|
1074
|
-
4.
|
|
1075
|
-
5.
|
|
1076
|
-
6.
|
|
1077
|
-
7.
|
|
1078
|
-
8.
|
|
1079
|
-
9.
|
|
1080
|
-
10.
|
|
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
|
|