Introduction
Setting up a CI/CD pipeline is no longer optional—it's a necessity for any team shipping code frequently. But even with powerful tools like GitHub Actions, GitLab CI, and ArgoCD, writing efficient workflows can be time-consuming. I've compiled 10 battle-tested prompts that I use daily to generate pipeline configurations, debug issues, and optimize deployments. Each prompt includes a real-world example so you can adapt it immediately.
1. Generate a GitHub Actions workflow for a Node.js app with lint, test, and deploy
Prompt: "Create a GitHub Actions workflow that runs ESLint, Jest tests, and deploys to AWS ECS. Use Node 18, trigger on push to main, and cache node_modules."
Example: I used this to set up a new microservice for a SaaS client. The generated YAML reduced setup from 2 hours to 10 minutes. Here's a snippet:
name: Node.js CI/CD
on:
push:
branches: [ main ]
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Use Node.js 18
uses: actions/setup-node@v3
with:
node-version: 18
cache: 'npm'
- run: npm ci
- run: npm run lint
- run: npm test
- run: npm run build
2. Write a GitLab CI pipeline for multi-stage Docker build
Prompt: "Design a GitLab CI pipeline with three stages: build, test, and deploy. Use Kaniko to build a Docker image without Docker-in-Docker. Push to GitLab Container Registry."
Example: For a legacy monolith migration, this prompt produced a secure pipeline that cut build time by 40%. Key stage:
build:
stage: build
image: gcr.io/kaniko-project/executor:debug
script:
- /kaniko/executor --context $CI_PROJECT_DIR --destination $CI_REGISTRY_IMAGE:$CI_COMMIT_SHA
3. Create an ArgoCD Application manifest for GitOps deployment
Prompt: "Generate an ArgoCD Application resource that syncs a Helm chart from a private Git repo to a Kubernetes cluster. Enable auto-sync with prune and self-heal."
Example: I used this to onboard a new team onto GitOps. The prompt saved me from reading the full ArgoCD docs. Output:
apiVersion: argoproj.io/v1alpha1
kind: Application
metadata:
name: my-app
spec:
source:
repoURL: https://github.com/myorg/charts.git
path: ./my-app
targetRevision: HEAD
destination:
server: https://kubernetes.default.svc
namespace: production
syncPolicy:
automated:
prune: true
selfHeal: true
4. Debug a failing GitHub Actions workflow
Prompt: "My GitHub Actions workflow fails at the 'deploy' step with a 403 error. The step uses aws-actions/configure-aws-credentials. How do I troubleshoot?"
Example: A junior engineer used this and discovered the IAM role was missing a trust policy. The prompt suggested checking AWS credentials via aws sts get-caller-identity in a debug step. We added that step temporarily, fixed the role, and the pipeline passed.
5. Optimize GitLab CI caching for Python projects
Prompt: "Improve a GitLab CI pipeline for a Django app by caching pip dependencies and pre-commit hooks. Reduce pipeline time from 12 minutes to under 5."
Example: After applying the generated configuration, the pipeline ran in 4.2 minutes. The key was using cache:key: files with requirements.txt.
6. Set up ArgoCD with GitHub Actions for image updates
Prompt: "Configure a GitHub Actions workflow that updates an ArgoCD Application's image tag after a Docker build, using Argo CD Image Updater."
Example: This enabled fully automated deployments for a fintech client. The workflow pushed a new tag to the registry, and ArgoCD detected the change within seconds.
7. Write a multi-environment deployment pipeline with approvals
Prompt: "Create a GitLab CI pipeline that deploys to staging and then production. Include a manual approval step before production, and use environment variables for each stage."
Example: A regulated industry client needed this for compliance. The prompt generated a pipeline with when: manual on the production job and separate environments.
8. Generate a GitHub Actions matrix build for multiple OS and Node versions
Prompt: "Build a matrix workflow that tests Node 16, 18, 20 on ubuntu, windows, and macos. Use a single job matrix."
Example: For an open-source library, this ensured cross-platform compatibility. The matrix expanded to 9 jobs automatically.
9. Create an ArgoCD Project with RBAC restrictions
Prompt: "Define an ArgoCD Project that allows only 'production' namespace deployments and restricts sources to a specific Git repo."
Example: A security audit required strict namespace isolation. This prompt produced a Project manifest that limited blast radius.
10. Convert a Jenkins pipeline to GitHub Actions
Prompt: "Here's a Jenkins Declarative Pipeline: [pipeline code]. Convert it to a GitHub Actions workflow with equivalent stages."
Example: Migration from Jenkins to GitHub Actions for a mid-size team. The prompt accurately mapped stage('Build') to a build job.
Conclusion
These 10 prompts cover the most common CI/CD scenarios I encounter daily. They save hours of boilerplate and debugging. Try them in your next pipeline—you'll be surprised how much faster you can go from idea to deployment. If you have a specific use case not listed, drop a comment below and I'll share a prompt for that too.
Comments