agentsclimarketplace

Scalekit code doctor

Skill scalekit-inc/skills/skills/scalekit-code-doctor

35 skills that teach AI coding agents to integrate Scalekit auth — agent auth, full-stack login, MCP OAuth 2.1, enterprise SSO, and SCIM. Works with Claude Code, Cursor, Windsurf, and 35+ other agents.

Install
npx -y skills add scalekit-inc/skills --skill scalekit-code-doctor

Assembled from the repository path, not quoted from the project. Check it against their README if it does not work.

2 things to look at

  • no licenseNo license file was found in the repository. Code published without one is not open source by default, so using it at work is a question for whoever answers licensing questions where you are.
  • 2 stars2 stars. Stars are a popularity signal and not a quality one, but at this level it is likely that nobody has read this closely except its author, and you would be relying on your own review.

What its author says it does

Copied from the file, not written here

Use when a user asks to generate, review, validate, or fix any code snippet that uses Scalekit APIs or SDKs. This skill is the single source of truth for Scalekit code correctness — it can generate illustration-quality snippets from scratch (for docs, websites, or integration guides) and review existing code to catch wrong method names, missing parameters, security anti-patterns, and broken auth flows. Covers all four SDKs (Node, Python, Go, Java), raw REST API calls, and both Scalekit product suites — SaaSKit (SSO, login, sessions, RBAC, SCIM) and AgentKit (connections, tool calling, MCP auth). Use when the user says review my Scalekit code, generate a Scalekit example, validate this auth flow, check my SDK usage, fix my Scalekit integration, write a code sample for docs, or anything involving Scalekit code quality.

SKILL.md

20.6 KB, as published. Nobody here has run it

Scalekit Code Doctor

You are the authoritative source for Scalekit code correctness. You can both generate correct code from scratch and review existing code to guarantee it works.

Before doing anything else, read the reference files in this skill's references/ directory:

  • references/REFERENCE.md — Every correct SDK method signature across Node, Python, Go, Java, and REST API endpoints
  • references/COMMON-MISTAKES.md — Known anti-patterns with wrong → right corrections

These files are your ground truth. Never hallucinate a method name, parameter, or import path — if it's not in the reference, fetch https://docs.scalekit.com/apis.md to verify before using it.


Step 1 — Detect mode

Determine which mode to operate in based on what the user provides:

Generate mode — The user describes what they want but has no code yet. Examples: "Show me how to add SSO login to Express", "Generate a Next.js callback handler", "Write a Python FastAPI auth example for docs"

Review mode — The user provides existing code for validation. Examples: "Is this Scalekit integration correct?", "Review my auth callback", "Why isn't my login working?"

If unclear, ask: "Do you want me to generate a fresh code example, or review existing code you have?"


Step 2 — Identify context

Before generating or reviewing, identify these three things:

Language and SDK

LanguagePackageImport
Node.js / TypeScript@scalekit-sdk/nodeimport { ScalekitClient } from '@scalekit-sdk/node'
Pythonscalekit-sdk-python (pip)from scalekit import ScalekitClient
Gogithub.com/scalekit-inc/scalekit-sdk-goimport scalekit "github.com/scalekit-inc/scalekit-sdk-go/v2"
Javacom.scalekit:scalekit-sdk-javaimport com.scalekit.ScalekitClient;
REST APINo SDK — raw HTTPBearer token via POST /oauth/token with client credentials

Framework (if applicable)

Next.js (App Router or Pages), Express, Fastify, FastAPI, Django, Flask, Spring Boot, Go (chi, gin, net/http), Laravel, etc.

Product area

Scalekit has two product suites. Identify which one the user's code belongs to:

SaaSKit — Full-stack authentication for B2B SaaS apps

  • SSO — Enterprise single sign-on (SAML, OIDC)
  • Login & Sessions — Sign-up, login, logout, session management
  • RBAC — Roles, permissions, access control
  • SCIM — Directory sync and user provisioning
  • Admin Portal — Customer-facing admin configuration

AgentKit — Authentication and tool access for AI agents

  • Connections — OAuth token vault for third-party services (connected accounts)
  • Tool Calling — Execute tools via connected accounts
  • MCP Authentication — OAuth 2.1 for MCP servers
  • Framework Integrations — LangChain, Vercel AI, Anthropic, OpenAI, Google ADK, Mastra

Cross-product

  • Webhooks — Event subscriptions and payload verification
  • M2M Auth — API keys and client credentials

Step 3 — Generate mode

When generating code, follow these rules:

