/langium-ai:lai-gen-syspromptfrom langium-ai
Generates or refines a system prompt for a Langium DSL project. Bootstraps new prompts via `lai gen sysprompt` and guides targeted refinement based on evaluation results and language changes.
Ships in langium-ai. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
None: SKILL.md is the whole skill.
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.
The target Langium project must have:
lai init completed — a lai.config.jsonc existslanguage.descriptor.yml) — generate one first using the lai-gen-descriptor skill if neededIf no system prompt exists, generate one from the descriptor:
# 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.
Read the current system prompt and any recent evaluation results to understand the gaps:
# 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:
When editing the system prompt markdown file directly, follow these principles:
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:
# <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.
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.
After refining the system prompt:
# 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
lai tag to mark runs before and after each refinement so you can compare.| Symptom | Likely Prompt Fix |
|---|---|
| LLM produces syntactically invalid code | Add or improve the Grammar Overview section with key rules |
| Validation errors in generated code | Add explicit Validation Rules section listing constraints |
| Wrong cross-references or unresolved names | Add Scoping and References section explaining name resolution |
| LLM ignores language conventions | Add Generation Guidelines with formatting and naming rules |
| Repetitive or unnatural output | Reduce over-specification; add more diverse examples |
| LLM misunderstands the language's purpose | Improve the Introduction section with domain context |
What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
npx claudepluginhub eclipse-langium/langium-ai --plugin langium-ai7 skills in this plugin
/laiGuide for using the langium-ai (LAI) CLI to generate language descriptors, synthesize system prompts, run evaluations, and iteratively refine AI-powered tooling in Langium projects. Use when working with lai commands, descriptors, or evaluation files./lai-gen-descriptorGenerate or refine a language descriptor for a Langium DSL project. Bootstraps a new descriptor via `lai gen descriptor` if none exists, then guides refinement of paths, services, examples, documentation, and structure./lai-gen-evalsExpand and refine the evaluation suite for a Langium DSL project. Generates comprehensive eval files that cover syntactic correctness, semantic validity, user intent matching, edge cases, and language understanding.Other plugins' skills for the same job