forcedotcom/sf-skills / plugins/builder/dx-org-lifecycle/skills/automation-sandbox-post-copy-configure
automation-sandbox-post-copy-configure
VerifiedApply a Salesforce sandbox post-copy automation JSON config against a target org. 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 — including activating/deactivating a Flow (PATCH `FlowDefinition.Metadata.activeVersionNumber` to the version, or `null`), re-pointing an OBM endpoint, updating a RemoteSiteSetting URL, or re-scheduling a ScheduledApex job after refresh. Also trigger for phrasings like "apply post-copy config", "run post-copy automation", "activate Flow <name> post-refresh", "deactivate Flow <name>", "re-point outbound messages after refresh", or "configure sandbox after refresh". Per entry, derive the Tooling API sobject, verify via describe, resolve the Id via SOQL, then PATCH the compound `Metadata` field (`ScheduledApex` uses anonymous Apex). DO NOT TRIGGER for generating config JSON from an SOP (use `automation-sandbox-post-copy-config-generate`) or for deploying metadata XML.
| File | Kind | Size |
|---|---|---|
| SKILL.md | skill md | 21.3 KB |
| assets/api_request_templates.json | config | 4.2 KB |
| examples/sample_config_input.json | config | 1.1 KB |
| examples/sample_execution_summary.md | markdown | 4.0 KB |
| references/api_endpoints.md | markdown | 10.7 KB |
| references/authentication.md | markdown | 2.9 KB |
| references/execution_phasing.md | markdown | 3.6 KB |
| references/flow_activation_path.md | markdown | 7.1 KB |
| references/rules_gotchas.md | markdown | 3.5 KB |
| references/scheduled_apex_path.md | markdown | 8.1 KB |
| scripts/build-scheduled-apex.mjsexecutable | script | 2.2 KB |
| scripts/classify-patch-result.mjsexecutable | script | 3.1 KB |
| scripts/map-metadata-key.mjsexecutable | script | 3.4 KB |
| scripts/plan-phases.mjsexecutable | script | 2.8 KB |
| scripts/resolve-target-org.mjsexecutable | script | 1.9 KB |
| scripts/soql-escape-job-name.mjsexecutable | script | 1.0 KB |
references/rules_gotchas.md
View on GitHub# Rules, Constraints, and Gotchas
Load-bearing invariants and the recovery/response for each recoverable
runtime failure. Read alongside `SKILL.md`; every rule below is a
skill-behavior invariant, not an authoring guideline.
## Rules / Constraints
| Constraint | Rationale |
|-----------|-----------|
| Every `ConfigurationName` must pass Step B (describe returns 200 AND exposes a `Metadata` field) before any PATCH is planned for it | Guessing the sobject name silently updates the wrong record type; the describe gate is the only defense against a plausible-but-wrong derivation |
| Never insert; this skill updates existing records only | Creation is the metadata-generation flow's responsibility; a missing target record is an error to surface, not one to paper over |
| Confirm the target org alias explicitly before the first API call | Default org may be a production alias; a wrong org selection is the most expensive failure mode |
| Group entries by `ExecutionOrder`, then serialize phase boundaries | Same `ExecutionOrder` = parallel-eligible; different values = strict serial ordering (later phase may depend on earlier phase's effect) |
| Cap intra-phase concurrency at 5 by default | Salesforce REST API rate limits: bursts of concurrent requests trigger `REQUEST_LIMIT_EXCEEDED` |
| Every PATCH body wraps the change in a compound `Metadata` field with camelCase keys, preserving the full existing block | Top-level fields on these Tooling sobjects are read-only, and `Metadata` is replace-in-full — omitted keys are blanked |
| If the derived camelCase key is not present in the current `Metadata` block, mark `FIELD_MAP_UNKNOWN` and skip | Silent PATCH of a different key updates the wrong field or adds a phantom one |
| `IsActive: false` → `SKIPPED_INACTIVE` (no PATCH), plus a Follow-ups bullet | Silently deactivating a live integration is a much bigger blast radius than leaving it alone and flagging it |
| A single entry's failure does not abort the phase unless `continue-on-error` is false | Isolated failures (stale Label, deleted record) must not block unrelated entries |
| Never print raw access tokens or full `sf org display` output | Access tokens grant full org access; they must not be surfaced to the user or written to disk |
| Report every entry's outcome in the final summary, including successes | Silence on a success is indistinguishable from a skip — completeness makes the report auditable |
## Gotchas
| Issue | Resolution |
|-------|------------|
| `sf` CLI session expired | Prompt the user to re-run `sf org login web --alias <alias>`; never attempt interactive login on their behalf |
| Target org alias resolves to production | Stop and confirm before any PATCH |
| Describe returns 404, or 200 without a `Metadata` field | Mark every entry with that `ConfigurationName` as `API_NOT_IDENTIFIED`; do not attempt an educated-guess endpoint |
| SOQL lookup returns multiple rows | Mark `AMBIGUOUS`, list all Ids, do not PATCH |
| SOQL lookup returns zero rows | Mark `NOT_FOUND`; do not fall back to insert |
| HTTP 401 mid-run | Surface, ask the user to re-authenticate, offer to resume — do not silently retry with a stale token |
| HTTP 429 / `REQUEST_LIMIT_EXCEEDED` | Reduce intra-phase concurrency (e.g., 5 → 2) and continue |
| URL contains credentials (`https://user:token@host/...`) | Send verbatim to the API but mask in the summary (`https://user:***@host/...`) |
| OBM entry has `Fields.Action = "Delete"` | Surface `DELETE_NOT_SUPPORTED` — this skill does not delete records |
Related skills
| Skill | Stars | Updated | Works with | Status | Install |
|---|---|---|---|---|---|
| writing-skillsobra/superpowersUse when creating new skills, editing existing skills, or verifying skills work before deployment | Stars: 322k | Updated | Claude CodeCodex | Verified | Install |
| xlsxanthropics/skillsUse this skill any time a spreadsheet file is the primary input or output. This means any task where the user wants to: open, read, edit, or fix an existing .xlsx, .xlsm, .xltx, .csv, or .tsv file (e.g., adding columns, computing formulas, formatting, charting, cleaning messy data); create a new spreadsheet from scratch or from other data sources; or convert between tabular file formats. Trigger especially when the user references a spreadsheet file by name or path — even casually (like "the xlsx in my downloads") — and wants something done to it or produced from it. Also trigger for cleaning or restructuring messy tabular data files (malformed rows, misplaced headers, junk data) into proper spreadsheets. The deliverable must be a spreadsheet file. Do NOT trigger when the primary deliverable is a Word document, HTML report, standalone Python script, database pipeline, or Google Sheets API integration, even if tabular data is involved. | Stars: 198k | Updated | Claude CodeCodex | Verified | Install |
| shipping-and-launchaddyosmani/agent-skillsPrepares production launches. Use when preparing to deploy to production, or when asking what needs to be in place before shipping. Use when you need a pre-launch checklist, when setting up monitoring, when planning a staged rollout, or when you need a rollback strategy. | Stars: 119k | Updated | Claude CodeCodex | Verified | Install |
| childhoodthedotmack/claude-memBabysit a shipped release after merge, publication, or deployment. Verify published packages, production behavior, installed plugins, and late CI or user reports until the observation window is clean; use babysit for PR readiness before release. | Stars: 118k | Updated | Claude CodeCodex | Verified | Install |