Generate Docker Compose and Dockerfile configurations for local development through interactive Q&A...
Follow the user's request and applicable repository instructions over these defaults. Use existing authorization; ask only about missing decisions that materially affect scope, cost, safety, or the result. Continue independent authorized work while awaiting an answer.
Run in the main conversation by default. Delegation can increase usage: obtain explicit approval for the proposed agent count and scope before using subagents. Reuse that approval within its bounds; ask again before expanding the approved count or scope.
name: and role-based service names. Do not set container_name by default because it prevents service scaling and creates cross-project collisions.latest tags in generated files.127.0.0.1 by default; keep databases, caches, SMTP, PHP-FPM, and internal APIs unexposed when possible.Run project commands from the target project directory. Resolve bundled helpers through <skill-directory>/scripts/; their location is separate from the project working directory. Check Docker and Compose capabilities before selecting syntax:
docker version
docker compose version
Inspect, when present:
compose.yaml, compose.yml, docker-compose*.yml, and override filesDockerfile*, .dockerignore, .devcontainer/, Makefiles, and package scriptsUse stack detection when it adds useful evidence; direct inspection is enough for a known, narrow repair. Resolve the script from this skill directory:
"<skill-directory>/scripts/detect-stack.sh" "<project-root>"
The script emits JSON on stdout and diagnostics on stderr. Confirm uncertain findings from source files without printing secret values.
When Docker is available, optionally inspect local images and networks:
"<skill-directory>/scripts/detect-images.sh"
"<skill-directory>/scripts/detect-network.sh"
Do not let cached images or a detected network override project compatibility or isolation requirements.
Infer and summarize:
.localhost hostnames, same-origin /api routing, and required host exposureResolve ordinary setup choices from evidence. Ask only when missing information changes the apps in scope, data compatibility, network exposure, or a material replacement not already requested.
| Need | Read |
|---|---|
| Detection rules and monorepo discovery | references/tech-stack-detection.md |
| Images, processes, dependencies, mounts, environment, Dockerfiles | references/service-configuration-guide.md |
| WordPress, Drupal, or Joomla | references/cms-configuration-guide.md |
| Ports, proxies, domains, networks, host access | references/networking-ports-guide.md |
| Existing Compose or Dockerfile changes | references/merge-backup-strategy.md |
| Readiness checks and smoke tests | references/health-check-patterns.md |
Use assets as starting points, not immutable output. Remove unselected services and adapt placeholders, healthchecks, commands, paths, users, and versions to the detected project.
For a material setup change, briefly summarize:
Generate the smallest coherent setup within the existing authorization:
.dockerignorecompose.yaml without the obsolete top-level versionPrefer:
sync, sync+restart, or rebuild rules for large trees, native dependencies, or projects that benefit from granular syncRun migrations, seeds, CMS installers, destructive cleanup, or database write tests only when authorization covers their data effects. A request to configure containers alone does not imply those actions.
Run static checks first:
docker compose config --quiet
docker build --check .
Use docker build --check only when the installed Docker version supports it. Build and start when the request includes running or verifying the local setup. For file-generation-only requests, keep execution within that narrower scope:
docker compose build
docker compose up -d --wait
docker compose ps -a
If --wait is unavailable, start detached and poll declared healthchecks with a bounded timeout. Inspect logs for failed or restarting services.
Run the bundled checks when applicable:
"<skill-directory>/scripts/health-check.sh"
"<skill-directory>/scripts/db-test.sh" # connection/read-only query
"<skill-directory>/scripts/db-test.sh" --crud # explicit temporary-table CRUD check
Also run a stack-specific smoke check such as php artisan about, wp core version, drush status, python manage.py check, or the application's health endpoint. When runtime verification is in scope, verify hot reload with a harmless temporary edit and restore it afterward. Reuse passing checks unless relevant configuration or runtime conditions change.
Report:
Never include secret values in the report.
Persistent host-port tracking is optional. First check:
PORT_REGISTRY_FILE="${DOCKER_LOCAL_DEV_PORT_REGISTRY:-${XDG_STATE_HOME:-$HOME/.local/state}/docker-local-dev/HOST_PORT_REGISTRY.md}"
test -f "$PORT_REGISTRY_FILE" && sed -n '1,220p' "$PORT_REGISTRY_FILE"
Creating or refreshing a registry scans beyond the current project and records local paths. Establish authorization for the scan root and output path; reuse it if already given. Then run:
node "<skill-directory>/scripts/scan-host-ports.mjs" --root "<approved-root>" --out "$PORT_REGISTRY_FILE" --yes
Treat registered ports as reserved even when no process is currently listening. For a single project without a registry, a live port check is sufficient.
localhost.