ast-visitor-pattern
A skill from the Prisma ORM repository's contributed skills describing when and how to model TypeScript discriminated unions as frozen classes with a visitor, instead of switch statements.
What the skill teaches
A skill from the Prisma ORM repository's contributed skills describing when and how to model TypeScript discriminated unions as frozen classes with a visitor, instead of switch statements. It applies when a set of variants, such as commands or tree nodes, is dispatched on in two or more places, and only for three or more variants; smaller cases keep a plain union and switch. The agent writes a hidden abstract base class with a kind field, an accept method and a freeze helper, a visitor interface with one method per variant, readonly subclasses and an exported union, and always builds instances with new, since frozen object literals break instanceof and accept.
Capabilities
- Decide when a visitor beats a switch statement
- Write frozen variant classes with an accept method
- Define a visitor interface per union
About
- Publisher
- Prisma
- Tool
- Code review
Install
The project doesn't document install steps that we could confirm. See the project's own instructions
MCP servers and skills can run code on your computer and act on your data. Review the source before installing.
Details
| Fact | Value | Source |
|---|---|---|
| Type | Skill | |
| Tool | Code review | |
| Publisher | Prisma | source |
| Official status | Not stated in its documentation | |
| Needs an API key or sign-in | Not stated in its documentation | |
| Includes scripts | No | source |
| Platforms | Not stated in its documentation | |
| AI clients | Not stated in its documentation | |
| Licence | Apache-2.0 | source |
| Pricing | Not stated in its documentation | |
| Activity | Last commit Nov 11, 202647,664 GitHub starsDownload data not available (not on npm or PyPI) | source |
| Links | Repository Website |
More from Prisma
1 server · 16 skills
- prisma-8 (Skill)
- prisma-cli (Skill)
- prisma-client-api (Skill)
- prisma-compute (Skill)
- prisma-driver-adapter-implementation (Skill)
- prisma-mongodb-upgrade (Skill)
Also listed under: Code review
Sources
- Skill file (SKILL.md)github.com/prisma/orm · Backs: Includes scriptsNov 10, 2026
- GitHub repositorygithub.com/prisma/orm · Backs: Publisher, Activity, LicenceNov 11, 2026
- Folder in the repository (ast-visitor-pattern)github.com/prisma/orm · Backs: Includes scriptsNov 10, 2026