Dockerfile optimise

From pproenca/dot-skills · View interactive version

Dockerfile optimise is an AI agent skill from the GitHub repository pproenca/dot-skills. Dockerfile optimization guidelines from official Docker documentation. This skill should be used when writing, reviewing, or refactoring Dockerfiles to ensure optimal build time, image size, security, and robustness. Triggers on tasks involving Dockerfile creation, Docker image builds, container opt

How to use this skill

Skill file

Dockerfile Optimization Best Practices

Comprehensive Dockerfile optimization guide sourced exclusively from official Docker documentation. Contains 48 rules across 8 categories, prioritized by impact to guide automated refactoring and code generation.

When to Apply

Reference these guidelines when:

Rule Categories by Priority

| Priority | Category | Impact | Prefix |

|----------|----------|--------|--------|

| 1 | Layer Caching & Ordering | CRITICAL | cache- |

| 2 | Multi-Stage Builds | CRITICAL | stage- |

| 3 | Base Image Selection | HIGH | base- |

| 4 | Build Context Management | HIGH | ctx- |

| 5 | Security & Secrets | HIGH | sec- |

| 6 | Dependency Management | MEDIUM-HIGH | dep- |

| 7 | Instruction Patterns | MEDIUM | inst- |

| 8 | Quality & Validation | MEDIUM | lint- |

Quick Reference

1. Layer Caching & Ordering (CRITICAL)

2. Multi-Stage Builds (CRITICAL)

3. Base Image Selection (HIGH)

4. Build Context Management (HIGH)

5. Security & Secrets (HIGH)

6. Dependency Management (MEDIUM-HIGH)

7. Instruction Patterns (MEDIUM)

8. Quality & Validation (MEDIUM)

How to Use

Read individual reference files for detailed explanations and code examples:

Reference Files

| File | Description |

|------|-------------|

| references/_sections.md | Category definitions and ordering |

| assets/templates/_template.md | Template for new rules |

| metadata.json | Version and reference information |

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.