Dockerfile and CI taste — Claude & Claude.ai prompt: build rules
A prompt that lists rules for Dockerfiles and CI: multi-stage builds, non-root user, image scanning. Useful when you ask an AI to write or review a build config.
Open on GitHubWhat Dockerfile and CI taste does
This is a prompt with a checklist for container builds. Each line carries a confidence score. Multi-stage builds ship only runtime artifacts in the final stage. Base images get pinned to a version tag, and to a digest for production. Slim or distroless images are preferred over a full OS, and the container runs as a non-root user. Layer order matters too: dependency manifests are copied and installed before source code.
Secrets never go into the image. Pass them at runtime or use build secrets. CMD is written in exec form so the process receives signals correctly. For package manager caches the prompt suggests BuildKit cache mounts, and a .dockerignore should exclude node_modules, .git and local env files.
The CI section covers scanning images with Trivy and failing on critical vulnerabilities, caching dependencies in GitHub Actions keyed on the lockfile hash, and running lint, type check and tests as separate parallel jobs. Images are tagged with the git SHA, never with latest. No lockfile in the repo means no hash to key the cache on, so that one is worth checking first.
What it helps with
- write a Dockerfile with a multi-stage build and a small final image
- move secrets out of the image into runtime or build secrets
- scan images in CI and fail the build on critical vulnerabilities
- split lint, type check and tests into parallel jobs
- cache dependencies in GitHub Actions keyed on the lockfile hash
Example prompts for the agent
- Write a Dockerfile for this project following the prompt: multi-stage build, non-root user, slim final image.
- Review my GitHub Actions workflow: cache keyed on the lockfile, separate lint and test jobs, tag by git SHA.
- Set up Trivy image scanning and make the build fail on critical vulnerabilities.
How to install Dockerfile and CI taste
How to use
Paste the text at the start of a chat or into project instructions
Manually: put the files in place
.claude/commands/prompts.csv.mdQuestions about Dockerfile and CI taste
How do I install Dockerfile and CI taste in Claude?
There is no install command. Copy the prompt text into a chat or save it as custom instructions so the rules apply to your Dockerfile and CI questions.
What does Dockerfile and CI taste do?
It gives the AI a checklist for container builds and pipelines: multi-stage builds, pinned base images, a non-root user, secrets kept out of the image, scanning and dependency caching.
Does it work with Claude?
Yes, the file lives at .claude/commands/prompts.csv.md. In Claude and Claude.ai you paste it as plain text.
Source text
prompts.csv · CC0-1.0
# Dockerfile and CI taste - Use multi-stage builds and ship only the runtime artifacts in the final stage. Confidence: 0.95 - Pin base images to a specific version tag, and to a digest for production. Confidence: 0.90 - Prefer slim or distroless final images over full OS images. Confidence: 0.85 - Run the container as a non-root user. Confidence: 0.95 - Order layers so dependency manifests are copied and installed before source code. Confidence: 0.95 - Always keep a .dockerignore that excludes node_modules, .git and local env files. Confidence: 0.95 - Add a HEALTHCHECK or an equivalent readiness probe. Confidence: 0.80 - Use BuildKit cache mounts for package manager caches. Confidence: 0.80 - Never bake secrets into images; pass them at runtime or use build secrets. Confidence: 0.95 - Use exec-form CMD so the process receives signals correctly. Confidence: 0.90 - Scan images with Trivy in CI and fail on critical vulnerabilities. Confidence: 0.80 - Cache dependencies in GitHub Actions keyed on the lockfile hash. Confidence: 0.85 - Run lint, type check and tests as separate parallel CI jobs. Confidence: 0.80 - Tag images with the git SHA and never rely on the latest tag for deploys. Confidence: 0.90 - Keep workflows short and move repeated steps into reusable workflows. Confidence: 0.70
© f · CC0-1.0 · f/prompts.chat