Skip to content

Navigation Menu

Sign in
Sign up

Create a AI Agent Skill for 4diac #2565

diplfranzhoepfinger started this conversation in Ideas
Discussion options

Documentation

this is working in a beta status.

This file serves as the main entry point for the AI 4diac project documentation.

How to obtain current XSDs

the XSDs might be soon here: https://github.com/eclipse-4diac/4diac-documentation/tree/main/src/specs

unless they are i use this ones: Meisterschulen-am-Ostbahnhof-Munchen/4diac_EasyExampleCounter#13 they are made by @azoitl and refined in a PR Linked there.

  1. Copy the skill from the PR above into the root folder of your 4diac-ide project.
  2. Copy the AGENTS.md as well into the root folder of your 4diac-ide project.

Coding Agents

Resources and tools for AI-assisted development:

Testing:

Prompt:

Tested with Antigravity CLI with Gemini 3.5 Flash (Medium)

create a new Block, with a ECC with 4 states: right, left, up down. it should behave like a Cross-Joystick. you
 only can go right over Center, so any transition must go over Center. validate against the XSD

Result:

  • the AI respects the reserved keywords (RIGHT, LEFT)
  • the AI validates the XML Structure, and corrects Errors
  • and many more. Feel free to test this.

Meisterschulen-am-Ostbahnhof-Munchen/4diac_EasyExampleCounter#14

image
You must be logged in to vote

Replies: 2 comments 1 reply

Comment options

@diplfranzhoepfinger There are two major issues with this post:

  1. Currently there is a legal uncertainty around the DTDs. The reason for that is that the DTD is part of IEC 61499-2. Therefore you can only distribute it if you have a license from IEC. Therefore I kindly ask you to not provide a DTD or an XSD converted from the DTD in any issue, discussion or PR in 4diac IDE.

  2. Do not use the ecore model to generate an XSD. The ecore model is the 4diac IDE internal representation of IEC 61499 data optimized for the needs of 4diac IDE (e.g., more efficient checking and editing). An XSD generated from the ecore will not at all resemble a vaild XML file.

You must be logged in to vote
1 reply
Comment options

@azoitl

  1. Currently there is a legal uncertainty around the DTDs. The reason for that is that the DTD is part of IEC 61499-2. Therefore you can only distribute it if you have a license from IEC. Therefore I kindly ask you to not provide a DTD or an XSD converted from the DTD in any issue, discussion or PR in 4diac IDE.

i made a very clear remark above about the copyright, and removed all copys of this file everywhere.

  1. Do not use the ecore model to generate an XSD. The ecore model is the 4diac IDE internal representation of IEC 61499 data optimized for the needs of 4diac IDE (e.g., more efficient checking and editing). An XSD generated from the ecore will not at all resemble a vaild XML file.

yes, i recognized this.

Comment options

Other Information, kept for reference (1)

XML Validation

There are two primary ways to validate XML files against the current XSD schemas.

Option A: Using xmllint (CLI)

If you are using Linux, macOS, or Windows (via WSL or Git Bash), you can use the xmllint tool from the libxml2 package.

Command:

xmllint --schema your_schema.xsd your_file.xml --noout

Option B: Using a Python Script

If you don't have xmllint, you can use a Python script. This is often preferred by coding agents.

Prerequisites:

pip install lxml

validate.py:

import sys
from lxml import etree
def validate_xml(xml_path, xsd_path):
 try:
 schema = etree.XMLSchema(etree.parse(xsd_path))
 xml_doc = etree.parse(xml_path)
 schema.assertValid(xml_doc)
 print("SUCCESS: XML is XSD compliant!")
 sys.exit(0)
 except Exception as e:
 print(f"VALIDATION FAILED:\\n{e}", file=sys.stderr)
 sys.exit(1)
if __name__ == "__main__":
 # Update these paths as needed
 validate_xml("data.xml", "schema.xsd")

Agent Configuration (old way)

Modern CLI agents read automatic configuration files in the root directory of your project. Use these to anchor XSD validation as a mandatory task.

Create the appropriate file in the main directory of your project depending on the tool:

  • For Gemini CLI: Create a GEMINI.md
  • For Claude Code: Create a CLAUDE.md
  • For Antigravity CLI & OpenCode: Use AGENTS.md

These files should contain the project rules, such as mandatory XML validation and language requirements, to ensure the agent follows them autonomously.

Advanced: Agent Skills (Recommended)

For a more modular approach, Antigravity and compatible agents support Agent Skills. This allows the agent to load expertise on-demand.

This is known to work for Opencode, Antigravity CLI

The XML validator is implemented as a skill in:
.agents/skills/xml-validator/

project/
└── .agents/
 └── skills/
 └── xml-validator/
 ├── SKILL.md
 └── validate.py 
  • SKILL.md: Instructions for the agent on how to use the skill.
  • validate.py: The validation script.

SKILL.md Content:

---
name: xml-validator
description: Use this skill when XML files need to be edited, created, or validated against an XSD schema.
---
# Instructions for the Agent
When you touch XML files, you must mandatory ensure validation.
## Command to execute
Run the Python script in this folder from the terminal:
`python .agents/skills/xml-validator/validate.py <file.xml> <schema.xsd>`
## Error Handling
If the script fails, read the terminal output (stdout/stderr), adjust the XML file to the XSD specifications, and run the script again until it passes without errors.

Agents can invoke this skill when working with XML files to ensure XSD compliance without cluttering the global context.

removed here is a Template for such a Skill.

Advanced Next Level: MCP Server

almost all known Agents support MCP Servers. Not only Claude (Antropic invented this) but at least also Antigravity CLI, Opencode (both Desktop and CLI) and Claude. See below for more.

For Pros: Scaling Up to True "Skills" via MCP

If you want Claude to do more than just invoke a basic terminal script—giving it a true, reusable function (or skill)—you can leverage Anthropic’s Model Context Protocol (MCP).

You can set up a local or global MCP server (for example, a lightweight Node.js or Python script) that exposes a custom tool like validate_xml(xml_path, xsd_path).

Once this server is registered in Claude's configuration file (~/.config/claude/config.json), Claude will have this XML validation skill ready system-wide. You will be able to trigger it in absolutely any directory, without ever needing to clutter your project folders with a dedicated validation script again.

Idea:

4diac could host such an MCP Server:

Example from Espressif:

https://mcp.espressif.com/

in this Link you also see more Coding Agents who support MCP.

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Ideas
Labels
None yet

AltStyle によって変換されたページ (->オリジナル) /