Dx Org Devhub Configure 标志

Dx Org Devhub Configure

组织热门
forcedotcom
dx-org-devhub-configure

使用 Salesforce CLI(sf)在 Salesforce 组织中启用 Dev Hub,并查看其临时组织配额。用户希望开启或启用 Dev Hub、设置组织以创建临时组织或第二代(2GP)及解锁软件包、检查 Dev Hub 是否已启用、查看可创建的临时组织数量(Active 和 Daily 临时组织限额及剩余配额)、配置 Dev Hub 偏好设置(例如打包、组织形状导出或临时组织快照),或列出从 Dev Hub 创建的活动临时组织时,使用此技能。启用操作会部署 enableScratchOrgManagementPref 设置,且不可撤销;需要系统管理员权限(ModifyAllData 或 ModifyMetadata),并且无法在沙盒中执行。以下情况不要触发:创建或删除单个临时组织、切换默认组织(使用 dx-org-switch),或查询试用期或组织到期日期(使用 dx-org-trial-expiration-check)。

Add to TypingMind

概览

发布者forcedotcom
代码仓库sf-skills
技能名称dx-org-devhub-configure
星标数
1.1K
复刻数
351
附带文件
3
许可协议Apache-2.0
链接
  • Markdown 格式的指令

    模型按需加载 SKILL.md 文件,因此只有在请求确实与该技能匹配时才会消耗 Token。

  • 兼容任何大语言模型

    AI 技能采用纯 Markdown,而非特定提供商的代码,因此可搭配 GPT、Claude、Gemini、Grok 或本地模型使用。

  • 3 个附带文件

    模型执行任务时可读取的脚本、模板和参考资料。这些文件为只读文件,绝不会被执行。

  • 开源

    由 forcedotcom 发布于 GitHub。请在安装前查看技能的源文件。

安装

在 TypingMind 中安装 Dx Org Devhub Configure AI 技能,即可搭配任意大语言模型使用;也可以将其放入其他支持读取 SKILL.md 的智能体中。

1

安装到 TypingMind

TypingMind 可直接从 GitHub 文件夹安装技能:读取 SKILL.md,打包资源文件,并将结果保存在本地。

  1. 打开应用,前往“插件 → 技能”。
  2. 选择“从 GitHub 安装”。
  3. 粘贴下方的技能文件夹 URL 并确认。
    https://github.com/forcedotcom/sf-skills/tree/main/plugins/builder/dx-org-lifecycle/skills/dx-org-devhub-configure
  4. 请在每个需要使用该技能的聊天中启用它。
依次选择“插件 → 技能 → 添加技能 → 从 GitHub URL 导入”,然后粘贴文件夹 URL 并点击“继续”。
2

安装到其他智能体

任何支持 Agent Skills 格式的智能体都可以使用此技能,只需将文件夹复制到该智能体的技能目录中。

Claude Code — .claude/skills
git clone --depth 1 https://github.com/forcedotcom/sf-skills.git /tmp/sf-skills
mkdir -p .claude/skills
cp -r /tmp/sf-skills/plugins/builder/dx-org-lifecycle/skills/dx-org-devhub-configure .claude/skills/dx-org-devhub-configure
复制后,请重启 Claude Code,以加载新技能。

在 TypingMind 中使用此技能

在任意 TypingMind 聊天中启用 Dx Org Devhub Configure,后续即可交由模型处理。技能的名称和描述会放在系统提示词中,一旦请求匹配,模型就会自动加载完整指令,无需您手动调用,且在实际使用前不会消耗 Token。

一旦请求与技能匹配,模型就会自动加载 Dx Org Devhub Configure。

兼容任何 AI 模型

AI 技能是纯 Markdown 指令,而非特定提供商的代码,因此 Dx Org Devhub Configure 不局限于最初适配的模型。只需在 TypingMind 中安装一次,即可搭配 GPT-5、Claude、Gemini、Grok、DeepSeek、Mistral、Llama 或您自行运行的本地模型使用,全程使用您自己的 API 密钥。

  • 仅在需要时加载

    系统提示词中仅包含技能名称和描述。首次遇到匹配的请求时才会加载完整指令,因此技能未使用时,这些指令不会消耗 Token。

  • 在聊天中切换模型

    技能是指令而非代码,因此切换模型不会导致技能失效,新模型会读取同一个 SKILL.md。

技能指令

这是模型会加载的 SKILL.md 内容。请在安装前阅读,因为技能就是模型将遵循的指令。

Enable Dev Hub & View Scratch Org Allocation

Enable Dev Hub on a Salesforce org, verify whether it is already on, and see the org's scratch org allocation (Active and Daily limits and how many remain) — for the default org or a named org. The skill can also configure Dev Hub sub-preferences (packaging, org shape export, scratch org snapshots) and list the active scratch orgs created from a Dev Hub.

Dev Hub is the org feature that lets you create and manage scratch orgs and second-generation (2GP) / unlocked packages.

When to use

Trigger on requests like:

  • "Enable Dev Hub" / "Turn on Dev Hub" / "Set up this org for scratch orgs."
  • "Is Dev Hub enabled on my org?" / "Check if Dev Hub is on."
  • "How many scratch orgs can I create?" / "What's my scratch org allocation / limit?" / "How many scratch orgs do I have left?"
  • "Turn on packaging / 2GP / unlocked packages" / "Enable org shape export" / "Enable scratch org snapshots" (Dev Hub sub-preferences).
  • "List the scratch orgs on my Dev Hub."

When NOT to use

Do not trigger this skill for:

  • Creating or deleting an individual scratch org — that is sf org create scratch / sf org delete scratch, a different workflow. This skill enables the Dev Hub feature and reports allocation; it does not create scratch orgs.
  • Switching the default/active org — use dx-org-switch.
  • Trial or org expiration dates ("when does my org expire") — use dx-org-trial-expiration-check.

How Dev Hub enablement is determined

The standard object ScratchOrgInfo is provisioned and becomes queryable only when Dev Hub is enabled. So a successful SELECT COUNT() FROM ScratchOrgInfo means Dev Hub is ON; an INVALID_TYPE error means it is OFF. This is the reliable signal.

Do not infer enablement from sf org list limits alone: it reports ActiveScratchOrgs / DailyScratchOrgs rows even on orgs where Dev Hub is off, so limits show allocation but not enablement.

How enabling works (important)

  • The Dev Hub master switch is the deployable Metadata API field DevHubSettings.enableScratchOrgManagementPref. There is no enableDevHub field and no dedicated sf command to turn it on — deploying this setting is exactly what the Setup toggle does.
  • Enabling is irreversible — once on, Dev Hub cannot be turned off.
  • Requires a user with ModifyAllData or ModifyMetadata (a System Administrator has these). A user without them gets INSUFFICIENT_ACCESS.
  • Cannot be enabled in a sandbox, or in an org that has a registered namespace.
  • Available in Developer, Enterprise, Performance, Unlimited, and trial editions.

