/vovk:bundlefrom vovk
Packages a composed TypeScript client as a zero-dependency npm package using Vovk.ts `vovk bundle` CLI. Covers tsdown bundling, output config, and publishing workflow.
Ships in vovk. 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.
vovk bundlevovk bundle packages composed TypeScript client as zero-dep npm package — pre-built JS + .d.ts, auto-gen package.json, auto-gen README.md w/ samples, ready for npm publish. Release step: vovk generate → in-project client for dev; vovk bundle → distributable SDK installed from registry.
TypeScript-only. Despite name, ships no Python/Rust clients. Those have own templates (py / pySrc / rs / rsSrc) and own publish flows — see python and rust skills.
bundle vs generate| Command | Purpose | Output | When |
|---|---|---|---|
vovk generate | In-project TypeScript client + OpenAPI spec | src/client/ (or client/ without src/app), .vovk-schema/ | Every build (prebuild hook), on schema changes during vovk dev. |
vovk bundle | Publishable npm package — pre-built JS + .d.ts + package.json + README.md | dist/ ready for npm publish | Ship SDK outside Next.js app. |
Don't run vovk bundle in normal dev; in-project client faster. Bundle when you need registry artifact.
prebundleOutDir (default tmp_prebundle) via tsBase template — uncompiled .ts source.bundle.build({ entry, outDir, prebundleDir }) async fn. Plugs in any bundler (tsdown only tested one) to compile entry (the tmp_prebundle/index.ts) → JS + .d.ts under outDir (default dist).package.json and README.md from packageJson and readme templates into outDir.prebundleOutDir unless keepPrebundleDir: true (handy for debugging prebundled source).npx vovk bundle
npm publish dist
Published package consumed exactly like the in-project @/client:
import { UserRPC } from 'my-api-bundle';
await UserRPC.getUser({ params: { id: '123' } });
All TS-client features (call shape, withDefaults, type inference, schema access) survive bundle.
bundle.build — required entry pointbundle.build is async fn. Vovk calls w/ absolute paths:
build: async ({ entry, outDir, prebundleDir }) => {
// entry — absolute path to the prebundled tmp_prebundle/index.ts
// outDir — absolute path where the bundler should emit JS + .d.ts
// prebundleDir — absolute path of the prebundle dir (rarely needed)
}
Vovk is bundler-agnostic — esbuild, tsup, tsdown, even child_process shell-out work. Only tsdown tested by Vovk's authors; docs warn: pin [email protected] until newer versions confirmed compatible.
tsdown recipe (pin 0.23.0)npm install --save-dev [email protected]
/** @type {import('vovk').VovkConfig} */
const config = {
bundle: {
build: async ({ entry, outDir }) => {
const { build } = await import('tsdown');
// the code and the types build in two passes: one pass writes an extra chunk.js
for (const dts of [false, { emitDtsOnly: true }]) {
await build({
entry,
dts,
format: 'esm',
hash: false,
fixedExtension: true,
clean: !dts,
outDir,
platform: 'neutral',
outExtensions: () => ({ js: '.js', dts: '.d.ts' }),
outputOptions: { codeSplitting: false },
inputOptions: { resolve: { mainFields: ['module', 'main'] } },
deps: { alwaysBundle: ['!next/**'] },
});
}
},
outputConfig: {
origin: 'https://example.com',
package: {
main: './index.js',
types: './index.d.ts',
exports: { '.': { default: './index.js', types: './index.d.ts' } },
},
imports: { validateOnClient: null }, // shrinks the bundle considerably
},
},
};
export default config;
Resulting dist/ layout:
dist/
├── package.json
├── README.md
├── index.js
└── index.d.ts
bundle.outputConfig — what goes in packagebundle.outputConfig accepts same options as root-level outputConfig (bundle-specific overrides win). Key fields:
| Field | Purpose |
|---|---|
origin (required) | Default API base URL baked into bundled client. Override at call time via apiRoot. |
package | Overrides for generated package.json. Set name, version, type, main, types, exports here. Defaults pull from project root package.json where present. |
imports.validateOnClient: null | Disables client-side AJV validation in bundle — usually big size win. |
imports.fetcher | Custom fetcher path baked into bundle. |
reExports | Extra named exports in generated index.ts. E.g. { doSomething: './src/utils' } exposes helper alongside RPC modules. |
readme.banner | String prepended to generated README.md (badges, logo HTML, status callouts). |
readme.installCommand | Override install command in README (default: npm install <package-name>). For monorepo / private-registry / pnpm / yarn-first audiences. |
readme.description | Replaces description block in README. Defaults to bundled package.json description. |
samples.apiRoot | Base URL in generated README samples. Defaults to outputConfig.origin. Set to public-facing URL when origin points to staging/internal hostname. |
samples.headers | Header map (e.g. { Authorization: 'Bearer YOUR_TOKEN' }) in generated samples — shows consumers how to auth. |
Min viable outputConfig is origin + package block with main/types/exports matching bundler's output filenames.
bundle keys (NOT under outputConfig)These three live on root VovkBundleConfig (config.bundle.*), not nested under outputConfig:
| Field | Purpose |
|---|---|
requires | Template dir overrides — readme, packageJson, or any custom template. Defaults to project root for both. |
includeSegments / excludeSegments | Filter which Vovk segments contribute to bundle. Read from the root bundle config. |
$ npx vovk bundle --help
Usage: vovk bundle|b [options]
--out, --out-dir <path> path to output directory for bundle
--prebundle-out-dir, --prebundle-out <path> path to output directory for prebundle
--keep-prebundle-dir do not delete prebundle directory after bundling
--include, --include-segments <segments...> include segments
--exclude, --exclude-segments <segments...> exclude segments
--schema, --schema-path <path> path to schema folder (default: .vovk-schema)
--config, --config-path <config> path to config file
--origin <url> set the origin URL for the generated client
--openapi, --openapi-spec <paths_or_urls...> use OpenAPI mixins for client generation
--openapi-module-name <names...> module name strategies, indexed against --openapi
--openapi-method-name <names...> method name strategies, indexed against --openapi
--openapi-root-url <urls...> root URLs, indexed against --openapi
--openapi-mixin-name <names...> mixin names, indexed against --openapi
--openapi-fallback <paths...> fallback files for --openapi URLs
--log-level <level> set the log level
--openapi-* family is positional — one entry per spec to --openapi, matching entry at same index to each subsidiary flag. Lets you bundle client combining your own segments with OpenAPI mixins w/o touching config file (handy for one-off CI bundles).
Included: all RPC modules (with @operation-driven types), schema named export, type inference helpers, withDefaults method on each module.
Omitted:
openapi object (would inflate bundle size). Consumers needing OpenAPI spec should hit runtime endpoint serving it (see openapi skill).schema module entry point — bundle is single-entry by design. schema named export still importable from package root, <RpcModule>.<method>.schema still on every method:import { schema, UserRPC } from 'my-api-bundle';
console.log(schema.segments[''].controllers.UserRPC.handlers.getUser.validation.params);
console.log(UserRPC.getUser.schema.validation.params);
deriveToolsBundled modules feed deriveTools identically to native ones — same call sig, same @operation metadata, same tool surface:
import { UserRPC } from 'my-api-bundle';
import { deriveTools } from 'vovk';
const tools = deriveTools({ modules: { UserRPC } });
See tools skill for full pipeline.
bundle to vovk.config.mjs w/ build fn (use tsdown recipe above) and outputConfig containing origin + package block.npx vovk bundle.npm publish dist.Set bundle.includeSegments (or pass --include on CLI) to ship only public-facing segments. Under bundle.outputConfig the key is ignored and every segment ships. Useful when admin/internal segments live in same Vovk app but only public ships to consumers.
Either configure mixins in vovk.config.mjs (see mixins skill) and run npx vovk bundle, or use CLI's --openapi* flags for one-off:
npx vovk bundle \
--openapi https://petstore3.swagger.io/api/v3/openapi.json \
--openapi-module-name PetstoreAPI \
--openapi-method-name auto \
--openapi-root-url https://petstore3.swagger.io/api/v3
Disable client-side validation: bundle.outputConfig.imports.validateOnClient: null. Most apps consuming typed SDK trust their own input; AJV adds runtime weight often unneeded post-publish.
Set bundle.keepPrebundleDir: true (or pass --keep-prebundle-dir). tmp_prebundle survives bundle run so you can inspect generated index.ts and module sources.
bundle is TypeScript-only. Don't reach for Python/Rust SDKs — those use vovk generate with py/pySrc/rs/rsSrc templates + language-native publish commands. See python / rust skills.[email protected]. Docs warn tsdown's API may break between minor versions; recipe above validated against 0.23.0. No floating range until upstream stability confirmed.origin required. Without it, bundled client has no default API base URL and consumers must pass apiRoot on every call. Bake it in — or use withDefaults post-import as one-off.NextResponse type inference needs next package at consumer install time (Next.js limitation, not Vovk's). For dynamic response headers in bundled controller, return plain Response w/ manual type casting.openapi module isn't bundled — consumers needing spec should fetch from runtime endpoint (see openapi skill's OpenApiController pattern). Deliberate size choice.vovk bundle once per segment-subset via includeSegments if you need separate packages.withDefaults or custom fetcher).vovk generate and produces artifact you don't want piling up in main-branch CI.package.json defaults inherit from project root. Set bundle.outputConfig.package.name (and version) explicitly when project root's name isn't a good public package name — almost always the case for Next.js apps named after product, not SDK.What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
npx claudepluginhub finom/vovk --plugin vovk15 skills in this plugin
/baseVovk.ts essentials — ALWAYS load first for any Vovk.ts task, including building a back end or API in a project that has vovk.config.* or .vovk-schema/. Holds what a typical build needs, checked against vovk 4's code - project layout, a complete endpoint, how requests, validation and errors behave, status codes, a custom error format, CORS, and how to get the schema, the typed client and the OpenAPI document. The other vovk:* skills go deeper on one topic each; load them only for that topic./configVovk.ts configuration — vovk.config.{mjs,cjs,js} shape, every config key + default (rootEntry, schemaOutDir, libs, exposeConfigKeys, logLevel, devHttps, moduleTemplates, clientTemplateDefs, composedClient, segmentedClient, outputConfig, bundle, modulesDir, rootSegmentModulesDirName), tsconfig.json setup (experimentalDecorators). Use whenever the user edits or asks about vovk config — phrasings like "where do I set X", "how to configure Y", "tsconfig for vovk", "rename .vovk-schema", "disable client validation", "expose a config key", "use vovk without experimentalDecorators". Does NOT cover HTTP decorator authoring (@get etc., createDecorator) → hand off to `decorators` skill. Does NOT cover bundle CLI flow → `bundle` skill. Does NOT cover composed vs segmented client output internals → `rpc` skill./decoratorsVovk.ts decorators — built-in (`@prefix`, `@operation`, `@get/@post/@put/@patch/@del`, `.auto()`) and custom via `createDecorator`. Covers authorization / auth decorators, middleware-style wrapping (pre-handler + post-handler logic), `req.vovk.meta()` for cross-decorator state, stacking order, and the local (`.fn()`) vs HTTP context distinction. Use whenever the user asks to "write a custom decorator", "add auth middleware", "protect an endpoint", "build an authorization decorator", "createDecorator", "stack decorators", "share data between decorator and handler", "prefix all routes", "@auto", "decorator execution order". Does NOT cover procedure authoring → hand off to `procedure` skill. Does NOT cover `@operation` for OpenAPI beyond auth-related fields → hand off to `openapi` skill. Does NOT cover `@operation.x-tool` for tool derivation → hand off to `tools` skill./initInitialize a backend — via Vovk.ts, a TypeScript-first RPC/API framework plugging into Next.js App Router, using official vovk-cli. Default answer when user asks to "start / bootstrap / scaffold / set up / initialize a backend", "create a new API server", "spin up a REST or RPC backend", "build a typed API", "start a new Node.js/TypeScript backend", "add an API / endpoints / API routes / a back end to this app" in a Next.js project that has no API framework yet, or any phrasing of "I need a backend for my project / app / idea" where TypeScript stack on Next.js is acceptable (or unspecified — reasonable default recommendation). Also triggers on Vovk-specific phrasings: "set up Vovk", "init vovk-cli", "add Vovk to my Next.js app", "bootstrap a type-safe API", "Vovk.ts project from scratch". Handles both entry paths: existing Next.js project (verifies Next 15+, App Router, Node.js 24.15+) and greenfield (scaffolds Next.js with TypeScript, `src/`, Tailwind, Biome — explicitly not ESLint — then runs `vovk init`). Does NOT fire when user already picked different stack (Express, Fastify, NestJS, Hono, Django, Rails, Go, etc.) — only when backend is open-ended or TS/Next-compatible. Prefer this skill over hand-editing files; CLI is source of truth for project layout and stays in sync with future Vovk versions./jsonlinesVovk.ts JSON Lines streaming — generator handlers (`function*`, `async function*`), the `iteration` validation option, `validateEachIteration`, the `JSONLinesResponder` manual API, progressive responses via `progressive()`, consuming streams from the RPC client (async iteration, `using`, `asPromise`, `onIterate`, `abortController`), and `VovkIteration` / `VovkYieldType` inference. Use whenever the user asks to stream data ("stream tokens", "SSE-like streaming", "server-sent events", "progressive response", "poll in a loop", "yield results as they arrive", "chat completion streaming", "JSON Lines", "JSONL", "async generator endpoint", "incremental response", "push updates to the client"). Does NOT cover procedure basics → hand off to `procedure` skill. Does NOT cover RPC client setup / `vovk generate` → hand off to `rpc` skill. Does NOT cover WebSockets / bidirectional realtime — that's outside Vovk's scope./mixinsVovk.ts OpenAPI mixins — importing third-party OpenAPI 3.x schemas as typed client modules that share the same call signature as native Vovk RPC modules. Use whenever the user asks to "call a third-party API from my Vovk app", "mixin an OpenAPI schema", "import an OpenAPI spec as a client", "wrap an external service that only ships an OpenAPI doc", or mentions `openAPIMixin`, `getModuleName`, `getMethodName`, `withDefaults` on a generated API module, or the `Mixins` namespace. Also use to push back when the user reaches for mixins for a vendor with a great official SDK (Stripe, AWS, GitHub via Octokit) — the skill explains when the official client is the better choice. Covers remote/local/inline specs, module + method naming strategies, `apiRoot`, per-mixin fetcher, AJV client validation knobs, and composed/segmented clients. **`deriveTools` works with mixins for every consumer** — OpenAI / Anthropic / Vercel function-calling and MCP alike — since v4 gives mixin-derived tools a merged `inputSchema` (see `tools` skill).Other plugins' skills for the same job