Agent Skill · WorkOS

workos-widgets

Use when the user is implementing, embedding, or debugging a WorkOS Widget — specifically the User Management, User Profile, Admin Portal SSO Connection, or Admin Portal Domain Verification widgets. Handles the full stack — detecting the frontend (Next.js, React, React Router, TanStack Start, Vite, SvelteKit), generating access tokens via the backend SDK in use (Node, Python, Go, Ruby, PHP, Java, .NET), and wiring up the widget component correctly per the bundled OpenAPI spec. Also use when code imports from @workos-inc/widgets or the user pastes or JSX.

Provider: WorkOS Path in repo: plugins/workos/skills/workos-widgets/SKILL.md

Skill body

WorkOS Widgets

Workflow Overview

  1. Identify widget target from the user request (user-management, user-profile, admin-portal-sso-connection, admin-portal-domain-verification).
  2. Scan project files in this order:
    • package/dependency manifests
    • framework/router entrypoints
    • auth/token utilities
    • styling/component patterns
  3. Detect stack, data-layer style, styling, component system, and package manager using references/detection.md.
  4. Check for AuthKit/WorkOS presence:
    • if detected, continue;
    • if not detected, ask the user to run WORKOS_MODE=agent npx workos@latest install. Wait for confirmation, then continue.
  5. If detection is ambiguous or conflicting, ask one focused question, then continue.
  6. Load only the relevant reference files for the detected stack and widget.
  7. Implement integration based on stack shape:
    • frontend route/page + widget component when widget UI lives in the same app
    • token endpoint/service + client integration surface when backend-first/multi-app architecture is detected
  8. Validate routing/wiring, imports, and token/API usage before finishing.

Canonical Inputs

Accept these inputs from the user request when available:

When input is missing, infer from existing project conventions and detected stack.

Detection and Ambiguity Protocol

Reference Loading Map

Always load these core references:

For React/TypeScript stacks (Next.js, React Router, TanStack Router, TanStack Start, Vite), also load:

Load stack-specific reference guidance:

Then load exactly one widget reference:

Global Widget Guidance

Core Guidelines

Completion Requirements

Before finishing, verify all relevant items:

  1. Widget component exists and accepts accessToken: string when component-level integration is in scope.
  2. Route/page wiring is complete when route integration is in scope.
  3. Token source matches existing app architecture (AuthKit client flow or backend WorkOS token flow).
  4. API methods and paths match the bundled OpenAPI spec, and data-layer usage matches project conventions.
  5. Loading and error branches exist for required query/mutation flows.

Validation Checklist

  1. Confirm endpoint paths and HTTP methods come from the bundled OpenAPI spec.
  2. Confirm request/response handling follows schema expectations from the spec.
  3. Confirm query/mutation invalidation/refetch is applied after successful mutations where required.
  4. Confirm empty/error/loading states are explicit and user-visible.
  5. Confirm package installs (if any) used the detected package manager/tooling.
  6. Confirm implementation stays aligned with existing codebase conventions.
  7. Confirm no existing component has been passed className or style props to override its built-in styling. Use each component as-is or via its own props API (variant, size, etc.).