CI/CD Pipeline Configuration Prompt (Claude)
CI/CD configurations involve many interdependent jobs and conditional triggers that are easy to get wrong. This prompt defines the full pipeline topology (test on PR, build on merge, deploy with approval gate) so the AI generates a complete, working pipeline rather than a fragment. The caching requirement is especially important — without it, dependency installs on every run significantly increase build times and costs. This variant is formatted for Claude: Optimised for Claude 3.5 Sonnet and Claude 3 Opus. Uses XML tags for structured input and output.
<role>You are an expert AI assistant with deep knowledge in this domain.</role>
<task>
You are a DevOps engineer specialising in CI/CD pipeline design.
Generate a {{platform}} CI/CD pipeline configuration for the following project:
Project type: {{project_type}}
Language/Runtime: {{runtime}}
Test command: {{test_command}}
Build command: {{build_command}}
Deploy target: {{deploy_target}}
Branch strategy:
- Main/production branch: {{main_branch}}
- Staging branch: {{staging_branch}}
Pipeline should:
- Run tests on every push and pull request
- Build and push Docker image on merge to main
- Deploy to staging on merge to {{staging_branch}}
- Deploy to production on merge to {{main_branch}} (with manual approval gate)
- Cache dependencies between runs
- {{additional_requirements}}
Include comments explaining each job and the reasoning behind key configuration choices.
</task>
<instructions>Structure your response clearly with headers and concrete examples.</instructions>Variables
{{platform}}CI/CD platform: GitHub Actions, GitLab CI, CircleCI, or Jenkins{{project_type}}Project type, e.g., "Node.js API", "Python microservice", "Go CLI tool"{{runtime}}Runtime and version, e.g., "Node.js 20"{{test_command}}Command to run tests, e.g., "npm test", "pytest"{{build_command}}Build command, e.g., "npm run build", "docker build"{{deploy_target}}Where to deploy, e.g., "AWS ECS", "Kubernetes", "Heroku", "Fly.io"{{main_branch}}Production branch name, e.g., "main"{{staging_branch}}Staging branch name, e.g., "staging"{{additional_requirements}}Other requirements, e.g., "run security scan with Trivy", or "None"Example
platform: GitHub Actions project_type: Node.js API runtime: Node.js 20 test_command: npm test build_command: docker build -t myapp . deploy_target: AWS ECS main_branch: main staging_branch: staging additional_requirements: Push Docker image to Amazon ECR
name: CI/CD Pipeline
on:
push:
branches: [main, staging]
pull_request:
jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: '20'
cache: 'npm'
- run: npm ci
- run: npm testRelated Tools
FAQ
- How do I store secrets like AWS credentials in the pipeline?
- Use the platform's secret management: GitHub Secrets, GitLab CI/CD Variables, or CircleCI Environment Variables. Reference them in the config as ${{ secrets.AWS_ACCESS_KEY_ID }} (GitHub) or $AWS_ACCESS_KEY_ID (GitLab).
- Can this generate Terraform for the CI/CD infrastructure too?
- Add to additional_requirements: "Also generate a Terraform configuration for the required AWS IAM role and ECR repository". The AI will produce both the pipeline YAML and the Terraform HCL.
- How do I add a matrix build for multiple Node.js versions?
- Add to additional_requirements: "Run tests in a matrix against Node.js versions 18, 20, and 22". The AI will add a strategy.matrix configuration to the test job.
Related Prompts
CI/CD configurations involve many interdependent jobs and conditional triggers that are ea...
CI/CD Pipeline Configuration Prompt (ChatGPT)CI/CD configurations involve many interdependent jobs and conditional triggers that are ea...
CI/CD Pipeline Configuration Prompt (Gemini)CI/CD configurations involve many interdependent jobs and conditional triggers that are ea...
CI/CD Pipeline Configuration Prompt (LLaMA / Ollama)CI/CD configurations involve many interdependent jobs and conditional triggers that are ea...
Dockerfile Generation PromptDockerfiles generated without guidance often use :latest tags, run as root, and copy the e...
Kubernetes Manifest Generation PromptKubernetes manifests have many interacting fields that are easy to misconfigure. This prom...