/skmtc:skmtc-generatorfrom skmtc
Writes and edits Skmtc generators that transform OpenAPI documents into application code via producer class trees. Use before creating or modifying any generator source, schema type, operation kind, export path, enrichment, or edge case.
Ships in skmtc. 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; scripts run unread.
Skmtc derives application code from an OpenAPI document. A generator
is a small package that the engine runs over every model (a schema,
by its ref) and every operation (path + method) of the
document. The engine writes every generated file again on each run, so
you change the generator and never its output.
A producer is a class with a constructor and a toString().
toString() arranges those fields into target code. It reads its own
fields and nothing else.A projection is a producer that owns one named definition in a file.
A snippet is a producer for a part inside a definition. Your code
builds producers while the engine generates. The engine calls
toString() once for each file, at the end.
@skmtc/gen-effect-http writes this for POST /search:
export const createApiSearch = (body: typeof SearchRequest.Type) =>
Effect.gen(function* () {
const client = yield* HttpClient.HttpClient;
const request = yield* HttpClientRequest.post("/search").pipe(
HttpClientRequest.schemaBodyJson(SearchRequest)(body),
);
const response = yield* client.execute(request);
return yield* HttpClientResponse.schemaBodyJson(CreateApiSearchResponse)(response);
});
These producers build it:
EffectEndpoint the function projection
├─ parameters List<TypedParameter> (body: typeof … .Type)
├─ request EffectRequest const request = … ;
│ └─ steps List<UrlParamsStep | HeadersStep | BodyStep>
│ one line inside .pipe( … )
└─ response ResponseRead | ResponseVoid
the last two lines
// EffectEndpoint
override toString(): string {
return `${this.parameters} =>
Effect.gen(function* () {
const client = yield* HttpClient.HttpClient;
${this.request}
${this.response}
})`
}
Each part that a reader of the output can name is a class. Each field
is a thing in the output: parameters, request, response. A new
kind of step is a new class and one line in EffectRequest. No function
in the package returns code, and the mean complexity of its functions is
1.5 (scripts/complexity.ts in this skill measures it).
Code that builds output from functions and joined strings is correct for the common cases and wrong for the rest. Text has no imports, the engine cannot reuse it, and another generator cannot refer to it. A function that inspects or rewrites a schema does the parser's work a second time, and takes one more branch for each case it meets.
A producer handles its case once. Each place that has the part gets it, with its imports. A new case is a new class and one case in the router. The classes that exist do not change.
Most of a generator's hard problems are solved before your code runs. Before you write a function that reads the document, find its job in this table. If the job is here, use what does it.
| Job | Use | What it gives you |
|---|---|---|
Merge an allOf, read oneOf and anyOf as a union, resolve each $ref, remove what a broken $ref holds | The parser. A settings.parse key (allOf, anyOf, intersections, danglingRefs) changes how it reads | A schema you render as it is, with no code that inspects, repairs, merges or compares schemas |
| Choose the code for a schema type | Your router: one switch (schema.type) with a never default, which returns a producer | Each class reads typed fields from a narrowed schema. A new type is a compile error until it has a case and a class |
| Build a model once, wherever it is used | insertModel, toModelRef | One definition and one import for each model. You hold its name |
| Give an inline schema (a body, a parameters object, a response) a definition | insertNormalizedModel with a fallbackName | The model generator renders it. You hold its name |
| Find a cycle, and the reference that must be lazy | toModelRef (suspended, inCycle) and isReferencedBack | No walk of the document and no set of visited schemas |
| Write the imports of a file | this.register({ imports }) for a library. Nothing for an insert | Imports that match what the file uses |
| Know a name or a path before anything is built | The base's statics, toIdentifierName and toExportPath, in base.ts. Other files read settings.identifier and settings.exportPath | One place to change a name. Other generators find your definition |
| Read an operation's parameters, body and response | toParams, toParametersObject, toRequestBody, toSuccessResponse on the operation | The path item's parameters merged in, the JSON media type chosen, a $ref resolved |
| Join a list and leave out absent items | List, built in the constructor | Separators and brackets in one place |
| Put a string from the document into code | handleKey, sanitizeIdentifier, toStringLiteral, toPathTemplate (references/typescript.md) | Correct quotes and escapes for any character |
| Make more than one definition from one subject | Variants. Pass variant on | Names and files that stay apart |
| Take a setting from the consumer | Enrichments, declared as a schema | A wrong value fails the run and names its place in skmtc.config.json |
| Catch two definitions that claim one name | The engine: Registered definition mismatch | Nothing to write |
| Report a fault in the document | The parser: issues in the manifest | Nothing to write |
Four jobs are yours, and each has one place:
| Your decision | Its one place |
|---|---|
| Which producer renders a part that has kinds (a response with a body, a response with none) | The constructor of the producer that holds the part |
| A name you derive from the identifier (an alias, a suffix) | A function in base.ts, beside the statics |
| Optional and nullable | The modifiers, applied once where the value renders |
| A fact that several producers read | One plain class, named after what it reads from the document |
Your twin. A stock generator already does the nearest job. Open it before you write a line, and copy its shape, names and order.
| You write | Start from |
|---|---|
| A model generator: each schema becomes a validator, a schema value or a type | skeleton/ in this skill. Copy it and fill its slots |
| An operation generator that builds a function: a client call, a handler | @skmtc/gen-effect-http: EffectEndpoint.ts and the nine classes beside it |
| An operation generator for a hook over a model generator | @skmtc/gen-tanstack-query-fetch-zod |
| A form or other UI for each operation | @skmtc/gen-shadcn-form |
| Many operations in one file (an accumulator) | @skmtc/gen-msw, @skmtc/gen-express |
| A class for one schema type | The class for that type in skeleton/src/ or @skmtc/gen-effect-schema |
Get the source with skmtc clone <project> -g @skmtc/<name>, or read
it at https://jsr.io/@skmtc/<name>.
The reference for your path (next section).
Signatures. Skmtc has almost no presence in training data, so
read a signature and never recall one:
deno doc jsr:@skmtc/core@<pinned version> <Symbol>. Read it in
place of a cast around a type error too.
Every path uses these when the work reaches them:
Every path ends with references/finish.md.
base.ts, with the name and the export
path of each definition. Done when no other file builds a name or a
path.An edge case shows that a decision has no place yet. Give it its place:
base.ts.settings.parse key that
changes the parse. Code that detects, repairs, merges or compares
schemas is the parser's.Three signs that you have left this path: a function that takes a schema and returns a schema or a yes or no about it; the same condition in two places; a second function written to correct the first.
toString(). The
one exception is the method that adds to an accumulator
(references/engine.md).summary, options and action
are parts. chain, parts and lines hold everything and name
nothing.toString(), as one template over the
fields, in the shape of the output.List is for a real list: items of one kind, in a number the
document sets. A fixed set of different parts is a template over named
fields.undefined and null are absent. 0, false, '' and
[] are values, and they render.toEndpointName. operationId is the document author's and changes
without notice.isRef(), resolve(),
toParams(), toRequestBody(). Do the same thing the same way as
the code around you.base.ts, a type guard on raw input.deno lint, with jsr:@skmtc/lint-plugin in the
generator's deno.json. No findings. From plugin 0.1.3 the rule
skmtc/complexity reports a function over the limit.deno run --allow-read --allow-env <this skill>/scripts/complexity.ts <generator>/src
exits 0.skmtc feedback sends the last two
to the Skmtc team as a public issue, so put no tokens or personal
data in it.references/engine.md (opens in a new tab)references/finish.md (opens in a new tab)references/model.md (opens in a new tab)references/operation.md (opens in a new tab)references/producers.md (opens in a new tab)references/typescript.md (opens in a new tab)scripts/complexity.test.ts (opens in a new tab)scripts/complexity.ts (opens in a new tab)skeleton/deno.json (opens in a new tab)skeleton/deno.lock (opens in a new tab)skeleton/mod.test.ts (opens in a new tab)skeleton/mod.ts (opens in a new tab)skeleton/src/MyLib.ts (opens in a new tab)skeleton/src/MyLibArray.ts (opens in a new tab)skeleton/src/MyLibIntersection.ts (opens in a new tab)skeleton/src/MyLibObject.ts (opens in a new tab)skeleton/src/MyLibProjection.ts (opens in a new tab)skeleton/src/MyLibRef.ts (opens in a new tab)skeleton/src/MyLibScalars.ts (opens in a new tab)skeleton/src/MyLibString.ts (opens in a new tab)What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
npx claudepluginhub skmtc/skmtc --plugin skmtcOther plugins' skills for the same job