Quality standard: illustration-ready

The output should be clean enough to publish directly on docs.scalekit.com or a marketing landing page. This means:

  1. Self-contained — The reader understands it without seeing other files
  2. Essential path only — Show the concept, not defensive boilerplate
  3. Real-looking values'https://yourapp.com/auth/callback' not 'http://localhost:3000/test'
  4. Correct imports — Exact package names from the reference table above
  5. Framework-idiomatic — Use the framework's conventions (App Router for Next.js, decorators for FastAPI, etc.)
  6. Minimal comments — Annotate Scalekit-specific lines only. Skip obvious framework code.
  7. 1–2 pages max — Concise. If a full flow needs more, split into labeled sections.

Mandatory checks before outputting generated code

Cross-reference every SDK call against references/REFERENCE.md:

  • Client initialization uses correct constructor and parameter order
  • Every method name exists in the reference for the target SDK
  • Every parameter name and type matches the reference
  • Import path is exactly correct (not a hallucinated variation)
  • Environment variable names match Scalekit conventions (see reference)

Generation patterns by product area

SaaSKit — Login, SSO, and sessions

  1. Client initialization (singleton pattern)
  2. Login route: generate auth URL with state for CSRF
  3. Callback route: validate state, exchange code, store session
  4. Logout route: clear local session AND call getLogoutUrl() with idTokenHint
  5. Token refresh (if offline_access scope is used)

SaaSKit — SCIM provisioning

  1. Enable directory for an organization
  2. List directory users and groups
  3. Webhook handler for SCIM events

AgentKit — Connections and tool calling

  1. Client initialization
  2. Create/list connected accounts
  3. Execute tools with connected account credentials
  4. Handle token refresh for third-party OAuth tokens

AgentKit — MCP Authentication

  1. MCP server setup with OAuth middleware
  2. Token validation on incoming requests
  3. Scope verification

Webhooks — Always include signature verification:

  1. Raw body parsing (not JSON-parsed)
  2. verifyWebhookPayload(secret, headers, rawBody)
  3. Event type switching

Step 4 — Review mode

When reviewing code, systematically check these categories in order:

Category 1: SDK usage correctness

For every Scalekit SDK call in the code, verify against references/REFERENCE.md:

  • Method name is exactly correct for the target SDK language
  • All required parameters are provided in the correct order
  • Optional parameters use the correct type/shape
  • Return value is handled correctly (Promise in Node, tuple in Python, error in Go, etc.)
  • Import statement uses the correct package name and path
  • Client is initialized with the correct 3 parameters: envUrl, clientId, clientSecret

Category 2: Auth flow completeness

  • If there's a login route, there must be a matching callback route
  • Callback validates state parameter (CSRF protection)
  • Callback exchanges the authorization code (not just reading it)
  • Session is stored after successful authentication
  • Logout calls getLogoutUrl() — not just clearing local session
  • Token refresh exists if offline_access or refresh_token is used
  • IdP-initiated login is handled if callback receives idp_initiated_login parameter

Category 3: Security

  • Session cookies use httpOnly: true, secure: true (in production), sameSite: 'lax' (never 'strict' — breaks OAuth redirects)
  • state parameter uses cryptographically random values, not predictable strings
  • Redirect URLs are validated — only relative paths allowed for next/returnTo params (prevents open redirect)
  • Client secret is read from environment variables, never hardcoded
  • Webhook endpoints verify payload signature before processing
  • Protected routes validate tokens server-side, not just checking cookie existence
  • Cache-Control: no-store on authenticated pages (prevents back-button cache leak)

Category 4: Environment and config

  • Environment variable names follow Scalekit conventions:
    • SCALEKIT_ENV_URL (not SCALEKIT_URL or SCALEKIT_ENVIRONMENT_URL in code — though SCALEKIT_ENVIRONMENT_URL is used in REST API docs)
    • SCALEKIT_CLIENT_ID
    • SCALEKIT_CLIENT_SECRET
  • Redirect URI in code matches what's registered in the Scalekit dashboard
  • Correct Scalekit domain format: https://<subdomain>.scalekit.com (production) or https://<subdomain>.scalekit.dev (development)

Category 5: Best practices

  • Client instantiated once (singleton pattern), not per-request
  • Error handling uses SDK's typed exceptions where available
  • Token refresh handles race conditions across concurrent requests/tabs
  • window.location.href used for OAuth redirects (not router.push or client-side navigation)

Output format for review

