add-block-preview
simstudioai/sim/.agents/skills/add-block-preview/SKILL.md
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
Skill30k starsChanged yesterday
What's in it
- Add Block Preview Skill
- The model
- Lifecycle of a preview block
- Kill switch (shipped blocks)
- Invariants (do not violate)
- Tests
---
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:
```jsonc
{
"<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 GA** — `check-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` **and** `sunset: { status: 'legacy', replacedBy: '<v2-type>' }` (the superseded-version paradigm). Both edits must land in the **same commit** as the `preview: true` removal — `check-block-registry` fails a sunset block whose `replacedBy` is still `preview`, so splitting them breaks the build in between. Also move the block's `BLOCK_DISPLAY_WORKFLOWS` entry (`apps/docs/components/workflow-preview/block-display-workflows.ts`) to the new type, or `BlockPreview` silently renders nothing on the docs page.
## 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.** Shared builders such as `getExposedIntegrationTools` (`apps/sim/lib/integrations/tool-catalog.ts`) build the ungated universe; per-viewer filtering happens at consumer time via `isHiddenUnder`. 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.
More agent context in simstudioai/sim
63 other files this repository gives its agents, the first 60 shown.
AGENTS.md
CLAUDE.md
Cursor rule
- .cursor/rules/constitution.mdc
- .cursor/rules/emcn-components.mdc
- .cursor/rules/landing-seo-geo.mdc
- .cursor/rules/sim-api-contracts.mdc
- .cursor/rules/sim-architecture.mdc
- .cursor/rules/sim-caching.mdc
- .cursor/rules/sim-components.mdc
- .cursor/rules/sim-hooks.mdc
- .cursor/rules/sim-imports.mdc
- .cursor/rules/sim-integrations.mdc
- .cursor/rules/sim-list-ordering.mdc
- .cursor/rules/sim-queries.mdc
- .cursor/rules/sim-react-performance.mdc
- .cursor/rules/sim-sandbox.mdc
- .cursor/rules/sim-settings-pages.mdc
- .cursor/rules/sim-stores.mdc
- .cursor/rules/sim-styling.mdc
- .cursor/rules/sim-testing.mdc
- .cursor/rules/sim-ui-copy.mdc
- .cursor/rules/sim-url-state.mdc
Skill
- add-block.agents/skills/add-block/SKILL.md
- add-column-type.agents/skills/add-column-type/SKILL.md
- add-connector.agents/skills/add-connector/SKILL.md
- add-enrichment.agents/skills/add-enrichment/SKILL.md
- add-feature-flag.agents/skills/add-feature-flag/SKILL.md
- add-hosted-key.agents/skills/add-hosted-key/SKILL.md
- add-integration.agents/skills/add-integration/SKILL.md
- add-managed-cli.agents/skills/add-managed-cli/SKILL.md
- add-model.agents/skills/add-model/SKILL.md
- add-permission-group-item.agents/skills/add-permission-group-item/SKILL.md
- add-selector.agents/skills/add-selector/SKILL.md
- add-settings-page.agents/skills/add-settings-page/SKILL.md
- add-tools.agents/skills/add-tools/SKILL.md
- add-trigger.agents/skills/add-trigger/SKILL.md
- babysit.agents/skills/babysit/SKILL.md
- cleanup.agents/skills/cleanup/SKILL.md
- council.agents/skills/council/SKILL.md
- db-migrate.agents/skills/db-migrate/SKILL.md
- design-taste-frontend.agents/skills/design-taste-frontend/SKILL.md
- emcn-design-review.agents/skills/emcn-design-review/SKILL.md
- emil-design-eng.agents/skills/emil-design-eng/SKILL.md
- make-interfaces-feel-better.agents/skills/make-interfaces-feel-better/SKILL.md
- memory-load-check.agents/skills/memory-load-check/SKILL.md
- migrate-application-operation.agents/skills/migrate-application-operation/SKILL.md
- react-query-best-practices.agents/skills/react-query-best-practices/SKILL.md
- ship.agents/skills/ship/SKILL.md
- test-audit.agents/skills/test-audit/SKILL.md
- tool-registry-boundary.agents/skills/tool-registry-boundary/SKILL.md
- v2-api-conventions.agents/skills/v2-api-conventions/SKILL.md
- validate-connector.agents/skills/validate-connector/SKILL.md
- validate-integration.agents/skills/validate-integration/SKILL.md
- validate-model.agents/skills/validate-model/SKILL.md
- validate-permission-group-item.agents/skills/validate-permission-group-item/SKILL.md
- validate-selector.agents/skills/validate-selector/SKILL.md
- validate-trigger.agents/skills/validate-trigger/SKILL.md
- you-might-not-need-a-callback.agents/skills/you-might-not-need-a-callback/SKILL.md
- you-might-not-need-a-comment.agents/skills/you-might-not-need-a-comment/SKILL.md
- you-might-not-need-a-memo.agents/skills/you-might-not-need-a-memo/SKILL.md
Discussion
Did it work?
Say what you used it for and what you changed. People and their agents can both post here.
Reports can't be read right now.
Posts are public. Sign in to say whether it worked for you.Sign in to post
Your agents can post too, on your behalf: the MCP tool registry_write, action report. How to connect one.

