Agent skill · forcedotcom
automation-sandbox-post-copy-configure
Apply a Salesforce sandbox post-copy automation JSON config against a target org. For each entry, the skill derives the correct Tooling API sobject from the entry's `ConfigurationName`, verifies the derivation via a describe probe, resolves the record Id via SOQL-over-REST, then PATCHes the record via the compound `Metadata` field using `sf api request rest`. `ScheduledApex` entries run anonymous Apex `System.schedule(...)` via `sf apex run` (because `CronTrigger` is read-only) and verify via a `CronTrigger` SOQL read-back. Use when the user asks to apply, run, execute, dry-run, or preview a post-copy or post-refresh config file (e.g. `post-copy-config.json`) against a sandbox. Trigger phrases: \"apply post-copy config\", \"run post-copy automation\", \"execute sandbox post-refresh JSON\", \"apply sandbox refresh config\", \"configure sandbox after refresh\". DO NOT TRIGGER for generating the config JSON from an SOP (delegate to `automation-sandbox-post-copy-config-generate`), or for deploying metadata XML.
What it needs
About 11k tokens when loaded.
What this skill does
Automation: Sandbox Post-Copy Configure Apply a Salesforce sandbox post-copy automation JSON config to a target org. Three canonical ConfigurationName values are pinned: OutboundMessages and RemoteSiteSettings take the compound-Metadata PATCH route (Steps A–E); ScheduledApex takes the anonymous-Apex route (Step F), because CronTrigger is read-only in the Tooling API. Any other ConfigurationName is derived and describe-verified. Every A–E entry — pinned or derived — must pass Step B (describe returns 200 with a Metadata compound field) before any PATCH is planned; Step B does not apply to ScheduledApex. Entries whose API cannot be verified are surfaced in the summary and skipped — never guessed at. Tool Restrictions Use ONLY the Bash tool to execute sf CLI commands (sf data query --use-tooling-api, sf api request rest, sf org display). Do NOT use MCP tools like executesoql — ignore them completely; the compound Metadata PATCH pattern this skill requires is not available through MCP tool wrappers. If the target org alias is not explicitly named by the user, invoke sf commands without --target-org — the harness has already set the CLI's default target-org. Never pass --target-org default — default is not an alias and will fail with NamedOrgNotFoundError. SOQL-over-REST (sf data query --use-tooling-api ...) is treated as an API call — same OAuth session, same authorization boundary as the subsequent PATCH. No direct database / non-Salesforce SQL access. STOP — do this before making any API call Never call the org from memory. Before the first request: 1. Read the config JSON end-to-end from the exact path the user gave (default ./post-copy-config.json). Every entry must have all five keys (ConfigurationName, Label, Fields, IsActive, ExecutionOrder). If any entry is malformed, abort and surface the file path + entry index — do not partially apply. Do not invent entries. If the file is missing, stop and ask; never fabricate a plan against synthetic labels. 2. …
How to use it
Reference it in AdaL, Claude Code, Cursor or any coding agent — nothing to install:
@skills forcedotcom/automation-sandbox-post-copy-configure--5072fe