You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
feat(skills): canonicalize skills to a single source with generated .claude/.cursor projections (#5609)
* improvement(cleanup-skill): parallelize analysis, apply fixes sequentially
* improvement(cleanup-skill): add comment-reduction pass; mirror 6 missing skills into .claude/commands
* fix(cleanup-skill): substitute parsed scope into analysis passes instead of literal <scope>
* fix(cleanup-skill): parse fix token anywhere; preserve pass labels through convergence for ordered apply
* fix(cleanup-skill): apply Step 1 proposals content-anchored, re-derive when a prior pass invalidated the snippet
* fix(babysit-skill): correct garbled --reverse explanation across all three copies
* fix(skills): propagate parallel cleanup to cursor/agents copies; disambiguate babysit /ship refs in claude copy
* fix(skills): port url-state + comment passes to cursor/agents; clarify converge pass-label ordering
* feat(skills): canonicalize skills under .agents/skills with generated .claude/.cursor projections
Establish .agents/skills/<name>/SKILL.md as the single source of truth (latest
content reconciled per skill from the three drifted copies), and generate the
.claude/commands and .cursor/commands projections from it via scripts/sync-skills.ts.
Adds skills:sync/skills:check, a CI gate, a pre-commit regen hook, and CONTRIBUTING docs.
Structurally fixes prior drift (e.g. abbreviated .claude ship -> full ship).
* fix(skills): strip leaked XML tags from skill tails; clarify lint:check has no per-file target
Removes stray </content>/</invoke> markup that leaked into add-block,
add-connector, add-hosted-key canonical skills, and reword the cleanup
skill's lint step to note bun run lint:check runs repo-wide via turbo
(no per-path API). Projections regenerated via skills:sync.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01QjefwescJoHZ6zcc3C17FR
* fix(add-block-skill): restore unknown-output stop in Final Validation
Re-add the "if any tool outputs are still unknown, tell the user instead
of guessing block outputs" step that was dropped when Final Validation
step 5 became the BlockMeta template check.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01QjefwescJoHZ6zcc3C17FR
---------
Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
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
4
+
argument-hint: <block-type>
5
+
---
6
+
7
+
# Add Block Preview Skill
8
+
9
+
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.
10
+
11
+
## The model
12
+
13
+
Three levers, evaluated in `apps/sim/lib/core/config/block-visibility.ts` and folded into the registry accessors (`apps/sim/blocks/registry.ts`):
14
+
15
+
1.**`preview: true`** on the `BlockConfig` (static, in code) — the block is default-hidden EVERYWHERE (hosted, self-hosted, dev, SSR) until revealed. Fail-closed.
16
+
2.**The hosted `block-visibility` AppConfig document** — per-block rule keyed by the existing block type:
17
+
18
+
```jsonc
19
+
{
20
+
"<block-type>": {
21
+
"enabled":false, // required. true = GA (visible to everyone)
22
+
"orgIds": ["org_..."], // optional allowlist clauses (any match reveals)
3.**`PREVIEW_BLOCKS` env** (comma-separated block types) — the off-AppConfig reveal path for self-hosters and local dev.
30
+
31
+
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.
32
+
33
+
## Lifecycle of a preview block
34
+
35
+
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.
36
+
2.**Local dev:** set `PREVIEW_BLOCKS=<block-type>` in your env to see it (with the suffix).
37
+
3.**Merge/deploy.** The block's code is live everywhere but visible nowhere — no AppConfig rule exists and self-hosters have no env entry.
38
+
4.**Hosted preview:** add a rule to the `block-visibility` AppConfig document and start a deployment (no code deploy):
- GA via config (code cleanup pending): `{ "enabled": true }` — suffix disappears everywhere within ~30s (AppConfig TTL) + client refetch.
42
+
43
+
Same runbook as `feature-flags`: edit the hosted document, `aws appconfig start-deployment` with the `sim-<env>-fast` strategy (see the infra README).
44
+
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).
45
+
46
+
## Kill switch (shipped blocks)
47
+
48
+
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.
49
+
50
+
## Invariants (do not violate)
51
+
52
+
-**Execution is never gated.** The executor, serializer, drop-naming, and `isBlockTypeAccessControlExempt` resolve via pure `getBlock`. Do not add visibility checks to execution paths.
53
+
-**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.
54
+
-**Keys are registry block types.** Never `custom_block_*` (parse drops them — custom blocks have their own enabled/disabled lifecycle).
55
+
-**The shared hidden-predicate is `isHiddenUnder`** (`apps/sim/blocks/visibility/context.ts`). Never restate the preview/disabled rule inline at a new consumer.
56
+
-**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.
57
+
- Gating is **surface hiding, not secrecy** — the full config ships in the client JS bundle. Anything truly secret cannot be a registered block.
58
+
59
+
## Tests
60
+
61
+
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.
description: Create or update a Sim integration block with correct subBlocks, conditions, dependsOn, modes, canonicalParamId usage, outputs, and tool wiring. Use when working on `apps/sim/blocks/blocks/{service}.ts` or aligning a block with its tools.
4
+
argument-hint: <service-name>
4
5
---
5
6
6
7
# Add Block Skill
@@ -443,7 +444,7 @@ Maps multiple UI fields to a single serialized parameter:
443
444
444
445
**Critical constraints:**
445
446
-`canonicalParamId` must NOT match any other subblock's `id` in the same block (causes conflicts)
446
-
-`canonicalParamId`must be unique per block (only one basic/advanced pair per canonicalParamId)
447
+
-A `canonicalParamId`links exactly one basic/advanced pair for a single logical parameter. Do NOT reuse the same `canonicalParamId` for different parameters, even under mutually-exclusive conditions/operations
447
448
- ONLY use `canonicalParamId` to link basic/advanced mode alternatives for the same logical parameter
448
449
- Do NOT use it for any other purpose
449
450
@@ -533,7 +534,10 @@ tools: {
533
534
Block outputs only support:
534
535
-`type` - The data type ('string', 'number', 'boolean', 'json', 'array')
535
536
-`description` - Human readable description
536
-
- Nested object structure (for complex types)
537
+
-`condition` - Optional visibility condition
538
+
-`hiddenFromDisplay` - Optional flag to hide from the output display
539
+
540
+
**Nested object/`properties` outputs are tool-output-only and will fail TypeScript at build time on block outputs.** For complex shapes use `type: 'json'` and describe the inner fields in the `description` string.
537
541
538
542
```typescript
539
543
outputs: {
@@ -556,7 +560,7 @@ outputs: {
556
560
557
561
### Typed JSON Outputs
558
562
559
-
When using `type: 'json'` and you know the object shape in advance, **describe the inner fields in the description** so downstream blocks know what properties are available. For well-known, stable objects, use nested output definitions instead:
563
+
When using `type: 'json'` and you know the object shape in advance, **describe the inner fields in the description** so downstream blocks know what properties are available. Block outputs have no nested `properties` form — always keep the output flat and put the shape in the `description`:
560
564
561
565
```typescript
562
566
outputs: {
@@ -568,26 +572,10 @@ outputs: {
568
572
type: 'json',
569
573
description: 'Zone plan information (id, name, price, currency, frequency, is_subscribed)',
570
574
},
571
-
572
-
// BEST: Use nested output definition when the shape is stable and well-known
- The object has a small, stable set of fields (< 10)
584
-
- Downstream blocks will commonly access specific properties
585
-
- The API response shape is well-documented and unlikely to change
586
-
587
-
Use `type: 'json'` with a descriptive string when:
588
-
- The object has many fields or a dynamic shape
589
-
- It represents a list/array of items
590
-
- The shape varies by operation
578
+
Nested object outputs (`plan: { id: { type: 'string' }, ... }`) are a **tool-output** feature only — `OutputFieldDefinition` for blocks does not allow them and they fail TypeScript at build time.
591
579
592
580
If the output shape is unknown because the underlying tool response is undocumented, you MUST tell the user and stop. Unknown is not the same as variable. Never guess block outputs.
Every integration block **must** export a `{Service}BlockMeta` object at the bottom of the block file. This metadata drives the integration catalog, tag filters, and workflow template suggestions shown to users.
-**Import `BlockMeta`** from `@/blocks/types` alongside `BlockConfig`
669
-
-**`tags`** must match the `tags` array on the block config exactly
670
-
-**`url`** is the canonical homepage of the external service the block integrates with (e.g. `'https://exa.ai'`, `'https://salesforce.com'`) — the catalog "link back to the tool". It is distinct from `BlockConfig.docsLink`, which points at Sim's own integration docs on `docs.sim.ai`. Use the service's real root domain over `https` (verify it actually resolves), no tracking params, no trailing slash. Omit `url` only for first-party/built-in blocks that have no external service (e.g. `agent`, `function`, `condition`, `api`, `response`)
671
-
-**Templates are optional** but should be added for any integration that has a recognizable use case — aim for 2–4 templates per block
672
-
-**Template `prompt`** should start with "Build a workflow that..." or "Create a workflow that..." and be concrete enough to generate a real workflow in Mothership
673
-
-**Template `modules`** lists the Sim modules the template relies on: `'knowledge-base' | 'tables' | 'files' | 'workflows' | 'scheduled' | 'agent'`
674
-
-**Template `category`** is one of: `'popular' | 'sales' | 'support' | 'engineering' | 'marketing' | 'productivity' | 'operations'`
675
-
-**`alsoIntegrations`** names other block types (e.g. `'slack'`, `'linear'`) referenced in the template prompt — helps the catalog surface this template when those blocks are selected
676
-
- Place the export **after** the main `{Service}Block` export, at the very bottom of the file
`skills` is an optional array of `SuggestedSkill` (`{ name, description, content }`) shown on the integration's detail page; users click **Add** to create the skill in their workspace. Aim for 3–5 skills for mainstream services, 2–3 for niche/low-level ones.
681
-
682
-
-**`name`** — kebab-case, lowercase letters/numbers/hyphens, ≤ 64 chars, unique within the integration, verb-led (e.g. `summarize-thread`).
683
-
-**`description`** — one line, ≤ 1024 chars: what it does and when to use it.
684
-
-**`content`** — markdown instructions for the agent (literal `\n` for newlines): a `# Title`, then `## Steps` and an output/guidance section. Keep ~600–2000 chars.
685
-
-**Ground every skill in operations the block actually exposes.** Cross-check each skill's steps against the block's `tools.access` list — never describe an action the integration cannot perform (e.g. "receive messages" when the block only sends).
686
-
-**Skills MUST be derived from real, popular use cases found online — never invented.** Before adding a skill, web-search the service's documented use cases (vendor use-case/solutions pages, official docs describing the workflow, reputable "top automations for X" articles). If you cannot source a use case as something people genuinely do with the service, do not add it. Do not hallucinate skills.
687
-
688
-
### Register in the blocksMeta object
689
-
690
-
After adding `{Service}BlockMeta` to the block file, register it in `apps/sim/blocks/registry.ts`:
691
-
692
-
```typescript
693
-
// Add import (alongside the block import, alphabetically)
1. Import `{Service}Block` and `{Service}BlockMeta` in `apps/sim/blocks/registry.ts`
707
-
2. Add to the `registry` object (alphabetically):
708
-
3. Add to the `blocksMeta` object (alphabetically):
620
+
After creating the block, remind the user to register it in `apps/sim/blocks/registry-maps.ts` (the data maps live here; `registry.ts` holds only the accessor functions). Add the import and an entry to each map alphabetically:
@@ -837,6 +749,13 @@ Please provide the SVG and I'll convert it to a React component.
837
749
You can usually find this in the service's brand/press kit page, or copy it from their website.
838
750
```
839
751
752
+
When converting the SVG: a **monochrome** logo (single white or black mark) must
753
+
use `fill='currentColor'`, never a hardcoded `#fff`/`#000000`. Block icons render
754
+
both inside their `bgColor` tile and "bare" on a neutral page (the home Suggested
755
+
actions list) in light and dark mode; a hardcoded white/black mark goes invisible
756
+
bare on the matching background. Multi-color brand logos keep their own fills.
757
+
Verify with `bun run check:bare-icons`.
758
+
840
759
## Advanced Mode for Optional Fields
841
760
842
761
Optional fields that are rarely used should be set to `mode: 'advanced'` so they don't clutter the basic UI. This includes:
@@ -893,6 +812,48 @@ Use `wandConfig` for fields that are hard to fill out manually, such as timestam
893
812
894
813
All tool IDs referenced in `tools.access` and returned by `tools.config.tool` MUST use `snake_case` (e.g., `x_create_tweet`, `slack_send_message`). Never use camelCase or PascalCase.
895
814
815
+
## BlockMeta (Required)
816
+
817
+
Every block file must export a `{Service}BlockMeta` alongside the block — **minimum 7 templates**. Look at existing examples in `apps/sim/blocks/blocks/` (e.g. `browser_use.ts`, `google_sheets.ts`) for the pattern.
818
+
819
+
```typescript
820
+
importtype { BlockMeta } from'@/blocks/types'
821
+
822
+
exportconst {Service}BlockMeta = {
823
+
tags: ['tag1', 'tag2'], // IntegrationTag[]
824
+
url: 'https://{service}.com', // external service homepage (verify it resolves) — NOT docs.sim.ai
825
+
templates: [
826
+
{
827
+
icon: {Service}Icon,
828
+
title: '{Service} <use-case>', // 2–5 words
829
+
prompt: 'Build a workflow that...', // specific use case, 1–3 sentences
Derive templates from the service's real use cases. Each prompt should name a concrete trigger, transformation, and output — not a generic description of what the service does.
851
+
852
+
`skills` are curated, ready-to-add agent skills shown on the integration's detail page (users click **Add** to create them in their workspace). Two hard rules:
853
+
854
+
-**Ground every skill in operations the block actually exposes** — cross-check each skill's steps against `tools.access`. Never describe an action the integration cannot perform.
855
+
-**Derive skills from real, popular use cases found online — never invent them.** Web-search the service's documented use cases (vendor use-case/solutions pages, official docs describing the workflow, reputable "top automations for X" articles) and only add a skill you can source as something people genuinely do with the service. Do not hallucinate skills.
856
+
896
857
## Checklist Before Finishing
897
858
898
859
-[ ]`integrationType` is set to the correct `IntegrationType` enum value
@@ -906,16 +867,14 @@ All tool IDs referenced in `tools.access` and returned by `tools.config.tool` MU
906
867
-[ ] Tools.access lists all tool IDs (snake_case)
907
868
-[ ] Tools.config.tool returns correct tool ID (snake_case)
908
869
-[ ] Outputs match tool outputs
909
-
-[ ] Block registered in `registry.ts` blocks object (alphabetically)
910
-
-[ ]`{Service}BlockMeta` exported at bottom of block file with `tags` and `templates`
911
-
-[ ]`url` set on `{Service}BlockMeta` to the external service's verified homepage (omit only for first-party blocks with no external service)
912
-
-[ ]`skills` added to `{Service}BlockMeta`, each grounded in the block's `tools.access` and derived from a real online-sourced use case (not invented)
913
-
-[ ]`BlockMeta` imported from `@/blocks/types` alongside `BlockConfig`
914
-
-[ ] Block meta registered in `registry.ts` blocksMeta object (alphabetically)
870
+
-[ ] Block + meta registered in registry-maps.ts (`BLOCK_REGISTRY` / `BLOCK_META_REGISTRY`)
0 commit comments