Logo vun Lai Gen Sysprompt

Lai Gen Sysprompt

Organisatioun
eclipse-langium
lai-gen-sysprompt

Generate or refine a system prompt for a Langium DSL project. Bootstraps a new system prompt via `lai gen sysprompt` if none exists, then guides targeted refinement based on evaluation results and language changes.

Iwwersiicht

Editeureclipse-langium
Repositorylangium-ai
Skill-Nummlai-gen-sysprompt
Stären
31
Forks
4
Matgeliwwert Fichieren
Nëmmen Instruktiounen
LizenzMIT
Linken
  • Instruktiounen am Markdown-Format

    Eng SKILL.md-Datei, déi de Modell bei Bedarf luet, soudatt nëmmen Token ufalen, wann eng Ufro tatsächlech dozou passt.

  • Funktionéiert mat all LLM

    KI-Skills si reng Markdown, keen ubidderspezifesche Code. Dofir funktionéiert dëse Skill mat GPT, Claude, Gemini, Grok oder engem lokale Modell.

  • Alles an den Instruktiounen

    Alles, wat de Modell brauch, steet an den Instruktiounen — keng zousätzlech Dateien ze synchroniséieren.

  • Open Source

    Vum eclipse-langium op GitHub verëffentlecht. Liest de Quelltext, ier Dir de Skill installéiert.

Installatioun

Installéiert de KI-Skill Lai Gen Sysprompt an TypingMind, fir e mat all LLM ze benotzen, oder füügt en an en anere KI-Agent an, deen SKILL.md liest.

1

An TypingMind installéieren

TypingMind installéiert e Skill direkt aus sengem GitHub-Dossier — dobäi gëtt SKILL.md gelies, d'Ressourcedateie gi gebëndelt an d'Resultat gëtt lokal gespäichert.

  1. Maacht d'App op a gitt op Plugins → Skills.
  2. Wielt „Vun GitHub installéieren“.
  3. Pecht d'URL vum Skill-Dossier hei drënner an a bestätegt.
    https://github.com/eclipse-langium/langium-ai/tree/main/skills/lai-gen-sysprompt
  4. Aktivéiert de Skill an all Chat, an deem Dir e benotze wëllt.
Plugins → Skills → Skill afügen → Vu GitHub-URL, pecht dann d'URL vum Dossier an a klickt op Weider.
2

An engem anere KI-Agent installéieren

All KI-Agent, deen d'Format Agent Skills liest, kann dëse Skill benotzen — kopéiert den Dossier an de Skill-Verzeechnes vun deem KI-Agent.

Claude Code — .claude/skills
git clone --depth 1 https://github.com/eclipse-langium/langium-ai.git /tmp/langium-ai
mkdir -p .claude/skills
cp -r /tmp/langium-ai/skills/lai-gen-sysprompt .claude/skills/lai-gen-sysprompt
Start Claude Code nom Kopéieren nei, fir datt den neie Skill erkannt gëtt.

An TypingMind benotzen

Aktivéiert Lai Gen Sysprompt an engem Chat vun TypingMind, an de Modell iwwerhëlt de Rescht. Den Numm an d'Beschreiwung stinn am System-Prompt. Soubal eng Ufro dozou passt, luet de Modell déi komplett Instruktioune selwer — Dir musst de Skill ni manuell opruffen, an et fale keng Token un, bis en tatsächlech benotzt gëtt.

De Modell luet Lai Gen Sysprompt automatesch, soubal eng Ufro dozou passt.

Funktionéiert mat all KI-Modell

KI-Skills si reng Markdown-Instruktiounen amplaz vun ubidderspezifeschem Code. Dofir ass Lai Gen Sysprompt net un de Modell gebonnen, fir deen de Skill geschriwwe gouf. Installéiert en eemol an TypingMind a benotzt e mat GPT-5, Claude, Gemini, Grok, DeepSeek, Mistral, Llama oder engem lokale Modell, deen Dir selwer bedreift — alles mat Ären eegenen API-Keys.

  • Gëtt nëmme gelueden, wann et néideg ass

    De System-Prompt enthält nëmmen den Numm an d'Beschreiwung. D'Instruktioune gi bei der éischter passender Ufro gelueden, soudatt en onbenotzte Skill näischt kascht.

  • De Modell am lafende Chat wiesselen

    Well de Skill aus Instruktiounen amplaz vu Code besteet, funktionéiert en och no engem Modellwiessel — den nächste Modell liest déi selwecht SKILL.md-Datei.

Skill-Instruktiounen

Dëst ass den Inhalt vu SKILL.md, deen de Modell luet. Liest e virun der Installatioun — e Skill besteet aus Instruktiounen, déi Äre Modell befollegt.

Generate or Refine a System Prompt

This skill covers the full lifecycle of a system prompt for a Langium DSL — from initial generation to iterative refinement. If no system prompt exists yet, it bootstraps one using lai gen sysprompt. If one already exists, it guides you through diagnosing issues from evaluation results and making targeted improvements.

You may also use the lai and langium skills for deeper understanding of the CLI workflow and Langium project structure.

