Skip to content

forcedotcom/sf-skills / plugins/builder/dx-org-lifecycle/skills/automation-sandbox-post-copy-configure

automation-sandbox-post-copy-configure

Verified

Apply 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.

scripts/classify-patch-result.mjs

View on GitHub
#!/usr/bin/env node
// Deterministic HTTP-result classifier for automation-sandbox-post-copy-configure.
//
// Reads the outcome of a single Tooling API PATCH and classifies it as
// SUCCESS / FAILED. HTTP 204 with an empty body is success; every other code
// is failure. Encodes the classification that was formerly prose in SKILL.md
// (authoring standard A9). The RETRY-once policy stays as inline bash in the
// caller (a `for attempt in 1 2; do ... && break; done` loop) — this script
// is invoked on each attempt to decide whether that attempt succeeded.
//
// Usage:
//   node classify-patch-result.mjs <httpCode> [responseBodyFile]
//
// Emits to stdout (single JSON object):
//   { "status": "SUCCESS", "http": 204 }
//   { "status": "FAILED",  "http": <code>, "error": "<extracted message>" }
//
// Exit code 0 on SUCCESS; exit code 2 on FAILED (so a bash caller can
// `if node classify-patch-result.mjs "$code" body.json; then …; else …; fi`).
// Exit code 1 on input error (missing http code).

import { existsSync, readFileSync } from 'node:fs';

function fail(msg) {
  process.stderr.write(`classify-patch-result: ${msg}\n`);
  process.exit(1);
}

const [, , httpArg, bodyPath] = process.argv;
if (!httpArg) fail('missing http code argument');

const http = Number.parseInt(httpArg, 10);
if (!Number.isInteger(http) || http < 100 || http > 599) {
  fail(`invalid http code ${JSON.stringify(httpArg)}`);
}

let body = '';
let bodyReadFailed = false;
if (bodyPath) {
  if (!existsSync(bodyPath)) {
    bodyReadFailed = true;
  } else {
    try {
      body = readFileSync(bodyPath, 'utf-8');
    } catch {
      bodyReadFailed = true;
    }
  }
}
const trimmedBody = body.trim();

// Success requires HTTP 204 AND (either no bodyPath supplied at all, or the
// supplied path was readable and empty). A bodyPath that was supplied but
// missing/unreadable indicates the caller's response-capture step failed —
// must not short-circuit to SUCCESS, since a captured empty body is not the
// same signal as a body we could not read.
if (http === 204 && trimmedBody === '' && !bodyReadFailed) {
  process.stdout.write(JSON.stringify({ status: 'SUCCESS', http: 204 }) + '\n');
  process.exit(0);
}

let errorMessage = trimmedBody;
try {
  const parsed = JSON.parse(body);
  if (Array.isArray(parsed) && parsed[0]?.message) {
    errorMessage = String(parsed[0].message);
  } else if (parsed?.message) {
    errorMessage = String(parsed.message);
  } else if (parsed?.error?.message) {
    errorMessage = String(parsed.error.message);
  }
} catch {
  /* body was not JSON — surface raw text */
}

if (errorMessage.length > 800) errorMessage = errorMessage.slice(0, 800) + '…';
if (bodyReadFailed) {
  errorMessage = `response body path ${bodyPath} was supplied but could not be read (missing or unreadable) — capture step likely failed`;
} else if (!errorMessage) {
  errorMessage = `HTTP ${http} with no body`;
} else if (http === 204) {
  errorMessage = `HTTP 204 with unexpected non-empty body: ${errorMessage}`;
}

process.stdout.write(
  JSON.stringify({ status: 'FAILED', http, error: errorMessage }) + '\n',
);
process.exit(2);
writing-skillsobra/superpowersUse when creating new skills, editing existing skills, or verifying skills work before deploymentStars: 322kUpdated Claude CodeCodexVerifiedInstall
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: 198kUpdated Claude CodeCodexVerifiedInstall
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: 119kUpdated Claude CodeCodexVerifiedInstall
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: 118kUpdated Claude CodeCodexVerifiedInstall