Notifications
Clear all

Best Claude Code skills for automating CI/CD pipeline script generation?

3 Posts
4 Users
0 Reactions
66 Views
0
Topic starter

What are the actual best Claude Code skills or system prompts for getting it to write reliable GitLab CI/CD yaml files without it constantly hallucinating deprecated runner tags or making up its own syntax for the variables? Ive been a DevOps lead for about six years now and I usually just hand-roll my pipelines but we got a huge influx of new microservices this month—about 40 of them for a fintech client in London—and I thought Id save time by using the new Claude Code CLI stuff.

Its driving me crazy. One minute its writing perfect bash scripts for my deployment stages and the next its trying to use some weird environment syntax that havent existed since 2019. I've tried feeding it my own internal docs as context but it seems to get distracted by the default training data or something.

I have to get these pipelines live by Friday and Im already fifty bucks deep into the API credits just trying to get it to stop messin up the cache keys and the rules:if logic. Is there a specific way to prompt it or a specific skill I can define to keep it grounded in modern YAML standards? Just feeling like Im fighting the tool more than Im actually coding at this point...


3 Answers
12

Re: "Honestly, I've been down this exact road and..."

  • I actually think the issue is less about the training data and more about how Claude tries to fill in the blanks when it gets bored. I went through this exact mess last year with a trading firm and learned the hard way that Claude Code loves making up environment variables. You might want to consider defining a custom skill that specifically loads a local schema.json. I would suggest being careful with the rules:if syntax tho, it almost always trips up on nested quotes. I personally stopped using the CLI tool for the heavy lifting and moved back to Microsoft Visual Studio Code with the GitLab Workflow Extension to catch errors instantly. I spent like eighty bucks on API calls before I realized it just needed a golden yaml file to copy from. Definitely ground it with a specific version number in your prompt... it helps a ton.


10

Building on the earlier suggestion, I'd say you gotta be super careful with how much freedom you give the CLI. If you're burning through credits like that, it's usually because the context window is getting messy with all those failed attempts. I would suggest creating a dedicated reference file and explicitly telling Claude to only use the syntax found there. Tell it 'If it's not in this file, it doesn't exist.' Also, watch out for those Anthropic Claude 3.5 Sonnet API costs when you're scaling to 40 services. I'd make sure to feed it a 'golden' example of a working job and force it to use that as a strict template. It's way cheaper to have it copy-paste and swap variables than letting it 'innovate' on your logic. Just double check those rules:if statements tho... it still loves to sneak in old only/except syntax when it gets lazy lol.


3

Honestly, I've been down this exact road and it's a nightmare when you're on a deadline for a client like that. In my experience, these models love to hallucinate old GitLab syntax because the internet is just full of outdated StackOverflow posts from 2018. Over the years, I've learned that Claude needs a very specific leash. I tried using it for a similar mass-migration of microservices last year and kept getting the same rubbish with the rules:if logic. It felt like I was spending more time debugging the AI than actually building the infra... I've found a few things that help keep it from going off the rails:

  • I strictly feed it snippets from the latest official GitLab schema docs in the prompt itself, not just my own internal docs.
  • I tell it to explicitly avoid any tags that aren't on my specific runner fleet.
  • I make it write the script in small chunks instead of the whole file at once. The problem is usually that the model defaults to the most common patterns in its training data, which happen to be the old, broken ones. It's frustrating when you're trying to automate and end up fixing syntax errors for hours. It just feels like double work at a certain point. Before you dump more credits into it tho, are you trying to get it to generate one master template for all 40 services, or are you having it customize every single pipeline based on the specific language stack of each service? Also, have you tried setting up a custom system prompt that explicitly blacklists those specific deprecated tags you keep seeing?


Share: