/sf-devops:dx-scratch-def-configurefrom Salesforce — DevOps & Orgs
Drafts or refines schema-valid Salesforce DX scratch-def JSON from natural language. Writes config/<purpose>-scratch-def.json under an existing SF DX project. Previews changes before applying.
Ships in Salesforce — DevOps & Orgs. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them; scripts run unread.
This skill writes config/<purpose>-scratch-def.json (default
config/project-scratch-def.json) from a product ask, or refines an existing
file in place. It does not create the org. Never mkdir config.
Every turn writes report.md on disk. Chat is not a substitute. Then exactly
one of these happens:
| Mode | When | What the user gets |
|---|---|---|
| Stop | Trial, shape-only, shape/snapshot + features with no id, missing project, unclear ask (generate or refine), batch, other-user path, invalid existing JSON, multi-def without a pick | The next step, named. No scratch-def file write. |
| Preview | First generate (including just-write / skip-preview), a revision, or a refine patch, and the project already has config/ | A draft (generate) or diff card (refine) + Write file?. Nothing is written yet. |
| Write | They accept this draft unchanged (this preview, as drafted). This turn may restate it; no prior chat required. | The file. Name dx-org-manage. |
First matching row wins. Copy that recipe into report.md.
Never Skill() another skill. Never run sf. Name the next skill in report.md only.
STOP: write report.md on disk. Chat is not a substitute. Skip the helper
and skip scratch-def JSON.
Consent is accepting this draft, unchanged — not a closed list of yes-words. Accepting this draft (this preview, as drafted) and asking to write is consent: apply immediately; reconstruct if they restate the same draft; do not ask Write file? again; do not run preview. No prior chat required. Phrases like "Looks good, write it", "write it", "yes write", "apply it", "as we drafted", or "as we previewed" with the same edition/features/settings are Write — even when this turn restates the draft or names the refine delta that was already previewed. That is not a first generate and not another refine preview. A first generate is Preview only when they ask to create/skip-preview without accepting a prior draft (no "looks good" / "as we drafted|previewed" consent). A different edition, product, or setting (a real change) is another preview. Refine is a patch on the existing file, not “this turn’s wording replaces the whole draft” (that generate-revision path still exists for in-chat drafts).
| If the ask is… | Then |
|---|---|
| Shape or snapshot lifecycle alone (no features to layer), including "use my org shape only" or "refine my shape" | STOP. Name dx-org-shape-manage or dx-org-snapshot-manage. |
| Trial / trialforce / "trial org definition" / "refine my trial config" | STOP. Name platform-trial-org-create. Do not skip this skill. |
| Underspecified generate ("I need a scratch def") — no edition and no products/clouds/features | STOP. Ask the two questions below. If config/ is also missing, include the Missing-project question. Do not invent an edition. |
| Underspecified refine ("Update my def" / "refine my scratch def") — no features, edition, or settings delta | STOP. Ask: features, edition, or settings? (Not agents — out of scope.) |
| Another user's laptop / no readable workspace path | STOP. Cannot read another user's machine. Ask for a readable workspace path. |
| Batch generation or batch refine (multiple def files in one turn) | STOP. Batch is not supported yet — offer to make or refine the first one. |
WRITE-eligible (imperative generate with edition and/or products/features, refine with a clear delta, or shape/snapshot + features) but cwd has no config/ | STOP. Ask the Missing-project question (folder that already contains config/). Do not create config/. |
Refine target resolves to more than one config/*scratch-def.json (ignore *.bak) and the user did not name which | STOP. List the paths and ask which file to patch. Do not pick silently. |
| Refine target exists but is invalid JSON | STOP. Report the parse error. Do not patch garbage. |
Shape/snapshot + features, root resolved, user omitted sourceOrg or snapshot id/name | STOP. Write report.md on disk. Ask for the id. Name dx-org-shape-manage / dx-org-snapshot-manage to list. Resume this skill with the id. |
| User consents that this preview is the draft/delta they want written, unchanged (this preview, as drafted) — including "Looks good, write it" / "as we drafted | previewed" restating the same generate draft or the already-previewed refine delta — and root resolved |
| User revises the draft — this turn names a different edition, products, settings, or other edits, including a write request that also changes the draft, and root resolved | This turn's wording is the full draft (in-chat generate revision). Preview it. Do not require a prior file or earlier chat. Do not apply yet. |
| Refine with a clear delta (add/remove features, change edition, add/remove settings), root resolved, target file chosen, and this turn is not consent to write | Read base → build structured delta only → Preview the diff card. Do not apply yet. Removing a feature does not silently delete unrelated settings — show orphaned required settings and ask before deleting a required pair. |
| Shape/snapshot + features, root resolved, user supplied the id, and this turn is not consent to write | Preview it. Do not apply yet. |
| Imperative generate that names edition and/or products/features (one def), including a first-turn write or skip-preview ask without accepting a prior draft, root resolved, and this turn is not consent to write | Preview it. Do not apply yet. |
Generate underspecified questions: (1) what are you building/demoing? (2) which products/clouds?
Refine underspecified question: What would you like to change — features, edition, or settings?
Missing-project question: What is the path to your Salesforce DX project (the directory that already contains a config folder)?
Show the confirmation card (see examples/confirm-card.md, or
artifacts/examples/confirm-card.md when packaged). Put schema-valid JSON
in chat alongside report.md (never inside it): the helper document. Ask
Write file? in report.md. Do not apply yet. Do not name dx-org-manage
until they consent to write.
If more than one config/*scratch-def.json exists (ignore *.bak) and the user
did not name which, the CRITICAL multi-def STOP wins — ask which file before
any default. Otherwise resolve the target (default
config/project-scratch-def.json). Read it for context. Build a structured
delta only for this turn's change — do not rebuild or send the full
scratch-def. The helper loads the base as-is (copy-through), applies the
delta, catalogs only newly added features, and returns a whole-file diff.
Pass the delta on stdin with --base:
python3 "$HELPER" preview --base config/project-scratch-def.json <<'EOF'
{"addFeatures":["Communities"]}
EOF
Delta keys (only those that apply): addFeatures, removeFeatures (match by
base name), setEdition, set / unset (top-level scalars such as
orgName), setSettings (nested object and/or dotted leaf keys — helper
expands dotted keys), unsetSettings (dotted path strings; category match is
case-insensitive), setObjectSettings / unsetObjectSettings. Same-base
quantity change: addFeatures with the new Feature:N token (replaces the
prior quantity).
Show the diff card from helper diff (added/removed features,
featuresQuantityChanged, edition / fields / objectSettings /
settings changes, orphaned required settings). Optionally keep preview
baseSha256 for the write turn. Put schema-valid resulting JSON
(document) in chat. Ask Write file?. Do not apply yet. If
settingsOrphanedByRemovedFeatures is non-empty, ask whether to delete those
settings before writing (add matching unsetSettings on the next preview if
they consent — use the exact orphan path from the card).
One apply only — no preview, no second card, no Write file?. Reconstruct
if this turn restates the same draft or delta (no in-context copy). --out config/<purpose>-scratch-def.json
(default config/project-scratch-def.json). For refine, pass the same --base,
--out equal to --base, the unchanged delta JSON, and optionally
--base-sha256 from that preview when you have it (refuses if the base file
changed). On success it copies the prior file to config/<name>.bak (one
rolling backup for compare/restore), then overwrites the active path:
python3 "$HELPER" apply --base config/project-scratch-def.json \
--out config/project-scratch-def.json <<'EOF'
{"addFeatures":["Communities"]}
EOF
Report the path + backup path + a one-line summary (refine: additions and removals) + the final written JSON in chat. Name dx-org-manage (dx-org-devhub-configure if Dev Hub is off).
Read examples/report-recipes.md (or artifacts/examples/report-recipes.md
when packaged) and copy the matching recipe. First line: # Scratch Def Report.
Plain prose — never the backtick character. Spell next-skill names as plain
words (dx-org-shape-manage, platform-trial-org-create).
Omit cache date, shipped-snapshot, jsonschema, and dropped-token notes from
report.md unless the helper warned this turn.
Run the CRITICAL first gate. If it is STOP, write report.md and stop here.
On WRITE-eligible asks, resolve the SF DX project root before any helper:
cwd with config/ is the root; otherwise the Missing-config STOP row.
Resolve the helper by absolute path:
HELPER="<skill_dir>/scripts/lib_scratch_def.py"
[ -f "$HELPER" ] || HELPER="<skill_dir>/artifacts/scripts/lib_scratch_def.py"
One helper call per turn from the SF DX project root. Keep the draft or
refine delta in chat/tool context. Pass it on stdin with a quoted heredoc
(<<'EOF'). Invoke python3 when that binary exists; otherwise python.
python3 "$HELPER" preview <<'EOF'
{"edition":"Developer","features":["API"]}
EOF
python3 "$HELPER" preview --base config/<purpose>-scratch-def.json <<'EOF'
{"addFeatures":["Communities"]}
EOF
python3 "$HELPER" apply --out config/<purpose>-scratch-def.json <<'EOF'
…same draft JSON…
EOF
Refine consent: same apply with --base, the same delta JSON, and
--out equal to --base (writes .bak then overwrites). Optionally pass
--base-sha256 from that preview. (default
config/project-scratch-def.json).
If the helper warns jsonschema not installed, ask the user to install
(python3 -m pip install jsonschema or python -m pip install jsonschema).
On success, retry this same helper call once. If they decline or install fails,
keep this result — do not block preview/apply.
Do not Read references/features.json or settings-map.json into chat.
Do not Grep them to pick extra tokens.Generate: put the user's product, cloud, and feature words in the features
array as-is (for example Revenue Cloud, not a guessed token list). Refine:
put those words in addFeatures / removeFeatures on the delta only. Use
lower camelCase settings keys. The helper maps each new string to at most
one PUBLIC token and enriches required settings for additions only. Do not
add catalog tokens the user did not name. Do not rebuild the full file.
Write report.md on disk. Put chat JSON and the card per Preview / Write.
Unknown token: drop it and warn in report.md. Ambiguous phrase ties (for example Sales Cloud matching more than one catalog blurb): drop and warn with candidates — do not silently pick the first.
report.md exists on disk and matches a recipeapply; file + final JSON in chat; no Write file?; name dx-org-manageCatalog: each helper invocation loads maps into process memory from:
cache/public-config-values-YYYY-MM-DD.json if usable.cache/. report.md: that date
(only when this fallback fired).references/features.json + settings-map.json
(artifacts/references/ when packaged). Backup. report.md: shipped snapshot
(only when this fallback fired).Every helper call (preview and apply) may write today's cache file under
cache/ before the user confirms the scratch-def. Add cache/ to .gitignore.
Treat cache JSON as generated. Delete is safe: the next call refetches if
today's file is missing. Feature tokens come from this catalog.
examples/confirm-card.md (opens in a new tab)examples/report-recipes.md (opens in a new tab)references/features.json (opens in a new tab)references/project-scratch-def.schema.json (opens in a new tab)references/settings-map.json (opens in a new tab)scripts/lib_scratch_def.py (opens in a new tab)scripts/requirements.txt (opens in a new tab)scripts/scrape_config_values.py (opens in a new tab)What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
3 plugins ship this exact skill · first indexed Nov 24, 2026
27 skills in this plugin
/automation-sandbox-post-copy-config-generateGenerates the JSON config file that the Salesforce sandbox post-copy automation tool consumes, from a customer SOP in any format (PDF, xlsx, csv, JSON, docx, Markdown, plain text, or a screenshot of an endpoint table). Use when the user asks to create, build, generate, produce, or convert a post-copy or post-refresh automation config — turning a sandbox-refresh SOP into a JSON array of OutboundMessages (OBM), RemoteSiteSettings, ScheduledApex, and Flows entries with ConfigurationName, Label, Fields, IsActive, and ExecutionOrder. Also trigger for phrasings like "post-copy config", "post-refresh automation JSON", "update the outbound message (OBM) endpoints after refresh", "convert this SOP to config", "remote site settings JSON", "refresh planner to JSON", or "sandbox refresh config". DO NOT TRIGGER when: user wants to deploy the generated config to an org (use platform-metadata-deploy), or apply/execute/run/dry-run the post-copy automation JSON against a sandbox (use automation-sandbox-post-copy-configure)./automation-sandbox-post-copy-configureApply 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./dx-app-analytics-queryISV App Analytics metadata types — AppAnalyticsQueryRequest and AppAnalyticsSettings. Use this skill when the user asks about retrieving managed package usage data, configuring App Analytics simulation mode, querying subscriber snapshots, or understanding the AppAnalyticsQueryRequest lifecycle (New → Pending → Complete → Expired). TRIGGER when: user mentions App Analytics, AppAnalyticsQueryRequest, AppAnalyticsSettings, package usage data, subscriber analytics, ISV analytics, or simulation mode for app analytics. DO NOT TRIGGER when: the task is about standard Salesforce reports/dashboards (use reporting skills), custom SOQL on Account/Contact (use querying-soql), or Data Cloud query/search (use retrieving-datacloud)./dx-devops-conflict-resolveUse this skill to diagnose and resolve what blocks a DevOps Center promotion of a work item's feature branch: Git merge conflicts and deployment failures. DevOps Center is Git-backed, so overlapping metadata changes surface as merge conflicts against the target stage branch, resolved with git (detect, resolve markers, commit, push). Deploy failures often cite a missing dependency a full promotion can fix when the component already exists on the branch. TRIGGER when the user wants to check a work item for conflicts before promoting, resolve merge conflicts or leftover conflict markers in metadata files (.xml, .object-meta.xml, .cls), reconcile a feature branch with its target stage branch, or diagnose why a DevOps Center promotion or deployment failed and whether a full promotion or a missing-dependency fix will resolve it. DO NOT TRIGGER for running the promotion itself (use dx-devops-promote), creating or updating work items (use dx-devops-work-item-manage), or deploying metadata directly to an org./dx-devops-pipeline-manageUse this skill to manage the full lifecycle of a DevOps Center pipeline — list all pipelines, get a single pipeline's details, create a new pipeline linked to a Git repository, add or remove stages, rename a stage, add or remove Salesforce environments on stages, attach or detach projects, and activate or deactivate the pipeline. Invoke when the user wants to set up a release pipeline, wire promotion stages across integration, UAT, staging, and production orgs, connect environments to stages, attach a project, or activate a continuous delivery pipeline. Uses sf devops pipeline and sf devops stage commands with --json output. DO NOT TRIGGER for work-item lifecycle, promotion or deployment execution, conflict detection, or standalone project creation (separate skills)./dx-devops-project-manageUse to list, view, or manage DevOps Center projects in a Salesforce org — show all projects, create a project, or update an existing project's name, description, or active status. Invoke to run sf devops project list on any listing request, or to create a project, set up a new pipeline foundation, initialize DevOps Center for a feature, update project settings, or activate/deactivate (archive) a project. Consolidates sf devops project list/create/update. DO NOT TRIGGER for work item, pipeline, promotion, or conflict operations — those are separate skills.npx claudepluginhub reej-consulting/reej-sf-skills --plugin sf-devopsOther plugins' skills for the same job