Skip to content
Back to skills

Dockerfile

ASecurity

Generate an optimized Dockerfile — multi-stage build, security hardening, small image size.

  • 8 stars
  • 0 votes
  • 0 copies
  • 1 view
  • Added September 6, 2026
ai-agentspythongoangularnodefastapidockergitapifullstacksecurity

Works with

  • api

Security analysis

A100/100

Scanned September 6, 2026

npx -y skills add KhaiTrang1995/agentic-awesome-kits --skill dockerfile --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Dockerfile?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Dockerfile
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/khaitrang1995-dockerfile/badge)](https://www.skillsdirectory.com/skills/khaitrang1995-dockerfile)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
name: dockerfile
description: Generate an optimized Dockerfile — multi-stage build, security hardening, small image size.
user-invocable: true
argument-hint: "<stack> [--prod] [--dev]"
---

# /dockerfile — Generate a Dockerfile

## Input examples
```
/dockerfile .NET 10 Minimal API --prod
/dockerfile Angular 20 nginx --prod
/dockerfile Python FastAPI
/dockerfile Go service --prod
/dockerfile --dev fullstack .NET + Angular (docker-compose dev)
```

## Process
1. Detect the stack → pick the right base image
2. Multi-stage build: build stage → runtime stage
3. Security hardening
4. L1 approval → Write

## Mandatory rules
- **Multi-stage build** — separate build and runtime
- **Non-root user** — NEVER run the container as root
- **Specific tag** — `mcr.microsoft.com/dotnet/aspnet:10.0-alpine`, NEVER `latest`
- **COPY before RUN** — leverage layer caching (copy csproj/package.json first, restore, then copy source)
- **.dockerignore** — exclude bin/, obj/, node_modules/, .git/
- **HEALTHCHECK** — mandatory for production
- **NEVER hardcode** secrets/connection strings — use env vars
- **Alpine-based** whenever possible (small image size)

## Output
```
Dockerfile
.dockerignore
```

## References
- @.claude/rules/docker-conventions.md

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.