forcedotcom/sf-skills / plugins/builder/salesforce-development/skills/dx-org-manage
dx-org-manage
VerifiedUse to EXECUTE Salesforce org operations immediately via the sf CLI (this skill runs them, it does NOT generate scripts): create scratch orgs (from edition, definition file, snapshot, or org shape), list/display/resume/delete scratch orgs, open orgs in browser. Trigger: 'create scratch org', 'create org from snapshot', 'delete scratch org', 'open my org'. Do NOT use for switching the default org (use dx-org-switch), deploying metadata (use platform-metadata-deploy), or creating/checking/listing/deleting org snapshots (use dx-org-snapshot-manage).
assets/derive-alias.sh
View on GitHub#!/usr/bin/env bash
# derive-alias.sh — deterministic scratch-org alias derivation + collision guard.
#
# Slugifies a base name and guarantees the result does not collide with an
# existing alias. `sf org create scratch` does NOT reject a reused alias — it
# silently re-points the alias to the new org, so the old org loses its handle.
# This script guards against that by appending -2, -3, … until the alias is free.
#
# Usage:
# derive-alias.sh <base-name> [<count>]
#
# <base-name> Raw name to slugify (e.g. a package-directory name or cwd
# basename, or a user-supplied alias). Required.
# <count> Optional. When >1, emits <count> distinct collision-guarded
# aliases (base-1 … base-N) for a batch create, one per line.
# Omit or 1 → emit a single collision-guarded alias.
#
# Output: the final alias(es), one per line, to stdout. Nothing else.
#
# Determinism: given the same base name and the same set of existing aliases,
# the output is always identical. The only external input is `sf org list`,
# which reflects live org state (the collision set) — that is intentional.
set -euo pipefail
if [ "$#" -lt 1 ] || [ -z "${1:-}" ]; then
echo "usage: derive-alias.sh <base-name> [<count>]" >&2
exit 2
fi
base_raw="$1"
count="${2:-1}"
# Slugify: lowercase, non-alphanumerics → hyphens, collapse repeats, trim ends.
slugify() {
printf '%s' "$1" \
| tr '[:upper:]' '[:lower:]' \
| sed -E 's/[^a-z0-9]+/-/g; s/-+/-/g; s/^-+//; s/-+$//'
}
base="$(slugify "$base_raw")"
if [ -z "$base" ]; then
echo "error: base name '$base_raw' slugifies to empty; provide an explicit alias" >&2
exit 3
fi
# Collect existing aliases once. Fail CLOSED: the collision guard is the whole
# point of this script, so if we cannot reliably read the existing alias set we
# must NOT proceed with an empty set (that would emit an alias that may already
# exist, and `sf org create scratch` silently re-points a reused alias to the
# new org). Require jq, and treat a failed `sf org list` as a hard error.
if ! command -v jq >/dev/null 2>&1; then
echo "error: jq is required for the alias collision check but was not found on PATH" >&2
exit 4
fi
org_list_json="$(sf org list --json 2>/dev/null)" || {
echo "error: 'sf org list --json' failed; cannot verify alias collisions — refusing to derive an unguarded alias" >&2
exit 5
}
existing="$(printf '%s' "$org_list_json" \
| jq -r '[.result.scratchOrgs[]?, .result.nonScratchOrgs[]?, .result.other[]?]
| .[]? | .alias // empty')" || {
echo "error: could not parse 'sf org list --json' output; refusing to derive an unguarded alias" >&2
exit 5
}
is_taken() {
printf '%s\n' "$existing" | grep -Fxq "$1"
}
# Produce one collision-guarded alias from a candidate stem.
guarded() {
local candidate="$1"
if ! is_taken "$candidate"; then
printf '%s\n' "$candidate"
return
fi
local n=2
while is_taken "${candidate}-${n}"; do
n=$((n + 1))
done
printf '%s\n' "${candidate}-${n}"
}
if [ "$count" -le 1 ]; then
guarded "$base"
else
# Batch: base-1 … base-N, each independently collision-guarded.
i=1
while [ "$i" -le "$count" ]; do
guarded "${base}-${i}"
i=$((i + 1))
done
fi
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 |