Skip to content

LLM Prompt Compiler

The LLM Prompt compiler converts a xtyle definition into a structured Markdown document designed for use as an LLM system prompt. Feed the output to Claude, GPT, or any language model to generate on-brand content without manually describing your brand in every conversation.

Terminal window
npm install @xtylejs/compiler-llm-prompt
Terminal window
xtyle compile brand.xtyle.json --target llm-prompt

Output is written to ./out/<name>.brand.md by default.

import { compile } from "@xtylejs/compiler-llm-prompt";
const markdown = compile(definition);

The compile function takes a full xtyle definition and returns a Markdown string.

The compiler walks the entire definition and produces sections for each pillar that has content. Sections are omitted when the definition doesn’t include relevant data.

SectionSourceContent
Identityverbal.identityBrand name, tagline, descriptions at multiple lengths
Colorsvisual.palette + visual.semanticSemantic color roles with resolved hex values
Typographyvisual.typographyFont families, weights, type scale
Componentsvisual.componentsComponent parts, sizes, variants, states
Jargonverbal.jargonDomain-specific terms with definitions and deprecated alternatives
Approved Copyverbal.copyPre-approved text fragments keyed by purpose
Boilerplateverbal.boilerplateStandard text (legal, disclaimers, footers)
Voicevoice.*Tone, values, vocabulary, anti-patterns, audience, positioning, art direction, register

Given the Midnight Diner definition, the compiler produces:

# Midnight Diner
*open late. no questions asked.*
Late-night ramen from a dark counter in a quiet alley.
## Colors
| Role | Value |
| --- | --- |
| primary | #F5A623 |
| surface | #0D0D0D |
| accent | #C0392B |
## Typography
- **heading:** Barlow Condensed, sans-serif
- **body:** Inter, system-ui, sans-serif
- **normal:** 400
- **bold:** 700
## Jargon
- **the usual** — whatever you had last time, remembered without asking
- **extra fire** — additional chili oil, applied without judgment
## Voice
### Tone
- **energy:** warm, low-key, like the cook who knows your name but doesn't need to chat
- **formality:** casual always. never formal.
- **humor:** deadpan. if you get it, you get it.
### Anti-Patterns
- food photography language
- hospitality industry buzzwords
- exclamation marks

The primary use case is feeding brand identity to an LLM as a system prompt:

System: [contents of midnight-diner.brand.md]
User: Write a social media post announcing our new winter menu.

The LLM receives the full brand context — voice, vocabulary constraints, tone, positioning, approved terminology — and generates content that stays on-brand without manual guidance in every prompt.

This works across all three pillars:

  • Visual context tells the LLM about the brand’s color palette and typography when generating design-adjacent content
  • Verbal tokens provide exact terminology, approved copy, and jargon definitions
  • Voice guidance constrains tone, vocabulary, and anti-patterns so the output matches the brand’s personality