devcontainer
When to use
Use this skill when working with DevContainer configuration, GitHub Codespaces setup, or development environment standardization.
Do NOT use when:
- Local Docker setup without Codespaces (use
docker skill)
- Production deployment (use
aws-infrastructure skill)
Procedure: Modify DevContainer
- Gather context — read
.devcontainer/devcontainer.json, check .devcontainer/ for env files and docs, check agents/overrides/skills/devcontainer.md for project-specific overrides.
- Identify change type — classify: image change, feature addition, secret addition, extension change, or env var change.
- Make the change — edit
devcontainer.json (or related files). Follow conventions below for secrets, features, and environment variables.
- Build and verify — run
devcontainer build to confirm the container builds. Check that extensions load and ports forward correctly.
- Document — if adding a new secret or dependency, update the onboarding docs in
.devcontainer/.
Architecture
Custom image
DevContainers typically use a pre-built custom image hosted on a container registry (GHCR, ECR, Docker Hub). Read devcontainer.json for the image URL.
The image should include:
- Language runtime (PHP, Node.js, Python, etc.)
- Package managers (Composer, npm, etc.)
- Common development tools
Features (installed on top of the image)
Common features:
| Feature |
Purpose |
git |
Git version control |
github-cli |
GitHub CLI (gh) for API access |
docker-in-docker |
Run Docker inside the DevContainer |
Secrets management
Secrets can be managed via:
- File mounts:
.devcontainer/.secrets/<NAME> → /run/secrets/<NAME>
- GitHub Codespaces secrets: configured in the repository settings
- Environment variables: in
.devcontainer/devcontainer.env
Read devcontainer.json for the actual secret definitions and requirements.
Workspace
- Workspace folder: typically
/workspace or /workspaces/{repo-name}
- Mount type: bind mount from local workspace
- Container name and hostname: defined in
devcontainer.json
IDE integration
- VS Code Live Share for collaborative development
- IDE extensions can be pre-configured in
devcontainer.json
Conventions
Adding new secrets
- Add the secret definition to
devcontainer.json → secrets section.
- Add a bind mount from
.devcontainer/.secrets/<NAME> to /run/secrets/<NAME>.
- Document the secret with
description and documentationUrl.
- Mark as required or optional.
Modifying the base image
- If the base image is maintained in a separate repository, do NOT change the image tag without coordination.
- Prefer adding features over modifying the base image.
Environment variables
- Runtime env vars go in
.devcontainer/devcontainer.env.
- Secrets go in
.devcontainer/.secrets/ (gitignored).
- Do NOT hardcode secrets in
devcontainer.json.
Output format
- Updated devcontainer.json or related configuration files
- Summary of changes and rebuild requirements
Auto-trigger keywords
- DevContainer
- Codespaces
- dev environment
- container setup
Validate
- Verify the DevContainer builds successfully (
devcontainer build).
- Confirm all required extensions and features are installed.
- Check that port forwarding and volume mounts work as expected.
Gotcha
- DevContainer rebuilds are slow — test configuration changes incrementally, not all at once.
- Secrets in devcontainer.json are visible in version control — use Codespaces secrets instead.
- Extensions in devcontainer.json install on EVERY rebuild — keep the list short.
Do NOT
- Do NOT commit secret files — they should be gitignored.
- Do NOT change the workspace mount path without updating all related configs.
- Do NOT remove required secrets without checking which services depend on them.
- Do NOT switch base images without team approval.
Related
- Skill:
docker — Docker setup, multi-stage Dockerfile, compose services
- Skill:
traefik — local reverse proxy with real domains and HTTPS
- Rule:
docker-commands.md — commands run inside Docker
1---2name: devcontainer3description: Wire up DevContainers / GitHub Codespaces — `devcontainer.json`, container images, secrets, VS Code features, port forwarding. NOT for tuning Copilot itself (use `copilot-config`).4---56# devcontainer78## When to use910Use this skill when working with DevContainer configuration, GitHub Codespaces setup, or development environment standardization.1112Do NOT use when:13- Local Docker setup without Codespaces (use `docker` skill)14- Production deployment (use `aws-infrastructure` skill)1516## Procedure: Modify DevContainer17181. **Gather context** — read `.devcontainer/devcontainer.json`, check `.devcontainer/` for env files and docs, check `agents/overrides/skills/devcontainer.md` for project-specific overrides.192. **Identify change type** — classify: image change, feature addition, secret addition, extension change, or env var change.203. **Make the change** — edit `devcontainer.json` (or related files). Follow conventions below for secrets, features, and environment variables.214. **Build and verify** — run `devcontainer build` to confirm the container builds. Check that extensions load and ports forward correctly.225. **Document** — if adding a new secret or dependency, update the onboarding docs in `.devcontainer/`.2324## Architecture2526### Custom image2728DevContainers typically use a **pre-built custom image** hosted on a container registry (GHCR, ECR, Docker Hub). Read `devcontainer.json` for the image URL.2930The image should include:31- Language runtime (PHP, Node.js, Python, etc.)32- Package managers (Composer, npm, etc.)33- Common development tools3435### Features (installed on top of the image)3637Common features:3839| Feature | Purpose |40|---|---|41| `git` | Git version control |42| `github-cli` | GitHub CLI (`gh`) for API access |43| `docker-in-docker` | Run Docker inside the DevContainer |4445### Secrets management4647Secrets can be managed via:48- **File mounts**: `.devcontainer/.secrets/<NAME>` → `/run/secrets/<NAME>`49- **GitHub Codespaces secrets**: configured in the repository settings50- **Environment variables**: in `.devcontainer/devcontainer.env`5152Read `devcontainer.json` for the actual secret definitions and requirements.5354### Workspace5556- **Workspace folder**: typically `/workspace` or `/workspaces/{repo-name}`57- **Mount type**: bind mount from local workspace58- Container name and hostname: defined in `devcontainer.json`5960### IDE integration6162- VS Code Live Share for collaborative development63- IDE extensions can be pre-configured in `devcontainer.json`6465## Conventions6667### Adding new secrets68691. Add the secret definition to `devcontainer.json` → `secrets` section.702. Add a bind mount from `.devcontainer/.secrets/<NAME>` to `/run/secrets/<NAME>`.713. Document the secret with `description` and `documentationUrl`.724. Mark as required or optional.7374### Modifying the base image7576- If the base image is maintained in a separate repository, do NOT change the image tag without coordination.77- Prefer adding **features** over modifying the base image.7879### Environment variables8081- Runtime env vars go in `.devcontainer/devcontainer.env`.82- Secrets go in `.devcontainer/.secrets/` (gitignored).83- Do NOT hardcode secrets in `devcontainer.json`.8485## Output format86871. Updated devcontainer.json or related configuration files882. Summary of changes and rebuild requirements8990## Auto-trigger keywords9192- DevContainer93- Codespaces94- dev environment95- container setup9697### Validate9899- Verify the DevContainer builds successfully (`devcontainer build`).100- Confirm all required extensions and features are installed.101- Check that port forwarding and volume mounts work as expected.102103## Gotcha104105- DevContainer rebuilds are slow — test configuration changes incrementally, not all at once.106- Secrets in devcontainer.json are visible in version control — use Codespaces secrets instead.107- Extensions in devcontainer.json install on EVERY rebuild — keep the list short.108109## Do NOT110111- Do NOT commit secret files — they should be gitignored.112- Do NOT change the workspace mount path without updating all related configs.113- Do NOT remove required secrets without checking which services depend on them.114- Do NOT switch base images without team approval.115116## Related117118- **Skill:** `docker` — Docker setup, multi-stage Dockerfile, compose services119- **Skill:** `traefik` — local reverse proxy with real domains and HTTPS120- **Rule:** `docker-commands.md` — commands run inside Docker