Skills DirectorySkills Directory
SkillsLearnSecurityCategoriesDocsCommunityBlog
Sign InSubmit Skill
Skills Directory

Security-tested agent skills for Claude, coding agents, and AI workflows.

Directory

  • Browse Skills
  • All Skills A–Z
  • Claude Skills
  • Claude Code Skills
  • Agent Skills
  • Categories
  • Authors
  • Submit a Skill

Learn

  • Learn Hub
  • Install Claude Skills
  • Write SKILL.md
  • Skills vs MCP
  • Directories Compared

Security

  • Security
  • Methodology
  • Secure Claude Skills
  • Security Badges

Company

  • About
  • Community
  • Blog
  • API Docs
  • Advertise

2026 Skills Directory. All rights reserved.

ProTermsPrivacyRefunds
Back to skills

Dockerfile Patterns

ASecurity

Dockerfile + container discipline — multi-stage builds (build → runtime); pinned base image with tag + sha256 digest; non-root USER mandatory; COPY over ADD (except verified tarball); chained apt-get install + cache cleanup in same RUN layer; explicit WORKDIR; exec-form CMD/ENTRYPOINT; layer ordering least-frequent → most-frequent change; EXPOSE documentary; HEALTHCHECK for long-running services; OCI labels (org.opencontainers.image.*); .dockerignore mandatory; Hadolint at strict ruleset; Bui...

12 stars
0 votes
0 copies
0 views
Added 9/28/2026
ai-agentspythonrustgojavanodedockertestingsecuritydocumentation

Security Analysis

A100/100

Scanned 9/28/2026

Install to Claude Code

$npx -y skills add Nmor/the-claude-council --skill dockerfile-patterns --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Dockerfile Patterns?

Add the live security badge to your README — it updates automatically with every re-scan.

