Agent Skillssimstudioai/sim › add-block-preview

add-block-preview

GitHub

管理 Sim 平台中 Block 的可见性门控,支持通过配置、环境变量或代码将未发布模块设为预览隐藏状态,并向特定用户或组织逐步开放,最终完成 GA 上线。

.agents/skills/add-block-preview/SKILL.md simstudioai/sim

Trigger Scenarios

需要隐藏未完成的 Block 功能 向特定组织或管理员灰度发布新功能 紧急下线已上线的 Block 功能

Install

npx skills add simstudioai/sim --skill add-block-preview -g -y
More Options

Non-standard path

npx skills add https://github.com/simstudioai/sim/tree/main/.agents/skills/add-block-preview -g -y

Use without installing

npx skills use simstudioai/sim@add-block-preview

指定 Agent (Claude Code)

npx skills add simstudioai/sim --skill add-block-preview -a claude-code -g -y

安装 repo 全部 skill

npx skills add simstudioai/sim --all -g -y

预览 repo 内 skill

npx skills add simstudioai/sim --list

SKILL.md

Frontmatter
{
    "name": "add-block-preview",
    "description": "Gate a block's visibility — ship an unreleased block as a preview (hidden until revealed via AppConfig\/env), reveal it to admins\/orgs, GA it, or kill-switch a shipped block",
    "argument-hint": "<block-type>"
}

Add Block Preview Skill

You manage block visibility gating in Sim — hiding blocks from every discovery surface (toolbar, cmd+K search, copilot @-mentions, agent tool picker, mothership VFS/metadata/tools, Access Control list, public docs/catalog) while never gating execution of already-placed instances.

The model

Three levers, evaluated in apps/sim/lib/core/config/block-visibility.ts and folded into the registry accessors (apps/sim/blocks/registry.ts):

  1. preview: true on the BlockConfig (static, in code) — the block is default-hidden EVERYWHERE (hosted, self-hosted, dev, SSR) until revealed. Fail-closed.

  2. The hosted block-visibility AppConfig document — per-block rule keyed by the existing block type:

    {
      "<block-type>": {
        "enabled": false,        // required. true = GA (visible to everyone)
        "orgIds": ["org_..."],   // optional allowlist clauses (any match reveals)
        "userIds": ["user_..."],
        "adminEnabled": true     // platform admins (user.role === 'admin')
      }
    }
    
  3. PREVIEW_BLOCKS env (comma-separated block types) — the off-AppConfig reveal path for self-hosters and local dev.

A revealed block that is not globally GA (enabled !== true, or env-revealed) renders with a " (Preview)" name suffix on discovery surfaces. getBlock() stays pure, so placed instances keep their canonical name and always execute.

Lifecycle of a preview block

  1. Author the block normally (/add-block etc.) and set preview: true on its BlockConfig. Ship no BlockMeta and no docs until GAcheck-block-registry deliberately skips preview blocks in meta coverage, and generate-docs skips them at every gate.

  2. Local dev: set PREVIEW_BLOCKS=<block-type> in your env to see it (with the suffix).

  3. Merge/deploy. The block's code is live everywhere but visible nowhere — no AppConfig rule exists and self-hosters have no env entry.

  4. Hosted preview: add a rule to the block-visibility AppConfig document and start a deployment (no code deploy):

    • Admins only: { "enabled": false, "adminEnabled": true }
    • Design-partner org: { "enabled": false, "orgIds": ["org_123"] }
    • GA via config (code cleanup pending): { "enabled": true } — suffix disappears everywhere within ~30s (AppConfig TTL) + client refetch.

    Same runbook as feature-flags: edit the hosted document, aws appconfig start-deployment with the sim-<env>-fast strategy (see the infra README).

  5. GA cleanup: delete preview: true from the block (now visible to self-hosters on their next upgrade), add its BlockMeta + regen docs, and drop the AppConfig entry. For a v2 upgrade, this is also when v1 gets hideFromToolbar: true (the superseded-version paradigm).

