platform-deploy-validate
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseValidating Deployment
部署验证
Run a server-side validation before deploying metadata. Validation surfaces errors without modifying the org and — for production targets — produces a job ID usable with for a fast, test-free deploy.
platform-quick-deploy在部署元数据前执行服务器端验证。验证会暴露错误但不会修改组织,并且针对Production目标会生成一个作业ID,可与配合使用,实现快速、无需测试的部署。
platform-quick-deployCapability Resolution
能力选择
Always prefer (prod) or (sandbox/scratch) over the Tooling API directly.
sf project deploy validatesf project deploy start --dry-run始终优先使用(针对Production)或(针对沙盒/临时环境),而非直接使用Tooling API。
sf project deploy validatesf project deploy start --dry-runWorkflow
工作流程
Step 1 — Confirm the target org
步骤1 — 确认目标组织
Classify the org with the gate's classifier — it is the authoritative source of truth (it handles sandbox/scratch markers, trial and Developer Edition hosts, and dev hubs, and returns one of ):
production|sandbox|scratch|trial|devhub|unknownbash
sf org display --target-org <alias> --json | "${CLAUDE_PLUGIN_ROOT}/scripts/sf-deploy-gate" classifyOnly takes the production path (Step 2b); every other result takes the sandbox/scratch path (Step 2a).
production使用网关的分类器对组织进行分类——这是权威的事实来源(它处理沙盒/临时环境标记、试用版和开发者版主机以及开发中心,并返回中的一种):
production|sandbox|scratch|trial|devhub|unknownbash
sf org display --target-org <alias> --json | "${CLAUDE_PLUGIN_ROOT}/scripts/sf-deploy-gate" classify只有采用Production路径(步骤2b);其他所有结果均采用沙盒/临时环境路径(步骤2a)。
productionStep 2a — Sandbox/Scratch path (dry-run)
步骤2a — 沙盒/临时环境路径(试运行)
bash
sf project deploy start --dry-run --target-org <alias> --json [scope flags]Scope flags (use exactly one, not all):
- — deploy a directory
--source-dir <path> - — deploy specific components
--metadata <Type:Name> - — deploy from manifest
--manifest manifest/package.xml
Default test level: omit for sandboxes (defers to org default). Add only if the user asks.
--test-level--test-level RunLocalTestsReport back: success/failure, components attempted, any errors. No job ID is returned for dry-runs (this is expected).
bash
sf project deploy start --dry-run --target-org <alias> --json [scope flags]范围标志(仅使用其中一个,而非全部):
- — 部署一个目录
--source-dir <path> - — 部署特定组件
--metadata <Type:Name> - — 从清单部署
--manifest manifest/package.xml
默认测试级别:沙盒环境省略(遵循组织默认设置)。仅当用户要求时添加。
--test-level--test-level RunLocalTests反馈内容:成功/失败状态、尝试部署的组件、任何错误。试运行不会返回作业ID(这是预期行为)。
Step 2b — Production path (validate)
步骤2b — Production路径(验证)
bash
sf project deploy validate --target-org <alias> --json [scope flags] --test-level RunLocalTestsProduction validations REQUIRE a test level. Use by default; switch to if the user has explicitly listed tests.
RunLocalTestsRunSpecifiedTests --tests <ClassName>...The response returns a job ID () valid for 10 days. Persist it for :
result.idplatform-quick-deploybash
mkdir -p .sfdx
echo '{"jobId":"<id>","createdAt":"<iso8601>","targetOrg":"<alias>","testLevel":"RunLocalTests"}' > .sfdx/last-validation.jsonReport:
- Validation result (passed / failed)
- Job ID and 10-day expiry date
- Test results summary (run / passed / failed)
- Recommended next step: with this job ID
platform-quick-deploy
bash
sf project deploy validate --target-org <alias> --json [scope flags] --test-level RunLocalTestsProduction验证需要指定测试级别。默认使用;如果用户明确列出测试用例,则切换为。
RunLocalTestsRunSpecifiedTests --tests <ClassName>...响应会返回一个作业ID(),有效期为10天。请将其持久化以便使用:
result.idplatform-quick-deploybash
mkdir -p .sfdx
echo '{"jobId":"<id>","createdAt":"<iso8601>","targetOrg":"<alias>","testLevel":"RunLocalTests"}' > .sfdx/last-validation.json反馈内容:
- 验证结果(通过/失败)
- 作业ID及10天有效期截止日期
- 测试结果摘要(运行数/通过数/失败数)
- 建议下一步操作:使用此作业ID执行
platform-quick-deploy
Step 3 — Failure triage
步骤3 — 失败排查
If validation fails, parse and and surface:
result.details.componentFailuresresult.details.runTestResult.failures- Top 5 component errors with full message
- Top 5 test failures with stack
- Suggested fix (component name → likely cause: missing dependency, FLS, syntax, etc.)
Do NOT propose fixes that change unrelated metadata. Stay scoped to what the validation reported.
如果验证失败,解析和并展示:
result.details.componentFailuresresult.details.runTestResult.failures- 前5个组件错误及完整消息
- 前5个测试失败及堆栈信息
- 建议修复方案(组件名称 → 可能原因:缺少依赖项、FLS、语法错误等)
请勿提出修改无关元数据的修复方案。仅针对验证报告的内容提供建议。
Rules
规则
- ALWAYS use on every CLI call
--json - NEVER skip validation when targeting Production (do not run against prod from this skill)
sf project deploy start - NEVER use or
--ignore-errorsduring validation; those flags belong to actual deploys, not validation--ignore-warnings - If the user asks to "deploy to prod" without prior validation, FIRST run validation, THEN hand off to (do not start a regular deploy against prod)
platform-quick-deploy - Persist the validation job ID to so the quick-deploy skill can find it
.sfdx/last-validation.json
- 所有CLI调用必须使用参数
--json - 针对Production目标时,绝不跳过验证(请勿从此技能中针对Production运行)
sf project deploy start - 验证期间绝不使用或
--ignore-errors;这些标志属于实际部署,而非验证--ignore-warnings - 如果用户要求“部署到Production”但未事先验证,先执行验证,再移交至(请勿针对Production启动常规部署)
platform-quick-deploy - 将验证作业ID持久化到,以便快速部署技能可以找到它
.sfdx/last-validation.json
Output
输出
Always end with:
- ✅ Validation passed → next-step pointer to (with job ID + expiry) OR to
platform-quick-deployfor non-prodplatform-metadata-deploy - ❌ Validation failed → categorized error list and suggested next iteration
始终以以下内容结尾:
- ✅ 验证通过 → 指向的下一步操作提示(包含作业ID和有效期),或针对非Production环境指向
platform-quick-deployplatform-metadata-deploy - ❌ 验证失败 → 分类错误列表及建议的下一步迭代