lai-gen-descriptor
Generate 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.
eclipse-langium · Static checks on file
Installation
Read the source and dependencies before running a command. Copying does not install or execute anything.
npx skills add eclipse-langium/langium-ai --skill lai-gen-descriptorAbout this skill
name: lai-gen-descriptor
description: Generate 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.
user-invocable: true
Generate or Refine a Language Descriptor
This skill covers the full lifecycle of a language.descriptor.yml — from initial generation to iterative refinement. If no descriptor exists yet, it bootstraps one using lai gen descriptor. If one already exists, it guides you through reviewing and improving it so that downstream artifacts (system prompts, evaluations, MCP servers) are as accurate as possible.
You may also use the lai and langium skills for deeper understanding of the CLI workflow and Langium project structure.
When to Use
- No descriptor yet — you have a Langium project initialized with
lai initand need to generate the first descriptor - Descriptor exists but is incomplete — auto-detection missed custom services, examples, or documentation
- Paths are wrong — the generated descriptor references files that don't exist or are in the wrong location
- Language has evolved — grammar, validation rules, or project structure changed since the descriptor was generated
- Evaluation failures — poor eval results trace back to incomplete or inaccurate descriptor content
- Adding examples or docs — new example programs or documentation have been added to the project
Prerequisites
The target Langium project must have:
lai initcompleted — alai.config.jsoncexists at the project root- A working Langium grammar (
.langiumfile) and generated TypeScript artifacts - Node.js and npm available
Step 1: Generate the Descriptor (if not present)
If no language.descriptor.yml exists, generate one:
# generate from project analysis (uses LLM to synthesize)
lai gen descriptor
# regenerate from scratch, ignoring any existing descriptor
lai gen descriptor --fresh
This produces a YAML file that maps your Langium project. It is a starting point — the auto-detector does its best but will likely need corrections.
If a descriptor already exists and you want to refine it, skip to Step 2.
Step 2: Review and Refine the Descriptor
The descriptor is the single source of truth that drives all prompt generation. Inaccuracies here propagate to every downstream artifact. Review each section carefully.
Descriptor Structure Reference
# LAI CLI version that generated this descriptor (auto-injected — don't hand-edit)
version: 0.3.0
# path to the project's Langium config file
langium_config: ./langium-config.json
# one entry per registered Langium language (multi-language projects have several)
languages:
- name: my-dsl # language name
description: A DSL for ... # single-line summary
caseInsensitive: false # true = keywords are case-insensitive
grammar: ./src/grammar/my-dsl.langium # path to the .langium grammar file
# service detection metadata used for eval generation (auto-detected — rarely edited)
serviceDetails:
createServicesFunc: createMyDslServices
createServicesAttributes: [MyDsl]
# custom Langium service files, grouped like Langium's service interfaces (all optional)
services:
module: ./src/my-dsl-module.ts # core DI module
# parser services
token_builder: ./src/my-dsl-token-builder.ts
value_converter: ./src/my-dsl-value-converter.ts
# references services
scope_provider: ./src/scoping/my-dsl-scope-provider.ts
scope_computation: ./src/scoping/my-dsl-scope-computation.ts
# validation services — validators is a LIST, one per language
validators:
- language: my-dsl
path: ./src/validation/my-dsl-validator.ts
# LSP services
type_provider: ./src/typing/my-dsl-type-provider.ts
# optional fields
builtins: # built-in files always in scope (string array)
- ./src/builtins/my-dsl-builtins.langium
tests: # test directories (string array)
- ./test/
examples: [...] # example programs
documentation: [...] # documentation references
The services section mirrors Langium's own service groups. Only include what your project actually customizes:
- core:
module - parser services:
async_parser,grammar_config,langium_parser,parser_error_message_provider,lexer_error_message_provider,completion_parser,token_builder,lexer,value_converter - documentation services:
comment_provider,documentation_provider - references services:
linker,name_provider,references,scope_provider,scope_computation - serializer services:
hydrator,json_serializer - validation services:
validators(a list of{ language?, path }),validation_registry - LSP services:
completion_provider,document_highlight_provider,document_symbol_provider,hover_provider,folding_range_provider,definition_provider,type_provider,implementation_provider,references_provider,code_action_provider,semantic_token_provider,rename_provider,formatter,signature_help_provider,call_hierarchy_provider,type_hierarchy_provider,declaration_provider,inlay_hint_provider,code_lens_provider,document_link_provider
2a. Fix File Paths
The auto-detector looks for common patterns (*-validator.ts, **/scoping/**, etc.) but may miss non-standard naming or directory structures. Verify every path in the descriptor actually exists:
languages[].grammar— must point to the.langiumfilelangium_config— must point tolangium-config.jsonservices.*— each should point to the actual TypeScript file implementing that serviceservices.validators[].path— each should point to a real validator so