Steps

  1. CRITICAL: Run the bundled helper script, which handles Dev Hub detection, the enablement deploy (with a safe dry-run default), allocation math, and structured output, and works on macOS and Linux. Always invoke it by absolute path from the skill directory — never ./scripts/, which resolves against the user's current directory and will either run the wrong script or fail. The script self-checks this: if $0 is not absolute it exits with a usage error, so pass the full path to <skill_dir> (the directory containing this SKILL.md).

    bash
    bash "<skill_dir>/scripts/devhub.sh" <alias-or-username>            # status: on? + allocation
    bash "<skill_dir>/scripts/devhub.sh"                               # default org (target-org)
    bash "<skill_dir>/scripts/devhub.sh" <org> --allocation           # allocation only
    bash "<skill_dir>/scripts/devhub.sh" <org> --enable               # validate enabling (dry run)
    bash "<skill_dir>/scripts/devhub.sh" <org> --enable --apply       # actually enable (irreversible)
    bash "<skill_dir>/scripts/devhub.sh" <org> --list-scratch         # list active scratch orgs
    bash "<skill_dir>/scripts/devhub.sh" <alias> --instance-url <url> --enable --apply  # log in first, then enable
    bash "<skill_dir>/scripts/devhub.sh" <url>                        # bare instance URL: log in to it

    When the user supplies an instance URL (their My Domain, sandbox, or pre-release/scratch login URL — e.g. https://my-domain.my.salesforce.com), pass that exact URL with --instance-url <url> — the script accepts Salesforce-owned hostnames and logs in with sf org login web --instance-url <url> and then continues. A bare URL positional is accepted as shorthand for the same thing.

    <skill_dir> is the absolute path to the directory containing this SKILL.md.

  2. For enablement, default to a dry run first. Run --enable (no --apply) to validate the deploy, then relay the result. Because enabling is irreversible, only run --enable --apply when the user has clearly asked to actually enable Dev Hub. Applied operations require an explicit org alias or username; the script refuses to mutate an implicit default org. If the deploy is rejected for permissions, surface the Setup-UI fallback it prints.

  3. Relay the script output. When an org can't be queried, surface the sf org login web command the script prints so the user can authenticate. Pick optional flags based on the request (see below): --allocation for limits only, --list-scratch to enumerate scratch orgs, --packaging / --snapshots / --shape to turn on sub-preferences, --json for automation.

Before you finish

Verify these before returning your answer:

  • CRITICAL: Invoked the helper via its absolute path (bash "<skill_dir>/scripts/devhub.sh" …), never ./scripts/ (the script rejects a non-absolute $0).
  • Did not run --apply unless the user clearly asked to actually enable Dev Hub or deploy a preference — enabling is irreversible.
  • Relayed the script's own output (status/allocation or the login/Setup-UI guidance it printed), rather than substituting a hand-written answer.

Options

FlagPurpose
--allocation, -AShow only the scratch org allocation (Active/Daily).
--list-scratch, -lList active scratch orgs created from this Dev Hub.
--enable, -eEnable Dev Hub (deploys enableScratchOrgManagementPref=true). Dry run unless --apply.
--configure, -cConfigure sub-preferences without (re)enabling the master switch. Pair with a pref flag.
--packagingenablePackaging2=true (Unlocked + 2GP packages).
--snapshotsenableScratchOrgSnapshotPref=true.
--shapeenableShapeExportPref=true.
--scratch-managementenableScratchOrgManagementPref=true (the Dev Hub switch).
--pref KEY=VALUEAny DevHubSettings sub-pref (KEY starts with enable, VALUE true/false). Repeatable.
--applyActually deploy to the explicit org argument. Default for --enable/--configure is a validate-only dry run.
--loginAuthenticate an org first via sf org login web (opens a browser), then run the action.
--instance-url <url>Log in to a specific instance (My Domain, sandbox, or pre-release/scratch instance) with sf org login web --instance-url <url>. Implies --login.
--jsonEmit machine-readable JSON.
--fail-if-disabledExit 3 if Dev Hub is not enabled (CI/cron gate).
--help, -hShow usage.

--enable may be combined with sub-pref flags to enable and configure at once (e.g. --enable --packaging --apply). If omitted, the org defaults to target-org, then target-dev-hub.

Output examples

The script prints the authoritative output at runtime. If you need to calibrate what an enabled-vs-disabled status transcript looks like (including the allocation table and the enable/Setup-UI guidance), read examples/status-output.md — otherwise skip it to keep this workflow lean.

Structured output for automation (--json)

Use --json in any mode for machine-readable output (no prose). Status returns devHubEnabled, status, and an allocation object; enablement returns success, applied, and devHubVerifiedState. Deterministic, no LLM needed.

bash
bash "<skill_dir>/scripts/devhub.sh" my-devhub --json
# {"org":"my-devhub","devHubEnabled":true,"status":"enabled", ... }

--fail-if-disabled exits 3 (and prints an ALERT: line to stderr) if Dev Hub is not enabled, so a scheduled job can gate on it.

Exit codes

  • 0 success
  • 1 an org could not be queried, or a deploy failed (auth/connection/deploy)
  • 2 bad usage or a missing dependency (sf or jq)
  • 3 Dev Hub is not enabled (only when --fail-if-disabled is set)

Authentication

If the org isn't authenticated yet, the skill can log in for you with --login (or --instance-url <url>), then continue with the requested action in the same run — this is the preferred path when the user provides an instance URL:

Substitute the user's actual instance URL for <url> (shown here as the generic https://my-domain.my.salesforce.com placeholder):

bash
# Log in to a specific instance (My Domain / pre-release / sandbox), then enable:
bash "<skill_dir>/scripts/devhub.sh" my-alias \
  --instance-url https://my-domain.my.salesforce.com --enable --apply

# Bare instance URL as shorthand — logs in to it, then reports status:
bash "<skill_dir>/scripts/devhub.sh" https://my-domain.my.salesforce.com

# Just authenticate an org (no other action):
bash "<skill_dir>/scripts/devhub.sh" my-alias --login

sf org login web opens a browser for the OAuth flow; complete it promptly (the session times out). A supplied positional (my-alias) becomes the CLI alias; a positional that looks like a URL (contains ://) is taken as the --instance-url to log in to. The script accepts only HTTPS Salesforce-owned hostnames for this option. Omit --instance-url for standard production/DE/trial logins (login.salesforce.com). If the browser flow keeps timing out, the script prints the sf org login device fallback for a code-based login.

If an org isn't authenticated and no login flag was passed, the script instead prints the exact command to log in and re-run — using the instance URL you supplied when there is one:

text
  my-org                         could not query org (...)

  To authenticate against https://my-domain.my.salesforce.com, run:
    sf org login web --instance-url "https://my-domain.my.salesforce.com" --alias "my-org"
  Or let this script log you in and continue in one step:
    devhub.sh "my-org" --instance-url "https://my-domain.my.salesforce.com" --login
  Then re-run. List existing logins with:  sf org list

Manual fallback (if the script is unavailable)

bash
# Detect Dev Hub (INVALID_TYPE error means OFF; a count means ON):
sf data query --query "SELECT COUNT() FROM ScratchOrgInfo" --target-org <org> --json

# Enable Dev Hub via the Tooling API (what the Setup toggle does; irreversible):
sf api request rest "/services/data/v47.0/tooling/sobjects/DevHubSettings/DevHub" \
  --method PATCH \
  --body '{"FullName":"DevHub","Metadata":{"enableScratchOrgManagementPref":true}}' \
  --target-org <org>

# Or enable in the UI: Setup > Quick Find > "Dev Hub" > turn Enable Dev Hub On.

# View scratch org allocation:
sf org list limits --target-org <org> --json | jq '.result[] | select(.name|test("ScratchOrg"))'

Notes

  • Requires the Salesforce CLI (sf) and jq on the PATH, plus at least one authenticated org (sf org login web).
  • After enabling, set the org as your default Dev Hub: sf config set target-dev-hub <org>.
  • Enabling packaging (enablePackaging2) requires Dev Hub to be on first — --enable --packaging handles the ordering in a single deploy.
  • Non-admin users still need object access (Read/Create on ScratchOrgInfo and ActiveScratchOrg) to create/view scratch orgs, and the "Create and Update Second-Generation Packages" permission to build 2GP/unlocked packages.
  • To switch the default org use dx-org-switch; to check expiration use dx-org-trial-expiration-check.

附带文件

技能加载后,模型会按需读取这些文件。它们仅作为可读文件提供,绝不会被执行。

常见问题

Dx Org Devhub Configure AI 技能有什么作用?

使用 Salesforce CLI(sf)在 Salesforce 组织中启用 Dev Hub,并查看其临时组织配额。用户希望开启或启用 Dev Hub、设置组织以创建临时组织或第二代(2GP)及解锁软件包、检查 Dev Hub 是否已启用、查看可创建的临时组织数量(Active 和 Daily 临时组织限额及剩余配额)、配置 Dev Hub 偏好设置(例如打包、组织形状导出或临时组织快照),或列出从 Dev Hub 创建的活动临时组织时,使用此技能。启用操作会部署 enableScratchOrgManagementPref 设置,且不可撤销;需要系统管理员权限(ModifyAllData 或 ModifyMetadata),并且无法在沙盒中执行。以下情况不要触发:创建或删除单个临时组织、切换默认组织(使用 dx-org-switch),或查询试用期或组织到期日期(使用 dx-org-trial-expiration-check)。

为什么在 TypingMind 中使用 Dx Org Devhub Configure?

因为您只需安装一次,就能搭配任何模型使用。Dx Org Devhub Configure 采用纯 Markdown 格式,而非特定提供商专用的代码,因此同一技能可用于 GPT-5、Claude、Gemini、Grok 或本地模型。您甚至可以在聊天中途切换模型,而不会影响技能的正常使用。TypingMind 使用您自己的 API 密钥,因此您直接向提供商付费,而不是按席位订阅;您的技能和聊天记录也都保留在您自己的存储空间中。

如何在 TypingMind 中安装 Dx Org Devhub Configure?

在 TypingMind 中打开“插件 → 技能 → 从 GitHub 安装”,然后粘贴 https://github.com/forcedotcom/sf-skills/tree/main/plugins/builder/dx-org-lifecycle/skills/dx-org-devhub-configure。TypingMind 会读取其中的 SKILL.md,打包相关文件,并将其安装为技能,供您在各个聊天中按需启用。

哪些 AI 模型可以使用 Dx Org Devhub Configure?

您在 TypingMind 中连接的任何模型都可以。AI 技能采用纯 Markdown 指令,而非特定提供商专用的代码,因此 GPT、Claude、Gemini、Grok 和本地模型都能在请求匹配时加载此技能。

Dx Org Devhub Configure 可以搭配多少个 AI 模型使用?

数量不限。只要模型支持技能,您就可以将它与 Dx Org Devhub Configure 搭配使用。GPT、Claude、Gemini、Grok、DeepSeek、Mistral、Llama 等模型都可以通过您自己的 API 密钥接入 TypingMind。

Dx Org Devhub Configure AI 技能免费吗?

是的。forcedotcom 已在 GitHub 上根据 Apache-2.0 许可证发布了该技能。您只需向自己的 AI 提供商支付所用 Token 的费用。

什么是 AI 技能?

AI 技能是一组可复用的指令,用于教会 AI 模型完成某项特定任务。它遵循开放的 Agent Skills 格式:包含名称和描述的 SKILL.md 文件,以及模型可能需要的脚本、模板或参考文件。模型仅在您的请求与技能匹配时才会读取这些指令,因此已安装的技能在使用前不会产生任何费用。

AI 技能与插件或 MCP 服务器有何不同?

插件或 MCP 服务器为模型提供可调用的新工具,也就是在某处运行并返回结果的代码。AI 技能则为模型提供知识和流程:如何处理任务、遵循哪些步骤,以及怎样的输出才算优质。技能采用纯 Markdown 格式,因此不需要服务器、API 密钥或运行时环境,并且适用于任何模型。

查看全部

立即创建您自己的 AI 工作区

订阅我们的电子简报,获取新功能和后续赠奖活动的通知 👇