跳到主内容
智客 ZICQ

技能库 智客分类:运维与云 dx-org-manage

Dx Org Manage

用于 EXECUTE Salesforce org 操作即刻通过 sf CLI(这种技能运行它们,它不生成脚本): 创建抓取(从版本,定义文件,快照,或 Org 形状),列表/display/resume/去掉抓取 orgs,在浏览器中打开抓取. 触发器 : “ 创建抓取 ” , “ 从快照创建 ” , “ 删除抓取 ” , “ 打开我的 ” 。 不要用于切换默认org( 使用 dx- org- switch) , 部署元数据( 使用平台- metata- deploy) , 或创建/ 检查/ 列表/ 删除org快照( 使用 dx- org- snapshot- manage) .

5819 安装量

官方网址:skills.sh

技能介绍

先看中文介绍;官方 description 原文单独保留,不改写 SKILL.md。

做什么

用于 EXECUTE Salesforce org 操作即刻通过 sf CLI(这种技能运行它们,它不生成脚本): 创建抓取(从版本,定义文件,快照,或 Org 形状),列表/display/resume/去掉抓取 orgs,在浏览器中打开抓取. 触发器 : “ 创建抓取 ” , “ 从快照创建 ” , “ 删除抓取 ” , “ 打开我的 ” 。 不要用于切换默认org( 使用 dx- org- switch) , 部署元数据( 使用平台- metata- deploy) , 或创建/ 检查/ 列表/ 删除org快照( 使用 dx- org- snapshot- manage) .

何时用

官方 description 未单独写出 Use when。按规范,代理会在用户任务与这段 description 的关键词匹配时激活本技能。

代理如何加载

按 Agent Skills 渐进披露:启动时只加载 name 与 description(约 100 token);任务匹配后才读入整份 SKILL.md 正文;scripts/、references/、assets/ 仅在需要时再读。 本文件正文结构:MANDATORY: Follow these instructions exactly. Do NOT fall back to MCP tools.、Creating Scratch Orgs、Listing Scratch Orgs、Displaying an Org、Resuming Scratch Org Creation、Deleting a Scratch Org。 其中含规范建议的小节:输入输出示例。

文件分析

文件分析:除 SKILL.md 外,正文引用了 references/scratch-org-create.md、references/definition_file_options.md、references/scratch-org-operations.md、references/edition_types.md、references/opening-org.md,属于带资源的技能包,这些文件按需再读。

官方 description(原文)

Use 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).

MANDATORY: Follow these instructions exactly. Do NOT fall back to MCP tools.Creating Scratch OrgsListing Scratch OrgsDisplaying an OrgResuming Scratch Org CreationDeleting a Scratch OrgOpening OrgsReference File IndexExample Files

来源分类:skills.sh agent-skill

SKILL.md 与 Agent 调用

官方规范 ↗
name
dx-org-manage
description
Use 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).
  1. 发现技能客户端向 Agent 提供名称与描述目录。
  2. 匹配与调用用户指定或任务匹配后,载入 SKILL.md 指令。
  3. 按需加载按步骤读取参考文档、使用脚本与素材。
指令中引用的文件 · 5
  • references/scratch-org-create.md
  • references/definition_file_options.md
  • references/scratch-org-operations.md
  • references/edition_types.md
  • references/opening-org.md

以下路径提取自原文;文件是否齐全请以来源仓库中的完整目录为准。

具体调用语法与可用工具以目标 Agent 客户端为准。 查看调用机制说明 ↗

安装这个技能

Skills CLI ↗

先选择目标 Agent 和安装范围,保留技能包的附属文件,安装后检查客户端能否发现该技能。

该技能引用了附属文件,请从来源获取完整目录;仅复制 SKILL.md 可能缺少依赖。

交给 Agent 安装

复制安装指令给支持 Agent Skills 的代理,确认其中的目标目录与客户端匹配。

把 Agent Skill「dx-org-manage」安装到我的项目:SKILL.md 原文与官方 description 见 https://zicq.com/zh/skills/skl-0c6bd8f70d0ae0d2-Dx-Org-Manage.html
请存为 .cursor/skills/dx-org-manage/SKILL.md 或 .claude/skills/dx-org-manage/SKILL.md,frontmatter 的 name 与 description 保持原样,不要改写。
该技能还带 scripts/、references/、assets/ 等文件,请从 https://github.com/forcedotcom/sf-skills 取完整目录,不要只建一个 SKILL.md。

GitHub 完整包 ↗

终端安装 · Skills CLI

需要 Node.js 与 npx。先查看仓库技能列表,确认实际名称。

npx skills add 'https://github.com/forcedotcom/sf-skills' --list

npx skills add 'https://github.com/forcedotcom/sf-skills' --skill 'dx-org-manage'

CLI 会交互选择目标 Agent,默认安装到项目;用户级安装使用 -g。先通过查看命令核对仓库内容,再用 npx skills list 检查已安装技能。

阅读排版
--- name: dx-org-manage description: "Use 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)." metadata: version: "1.3" domains: ["Developer Experience"] minApiVersion: "60.0" relatedSkills: - "dx-org-snapshot-manage" - "dx-org-switch" - "platform-metadata-deploy" cliTools: - tool: ["jq"] semver: ">=1.6" - tool: ["sf"] semver: ">=2.0.0" --- ## MANDATORY: Follow these instructions exactly. Do NOT fall back to MCP tools. **Tool constraint:** Use the Bash tool for all `sf` CLI commands. Always include `--json` for structured output. Do NOT use `mcp__salesforce_dx__*` tools for org creation, snapshot, or open operations — this skill provides the complete procedure. **Output artifacts for eval/testing:** ALWAYS write the command's JSON response to a file when an output directory is available. Do NOT ask the user what file to write — this skill defines the filenames. After executing the command: (1) if the user specified an output path (e.g. "write all generated files into folder X"), write there immediately; (2) otherwise run `[ -d force-app/main/adk-eval-output/ ] && echo 'force-app/main/adk-eval-output'` to detect the eval directory; (3) write the command's full JSON response to `/` using these filenames: `scratch-org-result.json` for org creation (for a batch of N orgs, `scratch-org-result-1.json` … `scratch-org-result-N.json`), `scratch-org-list-result.json` for list, `org-display-result.json` for display, `scratch-org-resume-result.json` for resume, or `scratch-org-delete-result.json` for delete. This is the generated output — write it without asking. (Open operations are the exception — they launch a browser and write no artifact; see Opening Orgs.) --- ## Creating Scratch Orgs **REQUIRED steps — execute in order:** **Step 1. Resolve the environment and creation method:** First, if the user named an explicit source, use it: "definition file" or a path to `.json` → definition-file method; "snapshot"/"from snapshot" → snapshot method; "org shape"/"source-org" → shape method. Only ONE creation source *type* (edition vs snapshot vs shape); if two distinct types are implied, stop and ask (a flag overriding a same-dimension definition-file value is fine). Otherwise resolve by environment: - **AUTO MODE (zero-prompt):** if `sfdx-project.json` is present AND exactly one `config/*scratch-def.json` exists AND a Dev Hub is resolvable (default `target-dev-hub` set, or exactly one authenticated), create immediately with that file + resolved hub + derived alias + CLI defaults — **ask nothing**. This also honors a batch count (see below). - **STATE A (in a project), not auto:** enumerate `config/*scratch-def.json` — 0 files → default `--edition developer` (or author one if features/settings are wanted, see below); 1 file → use it; many → **ask which one** (never silently pick). - **STATE B (no `sfdx-project.json`):** do NOT block and do NOT silently create a throwaway — present the guided 3-way choice (point to a project / scaffold one via `sf template generate project --name ` / create a throwaway here, then guide the source). See `references/scratch-org-create.md`. **Batch — "create N scratch orgs":** there is no native count flag — loop the create command N times with N distinct aliases (`-1` … `-N`, each collision-guarded so it never re-points an existing org). Report each org and write one artifact per org. On a mid-loop Dev Hub limit error, surface the CLI's error unchanged and report which orgs already succeeded. **Definition-file authoring:** if features/settings are requested and no suitable file exists, author a new purpose-named definition file (seed-then-modify; documented fields only; no-clobber), show it, and create from it. **In a non-interactive/eval context, author the file AND proceed to create without waiting** for edit confirmation. Details in `references/scratch-org-create.md` and `references/definition_file_options.md`. **Step 2. Resolve the Dev Hub to a concrete value — then pass it explicitly.** Resolve it **once** to an actual username or alias and pass that exact value via `--target-dev-hub` on every command in Step 3. Resolution order: 1. **A Dev Hub the user named explicitly** → use it verbatim. 2. **Else the default:** the non-empty `result[0].value` from `sf config get target-dev-hub --json`. ```bash sf config get target-dev-hub --json ``` 3. **Else the single authenticated Dev Hub.** Run **this exact command** — do NOT hand-write your own filter. A Dev Hub can appear in **any** of the `sf org list` buckets (`devHubs`, `nonScratchOrgs`, `other`, `sandboxes`, `scratchOrgs`); a filter that checks only one bucket (e.g. only `.other[]`) misses it and makes you think no hub exists: ```bash sf org list --json | jq -r '[.result.devHubs[]?, .result.nonScratchOrgs[]?, .result.other[]?, .result.sandboxes[]?, .result.scratchOrgs[]?] | map(select(.isDevHub == true).username) | unique | .[]' ``` - **Exactly one** username printed → use it. - **Zero** printed → no hub is authenticated. **Do NOT run `sf org create` at all** — there is nothing to pass to `--target-dev-hub`, and any create attempt will fail. Instead, STOP here: advise `sf org login web --set-default-dev-hub`, and if an output directory is available write that advisory as the artifact. Do not proceed to Step 3. - **Two or more** → ask the user which one (do not pick arbitrarily). - **Never invent or guess a Dev Hub name.** Fabricating a placeholder alias (e.g. `eval-target`, `my-dev-hub`, `DevHub`) is the top eval failure — the CLI correctly rejects it with `NotADevHubError`. If the command above prints nothing, that means **no Dev Hub exists in this environment** — it does NOT mean you should substitute a name. There is no valid fallback name to invent: an unresolved hub is a hard stop, not a value to guess. Do NOT run `sf org create scratch` with a made-up `--target-dev-hub`, and do NOT run it with no `--target-dev-hub` flag either (that yields `NoDefaultDevHubError`). Stop and advise `sf org login web --set-default-dev-hub`. - The default `target-dev-hub` may be **directory-scoped** in some CLI setups (`sf config get` can return empty after a `cd`), which is why step 3's all-bucket `sf org list` check is the reliable fallback — it is not directory-scoped. - Do NOT proceed until a concrete Dev Hub value is resolved. **Step 3. Build and execute the command** based on method: **Definition file:** ```bash sf org create scratch --definition-file --target-dev-hub --alias --json ``` **Edition only:** ```bash sf org create scratch --edition developer --target-dev-hub --alias --json ``` **From snapshot:** ```bash sf org create scratch --snapshot --target-dev-hub --alias --json ``` **From org shape:** ```bash sf org create scratch --source-org --target-dev-hub --alias --json ``` `--source-org` takes the 15-character **source org ID** — the ID of the org the shape was captured from (a `00D…` org ID), NOT the `3SR…` shape record ID shown by `sf org list shape`. Pass the ID the user gives you through unchanged. If the CLI rejects it (e.g. `InvalidIdLengthError`, `InvalidPrefixError`), surface that error verbatim and stop — do NOT truncate, reformat, guess, or retry with a different ID. **Apply these flags when requested:** - `--duration-days ` — default 7, max 30 - `--set-default` — make this the default org - `--no-track-source` — disable source tracking (for CI/CD) **Step 4. MANDATORY - Run org list and write output (SUCCESS path only):** This step runs only when Step 3 created an org successfully. If Step 3 returned an error, SKIP this step and follow **Error handling** below instead. After the org is created, you MUST run this command: ```bash sf org list --json ``` Then: 1. Parse the JSON result and find the `scratchOrgs` array 2. Find the entry where `username` matches the username from Step 3's creation result 3. Extract that complete org object (it will include: alias, username, orgId, instanceUrl, loginUrl, isDefaultUsername, orgEdition, status, expirationDate, devHubUsername, and other fields the CLI returns). 4. Report to the user: - Created scratch org. - Alias: [alias from the org list entry] - Username: [username] - Org ID: [orgId] 5. If an output directory is available (per the output artifacts rule above), write that extracted org object to `/scratch-org-result.json` **as-is — this skill is a pass-through wrapper**. Write every field the CLI returns for that org; do NOT curate, whitelist, or drop non-secret fields (e.g. `instanceName`, `createdOrgInstance`, `signupUsername`, `orgName`, `edition` are non-secret metadata the CLI returns freely — keep them). The one thing you never emit is a live secret: `accessToken` and `sfdxAuthUrl` — and the CLI already redacts these in `--json` output (they arrive as `"[REDACTED] …"`), so simply preserve that redaction and never un-redact or re-derive the real value. Example: If `sf org list --json` returns `{"result": {"scratchOrgs": [{"alias": "feature-dev", "username": "[email protected]", "orgId": "00D...", ...}]}}`, write the inner org object `{"alias": "feature-dev", "username": "[email protected]", "orgId": "00D...", ...}` — the full object for that org — to the file. Write the extracted org-list entry (the resolved org record), NOT the raw creation-command response. Do NOT suggest verification steps to the user. **Error handling (Step 3 create failed — no org was created):** Surface the CLI's error output to the user **verbatim** (no rewriting, no retry, no editing the definition file). Do NOT run Step 4 (there is no org to list/extract). If an output directory is available, write the create command's **raw error JSON as-is** to `/scratch-org-result.json` — this is the command's response and is the output artifact for the failed run. (For a batch, write the error to the artifact for the org that failed, and still write the success entries for any orgs that already succeeded before the failure.) Then, where the CLI's error matches one of these, add the corresponding pointer: - "Snapshot not found" → suggest `sf org list snapshot --target-dev-hub ` - "No default Dev Hub" → advise `sf org login web --set-default-dev-hub` **When you need more detail:** - For the complete creation workflow (AUTO MODE, STATE A/B, batch, definition-file authoring) → load `references/scratch-org-create.md`; for list/display/resume/delete → load `references/scratch-org-operations.md` - For available features, settings, and definition file structure → load `references/definition_file_options.md` - For edition selection guidance and comparison → load `references/edition_types.md` - To create/check/list/delete the snapshot itself before referencing it here → use the `dx-org-snapshot-manage` skill --- ## Listing Scratch Orgs **Step 1. Execute:** ```bash sf org list --json ``` **Step 2. Report + write output:** default view = active scratch orgs from `result.scratchOrgs[]`; report alias / username / orgId / expiration per org. Document `--all` (include expired/deleted) and `--clean` as options, not the default. Write the `result.scratchOrgs[]` **array** to `/scratch-org-list-result.json` (per the output-artifacts rule). **Detail:** `references/scratch-org-operations.md`. --- ## Displaying an Org **Step 1. Execute:** ```bash sf org display --target-org --json ``` **Step 2. Report + write output:** report alias / username / orgId / instanceUrl / status / expiration. Write the **wrapped** `{status, result}` JSON to `/org-display-result.json` — do NOT unwrap. In any committed example/gold, `accessToken` and `sfdxAuthUrl` must be redacted (value begins with `[REDACTED]`). **`--verbose`:** never add it and never run it from this skill — it returns `sfdxAuthUrl` (a refresh token) into agent context. If the user needs the auth URL, tell them to run `sf org display --verbose` themselves in their own terminal. **Detail:** `references/scratch-org-operations.md`. --- ## Resuming Scratch Org Creation For a create that ran with `--async` or timed out (exit code 69). **Step 1. Execute:** ```bash sf org resume scratch --job-id --json ``` If the user gave an explicit `--job-id`, use it; otherwise default to `--use-most-recent`. If there is no recent job, surface the CLI's not-found result unchanged and point the user to `sf org list` — do not invent a job id. **Step 2. Write output:** write the command's JSON as-is to `/scratch-org-resume-result.json`. **Detail:** `references/scratch-org-operations.md`. --- ## Deleting a Scratch Org **Destructive — no undo.** **Step 1. Confirm before running.** Ask "Delete scratch org `X`?" and wait for confirmation, UNLESS the user already gave explicit deletion intent. If the target is the current default org, call that out in the confirmation (extra-guard). **Step 2. Execute** (only after confirmation): ```bash sf org delete scratch --target-org --no-prompt --json ``` `--no-prompt` is passed *after* the skill's own confirmation, so the agent isn't left waiting on the CLI's interactive prompt. **Step 3. Write output:** write the command's JSON as-is to `/scratch-org-delete-result.json`. **Detail:** `references/scratch-org-operations.md`. --- ## Opening Orgs **REQUIRED steps — execute in order:** **Browser launch only — never `--json`, never `--url-only`.** Open is the one operation in this skill that writes NO artifact. Plain `sf org open` launches the browser and logs the user in without ever printing a login URL, so no credential enters agent context or a file. Do NOT add `--json`: `sf org open --json` returns a **live login URL** in `result.url` (`/secur/frontdoor.jsp?otp=`/`sid=`) that is credential-equivalent — pulling it into context (even to redact it before writing) is the exact S1 leak the plain command avoids. Same reason `--url-only` is banned: if the user explicitly asks for the URL and not a browser (e.g. "URL only", "just give me the link", "headless/remote"), do NOT run it — tell them to run `sf org open --url-only` **themselves in their own terminal** (same handling as `sf org display --verbose`). A vague "open my org" just opens the browser. **Step 1. Match user request to command:** | User wants | Command | |-----------|---------| | Open default org | `sf org open` | | Open specific org | `sf org open --target-org ` | | Specific browser | `sf org open --browser chrome` | | Incognito mode | `sf org open --private` | | Navigate to path | `sf org open --path ''` | | Open metadata file | `sf org open --source-file ` | | URL only | **Do not run.** Tell the user to run `sf org open --url-only` locally — it returns a live login token the skill must not emit. | **Step 2. Execute the matching command using the Bash tool.** Plain `sf org open` prints nothing on success — that is expected. **Step 3. Report result:** Report to the user that the org (or path/metadata file) was opened in the browser. There is NO artifact to write for open operations — do not write `org-url-result.json` or any file, and do not add `--json` to produce one. If the command errors, surface it per Error handling below. **Error handling:** - "no target org" → advise `sf config set target-org ` - "auth error" → advise `sf org login web --alias ` **When you need more detail:** - For complete opening org workflow and all available flags → load `references/opening-org.md` --- ## Reference File Index Load these reference files for detailed guidance: | File | When to read | |------|-------------| | `references/scratch-org-create.md` | Creating scratch orgs (edition, definition file, snapshot, org shape), AUTO MODE, STATE A/B project handling, batch create, and definition-file authoring | | `references/scratch-org-operations.md` | Operating on existing orgs: list, display, resume, delete — plus shared lifecycle rules and troubleshooting | | `references/definition_file_options.md` | User needs to configure org features, settings, or advanced definition file options beyond basic org creation | | `references/edition_types.md` | User asks which edition to choose or needs to understand edition differences | | `references/opening-org.md` | User needs to navigate to specific setup paths, open metadata files, or use advanced open flags | To create/check/list/delete a snapshot itself (rather than just consuming one), use the `dx-org-snapshot-manage` skill. ## Example Files Example command outputs for testing and troubleshooting: | File | Purpose | |------|---------| | `examples/scratch-orgs/success_definition_file.json` | Successful scratch org creation using `--definition-file` | | `examples/scratch-orgs/success_edition.json` | Successful scratch org creation using `--edition developer` | | `examples/scratch-orgs/success_snapshot.json` | Successful scratch org creation using `--snapshot` | | `examples/scratch-orgs/success_shape.json` | Successful scratch org creation using `--source-org` (org shape) | | `examples/scratch-orgs/error_no_devhub.json` | Error when Dev Hub not authenticated | | `examples/scratch-orgs/error_timeout.json` | Timeout error during org creation (exit code 69) | | `examples/scratch-orgs/list_output.json` | `sf org list --json` output (active scratch orgs array) | | `examples/scratch-orgs/display_output.json` | `sf org display --json` output (wrapped, tokens redacted) | | `examples/scratch-orgs/resume_output.json` | `sf org resume scratch --json` output (completed org) | | `examples/scratch-orgs/delete_output.json` | `sf org delete scratch --json` output |

相关技能

运维与云

Docker Essentials

用于容器管理,图像操作,调试的基本道克命令和工作流程.

运维与云

Find Skills

从开放的代理技能生态系统中发现并安装技能. 使用时:(1)用户问"我如何做X",X可能拥有现有技能,(2)用户说"为X找到技能"或"是否为X有技能",(3)用户问"你能否做X",X是专门能力,(4)用户想扩展代理能力,(5)用户想搜索工具,模板,或工作流程,(6)用户提到他们希望…

运维与云

Azure Diagnostics

Azure上使用AppLens,AzureMonitor,资源健康,安全分型的调试Azure生产问题. 当:调试生产问题,故障解答应用服务,应用服务高CPU,应用服务部署失败,故障解答容器应用,故障解答功能,故障解答AKS,VM RDP,Linux SSH,VM黑屏幕,无法连接到…

运维与云

Azure Prepare

准备 azd 用于部署的Azure项目:为Azure开发者CLI(azd)工作流程生成azure.yaml,基础设施(Bicep/Terraform)和多克文件. 仅当用户明确想要使用 azd 作为部署工具时使用, 或项目已经有一个 azure 。 雅姆尔文件。 不使用: 非az…