platform-metadata-deploy
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
Chineseplatform-metadata-deploy: Comprehensive Salesforce DevOps Automation
platform-metadata-deploy:Salesforce DevOps自动化全指南
Use this skill when the user needs deployment orchestration: dry-run validation, targeted or manifest-based deploys, CI/CD workflow advice, scratch-org management, failure triage, or safe rollout sequencing for Salesforce metadata.
当用户需要部署编排时使用本技能:包括预演验证、定向或基于清单的部署、CI/CD工作流建议、临时环境(scratch-org)管理、故障排查,或Salesforce元数据的安全发布排序。
When This Skill Owns the Task
本技能适用任务场景
Use when the work involves:
platform-metadata-deploy- ,
sf project deploy start,quick, or retrieval workflowsreport - release sequencing across objects, permission sets, Apex, and Flows
- CI/CD gates, test-level selection, or deployment reports
- troubleshooting deployment failures and dependency ordering
Delegate elsewhere when the user is:
- authoring Apex code → platform-apex-generate
- authoring LWC components → experience-lwc-generate
- creating custom objects or fields → platform-custom-object-generate, platform-custom-field-generate
- building Flows → automation-flow-generate
- doing org data operations → platform-data-manage
- authoring or testing Agentforce agents → agentforce-generate
当工作涉及以下内容时,使用:
platform-metadata-deploy- 、
sf project deploy start、quick或检索工作流report - 跨对象、权限集、Apex和Flow的发布排序
- CI/CD关卡、测试级别选择或部署报告
- 排查部署失败问题和依赖顺序
当用户进行以下操作时,请转用其他技能:
- 编写Apex代码 → platform-apex-generate
- 编写LWC组件 → experience-lwc-generate
- 创建自定义对象或字段 → platform-custom-object-generate、platform-custom-field-generate
- 构建Flow → automation-flow-generate
- 执行组织数据操作 → platform-data-manage
- 编写或测试Agentforce代理 → agentforce-generate
Critical Operating Rules
核心操作规则
- Use CLI v2 only.
sf - On non-source-tracking orgs, deploy/retrieve commands require an explicit scope such as ,
--source-dir, or--metadata.--manifest - Prefer first before real deploys.
--dry-run - For Flows, deploy safely and activate only after validation.
- Keep test-data creation guidance delegated to after metadata is validated or deployed.
platform-data-manage
- 仅使用**CLI v2**。
sf - 在无源码追踪的组织中,部署/检索命令需要明确的范围,例如、
--source-dir或--metadata。--manifest - 实际部署前优先使用**预演**。
--dry-run - 对于Flow,需安全部署,仅在验证后激活。
- 测试数据创建指导需在元数据验证或部署后,委托给****处理。
platform-data-manage
Default deployment order
默认部署顺序
| Phase | Metadata |
|---|---|
| 1 | Custom objects / fields |
| 2 | Permission sets |
| 3 | Apex |
| 4 | Flows as Draft |
| 5 | Flow activation / post-verify |
This ordering prevents many dependency and FLS failures.
| 阶段 | 元数据 |
|---|---|
| 1 | 自定义对象/字段 |
| 2 | 权限集 |
| 3 | Apex |
| 4 | 草稿状态的Flow |
| 5 | Flow激活/部署后验证 |
此顺序可避免许多依赖和FLS(字段级安全)失败问题。
Required Context to Gather First
需优先收集的必要信息
Ask for or infer:
- target org alias and environment type
- deployment scope: source-dir, metadata list, or manifest
- whether this is validate-only, deploy, quick deploy, retrieve, or CI/CD guidance
- required test level and rollback expectations
- whether special metadata types are involved (Flow, permission sets, agents, packages)
Preflight checks:
bash
sf --version
sf org list
sf org display --target-org <alias> --json
test -f sfdx-project.json询问或推断:
- 目标组织别名和环境类型
- 部署范围:source-dir、元数据列表或清单
- 本次操作是仅验证、部署、快速部署、检索还是CI/CD指导
- 所需测试级别和回滚预期
- 是否涉及特殊元数据类型(Flow、权限集、代理、包)
预检命令:
bash
sf --version
sf org list
sf org display --target-org <alias> --json
test -f sfdx-project.jsonRecommended Workflow
推荐工作流
1. Preflight
1. 预检
Confirm auth, repo shape, package directories, and target scope.
确认身份验证、代码库结构、包目录和目标范围。
2. Validate first
2. 优先验证
bash
sf project deploy start --dry-run --source-dir force-app --target-org <alias> --wait 30 --jsonUse manifest- or metadata-scoped validation when the change set is targeted.
bash
sf project deploy start --dry-run --source-dir force-app --target-org <alias> --wait 30 --json当变更集为定向时,使用基于清单或元数据范围的验证。
3. If validation succeeds, offer the next safe workflow
3. 验证成功后,提供下一步安全工作流
After a successful validation, guide the user to the correct next action:
- deploy now
- assign permission sets
- create test data via platform-data-manage
- run tests / smoke checks
- orchestrate multiple post-deploy steps in order
验证成功后,引导用户执行正确的后续操作:
- 立即部署
- 分配权限集
- 通过platform-data-manage创建测试数据
- 运行测试/冒烟测试
- 按顺序编排多个部署后步骤
4. Deploy the smallest correct scope
4. 部署最小且正确的范围
bash
undefinedbash
undefinedsource-dir deploy
基于source-dir的部署
sf project deploy start --source-dir force-app --target-org <alias> --wait 30 --json
sf project deploy start --source-dir force-app --target-org <alias> --wait 30 --json
manifest deploy
基于清单的部署
sf project deploy start --manifest manifest/package.xml --target-org <alias> --test-level RunLocalTests --wait 30 --json
sf project deploy start --manifest manifest/package.xml --target-org <alias> --test-level RunLocalTests --wait 30 --json
manifest deploy with Spring '26 relevant-test selection
针对Spring '26版本的相关测试选择的清单部署
sf project deploy start --manifest manifest/package.xml --target-org <alias> --test-level RunRelevantTests --wait 30 --json
sf project deploy start --manifest manifest/package.xml --target-org <alias> --test-level RunRelevantTests --wait 30 --json
quick deploy after successful validation
验证成功后的快速部署
sf project deploy quick --job-id <validation-job-id> --target-org <alias> --json
undefinedsf project deploy quick --job-id <validation-job-id> --target-org <alias> --json
undefined5. Verify
5. 验证
bash
sf project deploy report --job-id <job-id> --target-org <alias> --jsonThen verify tests, Flow state, permission assignments, and smoke-test behavior.
bash
sf project deploy report --job-id <job-id> --target-org <alias> --json然后验证测试结果、Flow状态、权限分配和冒烟测试行为。
6. Report clearly
6. 清晰报告
Summarize what deployed, what failed, what was skipped, and what the next safe action is.
Output template: references/deployment-report-template.md
总结已部署内容、失败内容、跳过内容以及下一步安全操作。
输出模板:references/deployment-report-template.md
High-Signal Failure Patterns
高信号失败模式
| Error / symptom | Likely cause | Default fix direction |
|---|---|---|
| validation rule or bad test data | adjust data or rule timing |
| missing dependency | include referenced metadata first |
| trigger / Flow / validation side effect | inspect automation stack and failing logic |
| tests fail during deploy | broken code or fragile tests | run targeted tests, fix root cause, revalidate |
| field/object not found in permset | wrong order | deploy objects/fields before permission sets |
| Flow invalid / version conflict | dependency or activation problem | deploy as Draft, verify, then activate |
Full workflows: references/orchestration.md, references/trigger-deployment-safety.md
| 错误/症状 | 可能原因 | 默认修复方向 |
|---|---|---|
| 验证规则或测试数据错误 | 调整数据或规则执行时机 |
| 缺少依赖项 | 先包含被引用的元数据 |
| 触发器/Flow/验证的副作用 | 检查自动化栈和失败逻辑 |
| 部署期间测试失败 | 代码损坏或测试不稳定 | 运行定向测试,修复根本原因,重新验证 |
| 权限集中未找到字段/对象 | 部署顺序错误 | 先部署对象/字段,再部署权限集 |
| Flow无效/版本冲突 | 依赖或激活问题 | 以草稿状态部署,验证后再激活 |
完整工作流:references/orchestration.md、references/trigger-deployment-safety.md
CI/CD Guidance
CI/CD指导
Default pipeline shape:
- authenticate
- validate repo / org state
- static analysis
- dry-run deploy
- tests + coverage gates
- deploy
- verify + notify
- When org policy and release risk allow it, consider for Apex-heavy deployments.
--test-level RunRelevantTests - Pair this with modern Apex test annotations such as and
@IsTest(testFor=...)— see platform-apex-generate for authoring guidance.@IsTest(isCritical=true)
Static analysis now uses Code Analyzer v5 (), not retired .
sf code-analyzersf scannerDeep reference: references/deployment-workflows.md
默认流水线结构:
- 身份验证
- 验证代码库/组织状态
- 静态分析
- 预演部署
- 测试+覆盖率关卡
- 部署
- 验证+通知
- 当组织策略和发布风险允许时,针对Apex密集型部署可考虑使用。
--test-level RunRelevantTests - 搭配现代Apex测试注解,如和
@IsTest(testFor=...)— 编写指导请参考platform-apex-generate。@IsTest(isCritical=true)
静态分析现在使用Code Analyzer v5(),而非已停用的。
sf code-analyzersf scanner深度参考:references/deployment-workflows.md
Agentforce Deployment Note
Agentforce部署说明
Use this skill to orchestrate deployment/publish sequencing around agents, but use the agent-specific skill for authoring decisions:
- agentforce-generate for authoring, Agent Builder, Prompt Builder, and metadata config
.agent
For full agent DevOps details, including pseudo metadata, publish/activate, and sync-between-orgs, see:
Agent:- references/agent-deployment-guide.md
使用本技能编排代理相关的部署/发布顺序,但代理编写决策请使用专门技能:
- agentforce-generate用于编写、Agent Builder、Prompt Builder和元数据配置
.agent
有关代理DevOps的完整细节,包括伪元数据、发布/激活以及跨组织同步,请查看:
Agent:- references/agent-deployment-guide.md
Cross-Skill Integration
跨技能集成
| Need | Delegate to | Reason |
|---|---|---|
| custom object creation | platform-custom-object-generate | define objects before deploy |
| custom field creation | platform-custom-field-generate | define fields before deploy |
| Apex authoring / fixes | platform-apex-generate | code authoring and repair |
| Flow creation / repair | automation-flow-generate | Flow authoring and activation guidance |
| test data or seed records | platform-data-manage | describe-first data setup and cleanup |
| Agent authoring and publish readiness | agentforce-generate | agent-specific correctness |
| 需求 | 转用技能 | 原因 |
|---|---|---|
| 自定义对象创建 | platform-custom-object-generate | 部署前定义对象 |
| 自定义字段创建 | platform-custom-field-generate | 部署前定义字段 |
| Apex编写/修复 | platform-apex-generate | 代码编写与修复 |
| Flow创建/修复 | automation-flow-generate | Flow编写与激活指导 |
| 测试数据或种子记录 | platform-data-manage | 先描述再进行数据设置与清理 |
| 代理编写与发布就绪检查 | agentforce-generate | 代理专属正确性检查 |
Reference Map
参考地图
Start here
入门参考
- references/orchestration.md
- references/deployment-workflows.md
- references/deployment-report-template.md
- references/orchestration.md
- references/deployment-workflows.md
- references/deployment-report-template.md
Specialized deployment safety
专项部署安全
- references/trigger-deployment-safety.md
- references/agent-deployment-guide.md
- references/deploy.sh
- references/trigger-deployment-safety.md
- references/agent-deployment-guide.md
- references/deploy.sh
Asset templates
资产模板
- assets/package.xml — manifest template covering common metadata types
- assets/destructiveChanges.xml — template for removing metadata from target orgs
- assets/package.xml — 涵盖常见元数据类型的清单模板
- assets/destructiveChanges.xml — 用于从目标组织移除元数据的模板
Score Guide
评分指南
| Score | Meaning |
|---|---|
| 90+ | strong deployment plan and execution guidance |
| 75–89 | good deploy guidance with minor review items |
| 60–74 | partial coverage of deployment risk |
| < 60 | insufficient confidence; tighten plan before rollout |
| 分数 | 含义 |
|---|---|
| 90+ | 完善的部署计划与执行指导 |
| 75–89 | 良好的部署指导,存在少量需审查项 |
| 60–74 | 部分覆盖部署风险 |
| < 60 | 信心不足;发布前需收紧计划 |
Completion Format
完成格式
text
Deployment goal: <validate / deploy / retrieve / pipeline>
Target org: <alias>
Scope: <source-dir / metadata / manifest>
Result: <passed / failed / partial>
Key findings: <errors, ordering, tests, skipped items>
Next step: <safe follow-up action>text
Deployment goal: <validate / deploy / retrieve / pipeline>
Target org: <alias>
Scope: <source-dir / metadata / manifest>
Result: <passed / failed / partial>
Key findings: <errors, ordering, tests, skipped items>
Next step: <safe follow-up action>