Skip to content
Back to skills

Deploy Readiness

ASecurity

Make a service start, run and stop safely wherever it is deployed, with the least code. Covers config read and checked at startup, secrets kept out of code, images and logs, health and readiness checks, graceful shutdown on SIGTERM, and a container that runs as it should. Use whenever a change adds or reads a config value or secret, adds a server, worker or scheduled job, touches startup or shutdown, a Dockerfile, a deploy manifest or CI deploy step, or when a deploy failed, hung or dropped r...

  • 2 stars
  • 0 votes
  • 0 copies
  • 1 view
  • Added December 3, 2026
devopstypescriptpythongoshellnodespringdockerkubernetesgitdatabase

Security analysis

A96/100
  • mediumInstalls packages at runtime which could introduce malicious dependencies

Pro shows the line behind each finding and how to fix it

Scanned December 3, 2026

npx -y skills add restierecon/tbv --skill deploy-readiness --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Deploy Readiness?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Deploy Readiness
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/restierecon-deploy-readiness/badge)](https://www.skillsdirectory.com/skills/restierecon-deploy-readiness)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
name: deploy-readiness
description: Make a service start, run and stop safely wherever it is deployed, with the least code. Covers config read and checked at startup, secrets kept out of code, images and logs, health and readiness checks, graceful shutdown on SIGTERM, and a container that runs as it should. Use whenever a change adds or reads a config value or secret, adds a server, worker or scheduled job, touches startup or shutdown, a Dockerfile, a deploy manifest or CI deploy step, or when a deploy failed, hung or dropped requests.
---

# Deploy Readiness

A service has to start with the right config, tell the platform when it can take
traffic, and stop without dropping work. Most of that is already done by the
platform, the server and the project. Add only what is missing, the way the project
already does it. Nothing more, nothing less.

## 1. Find how it runs
Before changing anything, find what runs this code in production: `Dockerfile`,
`docker-compose.yml`, `Procfile`, Kubernetes manifests or a Helm chart, `fly.toml`,
`app.yaml`, `serverless.yml`, a systemd unit, `.github/workflows/*deploy*`. Write one
line: `<platform> runs <command>, probes <paths or none>, sends <signal> with <N> s grace`.
Kubernetes sends SIGTERM and waits 30 s by default; most platforms do the same.

No platform files? Don't invent one. Build only the config and shutdown parts below,
and name the missing deploy setup in your report.

## 2. Read config once, at startup, and fail fast
- Read every setting from the environment in the one place the project already does
  it (`settings.py`, `config.ts`, `appsettings`). No second config file or library.
- Check every required value when the process starts, not when the first request
  needs it. A missing value stops startup with an error that names the variable,
  never its value.
- Defaults only for values that are safe everywhere (a port, a page size). A secret,
  a database URL or a third-party endpoint has no default.
- Parse once: a number is an `int`, a flag is a `bool`, a list is split, at startup.
- Add each new variable to the project's example file (`.env.example`, README table)
  with a placeholder, never a real value.

```python
import os

REQUIRED = ("DATABASE_URL", "PAYMENTS_KEY")


def load_config(environ=os.environ):
    missing = [name for name in REQUIRED if not environ.get(name)]
    if missing:
        raise SystemExit(f"missing environment variables: {', '.join(missing)}")
    return {
        "database_url": environ["DATABASE_URL"],
        "payments_key": environ["PAYMENTS_KEY"],
        "port": int(environ.get("PORT", "8000")),
    }
```

## 3. Keep secrets out of code, images and logs
Secrets come from the environment or the platform's secret store, at runtime. Never
in source, test fixtures, a `Dockerfile` `ENV` or `ARG`, a committed `.env`, a CI log
or an error message. `.env` stays in `.gitignore` and `.dockerignore`. A test uses an
obvious fake (`"test-key"`), never a copied real one.

## 4. Tell the platform when it can send traffic
Add checks only if the platform or load balancer calls them (step 1), at the paths it
already uses:

| Check | Answers | Checks dependencies? |
|---|---|---|
| Liveness (`/healthz`) | is the process stuck? Failing it restarts the process | no: a slow database must not restart every replica |
| Readiness (`/readyz`) | can it serve right now? Failing it stops traffic, no restart | only what it can't serve without, with a timeout under 1 s; 503 while shutting down |

Both return fast and reveal nothing: a status code and `ok`, no versions, hostnames
or error text.

## 5. Stop without dropping work
On SIGTERM: stop taking new work, finish what is in flight, close pools and
connections, exit 0, all inside the platform's grace period.
- First, use what the server already does: gunicorn, uvicorn, Spring Boot
  (`server.shutdown=graceful`), ASP.NET Core and Go's `http.Server.Shutdown` drain on
  their own. Set their timeout a few seconds under the grace period instead of writing
  a handler.
- A worker finishes its current job or hands it back to the queue, then exits; it
  never takes a new one after SIGTERM.
- In a container, start the process in exec form (`CMD ["node", "server.js"]`). The
  shell form runs `/bin/sh` as the main process, which doesn't pass SIGTERM on, so
  the app is killed at the end of the grace period instead of draining.

```typescript
import http from "node:http";

let shuttingDown = false;

const server = http.createServer(async (request, response) => {
  if (request.url === "/healthz") return void response.writeHead(200).end("ok");
  if (request.url === "/readyz") return void response.writeHead(shuttingDown ? 503 : 200).end();
  await app(request, response);
});

server.listen(Number(process.env.PORT ?? 8080));

process.on("SIGTERM", () => {
  shuttingDown = true;
  server.close(async () => {
    await pool.end();
    process.exit(0);
  });
  setTimeout(() => process.exit(1), 20_000).unref();
});
```

## 6. Keep the container plain
Only if the project ships one. Change the existing `Dockerfile`; don't add a second.
- a pinned base image tag (`python:3.12-slim`, not `python:latest`)
- dependencies installed from the lockfile, in a layer before the source is copied
- a non-root `USER`
- `.dockerignore` excludes `.git`, `.env` and local build output
- one process, logs to stdout, exec-form `CMD`
- migrations run as a separate release step, not at the start of every replica

```dockerfile
FROM python:3.12-slim
WORKDIR /app
COPY requirements.txt .
RUN pip install --no-cache-dir -r requirements.txt
COPY app ./app
USER nobody
CMD ["gunicorn", "--graceful-timeout", "20", "--bind", "0.0.0.0:8000", "app.main:app"]
```

## 7. Prove it with a test
- A missing required variable stops startup with its name in the error:

```python
def test_startup_names_the_missing_variable():
    with pytest.raises(SystemExit, match="PAYMENTS_KEY"):
        load_config({"DATABASE_URL": "postgres://test"})
```

- Each health or readiness path the change adds gets one test of its status codes,
  including 503 while shutting down.
- A shutdown handler you wrote gets one test that starts the process, sends SIGTERM
  during a request, and checks the request finished and the exit code is 0. Skip it
  when the server's own drain is used: test that its timeout setting is passed instead.

## 8. Keep it readable
Config in one function or module, read top to bottom. No comments: variable names say
what they hold. No config classes, loaders or schema libraries of your own unless the
project already uses them.

## In a TBV project
A slice that adds a config value carries a criterion like "startup fails with an error
naming `PAYMENTS_KEY` when it is unset" (slice-planning skill). Build exactly that.
Deploy gaps you notice elsewhere (no probes, shell-form `CMD`, root user) go under
FLAG CANDIDATES, not into the diff. Platform changes a human must make (secret store,
grace period, probe settings) go in your report, never guessed.

## Never
- A default value for a secret or a production endpoint.
- A secret in code, an image, a fixture, a log line or an error body.
- A liveness check that calls the database or another service.
- A shutdown that drops in-flight requests, or a second drain handler on top of the
  server's own.
- Migrations run by every replica at startup.
- A new deploy platform, config library or container added to make one change ready.
- Comments explaining config or shutdown code.

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

View all in devops →

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.