mcpField
W
workos-widgets

workos-widgets

github.com/workosDevelopment46859 installsUpdated today
Repository

About workos-widgets

A coding skill for implementing WorkOS Widgets in existing applications. It guides framework detection, component selection, token handling, and widget-specific setup.

Key features

  1. 01Detects frameworks and WorkOS setup
  2. 02Selects widget and reference guidance
  3. 03Guides React component integration
  4. 04Covers custom Client API paths
  5. 05Checks tokens, props, and UI states

Use cases

  1. 01Adding user-management screens
  2. 02Embedding profile or security components
  3. 03Building admin SSO or domain flows

Install

Copy the command and run it in a terminal.

$npx skills add https://github.com/workos/skills --skill workos-widgets

After installing, type/workos-widgetsin Claude Code to confirm it loaded.

Bundled files

References and scripts installed along with SKILL.md.

references/
component-setup.md
detection.md
fetching-apis.md
framework-go.md
framework-java.md
framework-mixed-repositories.md
framework-nextjs.md
framework-php.md
framework-python.md
framework-react-router.md
framework-ruby.md
framework-sveltekit.md
framework-tanstack-router.md
framework-tanstack-start.md
framework-vite.md
react-ts-standards.md
styling-and-components.md
token-strategies.md
version-evidence.md
widget-admin-portal-domain-verification.md
widget-admin-portal-sso-connection.md
widget-user-management.md
widget-user-profile.md
widgets-open-api-spec.yaml
references/scripts/
query-spec.cjs
query-spec.ts

Details

From the project README

WorkOS Widgets

Workflow Overview

  1. Distinguish embedded React components from direct custom Client API development. For Clerk UserButton / account requests, recommend actual Widgets plus an app-specific menu/navigation shell, not exact parity; UserSecurity, UserSessions and OrganizationSwitcher are covered in references/component-setup.md.
  2. Identify the widget target (user-management, user-profile, admin-portal-sso-connection, admin-portal-domain-verification).
  3. Detect the stack and whether AuthKit/WorkOS is already present (references/detection.md).
  4. If AuthKit/WorkOS is not present, ask the user to run WORKOS_MODE=agent npx workos@latest install, wait for confirmation, then continue.
  5. Load the relevant reference files for the detected stack and widget.
  6. Implement: a frontend route/page + widget component when the UI lives in the same app, or a token endpoint/service when a backend-first/multi-app architecture is detected.

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:

For profile/security/sessions/organization selection in a React-rendered UI, use component-setup.md. Published Widgets are React components: do not import them into .svelte or other non-React templates. For SvelteKit or another non-React frontend, use only an existing React rendering boundary; otherwise ask whether to add one or build a custom UI against the Client API. Additionally load the relevant widget reference when applicable (these describe desired behavior, not a mandate to rebuild published components):

Global Widget Guidance

  • Embed published components only in React-rendered UI using references/component-setup.md; they own their internal API calls.
  • For direct custom Client API work, fetch https://workos.com/docs/widgets-api first: current docs use GraphQL POST /client/graphql. Read references/fetching-apis.md for the boundary. The bundled REST spec is a legacy snapshot, not authoritative for all current requests; do not regenerate or migrate API layers just to add a component.
  • If the project renders the packaged @workos-inc/widgets components (UsersManagement, UserProfile, AdminPortalSsoConnection, ...), they must sit inside <WorkOsWidgets>, need the peer deps @radix-ui/themes and @tanstack/react-query, and take authToken (a string or () => Promise<string>), not accessToken.
  • Reuse existing domain types and OpenAPI schemas rather than duplicating model definitions.
  • Implement an authorization layer for widget requests, including elevated-token handling for sensitive endpoints (references/token-strategies.md).
  • For React/TypeScript widget code conventions, follow references/react-ts-standards.md.
  • WORKOS_MODE=agent keeps the installer deterministic (no prompts, no browser, no host-trust); pass --json when you need to parse its output.

Completion Requirements

  • Token source matches the existing app architecture (AuthKit client flow or backend WorkOS token flow).
  • Node 10.13.0 token issuance uses createToken and { token }, bound to the authenticated user and authorized organization. Other installed versions/languages are checked independently.
  • Props match the installed declarations: for Widgets 1.18.0, check UserSessions' string/getter authToken union and OrganizationSwitcher's callback; respect permission and renewal requirements.
  • Endpoint paths, methods, and request/response handling match the bundled OpenAPI spec.
  • Loading, empty, and error branches are explicit and user-visible; affected data is refreshed after successful mutations.
  • Packaged components are used as-is or via their own props API (variant, size, etc.), not overridden with className/style.

Comments

Markdown supported