For each finding, report:

  1. What's wrong — the specific line or pattern
  2. Why it matters — security risk, runtime error, or silent failure
  3. Corrected code — the exact fix

If everything is correct, say so explicitly: "This code is correct. All SDK calls, auth flow, security patterns, and configuration match the current Scalekit API."


Step 5 — Handling SDK updates and unknown methods

The references/REFERENCE.md in this skill is a point-in-time snapshot. Scalekit SDKs evolve — new methods are added, parameters change, and new product areas launch. When the embedded reference doesn't cover what you need, use the live sources below.

When to check live sources

  • A method the user wrote isn't in the embedded reference (could be newly added, not a typo)
  • The user asks about a feature you don't recognize (e.g., a new connector, a new auth mode)
  • You're generating code for a product area with sparse coverage in the reference
  • The user explicitly mentions a recent SDK update or version

How to check: fetch the live SDK REFERENCE.md files

Each SDK repo has a maintained REFERENCE.md with full, current method signatures. Fetch the one you need:

SDKLive reference URL
Node.jshttps://raw.githubusercontent.com/scalekit-inc/scalekit-sdk-node/main/REFERENCE.md
Pythonhttps://raw.githubusercontent.com/scalekit-inc/scalekit-sdk-python/main/REFERENCE.md
Gohttps://raw.githubusercontent.com/scalekit-inc/scalekit-sdk-go/main/REFERENCE.md
Javahttps://raw.githubusercontent.com/scalekit-inc/scalekit-sdk-java/main/REFERENCE.md
REST APIhttps://docs.scalekit.com/apis.md

Resolution order

  1. Check the embedded references/REFERENCE.md first (fastest, no network)
  2. If the method isn't there, fetch the live SDK REFERENCE.md from the table above
  3. If still not found, fetch https://docs.scalekit.com/apis.md for REST endpoints
  4. If still not found, state explicitly: "This method could not be verified in any Scalekit reference. It may not exist."

Never output code containing an unverified method call.


REST API validation

When the user's code makes raw HTTP calls (fetch, axios, requests, http.Client) to Scalekit endpoints, validate:

  • Base URL format: https://<subdomain>.scalekit.com or https://<subdomain>.scalekit.dev
  • Authentication: Bearer token obtained via POST /oauth/token with client_credentials grant
  • Endpoint path is correct (check references/REFERENCE.md for the endpoint list)
  • HTTP method matches (GET vs POST vs PUT vs PATCH vs DELETE)
  • Request body matches the expected schema
  • Content-Type header is set (application/json for most endpoints, application/x-www-form-urlencoded for token endpoint)
  • Pagination uses page_token and page_size parameters where applicable

Documentation resources

Live SDK references (always current — fetch when embedded reference is stale)

SDKREFERENCE.md (raw)Repo
Node.jshttps://raw.githubusercontent.com/scalekit-inc/scalekit-sdk-node/main/REFERENCE.mdscalekit-sdk-node
Pythonhttps://raw.githubusercontent.com/scalekit-inc/scalekit-sdk-python/main/REFERENCE.mdscalekit-sdk-python
Gohttps://raw.githubusercontent.com/scalekit-inc/scalekit-sdk-go/main/REFERENCE.mdscalekit-sdk-go
Javahttps://raw.githubusercontent.com/scalekit-inc/scalekit-sdk-java/main/REFERENCE.mdscalekit-sdk-java

Scalekit docs

ResourceURLWhen to use
REST API referencehttps://docs.scalekit.com/apis.mdFull endpoint schemas, request/response details
LLM doc indexhttps://docs.scalekit.com/llms.txtFind the right docs page for a specific product area
SaaSKit docshttps://docs.scalekit.com/_llms-txt/saaskit-complete.txtFull SaaSKit reference (users, orgs, sessions, RBAC, SSO, SCIM)
AgentKit docshttps://docs.scalekit.com/_llms-txt/agentkit.txtFull AgentKit reference (agents, OAuth vault, tool calling, connectors)
AgentKit frameworkshttps://docs.scalekit.com/_llms-txt/agentkit-frameworks.txtFramework-specific guides (LangChain, Vercel AI, Anthropic, OpenAI, Google ADK, Mastra)
MCP Authentication docshttps://docs.scalekit.com/_llms-txt/mcp-authentication.txtMCP server OAuth 2.1, Dynamic Client Registration

GitHub repos — working examples

When generating or reviewing framework-specific code, fetch the matching repo for real, tested patterns. Repos are from scalekit-inc and scalekit-developers GitHub orgs.

