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 |
scripts/build-scheduled-apex.mjs
View on GitHub#!/usr/bin/env node
// Deterministic Step F-2 helper: render assets/scheduled_apex_template.apex
// with a config entry's JobName / CronExpression / ApexClassName. Emits
// the substituted snippet to stdout; non-zero exit on any validation
// failure with a single-line human-readable reason on stderr.
//
// Kept out of SKILL.md prose per authoring standard A9 — string escaping
// and cron/identifier validation are deterministic and belong in scripts/.
import { readFileSync } from 'node:fs';
const [, , jobName, cronExpression, apexClassName, templatePath] = process.argv;
if (!jobName || !cronExpression || !apexClassName || !templatePath) {
process.stderr.write(
'usage: node build-scheduled-apex.mjs <JobName> <CronExpression> <ApexClassName> <template-path>\n'
);
process.exit(2);
}
// Reject characters that break out of the Apex single-quoted string
// literal we substitute into. Newlines are a compile error; backslash
// is not a general escape in Apex string literals and lets a crafted
// value inject arbitrary Apex.
const forbidden = /[\r\n\\]/;
for (const [name, value] of [
['JobName', jobName],
['CronExpression', cronExpression],
['ApexClassName', apexClassName],
]) {
if (forbidden.test(value)) {
process.stderr.write(
`ERROR: ${name} contains a newline or backslash: ${JSON.stringify(value)}\n`
);
process.exit(2);
}
}
const cronFields = cronExpression.trim().split(/\s+/).length;
if (cronFields !== 6 && cronFields !== 7) {
process.stderr.write(
`ERROR: CronExpression must be 6 or 7 whitespace-separated fields; got ${cronFields}: ${JSON.stringify(cronExpression)}\n`
);
process.exit(2);
}
if (!/^[A-Za-z_][A-Za-z0-9_]*$/.test(apexClassName)) {
process.stderr.write(
`ERROR: ApexClassName must be a bare Apex identifier (letters, digits, underscore, not starting with a digit): ${JSON.stringify(apexClassName)}\n`
);
process.exit(2);
}
const escapeApexSingleQuoted = (s) => s.replaceAll("'", "\\'");
const template = readFileSync(templatePath, 'utf8');
const rendered = template
.replaceAll('{{JOB_NAME}}', escapeApexSingleQuoted(jobName))
.replaceAll('{{CRON_EXPRESSION}}', escapeApexSingleQuoted(cronExpression))
.replaceAll('{{APEX_CLASS_NAME}}', apexClassName);
process.stdout.write(rendered);
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 |