Harness deployment

From Intense-Visions/harness-engineering · View interactive version

Harness deployment is an AI agent skill from the GitHub repository Intense-Visions/harness-engineering. > CI/CD pipeline analysis, deployment strategy design, and environment management. From commit to production with confidence. Deployment readiness is a hard gate: `harness check-deployment` **blocks**

How to use this skill

Skill file

Harness Deployment

CI/CD pipeline analysis, deployment strategy design, and environment management. From commit to production with confidence. Deployment readiness is a hard gate: harness check-deployment blocks a deploy on unambiguous, incident-causing violations, advises on maturity gaps, and abstains loudly when a repo does not deploy. This is a gate, not a suggestion.

When to Use

Process

Phase 0: ENFORCE -- Run the deployment gate

This is the mechanical gate and it runs first. The phases below (DETECT/ANALYZE/DESIGN/VALIDATE) are the advisory context you use to _fix_ what the gate finds — they never replace it.

  1. Invoke the gate. Never reimplement it. Run harness check-deployment (add --json for machine output, --findings-json for the trailing findings-contract line). The skill invokes the command; it does not re-derive the detection or the block/advise decision by hand. Hand-rolling the mechanical check instead of calling the command is a Red-Flag pattern.
  1. Read the exit code as the authority. The gate reports one of four values, and each means exactly one thing:

| Exit | Meaning | What it says about the deploy |

| ---- | ------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------- |

| 0 | Pass — deployment config detected, no hard violations (or the gate is explicitly disabled via deployment.enabled: false). | Cleared. Soft findings may still be listed as advisories. |

| 1 | Blocked — at least one hard violation. | Do not deploy. Fix the finding; the gate is the authority and does not get hand-waved past. |

| 2 | Error — internal failure or misconfiguration (unreadable/malformed harness.config.json). | Indeterminate. Fix the tooling/config; never treat a 2 as a pass. |

| 3 | Abstained — no deployment configuration detected at all. | The gate examined nothing — abstained, not passed. Never green. Confirm the repo genuinely does not deploy, or that detection missed the config. |

  1. Apply the block-vs-advise contract. Hard rules block (exit 1); soft rules advise (surfaced, exit 0):

| Code | Class | Fires when |

| ----------------- | ----------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |

| DEPLOY-SEC001 | HARD — non-waivable | A hardcoded secret or long-lived cloud credential appears in a pipeline file or a committed environment file. A ${{ secrets.X }} / process.env.X reference is not a leak and does not trip it. |

| DEPLOY-RB001 | HARD | A deploy target is detected but no rollback path is wired. |

| DEPLOY-ENV001 | HARD | A production deploy is reachable with no promotion/approval gate (direct-to-prod, no environment protection, no manual approval, no prior staging job). |

| DEPLOY-STAGE001 | SOFT | Recommended pre-deploy stages are missing (security scan, smoke tests, post-deploy verification), or a pipeline file is unparseable. |

| DEPLOY-ENV002 | SOFT | Weak environment separation (shared non-secret config across environments) that is not an outright leak. |

| DEPLOY-HC001 | SOFT | No post-deploy health check wired for a deploy target. |

| DEPLOY-PERF001 | SOFT | Pipeline structure smells (serial stages that could parallelize, missing dependency/build caching). |

  1. Severity overrides are per-rule and bounded. deployment.rules may downgrade a waivable hard rule (DEPLOY-RB001, DEPLOY-ENV001) to advisory for a repo where the concept genuinely does not apply — with a config comment saying why. DEPLOY-SEC001 ignores any downgrade: a leaked credential is never a judgment call. Disabling the whole gate (deployment.enabled: false) is an explicit, reviewable opt-out — not a fix for a single finding.
  1. When the gate blocks, drop into the advisory phases. Use DETECT to locate the offending config, ANALYZE to understand the gap, and DESIGN to write the fix in the project's CI/CD syntax. Re-run the gate until it clears.

Phase 1: DETECT -- Identify Pipeline and Environment Configuration

  1. Scan for CI/CD configuration files. Search the project root for pipeline definitions:
  1. Identify deployment targets. Parse pipeline files for deployment steps and extract:
  1. Detect environment configuration. Look for environment-specific config:
  1. Map the deployment topology. Build a summary of what gets deployed where:
  1. Present detection summary. Output the discovered topology before proceeding:

```

Deployment Topology:

Platform: GitHub Actions

Pipelines: 3 workflow files

Environments: dev, staging, production

Strategy: Rolling (detected from kubectl rolling-update)

Approval gates: production (manual)

```


Phase 2: ANALYZE -- Evaluate Pipeline Quality and Gaps

  1. Check pipeline stage completeness. A mature pipeline includes these stages. Flag any that are missing:
  1. Evaluate environment isolation. Verify that environments are properly separated:
  1. Check deployment safety mechanisms. Verify the pipeline includes:
  1. Analyze pipeline performance. Identify bottlenecks:
  1. Check secret hygiene in pipelines. Verify:

Phase 3: DESIGN -- Recommend Strategy Improvements

  1. Recommend deployment strategy. Based on the service characteristics:
  1. Design missing pipeline stages. For each gap identified in Phase 2, provide:
  1. Recommend environment promotion workflow. Design the path from commit to production:
  1. Design rollback procedure. Every deployment must have a documented rollback:
  1. Recommend monitoring integration. Connect deployment events to observability:

Phase 4: VALIDATE -- Verify Pipeline Correctness

  1. Lint pipeline configuration. Run syntax validation:
  1. Verify environment variable completeness. For each environment:
  1. Verify branch protection alignment. Confirm that:
  1. Generate deployment readiness report. Summarize findings:

