universal-dev-standards 6.14.0-beta.9 → 6.14.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/bin/uds.js +12 -1
- package/bundled/ai/options/commit-message/traditional-chinese.ai.yaml +69 -67
- package/bundled/ai/standards/commit-message.ai.yaml +12 -2
- package/bundled/ai/standards/secret-management-standards.ai.yaml +12 -1
- package/bundled/core/commit-message-guide.md +22 -19
- package/bundled/core/secret-management-standards.md +13 -1
- package/bundled/extensions/locales/zh-tw.md +19 -19
- package/bundled/hooks/validate-commit-msg.mjs +52 -9
- package/bundled/locales/zh-CN/CHANGELOG.md +2309 -1110
- package/bundled/locales/zh-CN/CLAUDE.md +987 -101
- package/bundled/locales/zh-CN/README.md +3 -3
- package/bundled/locales/zh-CN/SECURITY.md +3 -3
- package/bundled/locales/zh-CN/STANDARDS-MAPPING.md +103 -6
- package/bundled/locales/zh-CN/adoption/ADOPTION-GUIDE.md +68 -97
- package/bundled/locales/zh-CN/adoption/DAILY-WORKFLOW-GUIDE.md +2 -1
- package/bundled/locales/zh-CN/adoption/STATIC-DYNAMIC-GUIDE.md +8 -9
- package/bundled/locales/zh-CN/adoption/checklists/enterprise.md +81 -80
- package/bundled/locales/zh-CN/adoption/checklists/minimal.md +18 -14
- package/bundled/locales/zh-CN/adoption/checklists/recommended.md +49 -46
- package/bundled/locales/zh-CN/ai/MAINTENANCE.md +44 -9
- package/bundled/locales/zh-CN/ai/options/commit-message/traditional-chinese.ai.yaml +63 -55
- package/bundled/locales/zh-CN/core/acceptance-criteria-traceability.md +61 -14
- package/bundled/locales/zh-CN/core/acceptance-test-driven-development.md +2 -1
- package/bundled/locales/zh-CN/core/accessibility-standards.md +871 -62
- package/bundled/locales/zh-CN/core/adr-standards.md +155 -32
- package/bundled/locales/zh-CN/core/agent-communication-protocol.md +2 -1
- package/bundled/locales/zh-CN/core/agent-dispatch.md +68 -33
- package/bundled/locales/zh-CN/core/ai-agreement-standards.md +23 -22
- package/bundled/locales/zh-CN/core/ai-command-behavior.md +2 -1
- package/bundled/locales/zh-CN/core/ai-friendly-architecture.md +311 -72
- package/bundled/locales/zh-CN/core/ai-instruction-standards.md +71 -49
- package/bundled/locales/zh-CN/core/ai-response-navigation.md +2 -1
- package/bundled/locales/zh-CN/core/alerting-standards.md +231 -36
- package/bundled/locales/zh-CN/core/anti-hallucination.md +116 -697
- package/bundled/locales/zh-CN/core/anti-sycophancy-prompting.md +34 -33
- package/bundled/locales/zh-CN/core/api-design-standards.md +144 -58
- package/bundled/locales/zh-CN/core/behavior-driven-development.md +2 -1
- package/bundled/locales/zh-CN/core/branch-completion.md +75 -20
- package/bundled/locales/zh-CN/core/capability-declaration.md +44 -94
- package/bundled/locales/zh-CN/core/change-batching-standards.md +2 -1
- package/bundled/locales/zh-CN/core/changelog-standards.md +485 -63
- package/bundled/locales/zh-CN/core/chaos-engineering-standards.md +141 -39
- package/bundled/locales/zh-CN/core/checkin-standards.md +176 -116
- package/bundled/locales/zh-CN/core/circuit-breaker.md +43 -77
- package/bundled/locales/zh-CN/core/code-review-checklist.md +37 -23
- package/bundled/locales/zh-CN/core/commit-message-guide.md +892 -69
- package/bundled/locales/zh-CN/core/containerization-standards.md +259 -57
- package/bundled/locales/zh-CN/core/context-aware-loading.md +103 -29
- package/bundled/locales/zh-CN/core/database-standards.md +115 -114
- package/bundled/locales/zh-CN/core/deprecation-standards.md +155 -40
- package/bundled/locales/zh-CN/core/design-document-standards.md +265 -55
- package/bundled/locales/zh-CN/core/developer-memory.md +150 -60
- package/bundled/locales/zh-CN/core/documentation-lifecycle.md +20 -16
- package/bundled/locales/zh-CN/core/documentation-structure.md +1284 -127
- package/bundled/locales/zh-CN/core/documentation-writing-standards.md +649 -259
- package/bundled/locales/zh-CN/core/dual-phase-output.md +37 -70
- package/bundled/locales/zh-CN/core/environment-standards.md +251 -73
- package/bundled/locales/zh-CN/core/error-code-standards.md +501 -60
- package/bundled/locales/zh-CN/core/estimation-standards.md +174 -41
- package/bundled/locales/zh-CN/core/execution-history.md +2 -1
- package/bundled/locales/zh-CN/core/failure-source-taxonomy.md +71 -84
- package/bundled/locales/zh-CN/core/feature-flag-standards.md +202 -57
- package/bundled/locales/zh-CN/core/forward-derivation-standards.md +613 -154
- package/bundled/locales/zh-CN/core/frontend-design-standards.md +361 -78
- package/bundled/locales/zh-CN/core/git-workflow.md +148 -262
- package/bundled/locales/zh-CN/core/git-worktree.md +59 -26
- package/bundled/locales/zh-CN/core/guides/file-placement-guide.md +132 -48
- package/bundled/locales/zh-CN/core/guides/performance-guide.md +61 -59
- package/bundled/locales/zh-CN/core/guides/security-guide.md +2 -0
- package/bundled/locales/zh-CN/core/health-check-standards.md +46 -104
- package/bundled/locales/zh-CN/core/immutability-first.md +83 -60
- package/bundled/locales/zh-CN/core/knowledge-transfer-standards.md +94 -31
- package/bundled/locales/zh-CN/core/mutation-testing.md +45 -6
- package/bundled/locales/zh-CN/core/observability-standards.md +281 -37
- package/bundled/locales/zh-CN/core/performance-standards.md +402 -42
- package/bundled/locales/zh-CN/core/pipeline-integration-standards.md +2 -1
- package/bundled/locales/zh-CN/core/postmortem-standards.md +358 -53
- package/bundled/locales/zh-CN/core/privacy-standards.md +148 -40
- package/bundled/locales/zh-CN/core/project-context-memory.md +182 -48
- package/bundled/locales/zh-CN/core/project-structure.md +550 -170
- package/bundled/locales/zh-CN/core/recovery-recipe-registry.md +54 -114
- package/bundled/locales/zh-CN/core/refactoring-standards.md +141 -556
- package/bundled/locales/zh-CN/core/requirement-engineering.md +7 -6
- package/bundled/locales/zh-CN/core/retrospective-standards.md +215 -22
- package/bundled/locales/zh-CN/core/retry-standards.md +46 -101
- package/bundled/locales/zh-CN/core/reverse-engineering-standards.md +370 -120
- package/bundled/locales/zh-CN/core/runbook-standards.md +294 -48
- package/bundled/locales/zh-CN/core/security-decision.md +45 -70
- package/bundled/locales/zh-CN/core/security-standards.md +169 -16
- package/bundled/locales/zh-CN/core/skill-standard-alignment-check.md +105 -71
- package/bundled/locales/zh-CN/core/slo-standards.md +296 -44
- package/bundled/locales/zh-CN/core/spec-driven-development.md +37 -6
- package/bundled/locales/zh-CN/core/standard-admission-criteria.md +25 -31
- package/bundled/locales/zh-CN/core/standard-lifecycle-management.md +49 -57
- package/bundled/locales/zh-CN/core/structured-task-definition.md +2 -1
- package/bundled/locales/zh-CN/core/supply-chain-security-standards.md +159 -32
- package/bundled/locales/zh-CN/core/systematic-debugging.md +87 -42
- package/bundled/locales/zh-CN/core/tech-debt-standards.md +202 -86
- package/bundled/locales/zh-CN/core/test-completeness-dimensions.md +262 -190
- package/bundled/locales/zh-CN/core/test-data-standards.md +252 -30
- package/bundled/locales/zh-CN/core/test-driven-development.md +21 -1022
- package/bundled/locales/zh-CN/core/test-governance.md +94 -43
- package/bundled/locales/zh-CN/core/testing-standards.md +83 -37
- package/bundled/locales/zh-CN/core/timeout-standards.md +45 -85
- package/bundled/locales/zh-CN/core/token-budget.md +44 -80
- package/bundled/locales/zh-CN/core/translation-lifecycle-standards.md +48 -36
- package/bundled/locales/zh-CN/core/verification-evidence.md +44 -22
- package/bundled/locales/zh-CN/core/versioning.md +737 -73
- package/bundled/locales/zh-CN/core/virtual-organization-standards.md +30 -29
- package/bundled/locales/zh-CN/core/workflow-enforcement.md +9 -8
- package/bundled/locales/zh-CN/core/workflow-state-protocol.md +9 -8
- package/bundled/locales/zh-CN/docs/CHEATSHEET.md +2 -1
- package/bundled/locales/zh-CN/docs/CLI-FLOW.md +2 -1
- package/bundled/locales/zh-CN/docs/CLI-INIT-OPTIONS.md +19 -10
- package/bundled/locales/zh-CN/docs/FEATURE-REFERENCE.md +8 -6
- package/bundled/locales/zh-CN/docs/STANDARDS-REFERENCE.md +2 -1
- package/bundled/locales/zh-CN/docs/USAGE-MODES-COMPARISON.md +133 -132
- package/bundled/locales/zh-CN/docs/USER-MANUAL.md +11 -3
- package/bundled/locales/zh-CN/docs/WINDOWS-GUIDE.md +5 -2
- package/bundled/locales/zh-CN/docs/specs/system/memory-adoption-strategy.md +2 -0
- package/bundled/locales/zh-CN/docs/user/FAQ.md +2 -0
- package/bundled/locales/zh-CN/docs/user/GETTING-STARTED.md +2 -0
- package/bundled/locales/zh-CN/docs/user/GLOSSARY.md +2 -0
- package/bundled/locales/zh-CN/docs/user/README.md +4 -2
- package/bundled/locales/zh-CN/docs/user/TROUBLESHOOTING.md +2 -0
- package/bundled/locales/zh-CN/integrations/codex/AGENTS.md +136 -2
- package/bundled/locales/zh-CN/integrations/codex/README.md +62 -10
- package/bundled/locales/zh-CN/integrations/gemini-cli/GEMINI.md +59 -1
- package/bundled/locales/zh-CN/integrations/gemini-cli/README.md +9 -2
- package/bundled/locales/zh-CN/integrations/github-copilot/COPILOT-CHAT-REFERENCE.md +7 -1
- package/bundled/locales/zh-CN/integrations/github-copilot/README.md +8 -2
- package/bundled/locales/zh-CN/integrations/github-copilot/copilot-instructions.md +146 -12
- package/bundled/locales/zh-CN/integrations/github-copilot/skills-mapping.md +7 -1
- package/bundled/locales/zh-CN/integrations/google-antigravity/AGENTS.md +110 -3
- package/bundled/locales/zh-CN/integrations/google-antigravity/README.md +7 -1
- package/bundled/locales/zh-CN/integrations/opencode/AGENTS.md +140 -2
- package/bundled/locales/zh-CN/integrations/opencode/README.md +7 -1
- package/bundled/locales/zh-CN/integrations/opencode/skills-mapping.md +8 -2
- package/bundled/locales/zh-CN/integrations/openspec/AGENTS.md +46 -1
- package/bundled/locales/zh-CN/integrations/openspec/README.md +7 -1
- package/bundled/locales/zh-CN/integrations/spec-kit/AGENTS.md +20 -2
- package/bundled/locales/zh-CN/integrations/spec-kit/README.md +7 -1
- package/bundled/locales/zh-CN/options/changelog/auto-generated.md +2 -0
- package/bundled/locales/zh-CN/options/changelog/keep-a-changelog.md +2 -0
- package/bundled/locales/zh-CN/options/code-review/automated-review.md +2 -0
- package/bundled/locales/zh-CN/options/code-review/pair-programming.md +2 -0
- package/bundled/locales/zh-CN/options/commit-message/bilingual.md +139 -50
- package/bundled/locales/zh-CN/options/commit-message/english.md +159 -42
- package/bundled/locales/zh-CN/options/commit-message/traditional-chinese.md +156 -75
- package/bundled/locales/zh-CN/options/documentation/api-docs.md +3 -1
- package/bundled/locales/zh-CN/options/documentation/markdown-docs.md +2 -0
- package/bundled/locales/zh-CN/options/documentation/wiki-style.md +2 -0
- package/bundled/locales/zh-CN/options/git-workflow/gitflow.md +105 -77
- package/bundled/locales/zh-CN/options/git-workflow/github-flow.md +75 -57
- package/bundled/locales/zh-CN/options/git-workflow/merge-commit.md +155 -44
- package/bundled/locales/zh-CN/options/git-workflow/rebase-ff.md +168 -53
- package/bundled/locales/zh-CN/options/git-workflow/squash-merge.md +122 -37
- package/bundled/locales/zh-CN/options/git-workflow/trunk-based.md +108 -61
- package/bundled/locales/zh-CN/options/project-structure/dotnet.md +266 -47
- package/bundled/locales/zh-CN/options/project-structure/go.md +301 -43
- package/bundled/locales/zh-CN/options/project-structure/java.md +268 -48
- package/bundled/locales/zh-CN/options/project-structure/kotlin.md +2 -0
- package/bundled/locales/zh-CN/options/project-structure/nodejs.md +168 -51
- package/bundled/locales/zh-CN/options/project-structure/php.md +2 -0
- package/bundled/locales/zh-CN/options/project-structure/python.md +210 -52
- package/bundled/locales/zh-CN/options/project-structure/ruby.md +2 -0
- package/bundled/locales/zh-CN/options/project-structure/rust.md +2 -0
- package/bundled/locales/zh-CN/options/project-structure/swift.md +2 -0
- package/bundled/locales/zh-CN/options/testing/contract-testing.md +2 -0
- package/bundled/locales/zh-CN/options/testing/e2e-testing.md +227 -66
- package/bundled/locales/zh-CN/options/testing/industry-pyramid.md +2 -0
- package/bundled/locales/zh-CN/options/testing/integration-testing.md +185 -73
- package/bundled/locales/zh-CN/options/testing/istqb-framework.md +2 -0
- package/bundled/locales/zh-CN/options/testing/performance-testing.md +2 -0
- package/bundled/locales/zh-CN/options/testing/security-testing.md +2 -0
- package/bundled/locales/zh-CN/options/testing/system-testing.md +270 -96
- package/bundled/locales/zh-CN/options/testing/unit-testing.md +185 -71
- package/bundled/locales/zh-CN/skills/CONTRIBUTING.template.md +43 -42
- package/bundled/locales/zh-CN/skills/INTEGRATION-GUIDE.md +2 -1
- package/bundled/locales/zh-CN/skills/README.md +2 -1
- package/bundled/locales/zh-CN/skills/_shared/README.md +2 -1
- package/bundled/locales/zh-CN/skills/adr-assistant/guide.md +240 -4
- package/bundled/locales/zh-CN/skills/agents/README.md +180 -82
- package/bundled/locales/zh-CN/skills/agents/code-architect.md +3 -1
- package/bundled/locales/zh-CN/skills/agents/doc-writer.md +3 -1
- package/bundled/locales/zh-CN/skills/agents/reviewer.md +4 -2
- package/bundled/locales/zh-CN/skills/agents/spec-analyst.md +3 -1
- package/bundled/locales/zh-CN/skills/agents/test-specialist.md +3 -1
- package/bundled/locales/zh-CN/skills/ai-collaboration-standards/SKILL.md +91 -81
- package/bundled/locales/zh-CN/skills/ai-collaboration-standards/anti-hallucination.md +79 -59
- package/bundled/locales/zh-CN/skills/ai-collaboration-standards/certainty-labels.md +66 -40
- package/bundled/locales/zh-CN/skills/ai-friendly-architecture/SKILL.md +23 -36
- package/bundled/locales/zh-CN/skills/ai-instruction-standards/SKILL.md +217 -137
- package/bundled/locales/zh-CN/skills/api-design-assistant/SKILL.md +13 -2
- package/bundled/locales/zh-CN/skills/atdd-assistant/SKILL.md +16 -2
- package/bundled/locales/zh-CN/skills/atdd-assistant/acceptance-criteria-guide.md +2 -1
- package/bundled/locales/zh-CN/skills/atdd-assistant/atdd-workflow.md +98 -1
- package/bundled/locales/zh-CN/skills/atdd-assistant/guide.md +148 -132
- package/bundled/locales/zh-CN/skills/audit-assistant/SKILL.md +5 -2
- package/bundled/locales/zh-CN/skills/bdd-assistant/SKILL.md +16 -2
- package/bundled/locales/zh-CN/skills/bdd-assistant/bdd-workflow.md +2 -1
- package/bundled/locales/zh-CN/skills/bdd-assistant/gherkin-guide.md +2 -1
- package/bundled/locales/zh-CN/skills/bdd-assistant/guide.md +122 -121
- package/bundled/locales/zh-CN/skills/changelog-guide/SKILL.md +9 -2
- package/bundled/locales/zh-CN/skills/changelog-guide/guide.md +91 -88
- package/bundled/locales/zh-CN/skills/checkin-assistant/SKILL.md +12 -2
- package/bundled/locales/zh-CN/skills/checkin-assistant/guide.md +211 -210
- package/bundled/locales/zh-CN/skills/ci-cd-assistant/SKILL.md +14 -2
- package/bundled/locales/zh-CN/skills/code-review-assistant/SKILL.md +12 -2
- package/bundled/locales/zh-CN/skills/code-review-assistant/checkin-checklist.md +79 -78
- package/bundled/locales/zh-CN/skills/code-review-assistant/guide.md +119 -45
- package/bundled/locales/zh-CN/skills/code-review-assistant/review-checklist.md +89 -88
- package/bundled/locales/zh-CN/skills/commands/ac-coverage.md +43 -1
- package/bundled/locales/zh-CN/skills/commands/api-design.md +2 -1
- package/bundled/locales/zh-CN/skills/commands/atdd.md +71 -1
- package/bundled/locales/zh-CN/skills/commands/audit.md +2 -1
- package/bundled/locales/zh-CN/skills/commands/bdd.md +160 -62
- package/bundled/locales/zh-CN/skills/commands/changelog.md +36 -1
- package/bundled/locales/zh-CN/skills/commands/check.md +53 -1
- package/bundled/locales/zh-CN/skills/commands/checkin.md +45 -1
- package/bundled/locales/zh-CN/skills/commands/ci-cd.md +3 -2
- package/bundled/locales/zh-CN/skills/commands/code-review.md +41 -1
- package/bundled/locales/zh-CN/skills/commands/commit.md +56 -1
- package/bundled/locales/zh-CN/skills/commands/config.md +50 -1
- package/bundled/locales/zh-CN/skills/commands/coverage.md +43 -1
- package/bundled/locales/zh-CN/skills/commands/database.md +4 -3
- package/bundled/locales/zh-CN/skills/commands/derive-all.md +42 -1
- package/bundled/locales/zh-CN/skills/commands/derive-atdd.md +35 -1
- package/bundled/locales/zh-CN/skills/commands/derive-bdd.md +41 -1
- package/bundled/locales/zh-CN/skills/commands/derive-tdd.md +42 -1
- package/bundled/locales/zh-CN/skills/commands/derive.md +60 -4
- package/bundled/locales/zh-CN/skills/commands/dev-workflow.md +58 -8
- package/bundled/locales/zh-CN/skills/commands/discover.md +41 -1
- package/bundled/locales/zh-CN/skills/commands/docgen.md +37 -1
- package/bundled/locales/zh-CN/skills/commands/docs.md +136 -5
- package/bundled/locales/zh-CN/skills/commands/durable.md +4 -3
- package/bundled/locales/zh-CN/skills/commands/e2e.md +85 -1
- package/bundled/locales/zh-CN/skills/commands/guide.md +2 -1
- package/bundled/locales/zh-CN/skills/commands/incident.md +5 -4
- package/bundled/locales/zh-CN/skills/commands/init.md +57 -1
- package/bundled/locales/zh-CN/skills/commands/methodology.md +166 -77
- package/bundled/locales/zh-CN/skills/commands/metrics.md +3 -2
- package/bundled/locales/zh-CN/skills/commands/migrate.md +5 -4
- package/bundled/locales/zh-CN/skills/commands/observability.md +48 -3
- package/bundled/locales/zh-CN/skills/commands/pr.md +4 -3
- package/bundled/locales/zh-CN/skills/commands/refactor.md +76 -38
- package/bundled/locales/zh-CN/skills/commands/release.md +82 -1
- package/bundled/locales/zh-CN/skills/commands/requirement.md +40 -1
- package/bundled/locales/zh-CN/skills/commands/reverse-bdd.md +36 -1
- package/bundled/locales/zh-CN/skills/commands/reverse-sdd.md +44 -1
- package/bundled/locales/zh-CN/skills/commands/reverse-tdd.md +42 -1
- package/bundled/locales/zh-CN/skills/commands/reverse.md +43 -1
- package/bundled/locales/zh-CN/skills/commands/runbook.md +50 -3
- package/bundled/locales/zh-CN/skills/commands/scan.md +3 -2
- package/bundled/locales/zh-CN/skills/commands/sdd-retro.md +50 -1
- package/bundled/locales/zh-CN/skills/commands/sdd.md +182 -1
- package/bundled/locales/zh-CN/skills/commands/security.md +3 -2
- package/bundled/locales/zh-CN/skills/commands/slo.md +51 -3
- package/bundled/locales/zh-CN/skills/commands/tdd.md +74 -5
- package/bundled/locales/zh-CN/skills/commands/update.md +70 -8
- package/bundled/locales/zh-CN/skills/commit-standards/SKILL.md +4 -4
- package/bundled/locales/zh-CN/skills/commit-standards/conventional-commits.md +45 -44
- package/bundled/locales/zh-CN/skills/commit-standards/guide.md +172 -52
- package/bundled/locales/zh-CN/skills/commit-standards/language-options.md +50 -47
- package/bundled/locales/zh-CN/skills/contract-test-assistant/SKILL.md +2 -2
- package/bundled/locales/zh-CN/skills/contract-test-assistant/guide.md +76 -1
- package/bundled/locales/zh-CN/skills/database-assistant/SKILL.md +18 -5
- package/bundled/locales/zh-CN/skills/dev-methodology/SKILL.md +4 -2
- package/bundled/locales/zh-CN/skills/dev-methodology/create-methodology.md +2 -0
- package/bundled/locales/zh-CN/skills/dev-methodology/runtime.md +2 -0
- package/bundled/locales/zh-CN/skills/docs-generator/SKILL.md +16 -2
- package/bundled/locales/zh-CN/skills/docs-generator/guide.md +8 -7
- package/bundled/locales/zh-CN/skills/documentation-guide/SKILL.md +209 -184
- package/bundled/locales/zh-CN/skills/documentation-guide/documentation-structure.md +73 -72
- package/bundled/locales/zh-CN/skills/documentation-guide/readme-template.md +37 -36
- package/bundled/locales/zh-CN/skills/durable-execution-assistant/SKILL.md +28 -2
- package/bundled/locales/zh-CN/skills/e2e-assistant/SKILL.md +21 -6
- package/bundled/locales/zh-CN/skills/error-code-guide/SKILL.md +76 -95
- package/bundled/locales/zh-CN/skills/git-workflow-guide/SKILL.md +80 -87
- package/bundled/locales/zh-CN/skills/git-workflow-guide/branch-naming.md +44 -43
- package/bundled/locales/zh-CN/skills/git-workflow-guide/git-workflow.md +66 -65
- package/bundled/locales/zh-CN/skills/incident-response-assistant/SKILL.md +31 -13
- package/bundled/locales/zh-CN/skills/metrics-dashboard-assistant/SKILL.md +38 -2
- package/bundled/locales/zh-CN/skills/observability-assistant/SKILL.md +75 -1
- package/bundled/locales/zh-CN/skills/pr-automation-assistant/SKILL.md +32 -6
- package/bundled/locales/zh-CN/skills/project-discovery/SKILL.md +8 -2
- package/bundled/locales/zh-CN/skills/project-discovery/guide.md +158 -157
- package/bundled/locales/zh-CN/skills/project-structure-guide/SKILL.md +49 -46
- package/bundled/locales/zh-CN/skills/project-structure-guide/language-patterns.md +8 -7
- package/bundled/locales/zh-CN/skills/refactoring-assistant/SKILL.md +22 -2
- package/bundled/locales/zh-CN/skills/refactoring-assistant/guide.md +172 -171
- package/bundled/locales/zh-CN/skills/release-standards/SKILL.md +66 -23
- package/bundled/locales/zh-CN/skills/release-standards/changelog-format.md +42 -41
- package/bundled/locales/zh-CN/skills/release-standards/guide.md +51 -43
- package/bundled/locales/zh-CN/skills/release-standards/release-workflow.md +131 -95
- package/bundled/locales/zh-CN/skills/release-standards/semantic-versioning.md +62 -61
- package/bundled/locales/zh-CN/skills/requirement-assistant/SKILL.md +24 -15
- package/bundled/locales/zh-CN/skills/requirement-assistant/guide.md +88 -79
- package/bundled/locales/zh-CN/skills/requirement-assistant/requirement-checklist.md +128 -127
- package/bundled/locales/zh-CN/skills/requirement-assistant/requirement-writing.md +121 -120
- package/bundled/locales/zh-CN/skills/retrospective-assistant/guide.md +206 -2
- package/bundled/locales/zh-CN/skills/reverse-engineer/SKILL.md +2 -2
- package/bundled/locales/zh-CN/skills/reverse-engineer/bdd-extraction.md +2 -1
- package/bundled/locales/zh-CN/skills/reverse-engineer/guide.md +297 -173
- package/bundled/locales/zh-CN/skills/reverse-engineer/tdd-analysis.md +2 -1
- package/bundled/locales/zh-CN/skills/reverse-engineer/workflow.md +2 -1
- package/bundled/locales/zh-CN/skills/runbook-assistant/SKILL.md +9 -2
- package/bundled/locales/zh-CN/skills/security-assistant/SKILL.md +24 -6
- package/bundled/locales/zh-CN/skills/security-scan-assistant/SKILL.md +34 -10
- package/bundled/locales/zh-CN/skills/slo-assistant/SKILL.md +2 -1
- package/bundled/locales/zh-CN/skills/spec-derivation/SKILL.md +2 -2
- package/bundled/locales/zh-CN/skills/spec-driven-dev/guide.md +38 -6
- package/bundled/locales/zh-CN/skills/tdd-assistant/SKILL.md +16 -3
- package/bundled/locales/zh-CN/skills/tdd-assistant/guide.md +217 -156
- package/bundled/locales/zh-CN/skills/tdd-assistant/language-examples.md +727 -82
- package/bundled/locales/zh-CN/skills/tdd-assistant/tdd-workflow.md +396 -214
- package/bundled/locales/zh-CN/skills/test-coverage-assistant/SKILL.md +14 -5
- package/bundled/locales/zh-CN/skills/test-coverage-assistant/guide.md +25 -12
- package/bundled/locales/zh-CN/skills/testing-guide/testing-pyramid.md +99 -98
- package/bundled/locales/zh-CN/skills/testing-guide/testing-theory.md +3 -1
- package/bundled/locales/zh-CN/skills/tools/cline/README.md +2 -1
- package/bundled/locales/zh-CN/skills/tools/copilot/README.md +65 -18
- package/bundled/locales/zh-CN/skills/tools/copilot/copilot-instructions.md +2 -1
- package/bundled/locales/zh-CN/skills/tools/cursor/README.md +2 -1
- package/bundled/locales/zh-CN/skills/tools/windsurf/README.md +2 -1
- package/bundled/locales/zh-CN/skills/workflows/README.md +4 -2
- package/bundled/locales/zh-CN/templates/reverse-spec-template.md +50 -1
- package/bundled/locales/zh-TW/CHANGELOG.md +2282 -1112
- package/bundled/locales/zh-TW/CLAUDE.md +962 -76
- package/bundled/locales/zh-TW/README.md +3 -3
- package/bundled/locales/zh-TW/SECURITY.md +3 -3
- package/bundled/locales/zh-TW/STANDARDS-MAPPING.md +103 -6
- package/bundled/locales/zh-TW/adoption/ADOPTION-GUIDE.md +46 -93
- package/bundled/locales/zh-TW/adoption/DAILY-WORKFLOW-GUIDE.md +2 -1
- package/bundled/locales/zh-TW/adoption/STATIC-DYNAMIC-GUIDE.md +3 -1
- package/bundled/locales/zh-TW/adoption/checklists/enterprise.md +10 -9
- package/bundled/locales/zh-TW/adoption/checklists/minimal.md +6 -2
- package/bundled/locales/zh-TW/adoption/checklists/recommended.md +7 -4
- package/bundled/locales/zh-TW/ai/MAINTENANCE.md +34 -14
- package/bundled/locales/zh-TW/ai/options/commit-message/traditional-chinese.ai.yaml +48 -40
- package/bundled/locales/zh-TW/core/acceptance-criteria-traceability.md +56 -10
- package/bundled/locales/zh-TW/core/acceptance-test-driven-development.md +2 -1
- package/bundled/locales/zh-TW/core/accessibility-standards.md +895 -46
- package/bundled/locales/zh-TW/core/adr-standards.md +2 -1
- package/bundled/locales/zh-TW/core/agent-communication-protocol.md +2 -1
- package/bundled/locales/zh-TW/core/agent-dispatch.md +102 -33
- package/bundled/locales/zh-TW/core/ai-agreement-standards.md +58 -41
- package/bundled/locales/zh-TW/core/ai-command-behavior.md +2 -1
- package/bundled/locales/zh-TW/core/ai-friendly-architecture.md +306 -67
- package/bundled/locales/zh-TW/core/ai-instruction-standards.md +16 -13
- package/bundled/locales/zh-TW/core/ai-response-navigation.md +3 -3
- package/bundled/locales/zh-TW/core/alerting-standards.md +257 -35
- package/bundled/locales/zh-TW/core/anti-hallucination.md +169 -40
- package/bundled/locales/zh-TW/core/anti-sycophancy-prompting.md +2 -1
- package/bundled/locales/zh-TW/core/api-design-standards.md +2 -1
- package/bundled/locales/zh-TW/core/behavior-driven-development.md +3 -17
- package/bundled/locales/zh-TW/core/branch-completion.md +130 -34
- package/bundled/locales/zh-TW/core/capability-declaration.md +41 -79
- package/bundled/locales/zh-TW/core/change-batching-standards.md +2 -1
- package/bundled/locales/zh-TW/core/changelog-standards.md +14 -9
- package/bundled/locales/zh-TW/core/chaos-engineering-standards.md +138 -36
- package/bundled/locales/zh-TW/core/checkin-standards.md +84 -26
- package/bundled/locales/zh-TW/core/circuit-breaker.md +48 -87
- package/bundled/locales/zh-TW/core/code-review-checklist.md +19 -7
- package/bundled/locales/zh-TW/core/commit-message-guide.md +218 -87
- package/bundled/locales/zh-TW/core/containerization-standards.md +259 -57
- package/bundled/locales/zh-TW/core/context-aware-loading.md +121 -27
- package/bundled/locales/zh-TW/core/database-standards.md +2 -1
- package/bundled/locales/zh-TW/core/deprecation-standards.md +139 -37
- package/bundled/locales/zh-TW/core/design-document-standards.md +265 -55
- package/bundled/locales/zh-TW/core/developer-memory.md +102 -12
- package/bundled/locales/zh-TW/core/documentation-lifecycle.md +2 -1
- package/bundled/locales/zh-TW/core/documentation-structure.md +17 -8
- package/bundled/locales/zh-TW/core/dual-phase-output.md +28 -90
- package/bundled/locales/zh-TW/core/environment-standards.md +250 -72
- package/bundled/locales/zh-TW/core/error-code-standards.md +17 -6
- package/bundled/locales/zh-TW/core/estimation-standards.md +177 -44
- package/bundled/locales/zh-TW/core/execution-history.md +2 -1
- package/bundled/locales/zh-TW/core/failure-source-taxonomy.md +59 -117
- package/bundled/locales/zh-TW/core/feature-flag-standards.md +202 -57
- package/bundled/locales/zh-TW/core/forward-derivation-standards.md +592 -133
- package/bundled/locales/zh-TW/core/frontend-design-standards.md +120 -8
- package/bundled/locales/zh-TW/core/git-workflow.md +197 -37
- package/bundled/locales/zh-TW/core/git-worktree.md +79 -49
- package/bundled/locales/zh-TW/core/guides/anti-hallucination-guide.md +234 -487
- package/bundled/locales/zh-TW/core/guides/file-placement-guide.md +86 -2
- package/bundled/locales/zh-TW/core/guides/git-workflow-guide.md +411 -464
- package/bundled/locales/zh-TW/core/guides/performance-guide.md +2 -0
- package/bundled/locales/zh-TW/core/guides/refactoring-guide.md +237 -484
- package/bundled/locales/zh-TW/core/guides/security-guide.md +2 -0
- package/bundled/locales/zh-TW/core/health-check-standards.md +46 -104
- package/bundled/locales/zh-TW/core/immutability-first.md +45 -85
- package/bundled/locales/zh-TW/core/knowledge-graph-memory.md +2 -1
- package/bundled/locales/zh-TW/core/knowledge-transfer-standards.md +103 -40
- package/bundled/locales/zh-TW/core/observability-standards.md +284 -40
- package/bundled/locales/zh-TW/core/performance-standards.md +387 -86
- package/bundled/locales/zh-TW/core/pipeline-integration-standards.md +2 -1
- package/bundled/locales/zh-TW/core/postmortem-standards.md +367 -36
- package/bundled/locales/zh-TW/core/privacy-standards.md +153 -46
- package/bundled/locales/zh-TW/core/project-context-memory.md +210 -31
- package/bundled/locales/zh-TW/core/project-structure.md +240 -19
- package/bundled/locales/zh-TW/core/recovery-recipe-registry.md +54 -114
- package/bundled/locales/zh-TW/core/refactoring-standards.md +153 -48
- package/bundled/locales/zh-TW/core/requirement-engineering.md +8 -37
- package/bundled/locales/zh-TW/core/retrospective-standards.md +127 -7
- package/bundled/locales/zh-TW/core/retry-standards.md +41 -105
- package/bundled/locales/zh-TW/core/reverse-engineering-standards.md +5 -1
- package/bundled/locales/zh-TW/core/runbook-standards.md +296 -23
- package/bundled/locales/zh-TW/core/secret-management-standards.md +12 -4
- package/bundled/locales/zh-TW/core/security-decision.md +43 -84
- package/bundled/locales/zh-TW/core/security-standards.md +204 -25
- package/bundled/locales/zh-TW/core/self-review-protocol.md +2 -1
- package/bundled/locales/zh-TW/core/skill-standard-alignment-check.md +103 -69
- package/bundled/locales/zh-TW/core/slo-standards.md +301 -49
- package/bundled/locales/zh-TW/core/spec-driven-development.md +36 -7
- package/bundled/locales/zh-TW/core/standard-admission-criteria.md +22 -28
- package/bundled/locales/zh-TW/core/standard-lifecycle-management.md +40 -48
- package/bundled/locales/zh-TW/core/structured-task-definition.md +2 -1
- package/bundled/locales/zh-TW/core/supply-chain-security-standards.md +137 -10
- package/bundled/locales/zh-TW/core/systematic-debugging.md +94 -38
- package/bundled/locales/zh-TW/core/tech-debt-standards.md +170 -54
- package/bundled/locales/zh-TW/core/test-completeness-dimensions.md +101 -12
- package/bundled/locales/zh-TW/core/test-data-standards.md +245 -23
- package/bundled/locales/zh-TW/core/test-driven-development.md +4 -1
- package/bundled/locales/zh-TW/core/test-governance.md +92 -32
- package/bundled/locales/zh-TW/core/testing-standards.md +61 -14
- package/bundled/locales/zh-TW/core/timeout-standards.md +45 -85
- package/bundled/locales/zh-TW/core/token-budget.md +41 -112
- package/bundled/locales/zh-TW/core/translation-lifecycle-standards.md +28 -16
- package/bundled/locales/zh-TW/core/verification-evidence.md +2 -1
- package/bundled/locales/zh-TW/core/versioning.md +6 -2
- package/bundled/locales/zh-TW/core/virtual-organization-standards.md +42 -36
- package/bundled/locales/zh-TW/core/workflow-enforcement.md +2 -1
- package/bundled/locales/zh-TW/core/workflow-state-protocol.md +2 -1
- package/bundled/locales/zh-TW/docs/CHEATSHEET.md +2 -1
- package/bundled/locales/zh-TW/docs/CLI-FLOW.md +2 -1
- package/bundled/locales/zh-TW/docs/CLI-INIT-OPTIONS.md +12 -3
- package/bundled/locales/zh-TW/docs/DEV-WORKFLOW-MAPPING.md +2 -1
- package/bundled/locales/zh-TW/docs/FEATURE-REFERENCE.md +8 -6
- package/bundled/locales/zh-TW/docs/STANDARDS-REFERENCE.md +2 -1
- package/bundled/locales/zh-TW/docs/USAGE-MODES-COMPARISON.md +2 -1
- package/bundled/locales/zh-TW/docs/USER-MANUAL.md +9 -1
- package/bundled/locales/zh-TW/docs/WINDOWS-GUIDE.md +4 -1
- package/bundled/locales/zh-TW/docs/specs/system/memory-adoption-strategy.md +2 -0
- package/bundled/locales/zh-TW/docs/user/FAQ.md +2 -0
- package/bundled/locales/zh-TW/docs/user/GETTING-STARTED.md +2 -0
- package/bundled/locales/zh-TW/docs/user/GLOSSARY.md +2 -0
- package/bundled/locales/zh-TW/docs/user/README.md +2 -0
- package/bundled/locales/zh-TW/docs/user/TROUBLESHOOTING.md +2 -0
- package/bundled/locales/zh-TW/integrations/claude-code/README.md +2 -1
- package/bundled/locales/zh-TW/integrations/codex/AGENTS.md +136 -2
- package/bundled/locales/zh-TW/integrations/codex/README.md +7 -1
- package/bundled/locales/zh-TW/integrations/gemini-cli/GEMINI.md +59 -1
- package/bundled/locales/zh-TW/integrations/gemini-cli/README.md +8 -1
- package/bundled/locales/zh-TW/integrations/github-copilot/COPILOT-CHAT-REFERENCE.md +7 -1
- package/bundled/locales/zh-TW/integrations/github-copilot/README.md +9 -3
- package/bundled/locales/zh-TW/integrations/github-copilot/copilot-instructions.md +146 -12
- package/bundled/locales/zh-TW/integrations/github-copilot/skills-mapping.md +7 -1
- package/bundled/locales/zh-TW/integrations/google-antigravity/AGENTS.md +110 -3
- package/bundled/locales/zh-TW/integrations/google-antigravity/README.md +7 -1
- package/bundled/locales/zh-TW/integrations/opencode/AGENTS.md +140 -2
- package/bundled/locales/zh-TW/integrations/opencode/README.md +7 -1
- package/bundled/locales/zh-TW/integrations/opencode/skills-mapping.md +8 -2
- package/bundled/locales/zh-TW/integrations/openspec/AGENTS.md +46 -1
- package/bundled/locales/zh-TW/integrations/openspec/README.md +7 -1
- package/bundled/locales/zh-TW/integrations/spec-kit/AGENTS.md +20 -2
- package/bundled/locales/zh-TW/integrations/spec-kit/README.md +7 -1
- package/bundled/locales/zh-TW/methodologies/guides/tdd-guide.md +584 -475
- package/bundled/locales/zh-TW/options/changelog/auto-generated.md +2 -0
- package/bundled/locales/zh-TW/options/changelog/keep-a-changelog.md +2 -0
- package/bundled/locales/zh-TW/options/code-review/automated-review.md +2 -0
- package/bundled/locales/zh-TW/options/code-review/pair-programming.md +2 -0
- package/bundled/locales/zh-TW/options/commit-message/bilingual.md +93 -5
- package/bundled/locales/zh-TW/options/commit-message/english.md +118 -1
- package/bundled/locales/zh-TW/options/commit-message/traditional-chinese.md +82 -1
- package/bundled/locales/zh-TW/options/documentation/api-docs.md +2 -0
- package/bundled/locales/zh-TW/options/documentation/markdown-docs.md +2 -0
- package/bundled/locales/zh-TW/options/documentation/wiki-style.md +2 -0
- package/bundled/locales/zh-TW/options/git-workflow/gitflow.md +99 -71
- package/bundled/locales/zh-TW/options/git-workflow/github-flow.md +68 -50
- package/bundled/locales/zh-TW/options/git-workflow/merge-commit.md +131 -20
- package/bundled/locales/zh-TW/options/git-workflow/rebase-ff.md +142 -27
- package/bundled/locales/zh-TW/options/git-workflow/squash-merge.md +100 -15
- package/bundled/locales/zh-TW/options/git-workflow/trunk-based.md +103 -56
- package/bundled/locales/zh-TW/options/project-structure/dotnet.md +233 -14
- package/bundled/locales/zh-TW/options/project-structure/go.md +270 -12
- package/bundled/locales/zh-TW/options/project-structure/java.md +235 -15
- package/bundled/locales/zh-TW/options/project-structure/kotlin.md +2 -0
- package/bundled/locales/zh-TW/options/project-structure/nodejs.md +136 -19
- package/bundled/locales/zh-TW/options/project-structure/php.md +2 -0
- package/bundled/locales/zh-TW/options/project-structure/python.md +177 -19
- package/bundled/locales/zh-TW/options/project-structure/ruby.md +2 -0
- package/bundled/locales/zh-TW/options/project-structure/rust.md +2 -0
- package/bundled/locales/zh-TW/options/project-structure/swift.md +2 -0
- package/bundled/locales/zh-TW/options/testing/contract-testing.md +2 -0
- package/bundled/locales/zh-TW/options/testing/e2e-testing.md +182 -21
- package/bundled/locales/zh-TW/options/testing/industry-pyramid.md +2 -0
- package/bundled/locales/zh-TW/options/testing/integration-testing.md +134 -22
- package/bundled/locales/zh-TW/options/testing/istqb-framework.md +2 -0
- package/bundled/locales/zh-TW/options/testing/performance-testing.md +2 -0
- package/bundled/locales/zh-TW/options/testing/security-testing.md +2 -0
- package/bundled/locales/zh-TW/options/testing/system-testing.md +175 -1
- package/bundled/locales/zh-TW/options/testing/unit-testing.md +123 -9
- package/bundled/locales/zh-TW/skills/CONTRIBUTING.template.md +3 -2
- package/bundled/locales/zh-TW/skills/INTEGRATION-GUIDE.md +2 -1
- package/bundled/locales/zh-TW/skills/README.md +2 -1
- package/bundled/locales/zh-TW/skills/_shared/README.md +2 -1
- package/bundled/locales/zh-TW/skills/ac-coverage/SKILL.md +15 -4
- package/bundled/locales/zh-TW/skills/adr-assistant/guide.md +123 -3
- package/bundled/locales/zh-TW/skills/agents/README.md +99 -1
- package/bundled/locales/zh-TW/skills/agents/code-architect.md +2 -0
- package/bundled/locales/zh-TW/skills/agents/doc-writer.md +2 -0
- package/bundled/locales/zh-TW/skills/agents/reviewer.md +3 -1
- package/bundled/locales/zh-TW/skills/agents/spec-analyst.md +2 -0
- package/bundled/locales/zh-TW/skills/agents/test-specialist.md +2 -0
- package/bundled/locales/zh-TW/skills/ai-collaboration-standards/SKILL.md +48 -37
- package/bundled/locales/zh-TW/skills/ai-collaboration-standards/anti-hallucination.md +22 -2
- package/bundled/locales/zh-TW/skills/ai-collaboration-standards/certainty-labels.md +29 -3
- package/bundled/locales/zh-TW/skills/ai-friendly-architecture/SKILL.md +23 -36
- package/bundled/locales/zh-TW/skills/ai-instruction-standards/SKILL.md +12 -36
- package/bundled/locales/zh-TW/skills/api-design-assistant/SKILL.md +21 -5
- package/bundled/locales/zh-TW/skills/atdd-assistant/SKILL.md +40 -15
- package/bundled/locales/zh-TW/skills/atdd-assistant/acceptance-criteria-guide.md +2 -1
- package/bundled/locales/zh-TW/skills/atdd-assistant/atdd-workflow.md +98 -1
- package/bundled/locales/zh-TW/skills/atdd-assistant/guide.md +24 -8
- package/bundled/locales/zh-TW/skills/audit-assistant/SKILL.md +8 -2
- package/bundled/locales/zh-TW/skills/bdd-assistant/SKILL.md +29 -6
- package/bundled/locales/zh-TW/skills/bdd-assistant/bdd-workflow.md +2 -1
- package/bundled/locales/zh-TW/skills/bdd-assistant/gherkin-guide.md +2 -1
- package/bundled/locales/zh-TW/skills/bdd-assistant/guide.md +9 -8
- package/bundled/locales/zh-TW/skills/changelog-guide/SKILL.md +12 -3
- package/bundled/locales/zh-TW/skills/changelog-guide/guide.md +11 -7
- package/bundled/locales/zh-TW/skills/checkin-assistant/SKILL.md +19 -3
- package/bundled/locales/zh-TW/skills/checkin-assistant/guide.md +5 -3
- package/bundled/locales/zh-TW/skills/ci-cd-assistant/SKILL.md +35 -16
- package/bundled/locales/zh-TW/skills/code-review-assistant/SKILL.md +19 -2
- package/bundled/locales/zh-TW/skills/code-review-assistant/checkin-checklist.md +2 -1
- package/bundled/locales/zh-TW/skills/code-review-assistant/guide.md +81 -6
- package/bundled/locales/zh-TW/skills/code-review-assistant/review-checklist.md +2 -1
- package/bundled/locales/zh-TW/skills/commands/ac-coverage.md +47 -2
- package/bundled/locales/zh-TW/skills/commands/api-design.md +3 -2
- package/bundled/locales/zh-TW/skills/commands/atdd.md +80 -10
- package/bundled/locales/zh-TW/skills/commands/audit.md +3 -2
- package/bundled/locales/zh-TW/skills/commands/bdd.md +114 -16
- package/bundled/locales/zh-TW/skills/commands/changelog.md +45 -9
- package/bundled/locales/zh-TW/skills/commands/check.md +74 -21
- package/bundled/locales/zh-TW/skills/commands/checkin.md +56 -11
- package/bundled/locales/zh-TW/skills/commands/ci-cd.md +2 -1
- package/bundled/locales/zh-TW/skills/commands/code-review.md +43 -2
- package/bundled/locales/zh-TW/skills/commands/commit.md +58 -4
- package/bundled/locales/zh-TW/skills/commands/config.md +52 -4
- package/bundled/locales/zh-TW/skills/commands/coverage.md +45 -4
- package/bundled/locales/zh-TW/skills/commands/database.md +3 -2
- package/bundled/locales/zh-TW/skills/commands/derive-all.md +44 -2
- package/bundled/locales/zh-TW/skills/commands/derive-atdd.md +37 -2
- package/bundled/locales/zh-TW/skills/commands/derive-bdd.md +44 -3
- package/bundled/locales/zh-TW/skills/commands/derive-tdd.md +45 -3
- package/bundled/locales/zh-TW/skills/commands/derive.md +62 -5
- package/bundled/locales/zh-TW/skills/commands/dev-workflow.md +60 -9
- package/bundled/locales/zh-TW/skills/commands/discover.md +43 -2
- package/bundled/locales/zh-TW/skills/commands/docgen.md +39 -2
- package/bundled/locales/zh-TW/skills/commands/docs.md +139 -7
- package/bundled/locales/zh-TW/skills/commands/durable.md +3 -2
- package/bundled/locales/zh-TW/skills/commands/e2e.md +86 -3
- package/bundled/locales/zh-TW/skills/commands/guide.md +4 -2
- package/bundled/locales/zh-TW/skills/commands/incident.md +3 -2
- package/bundled/locales/zh-TW/skills/commands/init.md +72 -15
- package/bundled/locales/zh-TW/skills/commands/methodology.md +117 -28
- package/bundled/locales/zh-TW/skills/commands/metrics.md +2 -1
- package/bundled/locales/zh-TW/skills/commands/migrate.md +2 -1
- package/bundled/locales/zh-TW/skills/commands/observability.md +45 -2
- package/bundled/locales/zh-TW/skills/commands/pr.md +2 -1
- package/bundled/locales/zh-TW/skills/commands/refactor.md +54 -13
- package/bundled/locales/zh-TW/skills/commands/release.md +83 -2
- package/bundled/locales/zh-TW/skills/commands/requirement.md +41 -2
- package/bundled/locales/zh-TW/skills/commands/reverse-bdd.md +37 -2
- package/bundled/locales/zh-TW/skills/commands/reverse-sdd.md +45 -2
- package/bundled/locales/zh-TW/skills/commands/reverse-tdd.md +43 -2
- package/bundled/locales/zh-TW/skills/commands/reverse.md +44 -2
- package/bundled/locales/zh-TW/skills/commands/runbook.md +47 -2
- package/bundled/locales/zh-TW/skills/commands/scan.md +3 -2
- package/bundled/locales/zh-TW/skills/commands/sdd-retro.md +52 -3
- package/bundled/locales/zh-TW/skills/commands/sdd.md +209 -28
- package/bundled/locales/zh-TW/skills/commands/security.md +3 -2
- package/bundled/locales/zh-TW/skills/commands/slo.md +48 -2
- package/bundled/locales/zh-TW/skills/commands/tdd.md +71 -2
- package/bundled/locales/zh-TW/skills/commands/update.md +64 -2
- package/bundled/locales/zh-TW/skills/commit-standards/SKILL.md +2 -2
- package/bundled/locales/zh-TW/skills/commit-standards/conventional-commits.md +2 -1
- package/bundled/locales/zh-TW/skills/commit-standards/guide.md +137 -17
- package/bundled/locales/zh-TW/skills/commit-standards/language-options.md +21 -18
- package/bundled/locales/zh-TW/skills/contract-test-assistant/SKILL.md +2 -2
- package/bundled/locales/zh-TW/skills/contract-test-assistant/guide.md +81 -1
- package/bundled/locales/zh-TW/skills/database-assistant/SKILL.md +21 -5
- package/bundled/locales/zh-TW/skills/deploy-assistant/SKILL.md +2 -1
- package/bundled/locales/zh-TW/skills/dev-methodology/SKILL.md +4 -1
- package/bundled/locales/zh-TW/skills/dev-methodology/create-methodology.md +2 -0
- package/bundled/locales/zh-TW/skills/dev-methodology/runtime.md +2 -0
- package/bundled/locales/zh-TW/skills/docs-generator/SKILL.md +19 -2
- package/bundled/locales/zh-TW/skills/docs-generator/guide.md +4 -3
- package/bundled/locales/zh-TW/skills/documentation-guide/SKILL.md +67 -42
- package/bundled/locales/zh-TW/skills/documentation-guide/documentation-structure.md +2 -1
- package/bundled/locales/zh-TW/skills/documentation-guide/readme-template.md +2 -1
- package/bundled/locales/zh-TW/skills/durable-execution-assistant/SKILL.md +32 -3
- package/bundled/locales/zh-TW/skills/e2e-assistant/SKILL.md +25 -7
- package/bundled/locales/zh-TW/skills/error-code-guide/SKILL.md +17 -34
- package/bundled/locales/zh-TW/skills/git-workflow-guide/SKILL.md +33 -38
- package/bundled/locales/zh-TW/skills/git-workflow-guide/branch-naming.md +2 -1
- package/bundled/locales/zh-TW/skills/git-workflow-guide/git-workflow.md +2 -1
- package/bundled/locales/zh-TW/skills/incident-response-assistant/SKILL.md +35 -14
- package/bundled/locales/zh-TW/skills/journey-test-assistant/SKILL.md +2 -14
- package/bundled/locales/zh-TW/skills/knowledge-graph/SKILL.md +6 -2
- package/bundled/locales/zh-TW/skills/metrics-dashboard-assistant/SKILL.md +42 -3
- package/bundled/locales/zh-TW/skills/observability-assistant/SKILL.md +85 -18
- package/bundled/locales/zh-TW/skills/pr-automation-assistant/SKILL.md +27 -3
- package/bundled/locales/zh-TW/skills/project-discovery/SKILL.md +11 -3
- package/bundled/locales/zh-TW/skills/project-discovery/guide.md +5 -3
- package/bundled/locales/zh-TW/skills/project-discovery/workflow.md +2 -1
- package/bundled/locales/zh-TW/skills/project-structure-guide/SKILL.md +19 -16
- package/bundled/locales/zh-TW/skills/project-structure-guide/language-patterns.md +2 -1
- package/bundled/locales/zh-TW/skills/refactoring-assistant/SKILL.md +26 -3
- package/bundled/locales/zh-TW/skills/refactoring-assistant/guide.md +4 -2
- package/bundled/locales/zh-TW/skills/release-standards/SKILL.md +91 -45
- package/bundled/locales/zh-TW/skills/release-standards/changelog-format.md +4 -3
- package/bundled/locales/zh-TW/skills/release-standards/guide.md +14 -5
- package/bundled/locales/zh-TW/skills/release-standards/release-workflow.md +5 -1
- package/bundled/locales/zh-TW/skills/release-standards/semantic-versioning.md +2 -1
- package/bundled/locales/zh-TW/skills/requirement-assistant/SKILL.md +15 -6
- package/bundled/locales/zh-TW/skills/requirement-assistant/guide.md +18 -8
- package/bundled/locales/zh-TW/skills/requirement-assistant/requirement-checklist.md +2 -1
- package/bundled/locales/zh-TW/skills/requirement-assistant/requirement-writing.md +2 -1
- package/bundled/locales/zh-TW/skills/retrospective-assistant/guide.md +200 -6
- package/bundled/locales/zh-TW/skills/reverse-engineer/bdd-extraction.md +2 -1
- package/bundled/locales/zh-TW/skills/reverse-engineer/guide.md +161 -36
- package/bundled/locales/zh-TW/skills/reverse-engineer/tdd-analysis.md +2 -1
- package/bundled/locales/zh-TW/skills/reverse-engineer/workflow.md +2 -1
- package/bundled/locales/zh-TW/skills/runbook-assistant/SKILL.md +9 -1
- package/bundled/locales/zh-TW/skills/security-assistant/SKILL.md +25 -5
- package/bundled/locales/zh-TW/skills/security-scan-assistant/SKILL.md +34 -8
- package/bundled/locales/zh-TW/skills/skill-builder/SKILL.md +3 -21
- package/bundled/locales/zh-TW/skills/slo-assistant/SKILL.md +3 -1
- package/bundled/locales/zh-TW/skills/spec-derivation/SKILL.md +2 -1
- package/bundled/locales/zh-TW/skills/spec-driven-dev/guide.md +35 -2
- package/bundled/locales/zh-TW/skills/sweep/SKILL.md +2 -1
- package/bundled/locales/zh-TW/skills/tdd-assistant/SKILL.md +10 -2
- package/bundled/locales/zh-TW/skills/tdd-assistant/guide.md +68 -9
- package/bundled/locales/zh-TW/skills/tdd-assistant/language-examples.md +693 -47
- package/bundled/locales/zh-TW/skills/tdd-assistant/tdd-workflow.md +183 -1
- package/bundled/locales/zh-TW/skills/test-coverage-assistant/SKILL.md +15 -5
- package/bundled/locales/zh-TW/skills/test-coverage-assistant/guide.md +26 -13
- package/bundled/locales/zh-TW/skills/testing-guide/testing-pyramid.md +2 -1
- package/bundled/locales/zh-TW/skills/testing-guide/testing-theory.md +3 -1
- package/bundled/locales/zh-TW/skills/tools/cline/README.md +2 -1
- package/bundled/locales/zh-TW/skills/tools/copilot/README.md +65 -18
- package/bundled/locales/zh-TW/skills/tools/copilot/copilot-instructions.md +2 -1
- package/bundled/locales/zh-TW/skills/tools/cursor/README.md +2 -1
- package/bundled/locales/zh-TW/skills/tools/windsurf/README.md +2 -1
- package/bundled/locales/zh-TW/skills/workflows/README.md +11 -9
- package/bundled/locales/zh-TW/templates/reverse-spec-template.md +50 -1
- package/bundled/skills/.claude-plugin/plugin.json +71 -0
- package/bundled/skills/commit-standards/SKILL.md +2 -2
- package/bundled/skills/commit-standards/guide.md +3 -2
- package/bundled/skills/commit-standards/language-options.md +19 -17
- package/package.json +2 -2
- package/src/commands/audit.js +28 -1
- package/src/commands/check.js +72 -3
- package/src/commands/compile.js +37 -4
- package/src/commands/config.js +49 -24
- package/src/commands/init.js +78 -30
- package/src/commands/open-work.js +6 -2
- package/src/commands/release-messages.js +228 -0
- package/src/commands/release.js +127 -68
- package/src/commands/run-intent.js +11 -0
- package/src/commands/spec.js +4 -2
- package/src/commands/update.js +173 -20
- package/src/compilers/claude-code-compiler.js +9 -1
- package/src/config/ai-agent-paths.js +14 -1
- package/src/core/installed-formats.js +15 -0
- package/src/core/open-work-config.js +20 -1
- package/src/core/project-config.js +55 -0
- package/src/i18n/messages.js +106 -2
- package/src/installers/hooks-installer.js +1 -1
- package/src/installers/manifest-installer.js +1 -1
- package/src/installers/skills-installer.js +1 -1
- package/src/installers/standards-installer.js +3 -1
- package/src/mcp/server.js +9 -3
- package/src/prompts/init.js +26 -22
- package/src/reconciler/actual-state-scanner.js +2 -8
- package/src/reconciler/backup-locations.js +5 -0
- package/src/reconciler/backup-manager.js +19 -11
- package/src/reconciler/desired-state-calculator.js +89 -57
- package/src/reconciler/plan-executor.js +101 -8
- package/src/reconciler/recorded-versions.js +49 -0
- package/src/reconciler/relative-path.js +23 -0
- package/src/uninstallers/hook-uninstaller.js +9 -1
- package/src/uninstallers/skills-uninstaller.js +22 -3
- package/src/utils/available-standards-report.js +25 -4
- package/src/utils/available-standards.js +13 -3
- package/src/utils/build-manifest.js +1 -1
- package/src/utils/commit-message-judge.js +60 -13
- package/src/utils/friction-detector.js +23 -11
- package/src/utils/git-hooks.js +106 -4
- package/src/utils/integration-generator.js +95 -67
- package/src/utils/legacy-hook-migration.js +121 -2
- package/src/utils/open-work-tracking.mjs +105 -16
- package/src/utils/sdd-header.js +16 -4
- package/src/utils/skills-installer.js +2 -1
- package/src/utils/spinner.js +14 -4
- package/src/utils/standard-validator.js +3 -2
- package/standards-registry.json +10 -8
- package/bundled/locales/zh-TW/core/guides/testing-guide.md +0 -2280
|
@@ -1,152 +1,77 @@
|
|
|
1
1
|
---
|
|
2
|
-
source:
|
|
3
|
-
source_version:
|
|
4
|
-
translation_version:
|
|
5
|
-
last_synced: 2026-
|
|
2
|
+
source: ../../../../core/guides/refactoring-guide.md
|
|
3
|
+
source_version: 1.0.0
|
|
4
|
+
translation_version: 1.0.0
|
|
5
|
+
last_synced: 2026-10-16
|
|
6
|
+
source_hash: a34c3eab7aca
|
|
6
7
|
status: current
|
|
7
8
|
---
|
|
8
9
|
|
|
9
|
-
#
|
|
10
|
+
# 重構指南
|
|
10
11
|
|
|
11
|
-
> **語言**: [English](../../../../core/refactoring-
|
|
12
|
+
> **語言**: [English](../../../../core/guides/refactoring-guide.md) | 繁體中文
|
|
12
13
|
|
|
13
|
-
**版本**:
|
|
14
|
-
**最後更新**: 2026-01-
|
|
15
|
-
|
|
14
|
+
**版本**: 1.0.0
|
|
15
|
+
**最後更新**: 2026-01-29
|
|
16
|
+
**相關標準**: [重構標準](../refactoring-standards.md)
|
|
16
17
|
|
|
17
18
|
---
|
|
18
19
|
|
|
19
20
|
## 目的
|
|
20
21
|
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
**主要優點**:
|
|
24
|
-
- 系統化的程式碼品質改善方法
|
|
25
|
-
- 降低重構過程中引入錯誤的風險
|
|
26
|
-
- 清晰的重構 vs 重寫決策框架
|
|
27
|
-
- 可衡量的成果與投資報酬率追蹤
|
|
22
|
+
本指南提供程式碼重構的詳細說明、模式與教學。有關可執行的規則、檢查清單與門檻值,請參見[重構標準](../refactoring-standards.md)。
|
|
28
23
|
|
|
29
24
|
---
|
|
30
25
|
|
|
31
26
|
## 目錄
|
|
32
27
|
|
|
33
|
-
1. [
|
|
34
|
-
2. [
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
- [防腐層](#防腐層)
|
|
41
|
-
- [抽象分支](#抽象分支)
|
|
42
|
-
- [平行變更](#平行變更expand-migrate-contract)
|
|
43
|
-
4. [遺留程式碼安全策略](#遺留程式碼安全策略)
|
|
44
|
-
- [特徵測試](#特徵測試)
|
|
45
|
-
- [探針式重構](#探針式重構)
|
|
46
|
-
- [尋找接縫](#尋找接縫)
|
|
47
|
-
- [Sprout 與 Wrap 技術](#sprout-與-wrap-技術)
|
|
48
|
-
5. [資料庫重構](#資料庫重構)
|
|
49
|
-
6. [安全重構工作流程](#安全重構工作流程)
|
|
50
|
-
7. [重構度量指標](#重構度量指標)
|
|
51
|
-
8. [團隊協作](#團隊協作)
|
|
52
|
-
9. [技術債管理](#技術債管理)
|
|
53
|
-
10. [決策矩陣摘要](#決策矩陣摘要)
|
|
54
|
-
11. [相關標準](#相關標準)
|
|
55
|
-
12. [參考資料](#參考資料)
|
|
56
|
-
13. [版本歷程](#版本歷程)
|
|
57
|
-
|
|
58
|
-
---
|
|
59
|
-
|
|
60
|
-
## 重構 vs 重寫決策矩陣
|
|
61
|
-
|
|
62
|
-
在開始任何大型重構工作之前,評估重構或重寫哪個更合適。
|
|
63
|
-
|
|
64
|
-
### 決策流程圖
|
|
65
|
-
|
|
66
|
-
```
|
|
67
|
-
┌─────────────────────────────────────────────────────────────────┐
|
|
68
|
-
│ 重構 vs 重寫決策樹 │
|
|
69
|
-
├─────────────────────────────────────────────────────────────────┤
|
|
70
|
-
│ │
|
|
71
|
-
│ 程式碼目前在生產環境運行嗎? │
|
|
72
|
-
│ ├─ 否 → 考慮重寫(風險較低) │
|
|
73
|
-
│ └─ 是 ↓ │
|
|
74
|
-
│ │
|
|
75
|
-
│ 你了解程式碼在做什麼嗎? │
|
|
76
|
-
│ ├─ 否 → 先寫特徵測試,再決定 │
|
|
77
|
-
│ └─ 是 ↓ │
|
|
78
|
-
│ │
|
|
79
|
-
│ 測試覆蓋率足夠嗎(>60%)? │
|
|
80
|
-
│ ├─ 否 → 先補測試,再決定 │
|
|
81
|
-
│ └─ 是 ↓ │
|
|
82
|
-
│ │
|
|
83
|
-
│ 核心架構可以保留嗎? │
|
|
84
|
-
│ ├─ 否 → Strangler Fig(漸進替換) │
|
|
85
|
-
│ └─ 是 → 漸進式重構 ✓ │
|
|
86
|
-
│ │
|
|
87
|
-
└─────────────────────────────────────────────────────────────────┘
|
|
88
|
-
```
|
|
89
|
-
|
|
90
|
-
### 比較矩陣
|
|
91
|
-
|
|
92
|
-
| 因素 | 傾向重構 | 傾向重寫 |
|
|
93
|
-
|------|---------|---------|
|
|
94
|
-
| **程式碼規模** | 大型、複雜 | 小型、獨立 |
|
|
95
|
-
| **測試覆蓋率** | 良好(>60%)| 差或沒有 |
|
|
96
|
-
| **業務連續性** | 關鍵 | 可容忍停機 |
|
|
97
|
-
| **團隊知識** | 團隊理解程式碼 | 無組織知識 |
|
|
98
|
-
| **核心架構** | 健全,只是混亂 | 根本性缺陷 |
|
|
99
|
-
| **時間壓力** | 緊迫期限 | 彈性時間 |
|
|
100
|
-
| **風險容忍度** | 低 | 較高 |
|
|
101
|
-
|
|
102
|
-
### 警告:第二系統效應
|
|
103
|
-
|
|
104
|
-
> 「第二個系統是一個人設計過最危險的系統。」— Fred Brooks
|
|
105
|
-
|
|
106
|
-
重寫時,團隊常常過度工程化。避免:
|
|
107
|
-
- 新增原本沒有的功能
|
|
108
|
-
- 「為了未來彈性」過度抽象
|
|
109
|
-
- 忽視現有系統的教訓
|
|
28
|
+
1. [戰術性重構策略](#tactical-refactoring-strategies)
|
|
29
|
+
2. [戰略性重構策略](#strategic-refactoring-strategies)
|
|
30
|
+
3. [遺留程式碼安全策略](#safety-strategies-for-legacy-code)
|
|
31
|
+
4. [資料庫重構模式](#database-refactoring-patterns)
|
|
32
|
+
5. [團隊協作實踐](#team-collaboration-practices)
|
|
33
|
+
6. [技術債管理](#technical-debt-management)
|
|
34
|
+
7. [參考資料](#references)
|
|
110
35
|
|
|
111
36
|
---
|
|
112
37
|
|
|
113
38
|
## 戰術性重構策略
|
|
114
39
|
|
|
115
|
-
|
|
40
|
+
戰術性策略應用於日常開發工作。它們在分鐘至小時級別的時間尺度上運作,且僅需最少的協調。
|
|
116
41
|
|
|
117
42
|
### 預備性重構
|
|
118
43
|
|
|
119
|
-
|
|
44
|
+
**定義**:重構現有程式碼,使即將進行的變更更容易實作。
|
|
120
45
|
|
|
121
46
|
> 「先把改變變容易(這可能很難),然後再做那個容易的改變。」— Kent Beck
|
|
122
47
|
|
|
123
48
|
**適用情境**:
|
|
124
|
-
-
|
|
125
|
-
-
|
|
126
|
-
-
|
|
49
|
+
- 現有架構難以容納你要新增的功能
|
|
50
|
+
- 程式碼結構需要調整以適應新需求
|
|
51
|
+
- 你希望減少後續變更的阻力
|
|
127
52
|
|
|
128
53
|
**工作流程**:
|
|
129
54
|
|
|
130
55
|
```
|
|
131
|
-
1.
|
|
132
|
-
2.
|
|
133
|
-
3.
|
|
134
|
-
4.
|
|
56
|
+
1. Identify the change you want to make
|
|
57
|
+
2. Identify what makes this change difficult
|
|
58
|
+
3. Refactor to make the change easy
|
|
59
|
+
4. Make the (now easy) change
|
|
135
60
|
```
|
|
136
61
|
|
|
137
62
|
**範例**:
|
|
138
|
-
-
|
|
139
|
-
-
|
|
140
|
-
-
|
|
63
|
+
- 變更前:為緊密耦合的服務新增快取非常複雜
|
|
64
|
+
- 預備性重構:提取介面、注入依賴
|
|
65
|
+
- 變更後:新增快取變得簡單直接
|
|
141
66
|
|
|
142
67
|
**關鍵原則**:
|
|
143
|
-
-
|
|
68
|
+
- 預備性重構是與功能分開的獨立提交
|
|
144
69
|
- 每一步都維持測試通過
|
|
145
70
|
- 不要在同一個提交中混合重構與功能開發
|
|
146
71
|
|
|
147
72
|
### 童子軍規則
|
|
148
73
|
|
|
149
|
-
|
|
74
|
+
**定義**:離開時讓程式碼比你發現它時更乾淨。這是一種「機會主義重構」— 不刻意安排重構衝刺,而是在修復 Bug 或新增功能時,順手清理所接觸到的程式碼。
|
|
150
75
|
|
|
151
76
|
> 「離開營地時,讓它比你來的時候更乾淨。」— Robert C. Martin
|
|
152
77
|
|
|
@@ -154,20 +79,20 @@ status: current
|
|
|
154
79
|
- 任何維護作業
|
|
155
80
|
- Bug 修復
|
|
156
81
|
- 功能新增
|
|
157
|
-
- 對抗軟體熵(
|
|
82
|
+
- 對抗軟體熵(software entropy)
|
|
158
83
|
|
|
159
84
|
**指導原則**:
|
|
160
|
-
-
|
|
85
|
+
- 只做小改進(數分鐘,而非數小時)
|
|
161
86
|
- 不可改變行為
|
|
162
87
|
- 不可破壞現有測試
|
|
163
|
-
-
|
|
88
|
+
- 改動範圍保持在當前任務之內
|
|
164
89
|
|
|
165
90
|
**童子軍改進的範例**:
|
|
166
|
-
-
|
|
91
|
+
- 重新命名令人困惑的變數
|
|
167
92
|
- 將幾行程式碼提取為命名良好的方法
|
|
168
93
|
- 移除你注意到的死程式碼
|
|
169
94
|
- 加入澄清註解
|
|
170
|
-
-
|
|
95
|
+
- 修復微小的程式碼風格問題
|
|
171
96
|
|
|
172
97
|
**應避免的反模式**:
|
|
173
98
|
- 把 Bug 修復變成大規模重構專案
|
|
@@ -177,12 +102,12 @@ status: current
|
|
|
177
102
|
|
|
178
103
|
### 紅-綠-重構
|
|
179
104
|
|
|
180
|
-
測試驅動開發(TDD
|
|
105
|
+
測試驅動開發(TDD)循環的一部分。完整細節請參見[測試驅動開發](../test-driven-development.md)。
|
|
181
106
|
|
|
182
107
|
**特點**:
|
|
183
108
|
- 時長:每循環 5-15 分鐘
|
|
184
109
|
- 範圍:單一方法或類別
|
|
185
|
-
-
|
|
110
|
+
- 測試:重構後必須保持綠燈
|
|
186
111
|
|
|
187
112
|
**循環**:
|
|
188
113
|
|
|
@@ -190,7 +115,7 @@ status: current
|
|
|
190
115
|
┌─────────────────────────────────────────┐
|
|
191
116
|
│ │
|
|
192
117
|
│ ┌─────┐ ┌─────┐ ┌─────────┐ │
|
|
193
|
-
│ │
|
|
118
|
+
│ │ RED │ ──► │GREEN│ ──► │REFACTOR │ │
|
|
194
119
|
│ └─────┘ └─────┘ └─────────┘ │
|
|
195
120
|
│ ▲ │ │
|
|
196
121
|
│ └──────────────────────────┘ │
|
|
@@ -198,7 +123,7 @@ status: current
|
|
|
198
123
|
└─────────────────────────────────────────┘
|
|
199
124
|
```
|
|
200
125
|
|
|
201
|
-
|
|
126
|
+
**常見重構技術**:
|
|
202
127
|
- 提取方法(Extract Method)
|
|
203
128
|
- 重新命名(Rename)
|
|
204
129
|
- 內聯變數(Inline Variable)
|
|
@@ -213,9 +138,9 @@ status: current
|
|
|
213
138
|
|
|
214
139
|
### 絞殺榕模式
|
|
215
140
|
|
|
216
|
-
|
|
141
|
+
**定義**:透過逐步將功能路由至新系統,漸進替換遺留系統。
|
|
217
142
|
|
|
218
|
-
|
|
143
|
+
**來源**:得名於絞殺榕樹,它們環繞宿主樹生長,最終取代它。
|
|
219
144
|
|
|
220
145
|
**適用情境**:
|
|
221
146
|
- 漸進替換遺留系統
|
|
@@ -226,58 +151,58 @@ status: current
|
|
|
226
151
|
|
|
227
152
|
```
|
|
228
153
|
┌─────────────────────────────────────────────────────────────────┐
|
|
229
|
-
│
|
|
154
|
+
│ Strangler Fig Pattern │
|
|
230
155
|
├─────────────────────────────────────────────────────────────────┤
|
|
231
156
|
│ │
|
|
232
|
-
│
|
|
157
|
+
│ Phase 1: INTERCEPT │
|
|
233
158
|
│ ┌─────────┐ ┌─────────┐ ┌─────────────┐ │
|
|
234
|
-
│ │
|
|
159
|
+
│ │ Request │────▶│ Facade │────▶│ Legacy (100%)│ │
|
|
235
160
|
│ └─────────┘ └─────────┘ └─────────────┘ │
|
|
236
161
|
│ │
|
|
237
|
-
│
|
|
162
|
+
│ Phase 2: MIGRATE │
|
|
238
163
|
│ ┌─────────┐ ┌─────────┐ ┌─────────────┐ │
|
|
239
|
-
│ │
|
|
164
|
+
│ │ Request │────▶│ Facade │──┬─▶│ New (Feature A)│ │
|
|
240
165
|
│ └─────────┘ └─────────┘ │ └─────────────┘ │
|
|
241
|
-
│ └─▶│
|
|
166
|
+
│ └─▶│ Legacy (Rest) │ │
|
|
242
167
|
│ └─────────────┘ │
|
|
243
168
|
│ │
|
|
244
|
-
│
|
|
169
|
+
│ Phase 3: COMPLETE │
|
|
245
170
|
│ ┌─────────┐ ┌─────────────┐ │
|
|
246
|
-
│ │
|
|
171
|
+
│ │ Request │────▶│ New (100%) │ [Legacy decommissioned] │
|
|
247
172
|
│ └─────────┘ └─────────────┘ │
|
|
248
173
|
│ │
|
|
249
174
|
└─────────────────────────────────────────────────────────────────┘
|
|
250
175
|
```
|
|
251
176
|
|
|
252
|
-
|
|
177
|
+
**實作檢查清單**:
|
|
253
178
|
- [ ] 識別攔截點(API 閘道、門面、代理)
|
|
254
179
|
- [ ] 建立事件捕獲層
|
|
255
180
|
- [ ] 在新系統中實作第一個功能
|
|
256
181
|
- [ ] 漸進式路由流量
|
|
257
182
|
- [ ] 監控並比較結果
|
|
258
|
-
- [ ]
|
|
183
|
+
- [ ] 下線遺留元件
|
|
259
184
|
|
|
260
185
|
### 防腐層
|
|
261
186
|
|
|
262
|
-
|
|
187
|
+
**定義**:在遺留系統與新系統之間的翻譯層,防止遺留系統混亂的領域模型「污染」新系統的整潔架構。
|
|
263
188
|
|
|
264
|
-
**來源**:Eric Evans
|
|
189
|
+
**來源**:Eric Evans, Domain-Driven Design (2003)
|
|
265
190
|
|
|
266
191
|
**適用情境**:
|
|
267
192
|
- 新舊系統必須並存且頻繁互動
|
|
268
|
-
-
|
|
193
|
+
- 遺留系統有複雜/混亂的領域模型
|
|
269
194
|
- 保護新系統的限界上下文(Bounded Context)
|
|
270
195
|
|
|
271
196
|
**架構**:
|
|
272
197
|
|
|
273
198
|
```
|
|
274
199
|
┌────────────────────────────────────────────────────────────┐
|
|
275
|
-
│
|
|
200
|
+
│ Anti-Corruption Layer (ACL) │
|
|
276
201
|
├────────────────────────────────────────────────────────────┤
|
|
277
202
|
│ │
|
|
278
203
|
│ ┌─────────────┐ ┌─────────────┐ ┌─────────────┐ │
|
|
279
|
-
│ │
|
|
280
|
-
│ │ (
|
|
204
|
+
│ │ New System │────▶│ ACL │────▶│Legacy System│ │
|
|
205
|
+
│ │ (Clean API) │ │ │ │(Messy Model)│ │
|
|
281
206
|
│ └─────────────┘ │ ┌─────────┐ │ └─────────────┘ │
|
|
282
207
|
│ │ │ Adapter │ │ │
|
|
283
208
|
│ │ │ Facade │ │ │
|
|
@@ -291,14 +216,14 @@ status: current
|
|
|
291
216
|
**組件**:
|
|
292
217
|
|
|
293
218
|
| 組件 | 用途 |
|
|
294
|
-
|
|
295
|
-
| **Facade
|
|
296
|
-
| **Adapter
|
|
297
|
-
| **Translator
|
|
219
|
+
|-----------|---------|
|
|
220
|
+
| **Facade** | 簡化複雜的遺留介面 |
|
|
221
|
+
| **Adapter** | 將遺留資料格式轉換為新領域模型 |
|
|
222
|
+
| **Translator** | 將遺留術語映射到通用語言 |
|
|
298
223
|
|
|
299
224
|
**實作檢查清單**:
|
|
300
225
|
- [ ] 定義 ACL 的清晰介面
|
|
301
|
-
- [ ]
|
|
226
|
+
- [ ] 將遺留實體映射至新領域模型
|
|
302
227
|
- [ ] 處理資料格式轉換
|
|
303
228
|
- [ ] 實作錯誤翻譯
|
|
304
229
|
- [ ] 加入日誌以便除錯
|
|
@@ -307,43 +232,43 @@ status: current
|
|
|
307
232
|
**與絞殺榕的比較**:
|
|
308
233
|
|
|
309
234
|
| 面向 | 絞殺榕 | 防腐層 |
|
|
310
|
-
|
|
235
|
+
|--------|---------------|----------------------|
|
|
311
236
|
| **目標** | 取代遺留系統 | 與遺留系統共存 |
|
|
312
|
-
| **方向** |
|
|
237
|
+
| **方向** | 遷移離開遺留系統 | 與遺留系統整合 |
|
|
313
238
|
| **最終狀態** | 遺留系統下線 | 兩個系統繼續運作 |
|
|
314
239
|
|
|
315
240
|
### 抽象分支
|
|
316
241
|
|
|
317
|
-
|
|
242
|
+
**定義**:透過引入抽象層,在不使用長期分支的情況下重構共用程式碼。
|
|
318
243
|
|
|
319
244
|
**適用情境**:
|
|
320
|
-
-
|
|
321
|
-
-
|
|
322
|
-
-
|
|
245
|
+
- 在不使用長期分支的情況下重構共用程式碼
|
|
246
|
+
- 需要基於主幹的開發(trunk-based development)
|
|
247
|
+
- 變更風險過高,無法以單一 commit 完成
|
|
323
248
|
|
|
324
249
|
**步驟**:
|
|
325
250
|
|
|
326
251
|
```
|
|
327
|
-
|
|
328
|
-
|
|
252
|
+
Step 1: Introduce Abstraction
|
|
253
|
+
Client → Abstraction (interface) → Old Implementation
|
|
329
254
|
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
255
|
+
Step 2: Add New Implementation
|
|
256
|
+
Client → Abstraction → Old Implementation
|
|
257
|
+
└─→ New Implementation (feature-toggled)
|
|
333
258
|
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
[
|
|
259
|
+
Step 3: Switch and Remove
|
|
260
|
+
Client → New Implementation
|
|
261
|
+
[Old Implementation removed]
|
|
337
262
|
```
|
|
338
263
|
|
|
339
264
|
**關鍵原則**:
|
|
340
|
-
-
|
|
341
|
-
-
|
|
342
|
-
-
|
|
265
|
+
- 所有變更皆在 main/trunk 上(無長期分支)
|
|
266
|
+
- 功能開關(feature toggles)控制哪個實作生效
|
|
267
|
+
- 兩個實作可以在過渡期間共存
|
|
343
268
|
|
|
344
269
|
### 平行變更(Expand-Migrate-Contract)
|
|
345
270
|
|
|
346
|
-
|
|
271
|
+
**定義**:透過三階段方法變更由多個客戶端使用的介面。
|
|
347
272
|
|
|
348
273
|
**適用情境**:
|
|
349
274
|
- 變更多個客戶端使用的介面
|
|
@@ -353,20 +278,20 @@ status: current
|
|
|
353
278
|
**階段**:
|
|
354
279
|
|
|
355
280
|
```
|
|
356
|
-
|
|
357
|
-
├─
|
|
358
|
-
├─
|
|
359
|
-
└─
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
├─
|
|
363
|
-
├─
|
|
364
|
-
└─
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
├─
|
|
368
|
-
├─
|
|
369
|
-
└─
|
|
281
|
+
Phase 1: EXPAND
|
|
282
|
+
├─ Add new field/method alongside old
|
|
283
|
+
├─ New code uses new interface
|
|
284
|
+
└─ Old code still works
|
|
285
|
+
|
|
286
|
+
Phase 2: MIGRATE
|
|
287
|
+
├─ Update all clients to use new interface
|
|
288
|
+
├─ Verify all clients migrated
|
|
289
|
+
└─ Data migration (if needed)
|
|
290
|
+
|
|
291
|
+
Phase 3: CONTRACT
|
|
292
|
+
├─ Remove old field/method
|
|
293
|
+
├─ Clean up migration code
|
|
294
|
+
└─ Update documentation
|
|
370
295
|
```
|
|
371
296
|
|
|
372
297
|
---
|
|
@@ -395,26 +320,26 @@ status: current
|
|
|
395
320
|
**流程**:
|
|
396
321
|
|
|
397
322
|
```
|
|
398
|
-
1.
|
|
399
|
-
2.
|
|
400
|
-
3.
|
|
401
|
-
4.
|
|
402
|
-
5.
|
|
323
|
+
1. Call the code you want to understand
|
|
324
|
+
2. Write an assertion you expect to FAIL
|
|
325
|
+
3. Run the test and see what actually happens
|
|
326
|
+
4. Update the assertion to match actual behavior
|
|
327
|
+
5. Repeat until you've covered the behavior you need to change
|
|
403
328
|
```
|
|
404
329
|
|
|
405
330
|
**範例**:
|
|
406
331
|
|
|
407
332
|
```javascript
|
|
408
|
-
//
|
|
409
|
-
test('calculateDiscount
|
|
333
|
+
// Step 1: Initial (expected to fail)
|
|
334
|
+
test('calculateDiscount returns... something', () => {
|
|
410
335
|
const result = calculateDiscount(100, 'GOLD');
|
|
411
|
-
expect(result).toBe(0); //
|
|
336
|
+
expect(result).toBe(0); // Guess - will probably fail
|
|
412
337
|
});
|
|
413
338
|
|
|
414
|
-
//
|
|
415
|
-
test('calculateDiscount
|
|
339
|
+
// Step 2: After running, update with actual value
|
|
340
|
+
test('calculateDiscount returns 15 for GOLD customers', () => {
|
|
416
341
|
const result = calculateDiscount(100, 'GOLD');
|
|
417
|
-
expect(result).toBe(15); //
|
|
342
|
+
expect(result).toBe(15); // Actual behavior
|
|
418
343
|
});
|
|
419
344
|
```
|
|
420
345
|
|
|
@@ -429,11 +354,11 @@ test('calculateDiscount 對 GOLD 客戶回傳 15', () => {
|
|
|
429
354
|
**工作流程**:
|
|
430
355
|
|
|
431
356
|
```
|
|
432
|
-
1.
|
|
433
|
-
2.
|
|
434
|
-
3.
|
|
435
|
-
4.
|
|
436
|
-
5.
|
|
357
|
+
1. Create a scratch branch (or use git stash)
|
|
358
|
+
2. Aggressively refactor to understand the code
|
|
359
|
+
3. Take notes on what you learn
|
|
360
|
+
4. Discard all changes (git reset --hard)
|
|
361
|
+
5. Apply learnings to write characterization tests
|
|
437
362
|
```
|
|
438
363
|
|
|
439
364
|
**適用情境**:
|
|
@@ -448,7 +373,7 @@ test('calculateDiscount 對 GOLD 客戶回傳 15', () => {
|
|
|
448
373
|
**定義**:接縫是可以在不編輯程式碼的情況下改變行為的地方。
|
|
449
374
|
|
|
450
375
|
| 接縫類型 | 運作方式 | 範例 |
|
|
451
|
-
|
|
376
|
+
|----------|--------------|---------|
|
|
452
377
|
| **物件接縫** | 透過多型覆寫 | 透過介面注入測試替身 |
|
|
453
378
|
| **預處理接縫** | 編譯時替換 | 條件編譯、巨集 |
|
|
454
379
|
| **連結接縫** | 連結時替換 | 依賴注入、模組替換 |
|
|
@@ -458,7 +383,7 @@ test('calculateDiscount 對 GOLD 客戶回傳 15', () => {
|
|
|
458
383
|
### Sprout 與 Wrap 技術
|
|
459
384
|
|
|
460
385
|
| 技術 | 使用時機 | 做法 |
|
|
461
|
-
|
|
386
|
+
|-----------|-------------|-----|
|
|
462
387
|
| **Sprout Method** | 在現有方法中加入新邏輯 | 建立新方法,從舊方法呼叫 |
|
|
463
388
|
| **Sprout Class** | 新邏輯需要獨立演進 | 建立新類別,從舊程式碼參照 |
|
|
464
389
|
| **Wrap Method** | 需要在前後加入行為 | 重命名原方法,建立包裝器 |
|
|
@@ -471,52 +396,52 @@ test('calculateDiscount 對 GOLD 客戶回傳 15', () => {
|
|
|
471
396
|
理解無文件程式碼的技術:
|
|
472
397
|
|
|
473
398
|
```
|
|
474
|
-
1.
|
|
475
|
-
├─
|
|
476
|
-
├─
|
|
477
|
-
└─
|
|
478
|
-
|
|
479
|
-
2.
|
|
480
|
-
├─
|
|
481
|
-
├─
|
|
482
|
-
└─
|
|
483
|
-
|
|
484
|
-
3.
|
|
485
|
-
├─
|
|
486
|
-
├─
|
|
487
|
-
└─
|
|
488
|
-
|
|
489
|
-
4. Git
|
|
490
|
-
├─ git log -p <file
|
|
491
|
-
├─ git blame
|
|
492
|
-
└─
|
|
399
|
+
1. Scratch Refactoring (see above)
|
|
400
|
+
├─ Refactor to understand, not to keep
|
|
401
|
+
├─ Use git stash or branch
|
|
402
|
+
└─ Discard when done (git reset --hard)
|
|
403
|
+
|
|
404
|
+
2. Trace Variable Flow
|
|
405
|
+
├─ Follow data from input to output
|
|
406
|
+
├─ Mark key transformation points
|
|
407
|
+
└─ Document as you discover
|
|
408
|
+
|
|
409
|
+
3. Runtime Observation
|
|
410
|
+
├─ Add temporary logging
|
|
411
|
+
├─ Use debugger step-through
|
|
412
|
+
└─ Build mental model
|
|
413
|
+
|
|
414
|
+
4. Git Archaeology
|
|
415
|
+
├─ git log -p <file> (see all changes)
|
|
416
|
+
├─ git blame (find original author)
|
|
417
|
+
└─ Search commit messages for context
|
|
493
418
|
```
|
|
494
419
|
|
|
495
420
|
---
|
|
496
421
|
|
|
497
|
-
##
|
|
422
|
+
## 資料庫重構模式
|
|
498
423
|
|
|
499
424
|
### Schema 變更的 Expand-Contract 模式
|
|
500
425
|
|
|
501
426
|
```
|
|
502
427
|
┌─────────────────────────────────────────────────────────────────┐
|
|
503
|
-
│
|
|
428
|
+
│ Database Refactoring (Expand-Contract) │
|
|
504
429
|
├─────────────────────────────────────────────────────────────────┤
|
|
505
430
|
│ │
|
|
506
|
-
│
|
|
507
|
-
│ ├─
|
|
508
|
-
│ ├─
|
|
509
|
-
│ └─
|
|
431
|
+
│ Phase 1: EXPAND (Add new, keep old) │
|
|
432
|
+
│ ├─ Add new column/table │
|
|
433
|
+
│ ├─ Application writes to BOTH old and new │
|
|
434
|
+
│ └─ Safe to rollback at this point │
|
|
510
435
|
│ │
|
|
511
|
-
│
|
|
512
|
-
│ ├─
|
|
513
|
-
│ ├─
|
|
514
|
-
│ └─
|
|
436
|
+
│ Phase 2: MIGRATE (Move data) │
|
|
437
|
+
│ ├─ Copy data from old to new │
|
|
438
|
+
│ ├─ Verify data consistency │
|
|
439
|
+
│ └─ Application starts reading from new │
|
|
515
440
|
│ │
|
|
516
|
-
│
|
|
517
|
-
│ ├─
|
|
518
|
-
│ ├─
|
|
519
|
-
│ └─
|
|
441
|
+
│ Phase 3: CONTRACT (Remove old) │
|
|
442
|
+
│ ├─ Confirm old column/table no longer read │
|
|
443
|
+
│ ├─ Remove old column/table │
|
|
444
|
+
│ └─ Clean up dual-write code │
|
|
520
445
|
│ │
|
|
521
446
|
└─────────────────────────────────────────────────────────────────┘
|
|
522
447
|
```
|
|
@@ -524,7 +449,7 @@ test('calculateDiscount 對 GOLD 客戶回傳 15', () => {
|
|
|
524
449
|
### 常見 Schema 重構場景
|
|
525
450
|
|
|
526
451
|
| 場景 | 策略 | 風險等級 |
|
|
527
|
-
|
|
452
|
+
|----------|----------|------------|
|
|
528
453
|
| **重命名欄位** | 新增新的 → 遷移 → 刪除舊的 | 中 |
|
|
529
454
|
| **拆分表格** | 新表 + 外鍵 → 遷移 → 調整應用程式 | 高 |
|
|
530
455
|
| **合併表格** | 新表 → 合併資料 → 切換應用程式 | 高 |
|
|
@@ -534,29 +459,29 @@ test('calculateDiscount 對 GOLD 客戶回傳 15', () => {
|
|
|
534
459
|
### 資料庫遷移安全檢查清單
|
|
535
460
|
|
|
536
461
|
```
|
|
537
|
-
|
|
538
|
-
□
|
|
539
|
-
□
|
|
540
|
-
□
|
|
541
|
-
□
|
|
542
|
-
□
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
□
|
|
546
|
-
□
|
|
547
|
-
□
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
□
|
|
551
|
-
□
|
|
552
|
-
□
|
|
553
|
-
□
|
|
462
|
+
Pre-Migration:
|
|
463
|
+
□ Full backup completed
|
|
464
|
+
□ Migration script tested in staging
|
|
465
|
+
□ Rollback script prepared
|
|
466
|
+
□ Migration time estimated (consider data volume)
|
|
467
|
+
□ Maintenance window communicated
|
|
468
|
+
|
|
469
|
+
During Migration:
|
|
470
|
+
□ Monitor database performance
|
|
471
|
+
□ Verify data integrity incrementally
|
|
472
|
+
□ Application health checks passing
|
|
473
|
+
|
|
474
|
+
Post-Migration:
|
|
475
|
+
□ Data consistency verification
|
|
476
|
+
□ Application functionality verification
|
|
477
|
+
□ Performance baseline comparison
|
|
478
|
+
□ Backup retained for rollback period
|
|
554
479
|
```
|
|
555
480
|
|
|
556
481
|
### 零停機遷移技術
|
|
557
482
|
|
|
558
483
|
| 技術 | 說明 | 使用場景 |
|
|
559
|
-
|
|
484
|
+
|-----------|-------------|----------|
|
|
560
485
|
| **Online Schema Change** | pt-osc, gh-ost | MySQL 大表變更 |
|
|
561
486
|
| **Blue-Green Database** | 雙資料庫切換 | 高可用需求 |
|
|
562
487
|
| **Shadow Write** | 同時寫入兩個資料庫並比較 | 驗證遷移正確性 |
|
|
@@ -564,157 +489,57 @@ test('calculateDiscount 對 GOLD 客戶回傳 15', () => {
|
|
|
564
489
|
|
|
565
490
|
---
|
|
566
491
|
|
|
567
|
-
##
|
|
568
|
-
|
|
569
|
-
### 重構前
|
|
570
|
-
|
|
571
|
-
```
|
|
572
|
-
□ 定義成功標準(可衡量的)
|
|
573
|
-
□ 確保足夠的測試覆蓋率(建議 >80%)
|
|
574
|
-
□ 提交/暫存當前工作(乾淨的工作目錄)
|
|
575
|
-
□ 建立功能分支(或在主幹上使用功能開關)
|
|
576
|
-
□ 與團隊溝通以避免衝突
|
|
577
|
-
```
|
|
578
|
-
|
|
579
|
-
### 重構中
|
|
580
|
-
|
|
581
|
-
```
|
|
582
|
-
□ 一次只做一個小變更
|
|
583
|
-
□ 每次變更後執行測試
|
|
584
|
-
□ 如果測試失敗,立即復原
|
|
585
|
-
□ 頻繁提交(每次測試通過都是一個存檔點)
|
|
586
|
-
□ 重構時絕不加入新功能
|
|
587
|
-
```
|
|
588
|
-
|
|
589
|
-
### 重構後
|
|
590
|
-
|
|
591
|
-
```
|
|
592
|
-
□ 所有測試通過(與之前相同)
|
|
593
|
-
□ 程式碼可衡量地更好(複雜度、重複等)
|
|
594
|
-
□ 如需要則更新文件
|
|
595
|
-
□ 團隊審查完成
|
|
596
|
-
□ 沒有新增功能
|
|
597
|
-
```
|
|
598
|
-
|
|
599
|
-
---
|
|
600
|
-
|
|
601
|
-
## 重構度量指標
|
|
602
|
-
|
|
603
|
-
### 程式碼品質指標
|
|
492
|
+
## 團隊協作實踐
|
|
604
493
|
|
|
605
|
-
|
|
606
|
-
|-----|---------|-----|
|
|
607
|
-
| **循環複雜度** | 靜態分析工具 | 每函式 < 10 |
|
|
608
|
-
| **認知複雜度** | SonarQube 等 | 越低越好 |
|
|
609
|
-
| **耦合度** | 模組間依賴數 | 降低 |
|
|
610
|
-
| **內聚性** | LCOM 指標 | 提高 |
|
|
611
|
-
| **程式碼重複** | 重複程式碼百分比 | < 3% |
|
|
612
|
-
| **程式碼行數** | 僅供參考 | 較少 ≠ 一定更好 |
|
|
613
|
-
|
|
614
|
-
### 測試品質指標
|
|
615
|
-
|
|
616
|
-
| 指標 | 目標 | 備註 |
|
|
617
|
-
|-----|-----|------|
|
|
618
|
-
| **測試覆蓋率** | ≥ 80% | 重構期間不要降低 |
|
|
619
|
-
| **測試速度** | 更快 | 重構應改善可測試性 |
|
|
620
|
-
| **不穩定測試數** | 降低 | 穩定性改善 |
|
|
621
|
-
|
|
622
|
-
### 運維指標(DORA 指標)
|
|
623
|
-
|
|
624
|
-
| 指標 | 測量方式 | 預期改善 |
|
|
625
|
-
|-----|---------|---------|
|
|
626
|
-
| **部署頻率** | CI/CD 記錄 | 提高(可維護性改善)|
|
|
627
|
-
| **變更失敗率** | 回滾次數 | 降低 |
|
|
628
|
-
| **平均恢復時間** | 事故記錄 | 縮短 |
|
|
629
|
-
| **前置時間** | 從提交到部署 | 縮短 |
|
|
630
|
-
|
|
631
|
-
### 團隊效率指標
|
|
632
|
-
|
|
633
|
-
| 指標 | 測量方式 | 備註 |
|
|
634
|
-
|-----|---------|------|
|
|
635
|
-
| **新人上手時間** | 新員工熟悉時間 | 縮短 = 更好的可讀性 |
|
|
636
|
-
| **PR 審查時間** | Git 記錄 | 縮短 = 更好的可理解性 |
|
|
637
|
-
| **Bug 修復時間** | Issue 追蹤 | 縮短 = 更好的可維護性 |
|
|
638
|
-
|
|
639
|
-
### 重構 ROI 框架
|
|
494
|
+
### 重構專案啟動
|
|
640
495
|
|
|
641
496
|
```
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
├─
|
|
645
|
-
|
|
646
|
-
└─ 機會成本(未建置的功能)
|
|
647
|
-
|
|
648
|
-
收益:
|
|
649
|
-
├─ 減少的維護時間 × 未來年數
|
|
650
|
-
├─ 減少的 Bug × 修復成本
|
|
651
|
-
├─ 更快的功能開發
|
|
652
|
-
└─ 更低的人員流動成本
|
|
653
|
-
```
|
|
497
|
+
Kickoff Meeting Agenda:
|
|
498
|
+
1. Scope Definition
|
|
499
|
+
├─ What modules/files are in scope
|
|
500
|
+
└─ What is explicitly excluded
|
|
654
501
|
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
502
|
+
2. Success Criteria Alignment
|
|
503
|
+
├─ Quantitative goals (complexity reduction X%)
|
|
504
|
+
└─ Functional goals (behavior unchanged)
|
|
658
505
|
|
|
659
|
-
|
|
506
|
+
3. Work Division
|
|
507
|
+
├─ By module (vertical slicing)
|
|
508
|
+
└─ By layer (horizontal slicing)
|
|
660
509
|
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
├─ 哪些模組/檔案在範圍內
|
|
665
|
-
└─ 明確排除什麼
|
|
666
|
-
|
|
667
|
-
2. 成功標準對齊
|
|
668
|
-
├─ 量化目標(複雜度降低 X%)
|
|
669
|
-
└─ 功能目標(行為不變)
|
|
670
|
-
|
|
671
|
-
3. 工作分配
|
|
672
|
-
├─ 按模組(垂直切分)
|
|
673
|
-
└─ 按層級(水平切分)
|
|
674
|
-
|
|
675
|
-
4. 風險評估
|
|
676
|
-
├─ 最高風險區域
|
|
677
|
-
└─ 回滾策略
|
|
510
|
+
4. Risk Assessment
|
|
511
|
+
├─ Highest-risk areas
|
|
512
|
+
└─ Rollback strategy
|
|
678
513
|
```
|
|
679
514
|
|
|
680
515
|
### 分工策略
|
|
681
516
|
|
|
682
517
|
| 策略 | 使用時機 | 注意事項 |
|
|
683
|
-
|
|
684
|
-
|
|
|
685
|
-
|
|
|
686
|
-
|
|
|
687
|
-
|
|
|
518
|
+
|------|----------|---------|
|
|
519
|
+
| **垂直切片(Vertical Slicing)** | 獨立模組 | 確保介面不變 |
|
|
520
|
+
| **水平切片(Horizontal Slicing)** | 跨模組重構(例如命名慣例) | 需要嚴格同步 |
|
|
521
|
+
| **絞殺榕分工(Strangler Division)** | 大型系統替換 | 每一絞殺切片一人負責 |
|
|
522
|
+
| **暴民程式設計(Mob Programming)** | 核心/高風險區域 | 全員參與,降低風險 |
|
|
688
523
|
|
|
689
524
|
### 溝通機制
|
|
690
525
|
|
|
691
526
|
```
|
|
692
|
-
|
|
693
|
-
├─
|
|
694
|
-
├─
|
|
695
|
-
└─
|
|
696
|
-
|
|
697
|
-
PR 規範:
|
|
698
|
-
├─ 標題加 [Refactor] 前綴
|
|
699
|
-
├─ 說明改了什麼以及為什麼
|
|
700
|
-
├─ 包含前後複雜度比較
|
|
701
|
-
└─ 遺留程式碼需要特徵測試
|
|
702
|
-
|
|
703
|
-
衝突處理:
|
|
704
|
-
├─ 小範圍:立即解決
|
|
705
|
-
├─ 中範圍:每日同步會議
|
|
706
|
-
└─ 大範圍:考慮 Branch by Abstraction
|
|
707
|
-
```
|
|
708
|
-
|
|
709
|
-
### PR 大小指引
|
|
527
|
+
Daily Communication:
|
|
528
|
+
├─ Sync refactoring progress in standup
|
|
529
|
+
├─ Shared Refactoring Board (Kanban)
|
|
530
|
+
└─ Dedicated channel (#refactoring-xxx)
|
|
710
531
|
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
|
|
532
|
+
PR Standards:
|
|
533
|
+
├─ [Refactor] prefix in title
|
|
534
|
+
├─ Explain what changed and why
|
|
535
|
+
├─ Include before/after complexity comparison
|
|
536
|
+
└─ Require Characterization Tests for legacy code
|
|
716
537
|
|
|
717
|
-
|
|
538
|
+
Conflict Resolution:
|
|
539
|
+
├─ Small scope: Resolve immediately
|
|
540
|
+
├─ Medium scope: Daily sync meeting
|
|
541
|
+
└─ Large scope: Consider Branch by Abstraction
|
|
542
|
+
```
|
|
718
543
|
|
|
719
544
|
---
|
|
720
545
|
|
|
@@ -722,117 +547,54 @@ PR 規範:
|
|
|
722
547
|
|
|
723
548
|
### 技術債象限
|
|
724
549
|
|
|
725
|
-
基於 Martin Fowler
|
|
726
|
-
|
|
727
|
-
```
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
│
|
|
732
|
-
│
|
|
733
|
-
│
|
|
734
|
-
│
|
|
735
|
-
│
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
│
|
|
739
|
-
│
|
|
740
|
-
│
|
|
741
|
-
│
|
|
742
|
-
│
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
|
|
550
|
+
基於 Martin Fowler 的技術債象限(Technical Debt Quadrant):
|
|
551
|
+
|
|
552
|
+
```
|
|
553
|
+
Deliberate
|
|
554
|
+
│
|
|
555
|
+
┌───────────────┼───────────────┐
|
|
556
|
+
│ │ │
|
|
557
|
+
│ Prudent │ Reckless │
|
|
558
|
+
│ "We know │ "We don't │
|
|
559
|
+
│ this is │ have time │
|
|
560
|
+
│ debt" │ for design" │
|
|
561
|
+
│ │ │
|
|
562
|
+
Prudent ├───────────────┼───────────────┤ Reckless
|
|
563
|
+
│ │ │
|
|
564
|
+
│ Prudent │ Reckless │
|
|
565
|
+
│ "Now we │ "What's │
|
|
566
|
+
│ know how │ layering?" │
|
|
567
|
+
│ we should │ │
|
|
568
|
+
│ have done it"│ │
|
|
569
|
+
│ │ │
|
|
570
|
+
└───────────────┼───────────────┘
|
|
571
|
+
│
|
|
572
|
+
Inadvertent
|
|
746
573
|
```
|
|
747
574
|
|
|
748
|
-
### 債務優先順序
|
|
749
|
-
|
|
750
|
-
| 優先級 | 標準 | 行動 |
|
|
751
|
-
|-------|------|-----|
|
|
752
|
-
| **高** | 阻擋開發、導致頻繁 Bug | 立即處理 |
|
|
753
|
-
| **中** | 拖慢開發、增加複雜度 | 排入下個 Sprint |
|
|
754
|
-
| **低** | 小煩惱、影響隔離 | 隨機處理 |
|
|
755
|
-
|
|
756
575
|
### 追蹤技術債
|
|
757
576
|
|
|
758
577
|
```
|
|
759
|
-
|
|
760
|
-
├─
|
|
761
|
-
├─
|
|
762
|
-
├─
|
|
763
|
-
├─
|
|
764
|
-
└─
|
|
578
|
+
For each debt item, record:
|
|
579
|
+
├─ Description: What is the issue?
|
|
580
|
+
├─ Impact: How does it affect development?
|
|
581
|
+
├─ Estimated Effort: How long to fix?
|
|
582
|
+
├─ Risk if Ignored: What happens if not addressed?
|
|
583
|
+
└─ Related Code: Links to affected files/modules
|
|
765
584
|
```
|
|
766
585
|
|
|
767
586
|
---
|
|
768
587
|
|
|
769
|
-
## 決策矩陣摘要
|
|
770
|
-
|
|
771
|
-
選擇適當重構策略的快速參考:
|
|
772
|
-
|
|
773
|
-
| 策略 | 規模 | 風險 | 關鍵用途 |
|
|
774
|
-
|------|------|------|----------|
|
|
775
|
-
| **預備性重構** | 小 | 低 | 降低功能開發阻力 |
|
|
776
|
-
| **童子軍規則** | 極小 | 低 | 持續償還技術債 |
|
|
777
|
-
| **紅-綠-重構** | 小 | 低 | TDD 開發循環 |
|
|
778
|
-
| **絞殺榕模式** | 大 | 中 | 系統汰換、架構遷移 |
|
|
779
|
-
| **防腐層** | 中 | 低 | 新舊系統共存 |
|
|
780
|
-
| **抽象分支** | 大 | 中 | 主幹上的長期重構 |
|
|
781
|
-
| **平行變更** | 中 | 低 | 介面/Schema 遷移 |
|
|
782
|
-
| **特徵測試** | — | — | **所有遺留重構的前置條件** |
|
|
783
|
-
| **探針式重構** | 小 | 低 | 理解黑盒程式碼 |
|
|
784
|
-
|
|
785
|
-
### 策略選擇指南
|
|
786
|
-
|
|
787
|
-
```
|
|
788
|
-
你的情境是什麼?
|
|
789
|
-
|
|
790
|
-
功能開發被混亂程式碼阻擋?
|
|
791
|
-
└─► 預備性重構
|
|
792
|
-
|
|
793
|
-
在 Bug 修復中接觸程式碼?
|
|
794
|
-
└─► 童子軍規則
|
|
795
|
-
|
|
796
|
-
用 TDD 寫新程式碼?
|
|
797
|
-
└─► 紅-綠-重構
|
|
798
|
-
|
|
799
|
-
取代整個遺留系統?
|
|
800
|
-
└─► 絞殺榕模式
|
|
801
|
-
|
|
802
|
-
需要整合遺留而不被污染?
|
|
803
|
-
└─► 防腐層
|
|
804
|
-
|
|
805
|
-
在主幹上重構共享程式碼?
|
|
806
|
-
└─► 抽象分支
|
|
807
|
-
|
|
808
|
-
變更被廣泛使用的介面?
|
|
809
|
-
└─► 平行變更(Expand-Migrate-Contract)
|
|
810
|
-
|
|
811
|
-
處理未測試的遺留程式碼?
|
|
812
|
-
└─► 先用特徵測試 + 探針式重構
|
|
813
|
-
```
|
|
814
|
-
|
|
815
|
-
---
|
|
816
|
-
|
|
817
|
-
## 相關標準
|
|
818
|
-
|
|
819
|
-
- [測試驅動開發](../test-driven-development.md) - TDD 循環包含重構階段
|
|
820
|
-
- [程式碼審查清單](../code-review-checklist.md) - 重構 PR 審查指引
|
|
821
|
-
- [提交訊息指南](../commit-message-guide.md) - `refactor` 提交類型
|
|
822
|
-
- [程式碼簽入標準](../checkin-standards.md) - 提交前要求
|
|
823
|
-
|
|
824
|
-
---
|
|
825
|
-
|
|
826
588
|
## 參考資料
|
|
827
589
|
|
|
828
590
|
### 書籍
|
|
829
591
|
|
|
830
|
-
- Martin Fowler
|
|
831
|
-
- Michael Feathers
|
|
832
|
-
- Joshua Kerievsky
|
|
833
|
-
- Kent Beck
|
|
834
|
-
- Robert C. Martin
|
|
835
|
-
- Eric Evans
|
|
592
|
+
- Martin Fowler - "Refactoring: Improving the Design of Existing Code" (2nd Edition, 2018)
|
|
593
|
+
- Michael Feathers - "Working Effectively with Legacy Code" (2004)
|
|
594
|
+
- Joshua Kerievsky - "Refactoring to Patterns" (2004)
|
|
595
|
+
- Kent Beck - "Implementation Patterns" (2007)
|
|
596
|
+
- Robert C. Martin - "Clean Code" (2008)
|
|
597
|
+
- Eric Evans - "Domain-Driven Design" (2003)
|
|
836
598
|
|
|
837
599
|
### 文章
|
|
838
600
|
|
|
@@ -850,15 +612,6 @@ PR 規範:
|
|
|
850
612
|
|
|
851
613
|
---
|
|
852
614
|
|
|
853
|
-
##
|
|
854
|
-
|
|
855
|
-
| 版本 | 日期 | 變更 |
|
|
856
|
-
|-----|------|------|
|
|
857
|
-
| 2.0.0 | 2026-01-21 | 重大重構:新增戰術性策略(預備性重構、童子軍規則)、防腐層、決策矩陣摘要。重組為戰術性/戰略性/安全防護三層分類。 |
|
|
858
|
-
| 1.0.0 | 2026-01-12 | 初始重構標準定義 |
|
|
859
|
-
|
|
860
|
-
---
|
|
861
|
-
|
|
862
|
-
## 授權
|
|
615
|
+
## 授權條款
|
|
863
616
|
|
|
864
|
-
|
|
617
|
+
本指引依 [CC BY 4.0](https://creativecommons.org/licenses/by/4.0/) 授權條款釋出。
|