deploying-metadata
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
Chinesedeploying-metadata: Comprehensive Salesforce DevOps Automation
deploying-metadata:全面的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:
deploying-metadata- ,
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 → generating-apex
- authoring LWC components → generating-lwc-components
- creating custom objects or fields → generating-custom-object, generating-custom-field
- building Flows → generating-flow
- doing org data operations → handling-sf-data
- authoring or testing Agentforce agents → developing-agentforce
当工作涉及以下内容时,使用:
deploying-metadata- 、
sf project deploy start、quick或检索工作流report - 跨对象、权限集、Apex和Flows的发布排序
- CI/CD关卡、测试级别选择或部署报告
- 排查部署失败问题和依赖项排序
当用户从事以下工作时,请转交至其他技能:
- 编写Apex代码 → generating-apex
- 编写LWC组件 → generating-lwc-components
- 创建自定义对象或字段 → generating-custom-object、generating-custom-field
- 构建Flows → generating-flow
- 执行组织数据操作 → handling-sf-data
- 编写或测试Agentforce代理 → developing-agentforce
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.
handling-sf-data
- 仅使用**CLI v2**。
sf - 在非源码跟踪的组织中,部署/检索命令需要明确的范围,例如、
--source-dir或--metadata。--manifest - 实际部署前优先执行**预演**。
--dry-run - 对于Flows,安全部署并仅在验证后激活。
- 元数据验证或部署完成后,测试数据创建指导请转交至****。
handling-sf-data
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 | 草稿状态的Flows |
| 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 handling-sf-data
- run tests / smoke checks
- orchestrate multiple post-deploy steps in order
验证成功后,引导用户执行正确的下一步操作:
- 立即部署
- 分配权限集
- 通过handling-sf-data创建测试数据
- 运行测试/冒烟检查
- 按顺序编排多个部署后步骤
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 generating-apex 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=...)——编写指导请参见generating-apex。@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:
- developing-agentforce 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
使用此技能编排代理相关的部署/发布顺序,但代理编写决策请使用专门的技能:
- developing-agentforce用于编写、Agent Builder、Prompt Builder和元数据配置
.agent
有关代理DevOps的完整细节,包括伪元数据、发布/激活以及跨组织同步,请参见:
Agent:- references/agent-deployment-guide.md
Cross-Skill Integration
跨技能集成
| Need | Delegate to | Reason |
|---|---|---|
| custom object creation | generating-custom-object | define objects before deploy |
| custom field creation | generating-custom-field | define fields before deploy |
| Apex authoring / fixes | generating-apex | code authoring and repair |
| Flow creation / repair | generating-flow | Flow authoring and activation guidance |
| test data or seed records | handling-sf-data | describe-first data setup and cleanup |
| Agent authoring and publish readiness | developing-agentforce | agent-specific correctness |
| 需求 | 转交至 | 原因 |
|---|---|---|
| 自定义对象创建 | generating-custom-object | 部署前定义对象 |
| 自定义字段创建 | generating-custom-field | 部署前定义字段 |
| Apex编写/修复 | generating-apex | 代码编写与修复 |
| Flow创建/修复 | generating-flow | Flow编写与激活指导 |
| 测试数据或种子记录 | handling-sf-data | 先描述再进行数据设置与清理 |
| 代理编写与发布就绪检查 | developing-agentforce | 代理专属的正确性检查 |
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>