Introduction
It is fascinating to see how quickly AI is advancing, and even more striking how suddenly it entered mainstream life. In late 2022, when ChatGPT was launched, AI moved from research labs into everyday conversations, classrooms, offices, and homes. That moment opened the floodgates for a broader transformation in how people interact with intelligent systems.
Context: The Expanding AI Ecosystem
Within only a few months, the AI ecosystem expanded far beyond simple chat interfaces. Several complementary trends made AI systems more powerful, practical, and easier to integrate into real workflows:
- Large Language Models: models scaled from billions to trillions of parameters, becoming capable of reasoning, coding, summarizing, and generating content with near-human fluency.
- Agents: systems that do not only answer questions, but can also take actions, plan tasks, run tools, and complete workflows autonomously.
- Local LLMs: models running on laptops, desktops, and even phones, ensuring privacy and offline intelligence.
- MCPs (Model Context Protocols): a new layer that lets AI securely access tools, APIs, and data sources, turning models into extensible platforms.
- Skills: modular abilities that can be plugged into AI systems, enabling them to perform specialized tasks such as analysis and coding, including for new DSLs.
- Multimodal models: AI systems that can understand images, audio, video, and text together, making them far more capable than early chat-only systems.
We moved from “type a question, get an answer” to an entire AI ecosystem in which models can see, hear, act, reason, and integrate with the tools we use every day. This rapid evolution provides the context for exploring how LLMs can support specialized software engineering tasks.
Problem Statement: Supporting MoTion Pattern Creation
At Berger-Levrault, at the Software Engineering Lab within the BL Research Team, we work on software analysis and experiment with various LLMs to evaluate new functionalities, understand their impact on our work, and explore integration methods through programming and AI tools. In this context, we also use MoTion, a library that enables pattern matching by describing patterns with a specific syntax and finding matches over models imported in Moose, a platform for software analysis. MoTion is already used by several developers in both industrial and research contexts.
Below is an example of a MoTion pattern matching a TypeScript SwitchCase clause with exactly two cases and one default.
pattern := FASTTypeScriptProgram % {
#'children*' <=> FASTTypeScriptSwitchBody % {
#'children' <=> {
FASTTypeScriptSwitchCase % { } as: #case1.
FASTTypeScriptSwitchCase % { } as: #case2.
FASTTypeScriptSwitchDefault % { } as: #default
}
} as: #switchStmt
}.
results := pattern collectBindings: { #switchStmt. #case1. #case2. #default } for: aModel.
MoTion syntax contains many symbols, each handling a specific feature. For example: * applies a recursive search until reaching the end of an AST (when AST is matched), % {} defines the pattern type and its characteristics, allowing a more detailed and narrower search. The <-> assigns the corresponding value to a property, which can be a literal (like a number or string) or a subpattern, as in this example.
As shown in the example, learning MoTion’s syntax can be challenging. This led us to design a solution using LLMs to help developers create MoTion patterns directly from natural-language prompts.
Solution Overview: Skills
To connect natural-language requests with domain-specific tooling, we rely on the usage of Skills. Skills provide a structured methodology for defining agentic behavior, domain-specific knowledge, and procedural execution. Their main goal is to offer a standardized interface that allows AI agents to consume new capabilities dynamically.
Each skill is organized within a dedicated directory centered around a SKILL.md file. This file serves as the primary entry point and contains essential metadata and task-oriented instructions. In addition to documentation, the skill folder may include:
- Configuration files for AI agents for skills support
- Reference materials and technical specifications to be explored by the Large Language Model.
- Executable scripts for environment setup or task execution.
- Dependency guides for external libraries or frameworks.

By encapsulating these resources, Skills enable an LLM to assist users more effectively, providing grounded and context-aware responses rather than relying only on pre-trained knowledge.
Workflow: Using the MoTion Skill
Based on this approach, we implemented MoTion skill capable of producing patterns for Java AST, TypeScript AST, and XML (until the date of publishing this post). In a typical workflow, the interaction proceeds as follows:
- Installation: The user installs the MoTion skill within a compatible AI agent, such as Codex, registering it as an available capability for future use.
- Request: The user submits a natural-language prompt, such as: “Generate a MoTion pattern that identifies an empty Java class.”
- Skill activation: The agent forwards the request to the LLM, which identifies that the MoTion skill is relevant. The LLM then reads the
SKILL.mdfile and its associated resources. - Context ingestion: The model retrieves documentation on MoTion’s operational logic, its integration with TypeScript, and necessary dependencies, such as the FASTTypeScript library.
- Output: Based on this retrieved context, the LLM generates the precise MoTion pattern and returns it to the user.
Experiments
As researchers, we needed to verify that our approach actually works for creating MoTion patterns. To do this, we ran two experiments: the first one, to check the efficacity of MoTion skills in understanding existing patterns created by a developper experienced with MoTion. The second one is to compare the skills interaction with different LLMs using the same prompt, to see if they are going to understand the skill and generate the requested pattern. Here are our main observations coming from both experiments:
- Experiment 1:
- All patterns were explained correctly and presented in three distinct forms: (i) a brief overview,
(ii) a detailed explanation in plain English with a line-by-line decomposition of the pattern, and
(iii) a semantic interpretation closely aligned with natural language. - Some responses included comparative elements, relating the current pattern to previously analyzed ones, using phrases such as “unlike the previous pattern.”
- Suggestions to improve the patterns included removing unnecessary parentheses and proposing new patterns with the same structure but different class names to support the new metamodel versions, especially for TypeScript.
- Many responses also included additional notes, such as clarifications on what the pattern does
not match and details regarding bound or unbound elements.
- All patterns were explained correctly and presented in three distinct forms: (i) a brief overview,
- Experiment 2:
- Each platform received the same documentation and the same natural-language request, namely to generate a MoTion pattern for a TypeScript construct. All three LLMs successfully interpreted the task and produced syntactically valid MoTion patterns. However, differences emerged at the semantic level: both ChatGPT and Copilot generated patterns that were not only correct but also structurally identical. In contrast, Mistral AI produced a pattern that diverged slightly in structure, employing some different properties and classes. Moreover, its output contained a minor semantic error by using an incorrect property name.

Conclusion
AI has come a long way in a short time. What started as simple chatbots has grown into a full ecosystem of agents, skills, and tools that developers can use easily.
At the GL Lab of BL Research Team, our core activity revolves around software analysis, where we rely on MoTion, a tool developed in-house for pattern matching on software models. While MoTion is highly effective, its learning curve can be steep: new developers often face difficulties getting started, understanding its syntax, and writing efficient patterns.
We decided to leverage AI to simplify this experience. By implementing MoTion Skill, an AI-powered assistant built on top of MoTion, we aim to guide developers through patterns construction, and make pattern matching easier and accessible to anyone. Our early experiments have been promising, though they have also surfaced valuable observations.
This is only the beginning. We look forward to continuing our exploration of AI-driven solutions, experimenting with new approaches, and sharing our findings and lessons learned through posts like this one. Stay tuned!