Kill switch (shipped blocks)

To pull an already-GA block from discovery surfaces on hosted (incident, deprecation): add { "<block-type>": { "enabled": false } } to the document. Allowlist clauses can carve out exceptions. Execution is NOT stopped — workflows already using the block keep running; the kill switch only prevents new placement/discovery.

Invariants (do not violate)

  • Execution is never gated. The executor, serializer, drop-naming, and isBlockTypeAccessControlExempt resolve via pure getBlock. Do not add visibility checks to execution paths.
  • Clone-not-remove: gated blocks stay in getAllBlocks() output as clones with hideFromToolbar: true.find-by-type consumers rely on this. Never filter them out.
  • Keys are registry block types. Never custom_block_* (parse drops them — custom blocks have their own enabled/disabled lifecycle).
  • The shared hidden-predicate is isHiddenUnder (apps/sim/blocks/visibility/context.ts). Never restate the preview/disabled rule inline at a new consumer.
  • Process-global caches stay ungated. getStaticComponentFiles (VFS) and getExposedIntegrationTools build the ungated universe; per-viewer filtering happens at stamp/consumer time. Never move gating into a shared builder.
  • Gating is surface hiding, not secrecy — the full config ships in the client JS bundle. Anything truly secret cannot be a registered block.

Tests

Evaluation semantics: apps/sim/lib/core/config/block-visibility.test.ts. Registry projection: apps/sim/blocks/visibility/visibility.test.ts. When gating behavior changes, extend those — mock isPlatformAdmin for the admin clause; use the local withAppConfig harness.

Version History

  • ceda457 Current 2026-08-20 15:28

Same Skill Collection

.agents/skills/add-block/SKILL.md
.agents/skills/add-column-type/SKILL.md
.agents/skills/add-connector/SKILL.md
.agents/skills/add-enrichment/SKILL.md
.agents/skills/add-feature-flag/SKILL.md
.agents/skills/add-hosted-key/SKILL.md
.agents/skills/add-integration/SKILL.md
.agents/skills/add-managed-cli/SKILL.md
.agents/skills/add-model/SKILL.md
.agents/skills/add-tools/SKILL.md
.agents/skills/add-trigger/SKILL.md
.agents/skills/babysit/SKILL.md
.agents/skills/cleanup/SKILL.md
.agents/skills/council/SKILL.md
.agents/skills/db-migrate/SKILL.md
.agents/skills/design-taste-frontend/SKILL.md
.agents/skills/emcn-design-review/SKILL.md
.agents/skills/emil-design-eng/SKILL.md
.agents/skills/make-interfaces-feel-better/SKILL.md
.agents/skills/memory-load-check/SKILL.md
.agents/skills/react-query-best-practices/SKILL.md
.agents/skills/ship/SKILL.md
.agents/skills/tool-registry-boundary/SKILL.md
.agents/skills/v2-api-conventions/SKILL.md
.agents/skills/validate-connector/SKILL.md
.agents/skills/validate-integration/SKILL.md
.agents/skills/validate-model/SKILL.md
.agents/skills/validate-trigger/SKILL.md
.agents/skills/you-might-not-need-a-callback/SKILL.md
.agents/skills/you-might-not-need-a-comment/SKILL.md
.agents/skills/you-might-not-need-a-memo/SKILL.md
.agents/skills/you-might-not-need-an-effect/SKILL.md
.agents/skills/you-might-not-need-state/SKILL.md
.agents/skills/you-might-not-need-url-state/SKILL.md
.claude/skills/add-settings-page/SKILL.md
helm/sim/.claude/skills/sim-helm/SKILL.md
.agents/skills/migrate-application-operation/SKILL.md

Metadata

Files
0
Version
ceda457
Hash
637a6b79
Indexed
2026-08-20 15:28

- 위키
Copyright © 2011-2026 iteam. Current version is 2.155.2. UTC+08:00, 2026-08-25 11:40
浙ICP备14020137号-1 $방문자$