RTK Rust Design Patterns
rtk-ai/rtk
Describes seven Rust design patterns for the RTK CLI filter modules, with when to use each, RTK examples, and notes on when a pattern is overkill.
Replaces a plain TypeScript union plus switch statements with frozen subclasses and a visitor interface when several places dispatch on the same variants.
$ npx skills add prisma/orm --skill ast-visitor-pattern -a claude-codeProject install by default; add -g for ~/.claude/skills/.
$ gh skill install prisma/orm ast-visitor-pattern --agent claude-codeProject scope by default; add --scope user for a personal install. Needs GitHub CLI 2.90.0 or later (public preview).
$ git clone --depth 1 https://github.com/prisma/orm.git skills-src && mkdir -p .claude/skills && cp -r skills-src/skills-contrib/ast-visitor-pattern .claude/skills/ast-visitor-pattern && rm -rf skills-srcUse ~/.claude/skills/ instead of .claude/skills for a personal install. The folder must contain SKILL.md.
Claude Code skills documentation · loads skills from .claude/skills/
Install the "ast-visitor-pattern" agent skill from https://github.com/prisma/orm/tree/main/skills-contrib/ast-visitor-pattern into .claude/skills/ast-visitor-pattern/ in this project. Copy the whole folder (SKILL.md and every file beside it), keep the folder name "ast-visitor-pattern", then confirm the skill loads.Claude Code copies the folder itself, the same result as the manual copy. Check what it changed before you commit it.
$skill-installer install https://github.com/prisma/orm/tree/main/skills-contrib/ast-visitor-patternType this inside Codex. $skill-installer <name> installs a curated skill from openai/skills. The installer writes to $CODEX_HOME/skills (default ~/.codex/skills). Restart Codex if the skill does not show up.
$ npx skills add prisma/orm --skill ast-visitor-pattern -a codexProject install goes to .agents/skills/; add -g for ~/.codex/skills/.
$ gh skill install prisma/orm ast-visitor-pattern --agent codexProject scope by default (.agents/skills/); add --scope user for a personal install.
$ git clone --depth 1 https://github.com/prisma/orm.git skills-src && mkdir -p .agents/skills && cp -r skills-src/skills-contrib/ast-visitor-pattern .agents/skills/ast-visitor-pattern && rm -rf skills-srcUse ~/.agents/skills/ instead of .agents/skills for a personal install.
Codex skills documentation · loads skills from .agents/skills/
Install the "ast-visitor-pattern" agent skill from https://github.com/prisma/orm/tree/main/skills-contrib/ast-visitor-pattern into .agents/skills/ast-visitor-pattern/ in this project. Copy the whole folder (SKILL.md and every file beside it), keep the folder name "ast-visitor-pattern", then confirm the skill loads.Codex copies the folder itself, the same result as the manual copy. Check what it changed before you commit it.
$ npx skills add prisma/orm --skill ast-visitor-pattern -a cursorProject install goes to .agents/skills/; add -g for ~/.cursor/skills/.
$ gh skill install prisma/orm ast-visitor-pattern --agent cursorProject scope by default (.agents/skills/); add --scope user for a personal install.
$ git clone --depth 1 https://github.com/prisma/orm.git skills-src && mkdir -p .cursor/skills && cp -r skills-src/skills-contrib/ast-visitor-pattern .cursor/skills/ast-visitor-pattern && rm -rf skills-srcUse ~/.cursor/skills/ instead of .cursor/skills for a personal install.
Cursor skills documentation · loads skills from .cursor/skills/, .agents/skills/, .claude/skills/, .codex/skills/
Install the "ast-visitor-pattern" agent skill from https://github.com/prisma/orm/tree/main/skills-contrib/ast-visitor-pattern into .cursor/skills/ast-visitor-pattern/ in this project. Copy the whole folder (SKILL.md and every file beside it), keep the folder name "ast-visitor-pattern", then confirm the skill loads.Cursor copies the folder itself, the same result as the manual copy. Check what it changed before you commit it.
$ gemini skills install https://github.com/prisma/orm.git --path skills-contrib/ast-visitor-pattern--scope user (default) or --scope workspace; --path is the subfolder of the repo that holds the skill; --consent skips the security confirmation prompt.
$ npx skills add prisma/orm --skill ast-visitor-pattern -a gemini-cliProject install goes to .agents/skills/; add -g for ~/.gemini/skills/.
$ gh skill install prisma/orm ast-visitor-pattern --agent gemini-cliProject scope by default (.agents/skills/); add --scope user for a personal install.
$ git clone --depth 1 https://github.com/prisma/orm.git skills-src && mkdir -p .gemini/skills && cp -r skills-src/skills-contrib/ast-visitor-pattern .gemini/skills/ast-visitor-pattern && rm -rf skills-srcUse ~/.gemini/skills/ instead of .gemini/skills for a personal install, then run /skills reload.
Gemini CLI skills documentation · loads skills from .gemini/skills/, .agents/skills/
Install the "ast-visitor-pattern" agent skill from https://github.com/prisma/orm/tree/main/skills-contrib/ast-visitor-pattern into .gemini/skills/ast-visitor-pattern/ in this project. Copy the whole folder (SKILL.md and every file beside it), keep the folder name "ast-visitor-pattern", then confirm the skill loads.Gemini CLI copies the folder itself, the same result as the manual copy. Check what it changed before you commit it.
$ gh skill install prisma/orm ast-visitor-patternInstalls for Copilot at project scope by default; add --scope user for a personal install. Preview a skill first with gh skill preview. Needs GitHub CLI 2.90.0 or later (public preview).
$ npx skills add prisma/orm --skill ast-visitor-pattern -a github-copilotProject install goes to .agents/skills/; add -g for ~/.copilot/skills/.
$ git clone --depth 1 https://github.com/prisma/orm.git skills-src && mkdir -p .github/skills && cp -r skills-src/skills-contrib/ast-visitor-pattern .github/skills/ast-visitor-pattern && rm -rf skills-srcUse ~/.copilot/skills/ instead of .github/skills for a personal install. Commit .github/skills so cloud agent and code review can use it.
GitHub Copilot skills documentation · loads skills from .github/skills/, .claude/skills/, .agents/skills/
Install the "ast-visitor-pattern" agent skill from https://github.com/prisma/orm/tree/main/skills-contrib/ast-visitor-pattern into .github/skills/ast-visitor-pattern/ in this project. Copy the whole folder (SKILL.md and every file beside it), keep the folder name "ast-visitor-pattern", then confirm the skill loads.GitHub Copilot copies the folder itself, the same result as the manual copy. Check what it changed before you commit it.
$ npx skills add prisma/orm --skill ast-visitor-pattern -a opencodeOpenCode documents no install command of its own. Project install goes to .agents/skills/; add -g for ~/.config/opencode/skills/.
$ gh skill install prisma/orm ast-visitor-pattern --agent opencodeProject scope by default (.agents/skills/); add --scope user for a personal install.
$ git clone --depth 1 https://github.com/prisma/orm.git skills-src && mkdir -p .opencode/skills && cp -r skills-src/skills-contrib/ast-visitor-pattern .opencode/skills/ast-visitor-pattern && rm -rf skills-srcUse ~/.config/opencode/skills/ instead of .opencode/skills for a personal install.
OpenCode skills documentation · loads skills from .opencode/skills/, .claude/skills/, .agents/skills/
Install the "ast-visitor-pattern" agent skill from https://github.com/prisma/orm/tree/main/skills-contrib/ast-visitor-pattern into .opencode/skills/ast-visitor-pattern/ in this project. Copy the whole folder (SKILL.md and every file beside it), keep the folder name "ast-visitor-pattern", then confirm the skill loads.OpenCode copies the folder itself, the same result as the manual copy. Check what it changed before you commit it.
ast-visitor-patternReplaces a plain TypeScript union plus switch statements with frozen subclasses and a visitor interface when several places dispatch on the same variants.
When a discriminated union has three or more variants and two or more places that branch on it, such as renderers, serializers or classifiers, the plain union and switch give way to frozen subclasses with a visitor interface. The payoff is that adding a variant becomes a compiler error in every consumer, instead of a silent gap. The structure has an unexported abstract base, concrete node classes, the union type and a visitor interface.
Consumers write one visitor object per concern. The skill insists on building real instances, such as `new BarNode('x')`, never frozen object literals, because a literal has no prototype: `instanceof` fails, `accept()` is missing and a shallow copy strips the type. It also lists when not to use the pattern: a single dispatch site, or fewer than three variants with no expected growth. Examples point to Prisma's Mongo query AST.
Read from SKILL.md and the folder at commit 095af7a. It shows what the files ask for, not the result of running them.
Pre-approves nothing: there is no allowed-tools line, so your agent's usual permission prompts apply.
From allowed-tools in the SKILL.md frontmatter.
No scripts in the folder and no shell commands in SKILL.md (its code samples are typescript).
From the folder's file list and the shell code blocks in SKILL.md.
No URLs in SKILL.md.
From URLs in SKILL.md, links to its own repository left out.
Names no API keys, tokens, secrets or passwords.
From names ending in _API_KEY, _TOKEN, _SECRET, _KEY or _PASSWORD in SKILL.md.
AST Visitor Pattern for Unions loads about 830 tokens when it runs. Until then it costs about 79 tokens; SKILL.md has 176 words of instructions outside code blocks.
Estimates: characters ÷ 4, the usual rule of thumb; real counts depend on the model's tokenizer. Scripts and assets cost tokens only if the agent reads them.
The automated check found no risky patterns in SKILL.md.
Automated static check — not a guarantee. Review scripts before installing. It scans the text of SKILL.md for risky patterns (piping downloads into a shell, reading credential files, hidden Unicode, destructive commands); files beside SKILL.md are not scanned.
The full file from prisma/orm at commit 095af7a, republished under its Apache-2.0 licence (© prisma). 176 words, ~830 tokens.
.claude/skills/ast-visitor-pattern/SKILL.md (or your agent's skills folder).When a discriminated union has 3+ variants and 2+ dispatch sites (renderers, serializers, classifiers, etc.), replace plain union + switch with frozen subclasses and a visitor interface. This makes adding a new variant a compiler error at every consumer, instead of a silent omission.
Four pieces, usually in one file — the Mongo DDL set below spreads them over three:
// 1. Abstract base (not exported — consumers use the union type)
abstract class FooNode {
abstract readonly kind: string;
abstract accept<R>(visitor: FooVisitor<R>): R;
protected freeze(): void { Object.freeze(this); }
}
// 2. Visitor interface
export interface FooVisitor<R> {
bar(node: BarNode): R;
baz(node: BazNode): R;
}
// 3. Concrete subclasses — readonly fields, freeze() in constructor
export class BarNode extends FooNode {
readonly kind = 'bar' as const;
readonly value: string;
constructor(value: string) {
super();
this.value = value;
this.freeze();
}
accept<R>(visitor: FooVisitor<R>): R { return visitor.bar(this); }
}
export class BazNode extends FooNode {
readonly kind = 'baz' as const;
readonly count: number;
constructor(count: number) {
super();
this.count = count;
this.freeze();
}
accept<R>(visitor: FooVisitor<R>): R { return visitor.baz(this); }
}
// 4. Union type
export type Foo = BarNode | BazNode;Define a visitor object (or class) per concern:
const renderVisitor: FooVisitor<string> = {
bar(node) { return node.value; },
baz(node) { return String(node.count); },
};
function render(node: Foo): string {
return node.accept(renderVisitor);
}This holds everywhere a node is built — tests and production construction surfaces (contract-free factories, builders). A factory must return new BarNode(...), never Object.freeze({ kind: 'bar', value: 'x' }). A frozen plain object has no prototype, so instanceof fails, accept() is missing, and a downstream shallow-copy ({ ...node }) silently strips the type back to an anonymous bag; constructor-time invariants are skipped too.
// ✅
const call = new BarNode('x');
export function bar(value: string): BarNode { return new BarNode(value); }
// ❌
const call: Foo = { kind: 'bar', value: 'x' };
export function bar(value: string): Foo { return Object.freeze({ kind: 'bar', value }); }MongoAstNode base — packages/2-mongo-family/4-query/query-ast/src/ast-node.tsMongoDdlCommandVisitor interface — packages/2-mongo-family/4-query/query-ast/src/ddl-visitors.tspackages/2-mongo-family/4-query/query-ast/src/ddl-commands.ts© prisma, Apache-2.0. Rendered from Markdown: HTML in the file is shown as text, images as links, and headings moved down two levels. Raw file
Just SKILL.md in skills-contrib/ast-visitor-pattern of prisma/orm.
Open the folder on GitHubat commit 095af7a
AST Visitor Pattern for Unions next to the 5 skills that share the most tags, products or categories with it. Stars are the repository's; “used in” counts other GitHub owners with a copy.
| Skill | Stars | Used in | Tokens | Auto-check | Licence | Repo updated |
|---|---|---|---|---|---|---|
| AST Visitor Pattern for Unions this skillprisma/orm | 48k | — | ~830 | Automated safety check: Pass | Apache-2.0 | |
| RTK Rust Design Patternsrtk-ai/rtk | 83k | — | ~1.9k | Automated safety check: Pass | Apache-2.0 | |
| Vue Best Practicesoyjt/uniapp-vue3-template | 627 | 3 repos | ~667 | Automated safety check: Pass | MIT | |
| Typed Dependencies with fp-go EffectIBM/fp-go | 2k | — | ~4.3k | Automated safety check: Pass | Apache-2.0 | |
| Effect TSmattiacerutti/supernova | 187 | — | ~2.8k | Automated safety check: Pass | MIT | |
| Typescript React ReviewerSuFxGIT/scoutarr | 114 | — | ~1.7k | Automated safety check: Pass | None |
rtk-ai/rtk
Describes seven Rust design patterns for the RTK CLI filter modules, with when to use each, RTK examples, and notes on when a pattern is overkill.
oyjt/uniapp-vue3-template
Vue 3 and Vue.js best practices for TypeScript, vue-tsc, and Volar.
IBM/fp-go
Teaches an agent to write fp-go v2 services with the Effect type, carrying dependencies in its type parameter instead of in context.Context or parameters.
mattiacerutti/supernova
Write idiomatic Effect v4 TypeScript following official best practices from effect-solutions and the Effect source.
SuFxGIT/scoutarr
Expert code reviewer for TypeScript + React 19 applications.
jwynia/agent-skills
Guide AI agents through TypeScript coding best practices including type safety, error handling, code organization, and architecture patterns.
prisma/orm
Runs a loop on a GitHub pull request: fetch review state, triage comments into actions, implement them and resolve threads, repeating until nothing actionable is left.
prisma/orm
Fetches a pull request's canonical review state as JSON, validates it, and renders markdown, a text summary and triage target files from it using bundled scripts.
prisma/orm
Implements triaged pull request review actions, commits focused fixes, posts status replies on GitHub and resolves the threads.
prisma/orm
Runs the triage step of the review-framework loop: reads fetched PR review state, builds `review-actions.json`, validates it and renders `review-actions.md`.
prisma/orm
Guides an outside contributor through opening a prisma/orm pull request from a fork that follows CONTRIBUTING.md and passes review on the first round.
prisma/orm
Creates a GitHub pull request for the Prisma repo with a Linear-ticket-prefixed title and a decision-led narrative description, inferring the ticket from context.
Works with
Categories
Replaces a plain TypeScript union plus switch statements with frozen subclasses and a visitor interface when several places dispatch on the same variants. When a discriminated union has three or more variants and two or more places that branch on it, such as renderers, serializers or classifiers, the plain union and switch give way to frozen subclasses with a visitor interface. The payoff is that adding a variant becomes a compiler error in every consumer, instead of a silent gap.
AST Visitor Pattern for Unions fits situations like: creating a new set of variants that several functions will switch over; refactoring a union type whose switch statements have spread across files; reviewing factories that return frozen object literals instead of class instances.
Run `npx skills add prisma/orm --skill ast-visitor-pattern -a claude-code`. Or copy the skill folder (skills-contrib/ast-visitor-pattern in prisma/orm) into .claude/skills/ast-visitor-pattern in your project. Claude Code loads it when a task matches its description.
Run `npx skills add prisma/orm --skill ast-visitor-pattern -a codex`. Or copy the skill folder (skills-contrib/ast-visitor-pattern in prisma/orm) into .agents/skills/ast-visitor-pattern in your project. Codex loads it when a task matches its description.
Cursor, Gemini CLI, GitHub Copilot and OpenCode also load SKILL.md folders. With the skills CLI, run `npx skills add prisma/orm --skill ast-visitor-pattern -a cursor` (or -a gemini-cli, github-copilot or opencode for the others). To copy it by hand, put the folder in .cursor/skills/ast-visitor-pattern, .gemini/skills/ast-visitor-pattern, .github/skills/ast-visitor-pattern and .opencode/skills/ast-visitor-pattern in your project.
SKILL.md names no scripts, command-line tools or credentials: AST Visitor Pattern for Unions is instructions for the agent only. Our summary lists: A TypeScript codebase.
SKILL.md contains no URLs. Any network use would come from the scripts or tools the agent runs. This is read from the text; nothing was executed.
Our automated static check of SKILL.md found no risky patterns, such as piping downloads into a shell, reading credential files or hidden Unicode. It is not a guarantee. Review the folder before installing.
AST Visitor Pattern for Unions is published under the Apache-2.0 licence (the repository's licence). It allows redistribution, so the full SKILL.md is shown on this page.
About 830 tokens (SKILL.md is roughly 3.3k characters). Agents keep only the skill's name and description in context until a task matches; then they load SKILL.md in full.
Skills that share tags, products or a category with AST Visitor Pattern for Unions: RTK Rust Design Patterns (rtk-ai/rtk, 83k stars), Vue Best Practices (oyjt/uniapp-vue3-template, 627 stars), Typed Dependencies with fp-go Effect (IBM/fp-go, 2k stars) and Effect TS (mattiacerutti/supernova, 187 stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.
prisma (a GitHub organization, an official publisher) maintains it in prisma/orm, which has 47,701 GitHub stars. The repository holds 20 skills in this directory. The repository was last updated on October 6, 2026.
Source: prisma/orm on GitHub. Facts on this page come from the repository at the commit we read; the author's words are quoted as theirs.