Skip to content

Use Spytial-GDL with your agent

Use the spytial-gdl skill to write or edit a diagram and include it in a document or website. Codex and Claude Code use the same instructions and checker. You can also ask for GDL diagrams in agent replies.

Install the skill

Run this in your project with Node.js 22.20 or later. Add -g if you want the skill available across projects.

npx skills add https://github.com/sidprasad/spytial-gdl/tree/main/skills/spytial-gdl -a claude-code codex

The URL selects the spytial-gdl folder. The two names after -a tell the installer which clients should have access to that skill. To invoke it explicitly, use $spytial-gdl in Codex or /spytial-gdl in Claude Code.

To install from a local checkout, copy the entire skills/spytial-gdl/ directory into your project’s .agents/skills/ for Codex or .claude/skills/ for Claude Code.

The repository also contains two optional skills. spytial-operations helps choose a layout rule, such as keeping children below their parents. spytial-selectors helps write the query that picks which nodes or edges the rule applies to. The main skill links to both as references. The command above installs only the main skill, directly in the clients’ skill directories, without a plugin. Read the authoring skill · Browse all three skills

Write and edit a diagram

Draw our compiler pipeline in pipeline.gdl. The parser feeds the type checker and the formatter. Keep each consumer to the right of its input.

parser[Parser] -> checker[Type checker] : feeds
parser -> formatter[Formatter] : feeds

@orientation(selector=feeds, directions=[right])

The two arrows say who consumes the parser’s output. The prompt also asks for a left-to-right reading order, so the agent adds a rule on feeds. Drag the parser toward either consumer. Both consumers stay to its right and can move independently up or down. If all you want to show is who consumes the output, the two edge lines are sufficient.

To edit the diagram, ask “Add a linter that also takes the parser’s output.” The new edge parser -> linter[Linter] : feeds picks up the same rule. Graph notation · Layout requirements

Ask the agent to check the edited source and export an interactive HTML file. You can also run the bundled tool yourself. For the project installation above, run these commands from the project root.

skill_dir=.agents/skills/spytial-gdl
npm --prefix "$skill_dir" install --no-package-lock
node "$skill_dir/scripts/render.mjs" pipeline.gdl
node "$skill_dir/scripts/render.mjs" pipeline.gdl pipeline.html

Open pipeline.html in a browser to drag the nodes or download a PNG.

Include a diagram in a document

Add the pipeline diagram to the compiler section of our Markdown site. Readers should be able to drag the nodes.

On a site that already renders GDL, the agent can put the diagram directly in a spytial-gdl fence in that section. In an HTML document, the same source goes inside a <div class="spytial-gdl"> element. A new site can load the renderer once in its shared template with this tag.

<script type="module" src="https://cdn.jsdelivr.net/npm/spytial-gdl/src/auto.js"></script>

Preview the page and drag the parser to check the reading order. For a GitHub README, ask the agent to embed the exported PNG with alt text and link to pipeline.gdl. GitHub displays a GDL fence as source. For setup in MkDocs, Jekyll, and other site generators, see the embedding guide.

Use diagrams in agent replies

The skill gives the agent a way to write and check GDL. Your instructions tell it when to choose GDL over Mermaid. What you see depends on the chat client. A client that treats the fence as ordinary Markdown shows the source. A draggable graph inside the reply requires a renderer in the host. This repository supplies a browser renderer for websites and exported HTML files.

For one conversation, tell the agent “When a diagram would help you explain something to me, use Spytial-GDL instead of Mermaid.” Then ask an ordinary question, such as “How does a change to the parser reach the other parts of this compiler?” The agent can use a diagram in its answer without you asking it to create a file or change your website.

To keep this preference for a project, add the following to AGENTS.md for Codex or CLAUDE.md for Claude Code at the project root.

When a node-and-edge diagram would help explain an answer to me, use the
spytial-gdl skill. Prefer Spytial-GDL over Mermaid unless I request another
format. Show a live diagram when the chat supports it. Otherwise, include
the source in a `spytial-gdl` code fence.

For a personal default across projects, install the skill with -g and put the same instruction in ~/.codex/AGENTS.md or ~/.claude/CLAUDE.md. To interact with a graph from a text-only reply, ask for a standalone HTML file or paste the source into the playground. Codex instructions · Claude Code instructions