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.
スキルの内容
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.
できること
- Decide when a visitor beats a switch statement
- Write frozen variant classes with an accept method
- Define a visitor interface per union
概要
- 公開元
- Prisma
- ツール
- コードレビュー
インストール
プロジェクトのドキュメントに、確認できるインストール手順がありません。 プロジェクトの手順を見る
MCPサーバーやスキルは、お使いのコンピューターでコードを実行したり、データを操作したりできます。インストールする前にソースを確認してください。
詳細
出典
- スキルファイル(SKILL.md)github.com/prisma/orm · 根拠となる項目:スクリプトを含む2026年11月10日
- GitHubリポジトリgithub.com/prisma/orm · 根拠となる項目:公開元, 活動状況, ライセンス2026年11月11日
- リポジトリ内のフォルダ(ast-visitor-pattern)github.com/prisma/orm · 根拠となる項目:スクリプトを含む2026年11月10日