Adds PermDock authorization to a TypeScript app, from definitions to the first guard. Use when installing permdock, adding permissions, roles, plans, RBAC or access control, writing definePermissions, definePolicy or createPermDock, guarding a route, Server Action, procedure or React component, adding usage limits, plan gates or time-limited grants, or running permdock collect and doctor for the first time.
Ships in PermDock. 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.
Read when SKILL.md points to them.
Three files and one guard: src/permissions.ts (definitions), src/policy.ts (rules) and the factory file, then one check on the path the user asked for (quick start). Import paths and identifiers follow the naming convention.
permissions.post.update), never strings. Roles and plans are typed leaves (roles.owner, plans.pro).granted, denied or approval-required. Anything unknown, invalid or thrown denies, and a matching deny wins over every allow.policy.ts is server-only. Client entries import permissions.ts, snapshots and hooks only.subjectFrom* or the server session), never from a request body, header the client sets, or model output.where conditions first; a closure only when no portable operator expresses the rule.Start. A new app starts from a preset: the user's code from permdock.com/create, or flags. Run npx permdock init --preset <code> --dry-run, show the file list, then run it without --dry-run; it never overwrites a file unless --force is passed. It writes the owned files the steps below describe; review them instead of writing them. An app with its own checks keeps them and adopts beside them with shadowMode and permdock scan (existing apps). -> references/presets-and-recipes.md
✓ Either permdock init wrote the files and printed the install line, or the legacy checks are listed and none was removed.
Detect. Find the framework and the validator. Collect-only frameworks use permdock/unplugin for collect and permdock/server (or the matching HTTP adapter) at runtime; Nuxt collects the same way and runs on permdock/h3. Never add a per-vendor package.
✓ The adapter import path (permdock/<framework>) and the validator import are named.
Define. Create src/permissions.ts. Importable everywhere; no rules, no secrets.
import {
definePermissions,
defineRoles,
definePlans,
resource,
crud,
} from "permdock";
import { Post } from "./schemas";
export const permissions = definePermissions({
post: resource(Post, crud({ relations: { author: "authorId" } })),
});
export const roles = defineRoles({ member: {}, admin: {} });
export const plans = definePlans({ pro: {} });
✓ Every resource the first guard needs has a leaf; instance actions sit in actions, list and create in collection.
Policy. Create src/policy.ts. Prefer grants with to: selectors (anyone(), authenticated(), relation(), a role or plan leaf, actor(), assurance()); role(roles.member, …) sugar also works.
import { definePolicy, role, allow, principal, relation } from "permdock";
import { permissions, roles } from "./permissions";
const member = role(roles.member, [
allow(permissions.post.read),
allow(permissions.post.list),
allow(permissions.post.create),
allow(permissions.post.update, {
to: relation(permissions.post, "author"),
}),
allow(permissions.post.delete, {
where: { authorId: principal.id },
approval: "human",
}),
]);
export const policy = definePolicy(
{ permissions, roles },
{
roles: [member],
subject: (user) => user && { id: user.id, roles: user.roles },
},
);
Short policy features that need no other skill -> references/policy-options.md: usage limits, disclosure: 'hide', plan gates, validFrom / validUntil, step-up with assurance().
✓ At least one role grants the first guard's permission, and no client entry imports policy.ts.
Factory. Create src/permdock/server.ts (or the adapter's documented factory file) with createPermDock from permdock/<framework>. Copy the exact return names. -> references/adapters.md
✓ The factory file compiles and exports the adapter's public members.
Guard. Add one check on the path the user asked for: assert or protect / getPermission with a permission reference on the server, <Protected permission={permissions.post.update}> or useGate inside PermDockProvider in React. For a gated button, approval dialog, tenant switcher or role picker, add the recipe from the @permdock registry rather than writing one. -> references/presets-and-recipes.md
✓ That path cannot run without a granted decision, and the adapter handles a denial (Problem Details or fallback UI).
Check. Run permdock collect, permdock catalog, permdock usage and permdock doctor, and add permdock collect --check to CI. For a Vite SPA, Expo or another framework without 'use client', set doctor.clientEntries to the client source globs so PD001 checks them. When client code lives outside collect.srcPath, list every source folder in doctor.srcPath instead of widening the catalog. Add a describePolicy suite from permdock/testing (scenario testing). -> references/policy-options.md
✓ Collect and doctor findings are fixed, or the three files typecheck and one matrix test passes.
Install each with npx skills add ScaleDockHQ/PermDock --skill <name> when the app needs it:
permdock-agents: AI SDK, Claude Agent SDK, Eve, OpenAI Agents SDK, MCP, A2A and WebMCP tool maps, actors and delegation, automations (permdock/workflow, permdock/workflow-sdk) and chat bots (permdock/chat, permdock/chat-sdk).permdock-approvals: approval: { by }, quorum, escalation, staleOn, approval stores, the resume flow, and approval prompts by email or chat (permdock/delivery, permdock/resend, permdock/chat-sdk).permdock-tenancy: named scopes, memberships, ownership rules (min, assigns, for) and custom roles.permdock-data: where() and filter() in ORM queries, generated RLS, relationship graphs, parity tests.permdock-credentials: subjectFromJwt, API keys and service accounts, share links.permdock-audit: review the result or a pull request.policy.ts is imported only from server code, and PD001 is clean.permdock collect --check runs in CI, and a describePolicy suite covers the new grants.deniedResponse, context and wrap adapter hooks.permdock init and preset codes, what the package owns and what the app owns, and the @permdock shadcn recipes for React and React Native.permdock skill: the mental model, explain for an unexpected denial, and the docs MCP.What SKILL.md sets; muted values are Claude Code's defaults
Other plugins' skills for the same job
8 skills in this plugin
/permdockExplains how PermDock decides and routes to the right PermDock skill. Use first for any work with permdock, typed permissions, roles or access control in a TypeScript app, when a check is denied and the reason is unclear, when reading a Decision, denial reason or doctor code, when looking up current PermDock identifiers through the docs MCP, or when choosing between the permdock-wire, permdock-audit, permdock-agents, permdock-approvals, permdock-tenancy, permdock-data and permdock-credentials skills./permdock-agentsGuards AI agent tool calls, automations and chat commands with PermDock operations, subjects, actors and delegation. Use when declaring defineOperations, wiring operations in permdock/agent, permdock/ai-sdk, permdock/claude-agent, permdock/openai, permdock/eve or permdock/mcp, gating models or filtering tool results, running published automations with permdock/workflow or permdock/workflow-sdk, protecting chat commands and approval buttons with permdock/chat or permdock/chat-sdk, separating the user (principal) from the agent (actor), declaring a delegation option or policy delegations, publishing an A2A Agent Card with permdock/a2a, registering WebMCP tools with permdock/webmcp, verifying Web Bot Auth signers as actors, or when agent calls are denied with no-delegation or not-delegated./permdock:permdock-wirefrom PermDock
npx claudepluginhub scaledockhq/permdock --plugin permdock