Security grade badge for Dockerfile Patterns
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/nmor-dockerfile-patterns/badge)](https://www.skillsdirectory.com/skills/nmor-dockerfile-patterns)

More formats (shields.io, HTML) on the badges page.

Files
SKILL.md
---
name: dockerfile-patterns
description: Dockerfile + container discipline — multi-stage builds (build → runtime); pinned base image with tag + sha256 digest; non-root USER mandatory; COPY over ADD (except verified tarball); chained apt-get install + cache cleanup in same RUN layer; explicit WORKDIR; exec-form CMD/ENTRYPOINT; layer ordering least-frequent → most-frequent change; EXPOSE documentary; HEALTHCHECK for long-running services; OCI labels (org.opencontainers.image.*); .dockerignore mandatory; Hadolint at strict ruleset; BuildKit secret mounts (--mount=type=secret) never ENV/ARG for secrets. Auto-fires on Dockerfile + Compose files.
paths:
  - "**/Dockerfile"
  - "**/Dockerfile.*"
  - "**/*.dockerfile"
  - "**/Containerfile"
  - "**/containerfile"
  - "**/docker-compose*.yml"
  - "**/docker-compose*.yaml"
  - "**/compose*.yml"
  - "**/compose*.yaml"
  - ".dockerignore"
  - "**/.dockerignore"
---

# dockerfile-patterns

> **Size budget: 25 KB.** Check: wc -c. Gate: node ~/.claude/scripts/token-budget.mjs --check
>
> Migrated 2026-06-02 from `~/.claude/rules-library/dockerfile/` as part of the lazy-rules-loading
> plan. Phase H will delete the source files.
>
> Converted to progressive disclosure 2026-09-21: this file is a routing table; every
> word of the detail lives under `references/`, unchanged. This skill is `paths:`-gated,
> so its full weight was added to the always-on Floor on any Dockerfile or Compose edit.

## Purpose

Dockerfile + container discipline: how an image is authored, how that authoring is
enforced mechanically, which build patterns to reach for, how the image is hardened,
and how it is tested. Read the routing table, then open ONLY the reference file the
task needs — opening all five costs what the un-split file cost.

## Standards Cited

The container standards the references apply; detail and mappings live in them.

- **CIS Docker Benchmark 1.7**: host and image hardening controls (`references/security.md`)
- **NIST SP 800-190**: Application Container Security Guide (`references/security.md`)
- **OWASP Docker Top 10**: the container risk catalogue the security review maps to
- **SLSA Framework v1.0**: Build L3 provenance and reproducible builds (`references/patterns.md`)
- **OCI Distribution Spec 1.1** and the `org.opencontainers.image.*` annotations
- **FIPS 140-2 / 140-3**: validated cryptography for regulated base images

## Routing table

| Topic | Read | What is in it |
| --- | --- | --- |
| **Coding style** | [`references/coding-style.md`](references/coding-style.md) | The 15 mandatory authoring rules: multi-stage by default · pin base image to tag + `@sha256:` digest · non-root `USER` · `COPY` over `ADD` · chained install + cache cleanup in one `RUN` · explicit `WORKDIR` · exec-form `CMD`/`ENTRYPOINT` · layer ordering · `EXPOSE` documentary · `HEALTHCHECK` · OCI labels · `.dockerignore` · line length + formatting · `ENV` vs `ARG` · reproducibility. Plus the mandatory header, the Hadolint rule mapping table, standards cited, and why the rule exists. |
| **Hooks + enforcement pipeline** | [`references/hooks.md`](references/hooks.md) | The 6-layer pipeline and its scripts: pre-commit gate (layer 2) · pre-push build + structural test (layer 3) · CI workflow (layer 4) · deploy-time gate (layer 5) · runtime admission (layer 6). Plus `.hadolint.yaml` configuration and the developer-machine tooling install. |
| **Build patterns** | [`references/patterns.md`](references/patterns.md) | Patterns 1-14: minimal-runtime multi-stage · distroless/minimal base · BuildKit cache mounts · BuildKit secret mounts · SBOM + provenance attestation · heredoc `RUN` · build-time vs runtime config · one process per container · PID-1 signal forwarding · static binary on `scratch` · multi-platform (amd64 + arm64) · composable bases as stage-libraries · dependency-reflecting health endpoints · init-container / migration. Plus the 7 anti-patterns and the reuse-first sweep. |
| **Security** | [`references/security.md`](references/security.md) | Threat model · OWASP Docker Top 10 mapping · the 15 mandatory security rules (non-root, digest pinning, no secrets in image, CVE scanning, SBOM, Cosign signing, distroless, read-only rootfs, dropped capabilities, no `--privileged`, vulnerable defaults, egress documentation, layer minimisation, compromised-image detection, registry hardening) · per-stack hardening for Node.js, Python, Go, Rust, Java · Hadolint security rules. |
| **Testing** | [`references/testing.md`](references/testing.md) | The 5 test layers: image structure (container-structure-test, Goss) · smoke tests · Testcontainers integration · vulnerability + supply-chain scanning (Trivy, Dockle, Dive, Cosign verify) · compliance scans (CIS Docker, Pod Security Standards, FIPS). Plus CI gate composition, the 10 hard rules, and the tool table. |

### Fast routing by intent

| You are... | Start at |
| --- | --- |
| Writing or reviewing a `Dockerfile` | `coding-style.md`, then `patterns.md` for the build shape |
| Wiring the gates that enforce it | `hooks.md` |
| Hardening an image, or answering an audit finding | `security.md` |
| Adding tests, or a CI job failed | `testing.md` |
| Cutting image size or build time | `patterns.md` (cache mounts, distroless, scratch), then `testing.md` (Dive wasted-space rule) |
| Handling a secret at build time | `patterns.md` Pattern 4 + `security.md` rule 3 — never `ENV`/`ARG` |

## Cross-references

Each reference file carries its own `Standards cited`, `Cross-references`, `Why this
rule exists` and `Learning hooks` sections — they were not merged here, so the citation
travels with the guidance it supports.

Attribution

NmorNmor
View sourceMore from Nmor →
SSkills DirectorySkills Directory

Ship a skill? Prove it's safe.

Free 120-pattern security scan, letter grade, and an embeddable README badge.

Submit a skill

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

Comments (0)

No comments yet. Be the first to comment!

SSkills DirectorySkills Directory

Ship a skill? Prove it's safe.

Free 120-pattern security scan, letter grade, and an embeddable README badge.

Submit a skill

Related Skills

Caveman

Ultra-compressed communication mode that cuts output tokens while keeping technical accuracy. Levels: lite, full, ultra and the wenyan variants. Use for /caveman, "caveman mode", "talk like caveman", "be brief" or "less tokens".

1074701 votes

Hyperplan

Adversarial multi-agent planning skill. Self-orchestrates 5 hostile category members (unspecified-low, unspecified-high, deep, ultrabrain, artistry) via team-mode for ruthless cross-critique debate, distills only the defensible insights, then MANDATORILY hands the distilled insight bundle to the `plan` agent for executable plan formalization. Use when planning needs maximum rigor and surfacing of weak assumptions, blind spots, and over-engineering. Triggers: 'hyperplan', 'hpp', '/hyperplan', ...

695601 votes

Mcp Code Execution

Routes multi-tool workflows through MCP servers for large datasets and pipelines. Use when Bash tool overhead is limiting throughput on data-heavy tasks.

3351 votes

catchup

Recovers the conversation and failed tool calls of a previous Codex, Claude Code, Antigravity, Cline, Copilot CLI, Cursor, DeepSeek Harness, Kimi, OpenCode, Pi Agent, or ZCode session. Use when the user says "catch up", "what did the last session do", "get me up to speed", "I switched agents", asks to recover/summarize a previous session before continuing, or asks to diagnose or report a catchup failure. Do NOT use for the current conversation, git history, or any non-agent log.

691 votes

math-skill

A comprehensive mathematical reasoning skill for AI assistants — handles arithmetic to research-level problems with rigorous step-by-step reasoning, systematic verification, and transparent uncertainty handling

381 votes
View all in ai-agents →