本文へスキップ
Kitbay
スキル公式

psl-ast-layers

Apache-2.02026年11月11日 更新47,664GitHubスター

A contributor skill in the Prisma ORM repository for working with the syntax trees produced by its Prisma Schema Language parser, used by schema interpreters, the language server and formatters.

スキルの内容

A contributor skill in the Prisma ORM repository for working with the syntax trees produced by its Prisma Schema Language parser, used by schema interpreters, the language server and formatters. It explains three layers: an immutable green tree for parser internals only, a red tree that adds offsets and parent links for moving around, and typed AST classes with getters such as name() and fields(), which are the default. Rules say when to move between layers, how to anchor on a cursor offset in the language server, and to add a missing getter to the AST class instead of working around it. It warns against re-stringifying the tree, reading green nodes, building arrays from lazy iterators and hand-written child searches.

できること

  • Choose the right syntax tree layer
  • Navigate the tree with red-tree helpers
  • Resolve a cursor offset to a typed node
  • Add getters to typed AST classes