refactor-dockerfile

refactor-dockerfile is a skill for Claude Code from natthasath/natthasath-marketplace. It costs 108 tokens per session (1,124 once invoked), scanned A, original, MIT.

A Dockerfile refactoring and generation guide for packaging an application into a Docker container. It covers production-oriented structure, security, image size, and build caching.

In plain words
What is it for?
Use it to create or improve Dockerfiles for applications such as FastAPI services, including dependency installation and production container setup.
Why use it?
It helps avoid oversized or unsafe container images and slow rebuilds when only application code changes.

Skill for Claude Code

Written for Claude Code: disable-model-invocation in frontmatter.

Part of the refactor plugin — 5 skills shipped together

Good fit Use it to create or improve Dockerfiles for applications such as FastAPI services, including dependency installation and production container setup.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/natthasath/natthasath-marketplace/refactor-dockerfile
Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

Any agent
npx skills add natthasath/natthasath-marketplace --skill refactor-dockerfile
Clone the repo
git clone --depth 1 https://github.com/natthasath/natthasath-marketplace

Made for: Claude Code.

Or install refactor, the plugin that ships this one along with the rest of its 5 skills.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for refactor-dockerfile

README.md
[![agentmods](https://agentmods.dev/badge/skills/natthasath/natthasath-marketplace/refactor-dockerfile/github.svg)](https://agentmods.dev/skills/natthasath/natthasath-marketplace/refactor-dockerfile)
Your own site
<a href="https://agentmods.dev/skills/natthasath/natthasath-marketplace/refactor-dockerfile"><img src="https://agentmods.dev/badge/skills/natthasath/natthasath-marketplace/refactor-dockerfile/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for refactor-dockerfile

Your own site · 80×15
<a href="https://agentmods.dev/skills/natthasath/natthasath-marketplace/refactor-dockerfile"><img src="https://agentmods.dev/badge/skills/natthasath/natthasath-marketplace/refactor-dockerfile.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 108 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 1,124 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00108 $0.01124
Opus 5.5 $0.00043 $0.00450
Sonnet 5.5 $0.00022 $0.00225
Haiku 4.5 $0.00011 $0.00112

Measured 15d ago against content hash 056d24fafab8, method: parsed. Prices are Anthropic first-party input rates as of 2026-10-07, from the pricing page.

Security

Grade A, and why

refactor-dockerfile scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 15d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

plugins/refactor/skills/refactor-dockerfile/SKILL.md · 78 lines

How it starts

The opening of the file, as written. The whole thing — 78 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Dockerfile Production-Readiness Refactorer

คุณทำหน้าที่เป็นผู้ช่วย DevOps Engineer สำหรับการสร้างและปรับปรุง Dockerfile โดยเฉพาะ คุณมีหน้าที่ช่วยสร้างไฟล์ Dockerfile สำหรับ {xxx} และปรับปรุงโครงสร้างของ Docker Project ให้เป็นไปตามมาตรฐานการพัฒนาที่ดี ปลอดภัย และเหมาะสมกับการใช้งานจริงใน production environment

Dockerfile ที่มีโครงสร้างดีช่วยให้ build cache ทำงานได้อย่างมีประสิทธิภาพ ลด image size และทำให้ CI/CD pipeline เร็วขึ้น — ซึ่งส่งผลโดยตรงต่อ developer experience ของทั้งทีมทุกครั้งที่ push code

Core Rules (Non-negotiable)

  1. ตอบแบบ Artifact เสมอ เพื่อให้นำไปใช้งานได้ทันที และตอบเป็นภาษาไทย
  2. รวมหลายคำสั่ง RUN ให้อยู่ในบรรทัดเดียวโดยใช้ && เพื่อลดจำนวน layer
  3. ใช้กลยุทธ์การ cache โดยเรียง COPY และ RUN อย่างชาญฉลาด เพื่อลดเวลาในการ build ซ้ำ (ดูลำดับใน Workflow)
  4. หลีกเลี่ยงการติดตั้ง package ที่ไม่จำเป็น และใช้ไฟล์ .dockerignore กันไฟล์ที่ไม่เกี่ยวข้องไม่ให้เข้าไปใน image
  5. Dockerfile ที่สร้างขึ้นต้องอ่านง่าย ดูแลรักษาง่าย และสอดคล้องกับแนวทาง DevOps / CI/CD
  6. ใช้ skill นี้ทันทีเมื่อผู้ใช้ต้องการ containerize app หรือแชร์ Dockerfile ที่ต้องการปรับปรุง แม้จะไม่ได้ขอ refactor โดยตรง

Workflow

โปรดจัดเรียงคำสั่งใน Dockerfile ตามลำดับที่แนะนำดังนี้:

1. FROM

เลือก base image ที่มีขนาดเล็กและปลอดภัย เช่น alpine หรือ distroless หลักการ: base image ที่เล็กลดพื้นที่ attack surface และ pull time

2. LABEL

เพิ่ม metadata เช่น maintainer, version, description

3. ENV

กำหนด environment variables ที่ใช้สำหรับ runtime

4. ARG

กำหนดตัวแปรที่ใช้ในช่วง build-time เช่น APP_VERSION

5. WORKDIR

ตั้งค่า working directory ให้เหมาะสม

6. COPY (เฉพาะไฟล์สำคัญ)

คัดลอกไฟล์ที่จำเป็นเช่น package.json หรือ requirements.txt หลักการ: COPY แค่ dependency manifest ก่อน RUN install ทำให้ cache layer ถูกใช้ซ้ำได้เมื่อ source code เปลี่ยนแต่ dependencies ไม่เปลี่ยน

7. RUN

ติดตั้ง dependencies และล้าง cache เพื่อลดขนาด image

8. COPY (ไฟล์ที่เหลือ)

คัดลอก source code หรือไฟล์โปรเจกต์ทั้งหมด

9. EXPOSE

ระบุพอร์ตที่ container จะเปิดใช้งาน

Read the full file on GitHub · 78 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 15d ago Changed · +17 lines 056d24fafab8
  2. 1mo ago First seen · 61 lines · 108 tokens per session scan A 861737e8c1c8

Subscribe to this mod's changes

refactor-dockerfile is a skill published in the GitHub repository natthasath/natthasath-marketplace (1 stars, last pushed 10d ago), licensed MIT. It adds 108 tokens to every session and 1,124 once invoked, about $0.0004 per session on Opus 5.5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-09-09.

Related

Other skills, from other repositories

companion-clis

Companion CLIs for Runpod workflows — HuggingFace, GitHub, Docker, and AWS.

gaelic-ghost/socket · 26 tokens

dockerized-service-release-deployment-workflow

Create a Dockerized-service release contract with clean GitHub Actions builds, main-anchored tags, immutable digest manifests, published-release deployments, production approval, health checks, and exact-digest rollback.

gaelic-ghost/socket · 49 tokens

linux-development-vm-workflow

Prepare and reset persistent Linux development guests on macOS. Use when comparing container machine, Lima or Colima, and full VMs for distros, init systems, services, custom boot, disks, Rosetta, or nested virtualization.

gaelic-ghost/socket · 54 tokens

select-analysis-isolation

Select isolation before inspecting or executing untrusted content. Use for local analysis, a container, Linux or macOS VM, remote sandbox, or spare device with defined network, mounts, credentials, snapshots, evidence export, and teardown.

gaelic-ghost/socket · 51 tokens

devops-engineer

Act as a DevOps Engineer to design CI/CD pipelines, manage infrastructure as code, configure monitoring and alerting, implement containerization, and automate deployment workflows. Use when users need help with CI/CD pipeline design (GitHub Actions, GitLab CI, Jenkins), infrastructure as code (Terraform, Pulumi…

CrashBytes/claude-role-skills · 150 tokens

deploy-planner

Deployment and DevOps agent that generates Dockerfiles, CI/CD configs, and step-by-step deployment guides for free hosting platforms. Triggers on: deploy, launch, hosting, Docker, CI/CD, production, go live, ship it.

batterfried-philosophy172/Agent-Startup-Skills · 52 tokens