When to Use

  • No system prompt yet — you have a descriptor and need to generate the first system prompt
  • Evaluation results show low pass rates or recurring failure categories
  • The system prompt is missing key language details — grammar rules, validation constraints, scoping rules
  • LLM-generated code consistently has specific error patterns
  • The descriptor or language has changed since the prompt was last generated
  • The prompt is too verbose, unfocused, or missing edge cases

Prerequisites

The target Langium project must have:

  1. lai init completed — a lai.config.jsonc exists
  2. A language descriptor (language.descriptor.yml) — generate one first using the lai-gen-descriptor skill if needed
  3. Node.js and npm available

Step 1: Generate the System Prompt (if not present)

If no system prompt exists, generate one from the descriptor:

bash
# generate a system prompt
lai gen sysprompt

# regenerate from scratch, ignoring any existing prompt
lai gen sysprompt --fresh

This produces a markdown file (e.g., language.sysprompt.md) that instructs an LLM how to generate valid code in your DSL. It is driven entirely by the descriptor content.

If a system prompt already exists and you want to refine it, skip to Step 2.

Step 2: Identify What Needs Fixing

Read the current system prompt and any recent evaluation results to understand the gaps:

bash
# check latest evaluation results
lai show latest --verbose

# compare against a previous good run if available
lai compare <good-run-id> latest

Common issues to look for:

  • Missing grammar context — the prompt doesn't include key grammar rules the LLM needs
  • Incorrect or outdated examples — examples no longer match the current language
  • Vague instructions — the prompt tells the LLM what to generate but not how to avoid common mistakes
  • Missing validation rules — the LLM doesn't know about semantic constraints enforced by the validator
  • Overly long or unfocused — too much irrelevant detail dilutes the important parts

Step 3: Refine the Prompt Content

When editing the system prompt markdown file directly, follow these principles:

  • Be specific about error patterns. If evaluations show the LLM consistently produces invalid cross-references, add a section explaining the scoping rules explicitly.
  • Add negative examples. Show what not to generate alongside valid examples. Frame these as "Common mistakes to avoid."
  • Tighten grammar explanations. Instead of dumping the full grammar, highlight the rules that matter most for generation — entry rules, commonly used alternatives, and tricky syntax.
  • Include validation constraints. If the validator rejects certain patterns, document them as explicit constraints: "Every entity must have at least one property" or "Type references must resolve to a declared type."
  • Order sections by importance. Put the most critical generation rules first — LLMs attend more to earlier context.

Target Structure

