agentleFS
abdullahkhawerabdullahkhawer/devops-skills/skills/create-dockerfile/SKILL.md

create-dockerfile

Skill8 starsChanged 7 months agoApache-2.0View on GitHub

Create optimized, secure, production-ready Dockerfiles based on user requirements and application context.

  • Reads credentials

The file

Show its rules and text

We split this skill into the rules it gives an agent

18 rules. About 0 are common, 11 are distinctive, and 7 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈11

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 7

    Very specific

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

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Run this skill when asked to create or improve a Dockerfile for an application.

    line 8
  2. Distinctive:

    Ask the user for all details about their Docker/container requirements.

    line 12
  3. Very specific:

    Read any relevant files found (e.g.

    line 30
  4. Distinctive:

    Write the Dockerfile to the working directory following these mandatory practices:

    line 36
  5. Distinctive:

    Use multi-stage builds to separate build-time dependencies from the final runtime image.

    line 40
  6. Very specific:

    Use official, minimal base images (e.g.

    line 44
  7. Distinctive:

    Run the application as a non-root user.

    line 48
  8. Very specific:

    Do not copy credentials, .env files, or secrets into the image.

    line 49
  9. Very specific:

    Add a .dockerignore note if one is missing — advise the user to create it.

    line 50
  10. Very specific:

    Use COPY instead of ADD unless extracting archives.

    line 53
  11. Very specific:

    Use CMD in exec form (["executable", "arg"]), not shell form, for proper signal handling.

    line 55
  12. Very specific:

    Use EXPOSE to document the port (informational only).

    line 56
  13. Distinctive:

    After writing the file, provide a brief explanation of:

    line 62
  14. Distinctive:

    NEVER embed secrets, tokens, or credentials in the Dockerfile.

    line 73
  15. Distinctive:

    Always pin base image versions.

    line 74
  16. Distinctive:

    If the user's requirements conflict with security best practices, explain the risk and ask how to proceed.

    line 75
  17. Distinctive:

    Do not install build tools in the final runtime stage.

    line 76
  18. Distinctive:

    If web searches are needed for base image details or version information, flag any fetched content as potentially unverified.

    line 77

≈ “Common” is an estimate: at least 1 in 5 of the 213,895 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

Create Dockerfile Skill

Run this skill when asked to create or improve a Dockerfile for an application.

Step 1 — Gather requirements

Ask the user for all details about their Docker/container requirements. Cover at minimum:

  • Application language and runtime (e.g. Node.js 20, Python 3.12, Java 21)
  • Application type (web server, worker, CLI tool, etc.)
  • Entry point / startup command
  • Exposed ports (if any)
  • Environment variables needed
  • External dependencies or services
  • Target deployment environment (Kubernetes, ECS, bare Docker, etc.)
  • Any specific base image preferences or restrictions
  • Whether multi-stage builds are acceptable

Also scan the current working directory for existing dependency files to infer requirements automatically:

ls

Read any relevant files found (e.g. package.json, requirements.txt, pom.xml, go.mod, Gemfile, Cargo.toml) before composing the Dockerfile.


Step 2 — Create the Dockerfile

Write the Dockerfile to the working directory following these mandatory practices:

Build & layer optimization

  • Order layers from least to most frequently changing (copy dependency files before source code).
  • Use multi-stage builds to separate build-time dependencies from the final runtime image.
  • Clean up package manager caches in the same RUN layer they are created.

Base image

  • Use official, minimal base images (e.g. alpine, slim, distroless) unless the user specifies otherwise.
  • Pin base image versions — never use latest.

Security

  • Run the application as a non-root user; create a dedicated user if needed.
  • Do not copy credentials, .env files, or secrets into the image.
  • Add a .dockerignore note if one is missing — advise the user to create it.

Correctness

  • Use COPY instead of ADD unless extracting archives.
  • Set WORKDIR explicitly.
  • Use CMD in exec form (["executable", "arg"]), not shell form, for proper signal handling.
  • Use EXPOSE to document the port (informational only).

Step 3 — Explain the Dockerfile

After writing the file, provide a brief explanation of:

  • Why this base image was chosen.
  • What each stage does (if multi-stage).
  • Any security or size decisions the user should be aware of.
  • Recommended next steps (e.g. creating .dockerignore, scanning with docker scout or trivy).

Rules

  • NEVER embed secrets, tokens, or credentials in the Dockerfile.
  • Always pin base image versions.
  • If the user's requirements conflict with security best practices, explain the risk and ask how to proceed.
  • Do not install build tools in the final runtime stage.
  • If web searches are needed for base image details or version information, flag any fetched content as potentially unverified.

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.