---
name: deployment-pipeline-hardening
description: "Reviews a CI/CD pipeline for a safe release path: stage order, health checks, rollback, secret handling, and gates that stop a bad build before users see it. Use when a CI/CD pipeline needs a review of its gates, health checks, rollback path, and secret handling before more traffic depends on it. Do not use for writing a pipeline from scratch or choosing a hosting provider. Related topics: devops, coding."
---

# Deployment Pipeline Hardening

Reviews a CI/CD pipeline for a safe release path: stage order, health checks, rollback, secret handling, and gates that stop a bad build before users see it.

## When to use

Use this skill when a CI/CD pipeline needs a review of its gates, health checks, rollback path, and secret handling before more traffic depends on it. Do not use it for writing a pipeline from scratch or choosing a hosting provider.

## Workflow

1. Ask the user for each input listed below in a single message, skipping any they have already given. Where options are listed, offer them, but accept other answers too.
2. Trace one commit from push to production and list each stage with what it proves and what a failure does.
3. Find missing gates, such as tests that do not block deploys or a release with no post-deploy smoke check.
4. Confirm a one-step rollback exists and that database changes are compatible with both old and new code.
5. Audit secret handling and third-party step pinning, including exposure to pull requests from forks.
6. Return findings by risk, corrected snippets for the top three, and a short rollback runbook.

## Inputs

- **Pipeline config** (longer free text)
- **Hosting target** (free text, e.g. "Kubernetes or Cloud Run")
- **CI system** (choose one: GitHub Actions, GitLab CI, CircleCI, Jenkins, Other)
- **Release frequency** (choose one: Many per day, Daily, Weekly, Rarely)
- **Environments** (free text, e.g. "staging and production")
- **Concerns** (choose any: Rollback, Health checks, Secrets, Approvals, Caching, Supply chain)

## Output

Findings ordered by risk, corrected pipeline snippets for the top three, and a rollback runbook of no more than ten steps.

## Prompt template

Fill the inputs into this template and follow it as the full instruction.

### Deployment Pipeline Hardening

Review my release pipeline and make it safer to ship through.

- Pipeline config: {{Pipeline config}}
- Hosting target: {{Hosting target}}
- CI system: {{CI system}}
- Release frequency: {{Release frequency}}
- Environments: {{Environments}}
- Concerns: {{Concerns}}

Trace one commit from push to production and list each stage, what it proves, and what happens when it fails. Look for missing gates: tests that do not block the deploy, a production deploy from an unreviewed branch, no smoke test after release. Check there is a defined way back: the previous artifact kept, a one-step rollback, and database changes that work with both old and new code. Confirm health checks test real readiness, not just that the process started. For secrets, check they come from the platform store, are scoped per environment, never echo to logs, and are not exposed to pull requests from forks. Check third-party actions are pinned to a commit and artifacts are built once and promoted.

Return the findings by risk, a corrected pipeline snippet for the top three, and a short rollback runbook.

## Pitfalls

- Counting a green build as proof of safety when nothing checks the deployed service afterwards.
- Rebuilding the artifact per environment, so production runs code that staging never tested.
- Printing environment variables in a debug step and leaking secrets into public build logs.