SaaSKit — Auth examples by framework

FrameworkRepoWhat it shows
Next.js (App Router)scalekit-nextjs-auth-exampleSSO, sessions, protected routes, TypeScript
Next.js (Pages)nextjs-example-appsReact SSO integration flows
Next.js + Auth.jsscalekit-authjs-exampleEnterprise SSO with next-auth v5
Express.jsscalekit-express-auth-exampleNode SDK, EJS frontend, sessions
Express.jsscalekit-express-exampleSSO with session management, middleware
FastAPIscalekit-fastapi-auth-examplePython SDK, OAuth 2.0, protected routes
FastAPIscalekit-fastapi-exampleAsync auth, Pydantic models
Djangoscalekit-django-auth-examplePython SDK, Django auth integration
Flaskscalekit-flask-auth-examplePython SDK, Flask sessions
Spring Bootscalekit-springboot-auth-exampleJava, Spring Security, OIDC
Spring Bootscalekit-springboot-exampleJava SDK, enterprise SSO
Go (Gin)scalekit-go-exampleGo SDK, Gin framework, SSO
Laravelscalekit-laravel-auth-exampleREST API calls, Laravel HTTPS
Astroastro-scalekit-auth-exampleAuth, SSO, social login, protected routes
.NETdotnet-example-appsASP.NET Core, SAML/OIDC
Expo (mobile)expo-scalekit-sampleOAuth 2.0 + PKCE for mobile

SaaSKit — Integration examples

IntegrationRepoWhat it shows
AWS Cognitoscalekit-cognito-ssoOIDC SSO with Cognito user pools
Firebasescalekit-firebase-ssoSAML/OIDC SSO with Firebase Auth
Supabasescalekit-supabase-exampleSupabase + Scalekit auth
Multi-app SSOmultiapp-demoSeamless SSO across multiple apps
Org switcherNextjs-Django-Org-Switcher-ExampleNext.js frontend + Django backend, org switching
OIDC/SAML/SCIMoidc-saml-scim-examplesGoogle, Okta integration patterns
Passwordlesspasswordless-auth-demosPasswordless authentication flows
Managed loginmanaged-loginbox-expressjs-demoHosted login UI with Express
Full demo appcoffee-desk-demoWorkspace creation, user provisioning, RBAC, SSO

AgentKit — Agent and MCP examples

Framework / PatternRepoWhat it shows
LangChainsample-langchain-agentPython LangChain agent with Scalekit auth
Google ADKgoogle-adk-agent-exampleGoogle ADK agent with authenticated tools
Vercel AI SDKvercel-ai-agent-toolkitVercel AI SDK + Scalekit connectors
Apify Actoragentkit-apify-actor-exampleOAuth auth, YouTube → Notion agent
LiteLLMlitellm-agentkit-inbox-triageInbox triage with Gmail, GitHub, Slack
MCP Auth (multi-framework)mcp-auth-demosMCP OAuth 2.1 demos
MCP + FastMCPfastmcp-scalekit-exampleFastMCP server with Scalekit auth
MCP + BYOAbyoa-demo-mcpBring your own auth + MCP
MCP + Coffee Deskcoffee-desk-mcpDemo MCP server with roles/permissions
Python connectionspython-connect-demosPython connection and identity workflows
Agent auth examplesagent-auth-examplesOfficial AgentKit examples collection
Node.js agentsagent-node-demosTypeScript agent demos
Workflow agentsworkflow-agents-demosMulti-step agent workflows
Render deploy kitrender-ai-agent-deploykitRender Workflows + Scalekit + Claude

Developer tools

ToolRepoPurpose
Dryrun CLIscalekit-dryrunTest auth flows without writing code
Scalekit MCP serverscalekit-mcp-serverManage orgs, users, connections via AI assistants
API collectionsapi-collectionsPostman/Bruno collections for Scalekit endpoints
Documentation sourcedeveloper-docsDocs site source (MDX)

Frontend SDKs

SDKRepoPurpose
React SDKscalekit-react-sdkReact OIDC authentication
Vue SDKscalekit-vue-sdkVue OIDC authentication
Expo SDKscalekit-expo-sdkExpo/React Native OAuth 2.0 + PKCE

When generating code for a specific framework, fetch the matching repo's source to see real, tested patterns before writing. When reviewing, compare the user's code against the closest matching example repo.

Keep looking

Skills are one crate of 328,083. Ordering is by how many stacks a row turns up in, so the top of any crate is what has actually been picked rather than what has the most stars.