home / skills / ehtbanton / claudeskillsrepo / dockerignore-generator

dockerignore-generator skill

/dockerignore-generator

This skill generates a complete .dockerignore file tailored to your project type, excluding unnecessary files to optimize Docker builds.

npx playbooks add skill ehtbanton/claudeskillsrepo --skill dockerignore-generator

Review the files below or copy the command above to add this skill to your agents.

Files (2)
SKILL.md
736 B
---
name: dockerignore-generator
description: Generate .dockerignore files to exclude unnecessary files from Docker builds. Triggers on "create dockerignore", "generate docker ignore", "dockerignore for", "docker exclude files".
---

# Dockerignore Generator

Generate .dockerignore files to optimize Docker builds by excluding unnecessary files.

## Output Requirements

**File Output:** `.dockerignore`
**Format:** Docker ignore file syntax
**Standards:** Docker best practices

## When Invoked

Immediately generate a complete .dockerignore file appropriate for the project type.

## Example Invocations

**Prompt:** "Create dockerignore for Node.js project"
**Output:** Complete `.dockerignore` excluding node_modules, tests, docs.

Overview

This skill generates tailored .dockerignore files to speed up and shrink Docker builds by excluding unnecessary files and folders. It detects common project types and outputs a complete, standards-compliant .dockerignore ready to paste into the project root. The goal is practical, minimal ignore lists following Docker best practices to reduce image context size and build time.

How this skill works

On trigger phrases like "create dockerignore" or "dockerignore for <project>", the skill identifies the project type (Node.js, Python, Go, Java, etc.) from the prompt or provided files. It then creates a sensible .dockerignore using Docker ignore file syntax, excluding typical high-volume and transient paths (dependencies, build artifacts, editor files, tests) while preserving required sources. The output is a single .dockerignore file text formatted for immediate use.

When to use it

  • Adding Docker support to an existing repository
  • Optimizing build context to reduce Docker image size and build time
  • Preparing a CI/CD pipeline where transfer size matters
  • Creating images for microservices or single-function containers
  • Excluding sensitive or local config files from image context

Best practices

  • Exclude dependency folders (e.g., node_modules, .venv) to avoid copying large sets into the build context
  • Ignore build artifacts and output directories (dist, build, target) to keep context clean
  • Add editor and OS files (.vscode, .DS_Store, Thumbs.db) to avoid leaking local clutter
  • Keep required source files and Dockerfile-adjacent assets included; only ignore items not needed during build
  • Customize ignores per language/framework; the skill provides sensible defaults but review before committing

Example use cases

  • Create dockerignore for Node.js project — excludes node_modules, test folders, docs, local env files
  • Generate dockerignore for Python project — excludes .venv, __pycache__, .pytest_cache, build outputs
  • Dockerignore for Go — excludes vendor, bin, build artifacts and editor files
  • Generate dockerignore for Java/Maven — excludes target, .classpath, .project and IDE metadata
  • Create minimal dockerignore for small utility where only src and Dockerfile are included

FAQ

Will the generated .dockerignore remove files needed at runtime?

No. The skill aims to exclude build-time and development artifacts only. It keeps source files and assets normally required by your Dockerfile, but always review before use.

Can I request a custom list of excludes?

Yes. Provide the project type or specific paths to exclude and the skill will incorporate those into the generated .dockerignore.