/volcano:volcano-typescriptfrom volcano
Canonical TypeScript type definitions for the Volcano SDK: User, Session, AuthResponse, QueryBuilder, StorageObject, Realtime, Durable, durable approval, durable message, and durable callback types, Function invocation generics, OAuth providers, middleware types, and utility types.
Ships in volcano. 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.
Provide the canonical TypeScript type definitions for every Volcano SDK surface. Use this skill whenever a task needs a precise type — including return shapes for auth/db/storage/realtime/functions, query builder generics, and middleware contracts. The SDK ships these types alongside the runtime, so import type { ... } from '@volcano.dev/sdk' works at compile time without any extra package.
volcano.from<T>(...) or insert<T>(...).signIn, signUp, getUser, getSessions).PostgresChange, PresenceState).invoke<P, R>(...).getUser(token) or refreshToken(...).import { VolcanoAuth } from '@volcano.dev/sdk';
import type {
User,
Session,
AuthResponse,
UserResponse,
SessionResponse,
VolcanoAuthConfig,
} from '@volcano.dev/sdk';
interface VolcanoAuthConfig {
/** API URL (defaults to https://api.volcano.dev) */
apiUrl?: string;
/** Project anon key (required) */
anonKey: string;
/** Access token for server-side use */
accessToken?: string;
/** Refresh token for server-side use */
refreshToken?: string;
}
interface User {
id: string;
email: string;
user_metadata?: Record<string, JsonValue>;
created_at: string;
updated_at: string;
}
The id is the Volcano auth user_id; use it as the foreign key in your users application table.
interface Session {
access_token: string;
refresh_token: string;
expires_in: number;
}
interface AuthResponse {
user: User | null;
session: Session | null;
error: Error | null;
}
interface UserResponse {
user: User | null;
error: Error | null;
}
interface SessionResponse {
session: Session | null;
error: Error | null;
}
Returned from signUp, signIn, getUser, refreshSession, etc. Always check error before consuming user/session — they are null when error is set.
interface Post {
id: string;
title: string;
content: string;
status: 'draft' | 'published' | 'archived';
user_id: string;
created_at: string;
}
const { data, error } = await volcano
.from<Post>('posts')
.select('*')
.eq('status', 'published');
if (data) {
data.forEach(post => {
// TypeScript knows post.title is string
// and post.status is the union literal type
});
}
const { data, error } = await volcano
.insert<Post>('posts', {
title: 'New Post',
content: 'Content here',
status: 'draft',
});
const { data: updated } = await volcano
.update<Post>('posts', { status: 'published' })
.eq('id', postId);
TypeScript validates the partial shape against Post.
interface QueryBuilder<T> {
select(columns: string): QueryBuilder<T>;
eq(column: string, value: FilterValue): QueryBuilder<T>;
neq(column: string, value: FilterValue): QueryBuilder<T>;
gt(column: string, value: FilterValue): QueryBuilder<T>;
gte(column: string, value: FilterValue): QueryBuilder<T>;
lt(column: string, value: FilterValue): QueryBuilder<T>;
lte(column: string, value: FilterValue): QueryBuilder<T>;
like(column: string, pattern: string): QueryBuilder<T>;
ilike(column: string, pattern: string): QueryBuilder<T>;
is(column: string, value: null): QueryBuilder<T>;
in(column: string, values: FilterValue[]): QueryBuilder<T>;
order(column: string, options?: { ascending?: boolean }): QueryBuilder<T>;
limit(count: number): QueryBuilder<T>;
offset(count: number): QueryBuilder<T>;
execute(): Promise<QueryResult<T>>;
}
interface QueryResult<T> {
data: T[] | null;
error: Error | null;
count?: number;
}
The chain auto-resolves on await — you rarely need to call .execute() explicitly. count populates only when the query/result mode supports it.
interface StorageObject {
id: string;
bucket_id: string;
name: string;
owner_id?: string;
is_public: boolean;
size: number;
mime_type: string;
etag?: string;
metadata?: Record<string, JsonValue>;
created_at: string;
updated_at: string;
public_url?: string;
}
interface StorageUploadOptions {
contentType?: string;
}
interface StorageUploadResponse {
data: StorageObject | null;
error: Error | null;
}
interface StorageDownloadResponse {
data: Blob | null; // Blob in browser; convert with Buffer.from(await blob.arrayBuffer()) in Node
error: Error | null;
}
interface StorageListResponse {
data: StorageObject[] | null;
error: Error | null;
nextCursor: string | null; // null on the final page
}
const storage = volcano.storage.from('avatars');
const { data, error }: StorageUploadResponse = await storage.upload(
'user/avatar.jpg',
file,
{ contentType: 'image/jpeg' }
);
const { data: blob }: StorageDownloadResponse = await storage.download('user/avatar.jpg');
const { data: files, nextCursor }: StorageListResponse = await storage.list('user/', {
limit: 100,
});
Import realtime types from the realtime module:
import { VolcanoRealtime, RealtimeChannel } from '@volcano.dev/sdk/realtime';
import type {
PostgresChange,
PresenceState,
ConnectContext,
DisconnectContext,
ErrorContext,
RealtimeConfig,
ChannelOptions,
WebSocketConstructor,
} from '@volcano.dev/sdk/realtime';
interface RealtimeConfig {
apiUrl: string;
anonKey: string;
accessToken?: string;
getToken?: () => Promise<string>;
volcanoClient?: VolcanoAuth;
fetchConfig?: FetchConfig;
webSocket?: WebSocketConstructor;
}
interface ChannelOptions {
type?: 'broadcast' | 'presence' | 'postgres';
autoFetch?: boolean;
fetchBatchWindowMs?: number;
fetchMaxBatchSize?: number;
}
interface ConnectContext {
client?: string;
latency?: number;
}
interface DisconnectContext {
code?: number;
reason?: string;
reconnect?: boolean;
}
interface ErrorContext {
error?: Error;
message?: string;
code?: number;
}
interface PostgresChange {
table: string;
schema: string;
type: 'INSERT' | 'UPDATE' | 'DELETE';
record?: Record<string, unknown>; // present on INSERT/UPDATE
old_record?: Record<string, unknown>; // present on UPDATE/DELETE
columns?: string[]; // changed columns, UPDATE only
timestamp: string;
}
interface Message {
id: string;
content: string;
user_id: string;
created_at: string;
}
channel.onPostgresChanges('INSERT', 'public', 'messages', (change: PostgresChange) => {
const message = change.record as Message;
// ...
});
The callback's change.record is Record<string, unknown>; cast to your row type at the boundary.
interface PresenceState {
[clientId: string]: Record<string, unknown>;
}
interface UserPresence {
user_id: string;
username: string;
status: 'online' | 'away' | 'busy';
}
channel.onPresenceSync((state: PresenceState) => {
const users = Object.values(state) as UserPresence[];
// ...
});
interface InvokeParams {
userId: string;
action: 'fetch' | 'update' | 'delete';
}
interface InvokeResult {
success: boolean;
data?: Record<string, unknown>;
message?: string;
}
const { data, error } = await volcano.functions.invoke<InvokeParams, InvokeResult>(
'process-user',
{ userId: '123', action: 'fetch' }
);
if (data) {
// TypeScript knows data.success is boolean, data.message is string | undefined
}
The full return tuple from invoke<P, R>(...) is { data: R | null; status: number; headers: Record<string, string>; version: string; error: Error | null }.
Authoring types come from the durable entry point:
import { durable, type DurableContext, type DurableHandler } from '@volcano.dev/sdk/durable';
interface OrderInput {
order_id: number;
}
interface OrderResult {
order_id: number;
outcome: 'shipped' | 'refunded';
}
const run: DurableHandler<OrderInput, OrderResult> = async (input, ctx) => {
const order = await ctx.step('load', () => loadOrder(input.order_id));
await ctx.wait('settle', '30s');
return { order_id: order.id, outcome: 'shipped' };
};
export const handler = durable(run);
DurableContext, StepOptions, WaitUntilOptions, BatchOptions,
BatchResult, Retry, and DurableDuration describe authoring. Execution
client types come from the main entry point:
import type { DurableExecution, DurableExecutionStatus } from '@volcano.dev/sdk';
const status: DurableExecutionStatus = 'running';
const { data } = await volcano.durable.list(projectId, 'order-pipeline', { status });
const execution: DurableExecution | undefined = data?.data[0];
DurableExecution uses the API's snake-case fields. Its result is unknown,
so narrow it before use.
ctx.waitForApproval takes WaitForApprovalOptions and resolves with an
ApprovalDecision, both from the durable entry point:
import type { ApprovalDecision, WaitForApprovalOptions } from '@volcano.dev/sdk/durable';
const request: WaitForApprovalOptions = { title: 'Ship order 4417?', timeout: '3d' };
const decision: ApprovalDecision = await ctx.waitForApproval('ship-order', request);
// decision.status is 'approved' | 'denied' | 'expired'; decidedBy is null on expiry.
Reading and deciding approvals uses the main entry point's DurableApproval,
DurableApprovalStatus, PaginatedDurableApprovals, and DurableApprovalStats,
with DurableApprovalListOptions and DurableApprovalStatsOptions for filters:
import type { DurableApproval, DurableApprovalListOptions } from '@volcano.dev/sdk';
const options: DurableApprovalListOptions = { status: 'pending', function: 'order-pipeline' };
const { data } = await volcano.durable.approvals.list(projectId, options);
const approval: DurableApproval | undefined = data?.data[0];
Like DurableExecution, DurableApproval uses snake-case fields
(requested_at, expires_at, decision.decided_by).
ctx.waitForMessage takes WaitForMessageOptions and resolves with a
ReceivedMessage or null; ctx.publish resolves with a PublishedMessage.
MessageSender is the sender's type and userId. All four come from the
durable entry point:
import type { PublishedMessage, ReceivedMessage } from '@volcano.dev/sdk/durable';
const posted: ReceivedMessage | null = await ctx.waitForMessage('posted', { timeout: '1d' });
// posted has id, name, data (unknown), sender, and sentAt.
const progress: PublishedMessage = await ctx.publish('progress', { pct: 40 });
// progress has id and seq.
Sending, listing, and subscribing use the main entry point's
DurableMessageTarget, DurableMessageSendOptions,
DurableMessageListOptions, DurableMessageSubscribeOptions, and
DurableMessageSubscription. Results are DurableMessage and
DurableMessageList, with snake-case fields (execution_id, sent_at,
delivered_at, sender.user_id), and DurableMessageDirection is
'in' | 'out':
import type { DurableMessage, DurableMessageTarget } from '@volcano.dev/sdk';
const target: DurableMessageTarget = {
functionName: 'publish-post',
executionId: execution.id,
clientToken: execution.client_token,
};
const { data } = await volcano.durable.messages.list(target, { direction: 'out' });
// One page, oldest first: read on with `after` while `has_more`, or use
// `subscribe`, to reach the newest.
const lastOnPage: DurableMessage | undefined = data?.data.at(-1);
A start that creates an execution returns client_token on its
DurableExecution; a repeated start under the same name leaves it unset.
ctx.waitForCallback takes a CallbackSubmitter, (token: string) => unknown,
and WaitForCallbackOptions (timeout, heartbeatTimeout). It resolves with
unknown, the holder's JSON result, or null on timeout, so narrow it before
use. A failed callback throws CallbackFailedError, whose type and message
are what the holder sent. All three come from the durable entry point; the SDK
has no client method for answering, since the holder posts the token itself:
import { CallbackFailedError, type WaitForCallbackOptions } from '@volcano.dev/sdk/durable';
interface Charge { charge_id: string }
function isCharge(value: unknown): value is Charge {
return typeof value === 'object' && value !== null
&& typeof (value as { charge_id?: unknown }).charge_id === 'string';
}
const options: WaitForCallbackOptions = { timeout: '1h', heartbeatTimeout: '10m' };
let result: unknown;
try {
result = await ctx.waitForCallback('payment', startPayment, options);
} catch (error) {
if (error instanceof CallbackFailedError) return { declined: error.type };
throw error;
}
if (result === null) return { abandoned: true };
if (!isCharge(result)) throw new Error('payment callback result has no charge_id');
const charge: Charge = result;
type OAuthProviderName = 'google' | 'github' | 'microsoft' | 'apple';
interface OAuthProvider {
provider: OAuthProviderName;
linked_at: string;
updated_at: string;
}
interface OAuthAPIParams {
endpoint: string;
method?: string;
body?: JsonValue;
}
volcano.auth.signInWithOAuth('google'); // OK
volcano.auth.signInWithOAuth('invalid'); // Compile error: not in OAuthProviderName
const { providers } = await volcano.auth.getLinkedOAuthProviders();
providers?.forEach((p: OAuthProvider) => { /* ... */ });
interface AuthSession {
id: string;
user_id: string;
provider: 'email' | 'google' | 'github' | 'microsoft' | 'apple' | 'anonymous';
user_agent?: string;
ip_address?: string;
last_ip_address?: string;
expires_at: string;
last_activity_at?: string;
session_started_at?: string;
is_active: boolean;
is_current: boolean;
created_at: string;
updated_at: string;
}
interface SessionsResponse {
sessions: AuthSession[] | null;
total: number;
page: number;
limit: number;
total_pages: number;
error: Error | null;
}
Returned from volcano.auth.getSessions({ page, limit }). is_current flags the calling client's own session.
import type {
ServerClientConfig,
ServerClient,
User,
GetUserResult,
RefreshTokenResult,
} from '@volcano.dev/sdk/next/middleware';
interface ServerClientConfig {
anonKey: string;
apiUrl?: string;
accessToken?: string;
}
interface ServerClient {
getUser(accessToken: string): Promise<GetUserResult>;
refreshToken(refreshToken: string): Promise<RefreshTokenResult>;
}
interface GetUserResult {
user: User | null;
error: Error | null;
}
interface RefreshTokenResult {
accessToken: string | null;
refreshToken: string | null;
error: Error | null;
}
Recursive JSON-serializable type. Used throughout the SDK for user_metadata, OAuth bodies, function payloads, and realtime broadcast payloads:
type JsonValue =
| string
| number
| boolean
| null
| JsonValue[]
| { [key: string]: JsonValue };
Values accepted by query filter operators (eq/neq/gt/etc.):
type FilterValue = string | number | boolean | null | Date;
Convenience alias when typing user_metadata records:
type UserMetadata = Record<string, JsonValue>;
Centralize entity types in one application-owned shared model file and import them everywhere they're used. In the canonical web/ frontend this lives under web/types/ (e.g. web/types/models.ts); in a non-web app, use that app's existing shared types path instead of creating web/ just for types.
// web/types/models.ts, or your existing shared application types path
export interface User {
id: string;
email: string;
display_name?: string;
created_at: string;
}
export interface Post {
id: string;
user_id: string;
title: string;
content: string;
published: boolean;
created_at: string;
}
function isError<T>(result: { data: T | null; error: Error | null }): result is { data: null; error: Error } {
return result.error !== null;
}
const result = await volcano.from('posts').select('*');
if (isError(result)) {
console.error(result.error.message);
return;
}
// result.data is non-null here
Even with error null, data can be empty (e.g., select with no matches returns [], not null; but update/delete returning no rows returns [] or null depending on the call). Always handle both:
const { data, error } = await volcano.update('posts', { ... }).eq('id', id);
if (error) return handleError(error);
if (!data || data.length === 0) return notFound();
const updated = data[0];
The SDK gives you Record<string, unknown>; cast to your row type once at the entry of the handler:
channel.onPostgresChanges('INSERT', 'public', 'posts', (change) => {
const post = change.record as Post;
setPosts(prev => [post, ...prev]);
});
tsconfig.json should have "strict": true (the volcano-standard scaffold sets this by default). It surfaces null/undefined mistakes at compile time:
{
"compilerOptions": {
"strict": true,
"noUncheckedIndexedAccess": true
}
}
noUncheckedIndexedAccess is optional but catches subtle bugs with data[0] after a query.
| Domain | Most useful type | Where it appears |
|---|---|---|
| Auth | User, Session, AuthResponse | signIn/signUp/getUser returns |
| Database | QueryResult<T>, FilterValue | from<T>(...).select(...) chain |
| Storage | StorageObject, StorageUploadResponse, StorageListResponse | storage.from(...) operations |
| Realtime | PostgresChange, PresenceState, ConnectContext | Channel callbacks |
| Functions | invoke<P, R>(...) generic params | Both ends of an invocation |
| Durable | DurableHandler, DurableContext, DurableExecution, ApprovalDecision, DurableApproval, ReceivedMessage, PublishedMessage, DurableMessage, DurableMessageTarget, CallbackSubmitter, WaitForCallbackOptions, CallbackFailedError | Durable authoring, approvals, messages, callbacks, and execution clients |
| OAuth | OAuthProviderName, OAuthProvider | Provider name validation |
| Sessions | AuthSession, SessionsResponse | Multi-device session UI |
| Middleware | ServerClient, GetUserResult | Next.js middleware/route handlers |
| Utility | JsonValue, FilterValue, UserMetadata | Anywhere user-supplied JSON-shaped data flows |
tsconfig.json has "strict": true.data consumption is guarded by an if (error) (or equivalent) check first.volcano.from<T>(...), volcano.insert<T>(...), volcano.update<T>(...) use generic parameters where they apply.change.record to a typed row type at the entry boundary.invoke<Params, Result>(...) generics, not invoke(...).DurableHandler<Input, Result> when their input and result are known.OAuthProviderName, not string.volcano-sdk — top-level orientation and mandatory usage.volcano-platform — project shape, Volcano Functions runtime contract, build pipeline.volcano-auth, volcano-database, volcano-functions, volcano-durable, volcano-storage, volcano-realtime, volcano-nextjs, volcano-uiux) — pair with this skill when implementing.What SKILL.md sets; muted values are Claude Code's defaults
Other plugins' skills for the same job
18 skills in this plugin
/install-volcanoInstall, upgrade, or set up the Volcano CLI. Use this whenever a task needs the volcano CLI and `which volcano` hasn't been confirmed yet, even if the user never says "install" (e.g. "build me a todo API using volcano")./volcano-authUse for Volcano authentication and identity work including user accounts, email or password sign-up and sign-in, OAuth, sessions, anonymous users, password recovery, and private or per-user data./volcano-databaseUse whenever a Volcano app stores or persists data, including CRUD, records, per-user data, migrations, RLS, todos, chat messages, polls, analytics, counters, click tracking, CMS content, feature flags, and leaderboards./volcano-durableUse for Volcano durable functions, long-running or resumable workflows, checkpointed steps, waits, human approvals, messages sent to a running workflow, callbacks an external system answers with a token, live workflow progress, polling, durable executions, idempotent starts, and durable function schedulers./volcano-error-handlingReusable error handling patterns for Volcano SDK apps: centralized error dispatcher with action enum, useApiCall React hook for loading/error/data state, retry with exponential backoff, retry with toast notifications, and cross-domain error message catalog./volcano-feedbackUse after a Volcano task in which you hit a problem with Volcano itself, such as a CLI bug, docs or skills that disagree with the CLI, a missing command that forced a workaround, a server error that repeats, or conflicting Volcano instructions, and when the user asks to send Volcano feedback. Files each problem with volcano feedback from a background agent.npx claudepluginhub kong/volcano-agentic-plugins --plugin volcano