```

Deployment Readiness: [PASS/WARN/FAIL]

Pipeline stages: 7/9 present (missing: security scan, smoke tests)

Environment isolation: PASS

Rollback procedure: WARN (documented but not automated)

Secret hygiene: PASS

Pipeline performance: 12m avg (recommend parallelizing test stages)

Recommendations:

1. Add SAST scan stage between build and deploy

2. Add post-deploy smoke test stage

3. Automate rollback on health check failure

```

  1. Present results. Use emit_interaction to deliver the report and ask whether to proceed with implementing recommendations.

Harness Integration

Success Criteria

Examples

Example: Node.js API with GitHub Actions

Phase 1: DETECT
  Found: .github/workflows/ci.yml, .github/workflows/deploy.yml
  Environments: staging (auto), production (manual dispatch)
  Strategy: Rolling (kubectl set image)
  Registry: ghcr.io/org/api-server

Phase 2: ANALYZE
  Missing stages: security scan, post-deploy smoke tests
  Environment isolation: PASS
  Secret hygiene: WARN -- AWS_ACCESS_KEY_ID used instead of OIDC
  Pipeline duration: 18m (test and lint run sequentially)

Phase 3: DESIGN
  Recommendation: Add trivy scan after Docker build
  Recommendation: Switch to AWS OIDC for keyless authentication
  Recommendation: Parallelize lint and test jobs (saves ~4m)
  Recommendation: Add smoke test job after deploy-staging

Phase 4: VALIDATE
  actionlint: PASS
  Environment variables: PASS
  Branch protection: WARN -- main branch allows force-push
  Result: WARN -- 3 recommendations, 1 security improvement needed

Example: Python Service with GitLab CI and Canary Deploy

Phase 1: DETECT
  Found: .gitlab-ci.yml with 5 stages
  Environments: dev, staging, production
  Strategy: Canary (Istio VirtualService weight shifting)
  Registry: registry.gitlab.com/org/service

Phase 2: ANALYZE
  All 9 standard stages present
  Environment isolation: PASS
  Canary configuration: 5% -> 25% -> 75% -> 100% over 30 minutes
  Rollback: Automatic on 5xx rate > 1%

Phase 3: DESIGN
  Current strategy is well-configured. Minor recommendations:
  - Add canary duration metrics to Grafana dashboard
  - Add deployment event annotation to Prometheus
  - Consider adding a manual gate between 75% and 100%

Phase 4: VALIDATE
  GitLab CI lint: PASS
  Environment variables: PASS
  Branch protection: PASS
  Result: PASS -- pipeline is production-ready

Gates

These are hard stops enforced mechanically by harness check-deployment. A hard violation is an error, not a warning — it maps to a non-zero exit and the skill does not hand-wave past it.

Evidence Requirements

When this skill makes claims about existing code, architecture, or behavior,

it MUST cite evidence using one of:

  1. File reference: file:line format (e.g., src/auth.ts:42)
  2. Code pattern reference: file with description (e.g., src/utils/hash.ts —

"existing bcrypt wrapper")

  1. Test/command output: Inline or referenced output from a test run or CLI command
  2. Session evidence: Write to the evidence session section via manage_state

Uncited claims: Technical assertions without citations MUST be prefixed with

[UNVERIFIED]. Example: [UNVERIFIED] The auth middleware supports refresh tokens.

Red Flags

Universal

These apply to ALL skills. If you catch yourself doing any of these, STOP.

reference. Belief is not evidence.

Search the codebase first. The project may already have a convention.

but do not expand scope beyond the stated task.

Domain-Specific

Rationalizations to Reject

Universal

These reasoning patterns sound plausible but lead to bad outcomes. Reject them.

confirm it applies to this codebase.

with a concrete follow-up plan.

Domain-Specific

| Rationalization | Reality |

| ------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |

| "The secret is only in a workflow file, not application code" | A leaked credential in a pipeline is a live secret. DEPLOY-SEC001 is non-waivable — rotate it and remove the literal; deployment.rules cannot downgrade it. |

| "We'll add a rollback path before we actually deploy" | The gate verifies the rollback path exists now. "Later" means an incident finds you with no revert route. Wire rollback config, a rollback workflow/script, or a runbook before this merges. |

| "This repo only has one environment, so the promotion gate does not apply" | Then downgrade DEPLOY-ENV001 explicitly via deployment.rules with a comment — do not disable the whole gate. An unconfigured direct-to-prod path is exactly what DEPLOY-ENV001 exists to catch. |

| "The gate abstained, so we're clear to ship" | Abstention (exit 3) means the gate examined nothing — it is not a pass. Either the repo genuinely does not deploy, or detection missed the config. Confirm which before treating it as green. |

| "Just set enabled: false to get the pipeline green" | Disabling the gate is an explicit opt-out that shows up in config review, not a fix. If one hard rule is wrong for this repo, downgrade that single rule with a rationale; do not blind the whole gate. |

| "The pipeline references ${{ secrets.X }}, so DEPLOY-SEC001 is a false positive" | An env-var _reference_ is not a leak and does not trip the rule — a _hardcoded_ value does. If the gate flagged it, the literal is real; do not suppress it, remove it. |

| "It's just a config change, not a code change" | Config changes cause outages at the same rate as code changes. The gate applies the same rigor and rollback requirement to them. |

| "We tested this in staging" | Staging is not production. Traffic patterns, data volume, and edge cases differ. Staging success does not clear a hard gate finding. |

Escalation

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.