Skip to content

Generate with AI

Markdown version

If you already have a GitLab CI pipeline, an AI coding assistant can produce the equivalent Mélodium pipeline in minutes, without you having to learn the language first.

  • Your existing .gitlab-ci.yml file, the agent will read it directly.
  • An AI coding assistant running locally in your project (Claude Code, Cursor, Zed, or similar).
  • The Mélodium skill installed in your AI tool, the Mélodium MCP server connected to it, or both. See Install the Mélodium Skill. The MCP server provides the same migration guide through get_cicd_migration_guide, and lets the AI check the program it writes.

Step 1: Make Sure the Migration Reference Is Included

Section titled “Step 1: Make Sure the Migration Reference Is Included”

The general Mélodium skill covers the language and project layout. For a GitLab CI migration, the AI also needs skills/melodium/references/gitlab-migration.md, which has the exact treatment patterns for simpleStep, artifact streaming, stage ordering, allow_failure, when: always, and status reporting.

With Claude Code, this comes included automatically once the skill is installed under ~/.claude/skills/melodium, it loads its reference files on demand. With Cursor or Zed, make sure your rule file includes it:

Terminal window
# Cursor
cat skills/melodium/SKILL.md \
skills/melodium/references/gitlab-migration.md \
skills/melodium/references/projects.md \
> .cursor/rules/melodium.md
# Zed
cat skills/melodium/SKILL.md \
skills/melodium/references/gitlab-migration.md \
skills/melodium/references/projects.md \
> .rules

Your AI agent is already running inside your project and can read your pipeline file directly, so a simple prompt is enough:

Read .gitlab-ci.yml and migrate it to Mélodium.
Generate a complete project under .melodium-ci/ with Compo.toml and .mel files.
Use simpleStep for container jobs, localStep for self-hosted jobs.
Report status back to GitLab using the token and project parameters.

If your pipeline uses include: to pull in local template files, mention their location:

Also read the templates in ci/templates/ that are included by the pipeline.

The AI will produce a ready-to-use Mélodium project: a Compo.toml declaring the right dependencies, one .mel file per pipeline or logical group of jobs, stage ordering expressed as sequential wiring between treatments, parallel instances for parallel: jobs, direct byte-stream artifact passing with no intermediate storage, and GitLab commit status reporting.

Read through the generated code before running it. The cpu, memory, and storage parameters in simpleStep have generic defaults, adjust them to your actual build requirements. Check that gitlab_project_id, gitlab_sha, gitlab_ref, and gitlab_pipeline_id are wired to the right entrypoint parameters, and that the token is read from the right secret: gitlab_token defaults to "env:MELODIUM_SECRET_GITLAB_TOKEN", a CI/CD variable described in CI/CD Components. The AI merges before_script / after_script into the commands list, but unlike GitLab CI they then share the same shell environment, so verify that matches your intent. Check that filterBlock wiring correctly captures the logic of your original rules: conditions, and that the out_file / in_file names in simpleStep / simpleStepWithInput match the paths your scripts actually write and read.

If you want to understand what the AI produced, or adjust it yourself, this table shows how GitLab CI concepts map to Mélodium:

GitLab CI Mélodium
Pipeline (.gitlab-ci.yml) .mel treatment
Job Treatment with simpleStep or localStep
image: image parameter of simpleStep
script: / before_script: / after_script: commands list in simpleStep
Stage ordering Sequential wiring between treatments
needs: / dependencies: Sequential wiring; artifacts via data stream
artifacts: out_file + data stream; simpleStepWithInput to consume; artifacts parameter of simpleStep to keep them as run artifacts
cache: cache parameter of simpleStep, or work/cache in programs (see Caches)
rules: / only: / except: filterBlock<void>() on the trigger
when: always one<void>() fan-in of success and failure outputs
allow_failure: true Handle error output instead of stopping the chain
parallel: Multiple parallel treatment instances with one<void>()
interruptible: true simpleStepTerminable variant
Status reporting postGitlabState / setServiceState

Full API documentation is at doc.melodium.tech.

The generated code is a good starting point, and can be extended with any Mélodium element. For distribution across multiple machines and more advanced parallelisation, see Simple CI/CD Implementation and Advanced CI/CD Implementation.