devcontainer
Skill4 starsChanged 6 months agoMITView on GitHub
Create, update, and maintain robust devcontainer.json configurations and lifecycle scripts for reproducible development environments.
- Installs packages
1 other project uses a version of this.
Adopted by
Most recently taken up by
- DeepSpaceCartel/skillstheir own version, first seen Oct 25, 2026
Other versions1 project uses a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 1
- DeepSpaceCartel/skills★ 2same name
How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.
In this repository124 other files it gives its agents.
- AGENTS.mdAGENTS.md
- .github/AGENTS.mdAGENTS.md
- .github/workflows/AGENTS.mdAGENTS.md
- .vscode/AGENTS.mdAGENTS.md
- .github/copilot-instructions.mdCopilot instructions
- agent-log-analysisSkill
- agent-mdSkill
- agent-md-writerSkill
- agent-skill-md-writerSkill
- agentskillsSkill
- agents-md-writerSkill
- ai-prompt-writerSkill
- ansibleSkill
- apache-airflow-apiSkill
- apache-airflow-dagsSkill
- astro-cliSkill
- astronomer-docsSkill
- awesome-copilotSkill
- brainstorm-agent-runsSkill
- brainstorm-github-prSkill
- brainstormSkill
- catSkill
- chrome-devtoolsSkill
- claude-docsSkill
- codeqlSkill
- code-reviewSkill
- code-tourSkill
- coding-standard-writerSkill
- context-aware-opsSkill
- copilot-cliSkill
- copilot-docsSkill
- critical-thinkingSkill
- datadog-agentSkill
- datadog-apiSkill
- datadog-mcpSkill
- datadog-monitorsSkill
- datadog-pulumiSkill
- dictationSkill
- direnvSkill
- dockerfileSkill
- dockerSkill
- docs-reviewSkill
- docs-writerSkill
- dot-claudeSkill
- dotfilesSkill
- dot-githubSkill
- editorconfigSkill
- fact-writerSkill
- gdpr-compliantSkill
- gh-agent-taskSkill
- gh-apiSkill
- gh-aw-compileSkill
- gh-aw-firewall-debugSkill
- gh-aw-firewallSkill
- gh-aw-newSkill
- gh-awSkill
- gh-aw-troubleshootingSkill
- gh-codespaceSkill
- gh-issueSkill
- gh-modelsSkill
- The first 60 shown.
The file
We split this skill into the rules it gives an agent
10 rules. About 0 are common, 5 are distinctive, and 5 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈5
Distinctive · estimate
This author's own choices. Worth a look.
5
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 10
Create, update, and maintain robust devcontainer.json configurations and associated lifecycle scripts (e.g., onCreateCommand, …
- Very specific: line 17
Define Lifecycle Scripts: Use onCreateCommand, updateContentCommand, and postCreateCommand strategically based on execution timing.
- Very specific: line 22
Features over Dockerfiles: Prefer standardized Dev Container features (e.g., ghcr.io/devcontainers/features/python:1) instead of custom RUN …
- Distinctive: line 32
When setting up a reproducible development environment for a repository.
- Distinctive: line 34
When upgrading base images or adding new Dev Container Features to an existing project.
- Distinctive: line 39
If the project strictly uses Nix, Flox, or another purely declarative package manager without containerization.
- Distinctive: line 40
When executing a one-off script that doesn't require a persistent, isolated environment.
- Distinctive: line 120
Monolithic Dockerfiles: Avoid massive custom Dockerfiles unless doing complex system setups unsupported by standard features.
- Very specific: line 121
Using
latestTags: Avoid ubuntu:latest or base images without explicit versions. - Very specific: line 123
Hardcoding Workspace Paths: Avoid hardcoding /workspaces/....
≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Devcontainer
<!-- markdownlint-disable MD013 MD023 MD031 MD032 -->Create, update, and maintain robust devcontainer.json configurations and associated lifecycle scripts (e.g., onCreateCommand, updateContentCommand, postCreateCommand) to ensure reproducible, feature-rich, and secure development environments.
Core Process
- Locate or Create Configuration: Target
.devcontainer/devcontainer.jsonor.devcontainer/<name>/devcontainer.json. - Define Base Metadata: Assign a descriptive
nameand define the baseimage(e.g.,mcr.microsoft.com/devcontainers/base:jammy). - Configure Features: Leverage Dev Container Features (
ghcr.io/devcontainers/features/*) for modular tool installation instead of complex Dockerfiles. - Define Lifecycle Scripts: Use
onCreateCommand,updateContentCommand, andpostCreateCommandstrategically based on execution timing. - Customize IDE: Populate
customizations.vscode.extensionsandcustomizations.vscode.settingsfor a ready-to-use editor experience.
Core Principles
- Features over Dockerfiles: Prefer standardized Dev Container features (e.g.,
ghcr.io/devcontainers/features/python:1) instead of customRUN apt-get...in Dockerfiles for better caching and modularity. - Lifecycle Script Separation:
onCreateCommand: Background OS-level updates,apt-get, orpipxinstallations (runs once when container is created).updateContentCommand: Background OS-level or build-time setups that run after the workspace is mounted.postCreateCommand: Installing project-level dependencies likenpm installorpip install -r requirements.txtand foreground commands likepre-commit install(ensures full workspace availability;updateContentCommandcan sometimes execute too early).
- Root vs RemoteUser: Execute system installs as
root(e.g., usingsudoifremoteUserisvscode) and user installs (e.g., Python packages) as theremoteUser. - Reproducibility: Pin feature versions and base image tags (e.g.,
:jammyinstead of:latest).
When to Use
- When setting up a reproducible development environment for a repository.
- To standardize tooling, linters, and extensions for all contributors via VS Code or GitHub Codespaces.
- When upgrading base images or adding new Dev Container Features to an existing project.
When Not to Use
- For creating lightweight, production-ready Docker images (devcontainers are heavy and optimized for development, not production).
- If the project strictly uses Nix, Flox, or another purely declarative package manager without containerization.
- When executing a one-off script that doesn't require a persistent, isolated environment.
Common Pitfalls
- Monolithic Dockerfiles: Writing massive, custom
Dockerfiles full ofapt-getcommands instead of using standardized, cached Dev Container Features. - Wrong Lifecycle Hook: Using
postCreateCommandfor heavy OS-level installations, drastically delaying the time it takes for the user's workspace to become interactive. - Root Permission Errors: Forgetting that certain
onCreateCommandscripts run asroot, whilepostCreateCommandruns as theremoteUser(e.g.,vscode), leading to permission denied errors on npm/pip installs.
Example: devcontainer.json
// For format details, see https://aka.ms/devcontainer.json. For config options, see the
// README at: https://github.com/devcontainers/templates/tree/main/src/ubuntu
{
"name": "Dev Container (Python & Ansible)",
// "build": {
// "dockerfile": "Dockerfile",
// // Update 'VARIANT' to pick an Ubuntu version: jammy / ubuntu-22.04, focal / ubuntu-20.04, bionic / ubuntu-18.04
// // Use ubuntu-22.04 or ubuntu-18.04 on local arm64/Apple Silicon.
// // "args": { "VARIANT": "ubuntu-22.04" }
// },
// Configure tool-specific properties.
// Note: Keep the list in alphabetical order.
"customizations": {
"vscode": {
"extensions": [
"bierner.markdown-mermaid",
"DavidAnson.vscode-markdownlint",
"GitHub.copilot",
"GitHub.copilot-chat",
"GitHub.vscode-github-actions",
"ms-vscode.vscode-chat-customizations-evaluations",
"vscodevim.vim",
"vsls-contrib.codetour",
"xaver.clang-format"
],
"settings": {
"editor.formatOnSave": true,
"python.defaultInterpreterPath": "/usr/local/bin/python"
}
}
},
// Features to add to the dev container. More info: https://containers.dev/features.
"features": {
"ghcr.io/devcontainers-contrib/features/actionlint:1": {},
"ghcr.io/devcontainers-contrib/features/node-asdf:0": {},
"ghcr.io/devcontainers-extra/features/pipx-package:1": {},
"ghcr.io/devcontainers/features/docker-in-docker:2": {},
"ghcr.io/devcontainers/features/python:1": {},
"ghcr.io/guiyomh/features/vim:0": {},
"ghcr.io/jungaretti/features/make:1": {},
"ghcr.io/jungaretti/features/ripgrep:1": {},
"ghcr.io/sliekens/devcontainer-features/opencode:1": {}
},
// Pre-create opencode directories on host before container starts (required for bind mounts)
"initializeCommand": "mkdir -p \"$HOME/.local/share/opencode\" \"$HOME/.config/opencode\"",
// Use 'forwardPorts' to make a list of ports inside the container available locally.
// Note: Keep examples generic and repository-agnostic; add repo-specific setup only when those files and tools are guaranteed to exist.
// "forwardPorts": [],
// Use 'postCreateCommand' to run commands after the container is created.
// "postCreateCommand": "uname -a",
// Or use a Dockerfile or Docker Compose file. More info: https://containers.dev/guide/dockerfile
"image": "mcr.microsoft.com/devcontainers/base:jammy",
"postCreateCommand": "pip install -r requirements.txt || npm install || true",
// Comment out to connect as root instead. More info: https://aka.ms/vscode-remote/containers/non-root.
"remoteUser": "vscode",
// Note: Python dependencies can be added in the `requirements.txt` file.
"onCreateCommand": "sudo apt-get update && if [ -f .devcontainer/apt-packages.txt ]; then xargs -a .devcontainer/apt-packages.txt sudo apt-get install -y; fi"
}What to Avoid
- Monolithic Dockerfiles: Avoid massive custom Dockerfiles unless doing complex system setups unsupported by standard features.
- Using
latestTags: Avoidubuntu:latestor base images without explicit versions. Prefer stable tags likejammy. - Long Synchronous Post-Create Commands: Move long-running OS package installs to
onCreateCommandorupdateContentCommandto improve perceived startup time. - Hardcoding Workspace Paths: Avoid hardcoding
/workspaces/.... Use the${localWorkspaceFolder}or${containerWorkspaceFolder}variables if needed.
Limitations
- Agents cannot natively build or attach to the devcontainer to test the environment interactively. Rely on schema validation, JSON linting, and best practices.
Related Skills
- yaml: You MUST load this skill when formatting or linting YAML configurations related to devcontainers.
- pre-commit: You MUST load this skill when configuring pre-commit hooks in the devcontainer.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

