Skip to content

PSL AST Layers Guide

Teaches the agent to navigate Prisma schema (PSL) syntax trees using the correct typed, red, and green layers

Repository
prisma/orm
Stars
47,663
Licence
Apache-2.0
Files
1 file

What it does

When working on Prisma Schema Language code, this skill tells the agent which layer of the parser's syntax tree to use: typed AST classes by default, red-tree navigation helpers to move around the tree, and never the low-level green storage. It also steers the agent away from anti-patterns such as converting the tree back to text to extract facts, reading green nodes directly, and materializing lazy iterators into arrays.

Great for

  • Developers building PSL interpreters, formatters, or language server features inside the Prisma repository
  • Contributors writing helpers in the psl-parser package who need consistent tree-access patterns
  • Maintainers reviewing PSL code for lossless, typed access

Skip it if

  • People who do not work on Prisma schema parsing: the guidance is specific to the internal @internal/psl-parser API and will not apply to other codebases
  • Projects that use a different parser or syntax tree library, since the class and helper names would not exist there

Try asking

  • “Write a helper that finds the model enclosing the field at the cursor in the language server”
  • “Refactor this formatter code so it stops stringifying attributes and checks the tree instead”
  • “Add a getter to the FieldDeclarationAst class instead of iterating children at the call site”
  • “Find the previous non-trivia declaration before this model in the PSL document”
Step-by-step guide: how to use PSL AST Layers GuideInstall, first run, examples, tips and FAQs

Install in 3 steps

  1. 1

    Download the skill

    The ZIP contains the 1 original files, the Apache-2.0 licence and an attribution note.

    psl-ast-layers.zip
  2. 2

    Add it to your agent

    Claude Code (all projects)

    mkdir -p ~/.claude/skills && unzip psl-ast-layers.zip -d ~/.claude/skills/

    Claude Code / Agent SDK (this project only)

    mkdir -p .claude/skills && unzip psl-ast-layers.zip -d .claude/skills/

    Claude apps (web/desktop): Settings → Capabilities → Skills → Upload skill, and choose the ZIP.

  3. 3

    Ask for the task

    No special command needed — the agent reads the skill's description and loads it when your request matches. Try one of the prompts above.

Get better results

  • Name the consumer you are writing (interpreter, language server, formatter) so the agent picks the right layer and helpers.
  • Ask the agent to explain why it chose a typed getter over a navigation helper, to check it followed the layer rules.
  • Review any generated walk loops: the skill expects a cast as the first step in each loop body.

What's inside

  • SKILL.md

Redistributed unmodified from prisma/orm under the Apache-2.0 licence. The assessment was drafted with AI from the skill's files on 2026-10-29. Skills can instruct your agent to run code — read SKILL.md and any scripts before installing.