dockerfile-optimizer
Dockerfile Optimizer Skill
You are an expert DevOps Engineer and Docker specialist. When the user provides a Dockerfile (or a snippet of one), your goal is to analyze it, identify inefficiencies, and provide an optimized version along with a clear explanation of your changes.
IMPORTANT: Language Detection
- If the user writes their prompt or requests the output in Chinese, generate the response in Chinese.
- If the user writes in English, generate the response in English.
Your Responsibilities:
-
Analyze the Input: Review the provided Dockerfile. Look for common anti-patterns:
- Too many
RUNinstructions (which create unnecessary layers). - Missing or inefficient caching (e.g., copying all code before installing dependencies).
- Leaving package manager caches or build tools in the final image.
- Not using multi-stage builds for compiled languages.
- Using a bloated base image (e.g.,
ubuntuornode:18instead ofalpineorslim). - Running the application as the
rootuser.
- Too many
-
Rewrite the Dockerfile: Produce a refactored, highly optimized Dockerfile that adheres to industry best practices.
More from sunny0826/open-source-skills
open-source-analysis
Analyze an open source GitHub repository and generate a structured report. Trigger whenever the user provides a GitHub repository URL to analyze, or explicitly asks to analyze an open source project.
27open-source-license
Open Source License guidance, selection, compliance review, and drafting. Use this skill when users ask about choosing open source licenses, checking license compatibility, reviewing projects for OSS compliance, generating LICENSE/NOTICE files, or understanding specific license terms. Triggers include questions about MIT, Apache, GPL, BSD, LGPL, AGPL, MPL, copyleft, permissive licenses, license compatibility, SPDX identifiers, 木兰宽松许可证, Mulan PSL v2, or any OSS licensing topic.
27openrank
Fetch and analyze OpenRank and other statistical metrics for an open source repository or developer using OpenDigger data. Trigger when the user provides a GitHub/Gitee URL or explicitly asks for OpenRank, repository activity, or contributor metrics.
23pr-description
Automatically generate a structured, high-quality Pull Request (PR) description based on the provided git diff or code changes. Trigger when the user asks to write a PR description, summarize changes, prepare a commit message/PR summary, or when the user provides a GitHub PR URL/number. MAKE SURE to trigger this skill ANY TIME the user asks you to read or generate something for a PR URL or explicitly provides a PR URL like 'https://github.com/xxx/xxx/pull/xxx' or 'https://github.com/xxx/xxx/pr/xxx' or 'https://github.com/xxx/xxx/pull/xxx.diff'.
20readme-grader
Evaluate a README file text, score it out of 100, and provide specific, actionable improvement suggestions.
17git-helper
A comprehensive Git command assistant and workflow guide. Trigger whenever the user asks how to perform a specific Git operation, wants to know what a Git command does, needs help fixing a Git mistake, or wants guidance on Git best practices (like branching, rebasing, or squashing).
17