Files
sim/.claude
Waleed e257d067f2 feat(integrations): suggest curated skills per integration with one-click add (#4912)
* feat(integrations): suggest curated skills per integration with one-click add

Curate research-backed, capability-grounded skills for every catalog
integration and surface them on the integration detail page. Each skill
maps to operations the block actually supports and can be added to the
workspace in one click; track adds in PostHog.

- Add SuggestedSkill type + skills field on BlockMeta; populate skills
  for all 193 catalog integrations (3 audit passes for grounding/sourcing)
- getSuggestedSkillsForBlock() with versioned-type (e.g. notion_v2) base fallback
- Skills section on the integration detail page with add/added states
- integration_skill_added PostHog event with workspace/integration metadata

* fix(integrations): flip suggested-skill row to Added immediately after add

The row derived Added state solely from the useSkills cache, so between a
successful create and the list refetch the row still showed Add and could
be clicked again, hitting the server duplicate-name check. Track added
names in local state so the row reflects the add immediately.

* fix(integrations): harden suggested-skill add flow; document skill authoring

Address PR review feedback on the suggested-skills section:
- Make useSkills the single source of truth for Added state by writing the
  created skill into the React Query cache onSuccess (fixes stale Added that
  survived a delete, and the lag that allowed a duplicate click)
- Track in-flight adds in a Set so concurrent adds keep independent pending
  state and cannot be double-submitted
- Surface failures with toast.error instead of swallowing the rejection
- Extract the duplicated SkillTile into a shared workspace component

Also document the new BlockMeta.skills field in the add-block and
validate-integration skills (+ blocks AGENTS.md): skills must be grounded in
the block's tools.access and sourced from real online use cases, never invented.

* fix(integrations): synchronous in-flight guard for skill add; align cursor docs

- Guard handleAdd with a ref so two rapid clicks cannot both fire a create
  before the disabled state re-renders (pendingNames is async)
- Fold the create-cache-merge rationale into the hook's TSDoc and drop
  non-TSDoc inline comments to match the repo convention
- Align .cursor add-block/validate-integration command docs with the newer
  .claude/.agents versions: BlockMeta section + skills authoring/validation
  guidance (grounded in tools.access, sourced from real online use cases)

* fix(integrations): gate skill Add/Added on authoritative workspace skills

useSkills uses keepPreviousData, so during initial load or a workspace switch
the list could be empty or a prior workspace's placeholder — making rows show
a misleading Add (duplicate-submittable) or a false Added. Derive skillsReady
from !isPending && !isPlaceholderData, only mark Added when ready, and disable
Add until the current workspace's list has loaded.

* chore(integrations): drop local-variable comments in skills section

Keep to the repo's TSDoc-on-declarations convention — the in-flight guard and
skillsReady derivation are self-evident from naming.
2026-06-08 16:52:07 -07:00
..