plugins/backend-toolkit/skills/cicd-pipeline/SKILL.md
Build a backend CI/CD pipeline — containerized builds, type-check/lint/test gates, DB migration as an explicit gate, SHA-tagged images, and blue-green/canary deploy with rollback. Use at project init, when deploys are manual/risky, or when migrations break production. Not for designing the migration itself (use migration-strategy) or the test pyramid (use test-strategy).
npx skillsauth add jaykim88/claude-ai-engineering cicd-pipelineInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
Make every backend deploy automated, gated, and reversible — containerized build, quality gates, migrations applied safely as an explicit step, and a deploy strategy that can roll back without downtime.
Universal — the gated pipeline (build → test → migrate → deploy), SHA-tagged images, and blue-green/canary with rollback are CI/CD principles; the CI platform and registry differ.
type-check, lint, test (unit + integration + contract) run on every PR — parallel jobsconcurrency: { group, cancel-in-progress: true } on GHA) — saves minutes + CI costpaths-ignore for docs-only) so a README edit doesn't run the full pipeline1b. Harden the pipeline itself (it runs with your secrets)
permissions: at the top (contents: read); widen per-job only as needed — the default token is over-permissionedpull_request (default) has no secret access; pull_request_target runs with secrets against PR code, use only with extreme careContainerized build, SHA-tagged
latestDB migration as an EXPLICIT, gated step — before the deploy
migrate deploy as its own pipeline step, before routing traffic to new codemigration-strategy) so old code still works during rolloutDeploy strategy with rollback
Health checks + auto-rollback
observability-setup)Security in the pipeline
npm audit), secret scan (gitleaks), image scan (trivy)backend-security-audit)Validate (validation loop)
| ❌ Anti-pattern | ✅ Correct |
|---|---|
| Migrations run inside app startup | Explicit gated migration step before deploy |
| latest image tag | SHA-tagged immutable images |
| Deploy with no rollback path | Blue-green / canary with instant rollback |
| Traffic switched before health check | Health-gated traffic shift |
| Sequential type-check→lint→test | Parallel quality-gate jobs |
| Stale runs piling up on every PR push | concurrency: cancel-in-progress |
| Workflow with default (over-permissioned) GITHUB_TOKEN | Least-privilege permissions: contents: read |
| uses: action@v4 (moving tag — hijack risk) | Pin to a full commit SHA |
| Secrets exposed via pull_request_target against fork code | Use pull_request; pull_request_target only with extreme care |
| Long-lived cloud access keys in CI secrets | OIDC federation to the cloud |
| Tier | Examples | Action SLA |
|---|---|---|
| Critical | No rollback path; migrations run unsafely on startup with no gate; secrets not scanned (leak risk); secrets exposed to untrusted fork PRs via pull_request_target | Fix immediately |
| Major | latest tags (non-reproducible deploys); no health-gated traffic switch; default over-permissioned GITHUB_TOKEN; third-party actions pinned to a moving tag | Fix this sprint |
| Minor | Sequential CI jobs (slow); image scan not yet wired; no concurrency: cancel-in-progress (stale runs pile up) | Schedule within 2 sprints |
.github/workflows/*.yml (build/test/migrate/deploy stages)chore(ci): containerized build + migration gate / chore(deploy): blue-green with rollbackdocker/build-push-action + setup-buildx; multi-stage Dockerfile (deps → build → distroless runtime)prisma migrate deploy before the deploy job; deploy needs: italembic upgrade head as the migration gategolang-migrate gatemigration-strategy — migrations run as a gated pipeline steptest-strategy — tests + contract verification gate the buildbackend-security-audit — dependency + secret scanning in CIdevelopment
Design webhooks correctly on both sides — sending (HMAC signing, retries with backoff, at-least-once) and receiving (verify signature on raw body, enqueue + 200 fast, dedupe on event id). Use when adding webhook delivery or consuming a provider's webhooks. Not for internal service-to-service events (use async-messaging) or general outbound-call retry policy (use resilience-patterns).
testing
Use transactions and isolation levels correctly — keep them short, no network calls inside, explicit isolation, retry on serialization conflicts, and choose optimistic vs pessimistic locking. Use when a write spans multiple tables, when concurrent updates corrupt data, or when designing money/inventory flows. Not for cross-service event delivery (use async-messaging Outbox) or schema-level constraints (use schema-design).
development
Backend testing pyramid — unit for pure logic, integration against a real DB (Testcontainers), and consumer-driven contract testing (Pact) for service boundaries. Use before a feature, after a bug fix, or when services break each other on deploy. Not for load testing (use performance-profiling) or security testing (use backend-security-audit).
data-ai
Design a relational schema — normalize to 3NF then denormalize with justification, choose the right Postgres index type per data shape, enforce constraints at the DB. Use when modeling a new domain, when queries are slow, or before a migration. Not for diagnosing slow queries (use query-optimization) or shipping the change without downtime (use migration-strategy).