The generated prompt always starts with a fixed set of sections (using ### headings): Introduction, one Grammar section per language, Built-in Library (if any), Validation Rules, Examples, Documentation, and Capabilities. The structure below is guidance for how you may reorganize and expand the prompt during manual refinement — it is not what the generator produces verbatim.

A well-refined system prompt should have this structure:

markdown
# <Language Name> Language System Prompt

## Introduction
Brief description of the language and its purpose.

## Grammar Overview
Key grammar rules relevant to code generation, not necessarily the full grammar.
Highlight entry rules, common patterns, and syntactic constraints.

## Validation Rules
Semantic constraints enforced by the validator that the LLM must respect.
These are the rules that cause evaluation failures when violated.

## Scoping and References
How cross-references resolve, what names are in scope where.
Only include if the language has custom scoping.

## Examples
Valid example programs with brief annotations explaining what they demonstrate.

## Common Mistakes
Patterns the LLM should avoid, derived from evaluation failures.

## Generation Guidelines
Specific instructions for how to produce output: formatting, naming conventions,
required elements, optional elements.

Not all sections are needed for every language — include only what's relevant.

Step 4: LLM-Assisted Refinement (Optional)

If you want to use an LLM to help refine the system prompt rather than editing manually, use a prompt like this. Substitute the variables with actual content from your project:

You are refining a system prompt for the <LANGUAGE_NAME> language.

The system prompt is a markdown document with sections such as Introduction,
Grammar, Validation Rules, Examples, Documentation, and Capabilities. Refine it
for clarity, accuracy, and coverage while preserving its existing section
structure and ordering.

Detail level guidance:
- basic: Keep explanations minimal and focused on essentials only.
- moderate: Provide a balanced level of detail — enough for clarity without being verbose.
- comprehensive: Include thorough explanations, edge cases, and detailed context.

Summarization: <"Condense and summarize where possible" OR "Preserve the full detail of the original content">

Current prompt:
<THE EXISTING SYSTEM PROMPT CONTENT>

<If evaluation results are available, include:>
Recent evaluation failures:
<List of failing test cases with their error messages>

Task:
- Improve clarity and readability
- Ensure technical accuracy
- Add helpful context for code generation
- Address the evaluation failures listed above
- Maintain all key information
- Keep the markdown structure and section ordering
- Match the detail level guidance above

Return the refined prompt in markdown format. Do not add extra commentary, just return the improved prompt.

Step 5: Apply and Verify

After refining the system prompt:

bash
# re-run evaluations against the updated prompt
lai evaluate

# compare against the previous run
lai compare <previous-run-id> latest

# tag the run if it improved
lai tag latest after-refinement

Iterative Refinement Tips

  • Fix one category of failure at a time. Don't try to address all issues in a single edit — make a targeted change, evaluate, and repeat.
  • Track what changed. Use lai tag to mark runs before and after each refinement so you can compare.
  • Don't over-specify. Adding too many constraints can make the LLM produce rigid, unnatural output. Find the balance between correctness and flexibility.
  • Update the descriptor first if the language changed. If grammar rules or validation logic changed, update the descriptor and regenerate before refining — otherwise your refinements may conflict with a future regeneration.

Common Refinement Patterns

SymptomLikely Prompt Fix
LLM produces syntactically invalid codeAdd or improve the Grammar Overview section with key rules
Validation errors in generated codeAdd explicit Validation Rules section listing constraints
Wrong cross-references or unresolved namesAdd Scoping and References section explaining name resolution
LLM ignores language conventionsAdd Generation Guidelines with formatting and naming rules
Repetitive or unnatural outputReduce over-specification; add more diverse examples
LLM misunderstands the language's purposeImprove the Introduction section with domain context

Heefeg gestallte Froen

Wat mécht de KI-Skill Lai Gen Sysprompt?

Generate or refine a system prompt for a Langium DSL project. Bootstraps a new system prompt via `lai gen sysprompt` if none exists, then guides targeted refinement based on evaluation results and language changes.

Firwat Lai Gen Sysprompt op TypingMind benotzen?

Well Dir en eemol installéiert a mat all Modell benotze kënnt. Lai Gen Sysprompt besteet aus einfachem Markdown amplaz vun ubidderspezifeschem Code. Dee selwechte Skill funktionéiert also mat GPT-5, Claude, Gemini, Grok oder engem lokale Modell – an Dir kënnt de Modell matzen am Chat wiesselen, ouni datt de Skill ophält ze funktionéieren. TypingMind benotzt Är eegen API-Schlësselen, sou datt Dir d'Ubidder direkt bezuelt amplaz vun engem Abonnement pro Benotzerplaz. Är Skills a Chats bleiwen an Ärem eegene Späicher.

Wéi installéieren ech Lai Gen Sysprompt an TypingMind?

Maacht an TypingMind Plugins → Skills → Vu GitHub installéieren op a setzt https://github.com/eclipse-langium/langium-ai/tree/main/skills/lai-gen-sysprompt an. TypingMind liest d'Datei SKILL.md an installéiert de Skill, deen Dir pro Chat aktivéiere kënnt.

Wéi eng KI-Modeller kënnen Lai Gen Sysprompt benotzen?

All Modell, deen Dir an TypingMind verbënnt. KI-Skills sinn einfach Markdown-Instruktiounen an net ubidderspezifesche Code. Dofir kënne GPT, Claude, Gemini, Grok a lokal Modeller dëse Skill lueden, wann eng Ufro dozou passt.

Wéi vill KI-Modeller kann ech mat Lai Gen Sysprompt benotzen?

Esou vill Dir wëllt. Soulaang e Modell Skills ënnerstëtzt, kënnt Dir Lai Gen Sysprompt domat benotzen – GPT, Claude, Gemini, Grok, DeepSeek, Mistral, Llama a méi – alles op TypingMind mat Ären eegenen API-Schlësselen.

Ass de KI-Skill Lai Gen Sysprompt gratis?

Jo. De Skill gëtt vum eclipse-langium ënner der Lizenz MIT op GitHub publizéiert. Dir bezuelt nëmmen Ären eegene KI-Ubidder fir d'Token, déi Dir benotzt.

Wat si KI-Skills?

E KI-Skill ass e weiderverwendbaart Pak vun Instruktiounen, dat engem KI-Modell bäibréngt, wéi en eng bestëmmt Aufgab erfëllt. E follegt dem oppenen Agent Skills-Format: eng Datei SKILL.md mat engem Numm an enger Beschreiwung, plus all Scripten, Virlagen oder Referenzdateien, déi de Modell eventuell brauch. De Modell liest d'Instruktiounen eréischt, wann Är Ufro zum Skill passt. En installéierte Skill kascht also näischt, bis e benotzt gëtt.

Wéi ënnerscheede sech KI-Skills vu Plugins oder MCP-Serveren?

E Plugin oder MCP-Server gëtt engem Modell nei Tools, déi en opruffe kann – Code, deen iergendwou leeft an e Resultat zeréckgëtt. E KI-Skill gëtt dem Modell dogéint Wëssen an eng Virgoensweis: wéi en eng Aufgab ugeet, wéi eng Schrëtt en nokënnt a wéi eng gutt Ausgab ausgesäit. Skills bestinn aus einfachem Markdown, brauche kee Server, keen API-Schlëssel a keng Lafzäitëmfeld a funktionéiere mat all Modell.

All weisen

Elo Ären eegene KI-Workspace ariichten

Abonnéiert Iech op eisen Newsletter, fir iwwer nei Funktiounen an zukünfteg Gewënnspiller informéiert ze ginn 👇