agentleFS
AaqibhafeezkhanAaqibhafeezkhan/skillself/skills/dockerfile-audit/SKILL.md

dockerfile-audit

Skill0 starsChanged 4 days agoMITView on GitHub

The skill audits Dockerfiles for base-image pinning, non-root execution, package-layer hygiene, copy order, ADD misuse, health checks and secret-bearing build arguments; use it to harden a container image before release.

  • Installs packages

The file

We split this skill into the rules it gives an agent

7 rules. About 0 are common, 4 are distinctive, and 3 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈4

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 3

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Use this skill when asked to audit, lint, harden, or review a Dockerfile or container build file for security and reproducibility.

    line 13
  2. Distinctive:

    Read the complete Dockerfile and preserve its original line numbering.

    line 24
  3. Very specific:

    Check for a non-root USER instruction and flag its absence.

    line 26
  4. Very specific:

    Run python3 skills/dockerfile-audit/scripts/lint_dockerfile.py Dockerfile and capture its exact stdout and exit code.

    line 31
  5. Distinctive:

    Do not infer that a base tag is immutable.

    line 49
  6. Distinctive:

    Do not expose secret values in findings.

    line 50
  7. Very specific:

    Do not treat a build-stage USER as proof that the final image is non-root.

    line 51

≈ “Common” is an estimate: at least 1 in 5 of the 408,460 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

Purpose

Find concrete Dockerfile risks and report each finding with a deterministic rule identifier.

When to use

Use this skill when asked to audit, lint, harden, or review a Dockerfile or container build file for security and reproducibility.

Inputs needed

  • The complete Dockerfile content or a readable file path.
  • The intended runtime user only when a specific non-root account name is required.

Step-by-step procedure

  1. Read the complete Dockerfile and preserve its original line numbering.
  2. Identify every FROM instruction and flag an omitted tag, latest, or a mutable unpinned tag.
  3. Check for a non-root USER instruction and flag its absence.
  4. Inspect each apt-get install layer for --no-install-recommends and removal of /var/lib/apt/lists/* in that same layer.
  5. Compare broad COPY . or COPY ./ instructions with dependency-manifest copies and flag context copies that occur first.
  6. Flag ADD when it is used for local files rather than archive extraction or a remote source with a documented reason.
  7. Flag a missing HEALTHCHECK and secret-like values supplied through ENV or ARG.
  8. Run python3 skills/dockerfile-audit/scripts/lint_dockerfile.py Dockerfile and capture its exact stdout and exit code.

Exact output format

Return one row per finding as line:rule:message, sorted by ascending line number and then rule identifier. Do not add prose. A clean file produces No findings. and exit code zero.

Edge cases

  • A multi-stage Dockerfile needs a non-root runtime user in the final stage; a build-stage user does not satisfy the check.
  • A pinned digest is accepted even if the tag is descriptive.
  • Shell-form RUN commands are examined only for the specified package-manager rules.
  • A HEALTHCHECK NONE is still an explicit health-check disablement and must be reported for a service image.

Do not

  • Do not infer that a base tag is immutable.
  • Do not expose secret values in findings.
  • Do not treat a build-stage USER as proof that the final image is non-root.

Worked example summary

A multi-stage Node image copies the build context before package.json, uses an unpinned base tag, installs apt packages without cleanup, and omits a runtime user and health check. The linter emits one deterministic finding for each applicable rule.

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.