Skip to main content
skill CX Codex

platform-deploy-validate — Claude Code skill: validate Salesforce

Runs a server-side validation of Salesforce metadata before deploying. Errors show up, the org stays untouched, and production returns a job ID for a quick deploy.

Install into Claude Code · Skills CLI (Vercel) All methods and platforms ↓
npx skills add forcedotcom/sf-skills --skill platform-deploy-validate -a claude-code
Open on GitHub

What platform-deploy-validate does

The skill validates metadata on the server without changing anything in the org. It first classifies the target org with ${CLAUDE_PLUGIN_ROOT}/scripts/sf-deploy-gate bucket <alias>, which returns production, sandbox, scratch, trial or unknown. Only production takes the production path; everything else goes through the sandbox route.

For sandbox and scratch it runs sf project deploy start --dry-run with one scope flag: --source-dir, --metadata or --manifest. The test level is left alone unless you ask for --test-level RunLocalTests. No job ID comes back from a dry-run, and that is expected. Production requires sf project deploy validate with a test level: RunLocalTests by default, or RunSpecifiedTests --tests <ClassName> when you list the tests yourself. The response carries a job ID valid for 10 days, and the skill writes it to .sfdx/last-validation.json for platform-quick-deploy.

When validation fails, the skill parses componentFailures and runTestResult.failures and surfaces up to five component errors and five test failures with stack traces. Suggested fixes stay inside what the report covers. Actual deploys belong to platform-metadata-deploy, destructive changes to platform-destructive-deploy — this skill does neither. The --ignore-errors and --ignore-warnings flags are not used during validation; they belong to real deploys.

What it helps with

  • validate metadata before a production deploy
  • get a job ID for a fast deploy without rerunning tests
  • run a dry-run against a sandbox or scratch org
  • triage component errors and test failures after a failed validation
  • check that a deploy won't break the org before starting it

Example prompts for the agent

  • validate the deploy to production before we ship
  • do a dry-run for this sandbox org
  • validate the metadata from manifest/package.xml

How to install platform-deploy-validate

1Skills CLI (Vercel)

npx skills add forcedotcom/sf-skills --skill platform-deploy-validate -a claude-code

2Manually: put the files in place

~/.claude/skills/platform-deploy-validate/SKILL.md

Copy the whole skill folder; for one project use .claude/skills/platform-deploy-validate/

Step by step, with commands for each platform: How to install skills in Claude Code: five ways

Questions about platform-deploy-validate

How do I install platform-deploy-validate in Claude?

Run npx skills add forcedotcom/sf-skills --skill platform-deploy-validate -a claude-code. The skill lands in ~/.claude/skills/platform-deploy-validate/SKILL.md.

What does platform-deploy-validate do?

It runs a server-side validation of Salesforce metadata before deploying. Production targets get a 10-day job ID; sandbox and scratch targets get a dry-run.

How is it different from platform-metadata-deploy?

It only validates and never performs the deploy. Use platform-metadata-deploy for the real deploy and platform-destructive-deploy for destructive changes.

Source text

SKILL.md · Apache-2.0
---
name: platform-deploy-validate
description: "Validate Salesforce metadata before deploying. TRIGGER when the user asks to validate a deploy, do a dry-run, check before deploying, or targets a Production org for any deploy operation. Routes prod targets to `sf project deploy validate` (returns a 10-day quick-deploy job ID) and sandbox/scratch targets to `sf project deploy start --dry-run`. DO NOT TRIGGER for actual deploys (use platform-metadata-deploy) or destructive changes (use platform-destructive-deploy)."
allowed-tools:
  - Bash
  - Read
  - Write
metadata:
  cliTools:
    - tool: ["sf"]
      semver: ">=2.0.0"
  relatedSkills:
    - "platform-metadata-deploy"
    - "platform-destructive-deploy"
    - "platform-quick-deploy"
---

# Validating 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 `platform-quick-deploy` for a fast, test-free deploy.

## Capability Resolution

Always prefer `sf project deploy validate` (prod) or `sf project deploy start --dry-run` (sandbox/scratch) over the Tooling API directly.

## Workflow

### Step 1 — Confirm the target org

Classify the org with the gate's classifier — it is the authoritative source of truth and resolves the org the same way the deploy hook does (it handles sandbox/scratch markers, trial and Developer Edition orgs including SDOs, and treats a Dev Hub with no such signal as production; returns one of `production|sandbox|scratch|trial|unknown`):

```bash
"${CLAUDE_PLUGIN_ROOT}/scripts/sf-deploy-gate" bucket <alias>
```

