/saaskit:implement-scimfrom saaskit
Implements SCIM so an agent can provision users and groups from a directory. Use when the user wants SCIM or to provision users. It does not write SaaSKit login (that's `implement-saaskit`) or add SSO (that's `implement-sso`).
Ships in saaskit. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
None: SKILL.md is the whole skill.
Provision users and groups from a directory. Then stop.
verifyWebhookPayload before reading the event. Invalid signature → 400. Do not process it.user_created can arrive twice.organization.directory.user_deleted. MUST NOT hard-delete unless the repo already does.implement-sso instead.implement-saaskit.SCALEKIT_ENVIRONMENT_URL, SCALEKIT_CLIENT_ID, SCALEKIT_CLIENT_SECRET, and SCALEKIT_WEBHOOK_SECRET. Never SCALEKIT_ENV_URL. Do not prepend https://.express.raw({ type: 'application/json' }) on /webhooks/scalekit before express.json(). The signature is the exact request bytes.verifyWebhookPayload(secret, headers, payload) takes a string. It throws. Catch → 400.webhook-id, webhook-timestamp, and webhook-signature.email, name, organization_id. Group fields: id, display_name, organization_id.email, givenName, familyName — no name. Groups have id, displayName.getPrimaryDirectoryByOrganizationId(orgId) returns the directory object, not { directory }.org_… from the dashboard or the event. Do not invent IDs.If the user wants the admin portal so IT can turn on the directory, name implement-sso. Stay here for the webhook.
Print this checklist. Wait for the user. Then continue.
Put the three env names in the project env file. Leave SCALEKIT_WEBHOOK_SECRET for Step 5.
Done when: the three env names exist.
Install @scalekit-sdk/node only when the repo has no Scalekit SDK yet.
import { ScalekitClient } from '@scalekit-sdk/node';
const scalekit = new ScalekitClient(
process.env.SCALEKIT_ENVIRONMENT_URL,
process.env.SCALEKIT_CLIENT_ID,
process.env.SCALEKIT_CLIENT_SECRET
);
Done when: the client initializes from those env vars.
app.post('/webhooks/scalekit', express.raw({ type: 'application/json' }), async (req, res) => {
const payload = req.body.toString('utf8');
try {
scalekit.verifyWebhookPayload(
process.env.SCALEKIT_WEBHOOK_SECRET,
req.headers,
payload
);
} catch {
return res.status(400).json({ error: 'Invalid signature' });
}
const event = JSON.parse(payload);
await handleDirectoryEvent(event.type, event.data);
return res.status(201).json({ received: true });
});
Respond 201 within 10 seconds. If the map is slow, enqueue and still return 201.
Done when: POST /webhooks/scalekit verifies the signature and returns 201.
Call the repo's existing create, update, and deactivate helpers. Search for those names. Do not invent a second user store.
async function handleDirectoryEvent(type, data) {
switch (type) {
case 'organization.directory.user_created':
case 'organization.directory.user_updated':
return upsertUser({ email: data.email, name: data.name, orgId: data.organization_id });
case 'organization.directory.user_deleted':
return deactivateUser(data.email);
case 'organization.directory.group_created':
case 'organization.directory.group_updated':
return upsertGroup({ id: data.id, name: data.display_name, orgId: data.organization_id });
case 'organization.directory.group_deleted':
return removeGroup(data.id);
default:
return;
}
}
Done when: those six events map to local users and groups.
Print this checklist. Wait for the user. Then continue.
https://…/webhooks/scalekitorganization.directory.user_createdorganization.directory.user_updatedorganization.directory.user_deletedorganization.directory.group_createdorganization.directory.group_updatedorganization.directory.group_deletedSCALEKIT_WEBHOOK_SECRETDone when: the secret is in env and a test event created or updated a local user.
Use this for a first sync or a backfill. orgId is the customer's org_… from the dashboard or the last event.
const directory = await scalekit.directory.getPrimaryDirectoryByOrganizationId(orgId);
const { users } = await scalekit.directory.listDirectoryUsers(orgId, directory.id);
for (const user of users) {
await upsertUser({
email: user.email,
name: [user.givenName, user.familyName].filter(Boolean).join(' '),
orgId,
});
}
const { groups } = await scalekit.directory.listDirectoryGroups(orgId, directory.id);
for (const group of groups) {
await upsertGroup({ id: group.id, name: group.displayName, orgId });
}
Done when: a list of directory users and groups upserts into the same store as Step 4.
Do not embed the admin portal here.
Done when: the webhook maps users and groups, a test event landed, and this skill has stopped.
implement-sso for the admin portal so IT can turn on the directoryimplement-saaskit if the app also needs SaaSKit loginimplement-access-control for roles and permissions at a routeWhat SKILL.md sets; muted values are Claude Code's defaults
npx claudepluginhub scalekit-inc/authstack --plugin saaskit15 skills in this plugin
/add-api-authAdds API key or client-credentials auth so an agent can protect an API. Use when the user wants an API key or client credentials. It does not put OAuth 2.1 on an MCP server (that's `add-mcp-oauth`) or write SaaSKit login (that's `implement-saaskit`).
/add-mcp-oauthAdds MCP OAuth so an agent can protect the user's MCP server. Use when the user wants MCP OAuth or to protect their MCP server. It does not add API keys or client credentials (that's `add-api-auth`) or expose AgentKit tools over MCP (that's `expose-agentkit-mcp`).
/check-saaskit-prodChecks SaaSKit production so an agent can finish a go-live checklist. Use when the user wants SaaSKit production or to go live SaaSKit. It does not write login (that's `implement-saaskit`) or run dryrun (that's `run-dryrun`).
Other plugins' skills for the same job