Only `production` takes the production path (Step 2b); every other result takes the sandbox/scratch path (Step 2a). `unknown` means the org type could not be confirmed (usually an incomplete org record). Say so plainly: the deploy gate still allows the deploy, auto-deploy on save stays off for that org, and re-authenticating with `sf org login web` usually restores the classification.

### Step 2a — Sandbox/Scratch path (dry-run)

```bash
sf project deploy start --dry-run --target-org <alias> --json [scope flags]
```

Scope flags (use exactly one, not all):
- `--source-dir <path>` — deploy a directory
- `--metadata <Type:Name>` — deploy specific components
- `--manifest manifest/package.xml` — deploy from manifest

Default test level: omit `--test-level` for sandboxes (defers to org default). Add `--test-level RunLocalTests` only if the user asks.

Report back: success/failure, components attempted, any errors. **No job ID is returned** for dry-runs (this is expected).

### Step 2b — Production path (validate)

```bash
sf project deploy validate --target-org <alias> --json [scope flags] --test-level RunLocalTests
```

Production validations REQUIRE a test level. Use `RunLocalTests` by default; switch to `RunSpecifiedTests --tests <ClassName>...` if the user has explicitly listed tests.

The response returns a **job ID** (`result.id`) valid for **10 days**. Persist it for `platform-quick-deploy`:

```bash
mkdir -p .sfdx
echo '{"jobId":"<id>","createdAt":"<iso8601>","targetOrg":"<alias>","testLevel":"RunLocalTests"}' > .sfdx/last-validation.json
```

Report:
- Validation result (passed / failed)
- Job ID and 10-day expiry date
- Test results summary (run / passed / failed)
- Recommended next step: `platform-quick-deploy` with this job ID

### Step 3 — Failure triage

If validation fails, parse `result.details.componentFailures` and `result.details.runTestResult.failures` and surface:
- 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.

## Rules

- ALWAYS use `--json` on every CLI call
- NEVER skip validation when targeting Production (do not run `sf project deploy start` against prod from this skill)
- NEVER use `--ignore-errors` or `--ignore-warnings` during validation; those flags belong to actual deploys, not validation
- If the user asks to "deploy to prod" without prior validation, FIRST run validation, THEN hand off to `platform-quick-deploy` (do not start a regular deploy against prod)
- Persist the validation job ID to `.sfdx/last-validation.json` so the quick-deploy skill can find it

## Output

Always end with:
- ✅ Validation passed → next-step pointer to `platform-quick-deploy` (with job ID + expiry) OR to `platform-metadata-deploy` for non-prod
- ❌ Validation failed → categorized error list and suggested next iteration

© forcedotcom · Apache-2.0 · forcedotcom/sf-skills

Similar skills

All skills for DevOps and infrastructure →

From the same set181

dx-org-trial-expiration-check Checks when your Salesforce orgs expire, or whether they already have. Handy when a trial is running out and you lost track of the date. CX Codex +1 3,200installs platform-apex-anonymous-run Runs anonymous Apex against connected Salesforce orgs using the sf CLI. It captures debug logs, extracts compilation or runtime errors, and isolates test runs using rollback savepoints. CX Codex +1 3,100installs platform-manifest-generate Writes a Salesforce package.xml or a destructive manifest from a source folder, a component list, or org introspection. Handy when the deploy is ready but the manifest is not. CX Codex +1 3,000installs platform-sandbox-configure Manages Salesforce sandboxes via Connect REST API. It handles inventory listing, license checks, creation, refreshes, activation, and deletion directly in the agent chat. CX Codex +1 3,000installs dx-devops-work-item-manage Runs the DevOps Center work item lifecycle from the terminal: list, create, commit to the branch, move status, open a pull request. CX Codex +1 3,000installs platform-architecture-analyze Audits a Salesforce DX project against the Salesforce Well-Architected framework. It checks code and metadata, scores pillars, and leaves repo files untouched. CX Codex +1 2,900installs sales-agentforce-pipeline-management-configure Configures and repairs Agentforce Pipeline Management and the Sales Management agent in a Salesforce org. Use it to set up Opportunity field suggestions and connected data sources. CX Codex +1 2,900installs platform-report-generate This skill writes and validates Salesforce Lightning report metadata: columns, groupings, filters, charts. Useful when a .report-meta.xml deploy keeps failing. CX Codex +1 2,900installs

Project sponsors

Companies that keep this analytics open
Gold sponsor

Impressions, clicks and code copies — open statistics. We keep the numbers public for the same reason NeBlask itself is public. Become a sponsor