devcontainer-helper
Scannednpx machina-cli add skill gabeosx/agentskillsdir/devcontainer-helper --openclawDevContainer Helper
This skill assists in creating and managing devcontainer.json files for consistent development environments.
Workflow
1. specific Requirements
Before generating the file, determine the user's needs:
- Base Environment: Do they want a pre-built image (e.g., Ubuntu, Python, Node), a custom
Dockerfile, or adocker-compose.ymlsetup? - Languages & Tools: What languages (Node.js, Python, Go, Rust, etc.) and tools (Git, CLI utilities) are needed?
- Extensions: Are there specific VS Code extensions required?
- Ports: What ports need to be forwarded?
2. Generate Configuration
Use the template in assets/devcontainer-template.json as a starting point.
For Image-based (Simplest):
Use the image property. Add features for additional tools.
For Dockerfile:
Use build.dockerfile property pointing to their Dockerfile.
For Docker Compose:
Use dockerComposeFile and service properties.
3. Add Features
Encourage using "Features" over manual Dockerfile commands when possible for better maintainability.
Common features:
- Node.js:
ghcr.io/devcontainers/features/node:1 - Python:
ghcr.io/devcontainers/features/python:1 - Docker-in-Docker:
ghcr.io/devcontainers/features/docker-in-docker:2 - Git:
ghcr.io/devcontainers/features/git:1
4. Lifecycle Scripts
If the user needs to run commands (like npm install or pip install) after the container builds:
- Use
postCreateCommandfor one-time setup. - Use
postStartCommandfor commands that run every time the container starts.
References
See references/cheatsheet.md for a list of common devcontainer.json properties and valid values.
Source
git clone https://github.com/gabeosx/agentskillsdir/blob/main/.gemini/skills/devcontainer-helper/SKILL.mdView on GitHub Overview
This skill assists in creating and managing devcontainer.json files to standardize development environments. It guides users through choosing a base (image, Dockerfile, or docker-compose), selecting languages/tools, extensions, and ports, and setting up lifecycle scripts.
How This Skill Works
First, capture the requirements (base environment, languages, tools, extensions, ports). Then generate the configuration from the devcontainer template, choosing image-based, Dockerfile, or docker-compose styles. Finally, add features instead of manual Dockerfile steps and configure postCreateCommand and postStartCommand as needed.
When to Use It
- Starting a new project and need a base development container (image, Dockerfile, or docker-compose).
- You want to add language tooling and extensions in a repeatable way.
- You need to expose ports for services (web apps, DBs) from the container.
- You want to avoid large Dockerfile commands by using devcontainer features.
- You must run setup steps after container creation or on every start.
Quick Start
- Step 1: Gather requirements (base image vs Dockerfile, languages, extensions, ports).
- Step 2: Choose an approach (image, Dockerfile, or docker-compose) and start from assets/devcontainer-template.json.
- Step 3: Add features and lifecycle scripts (postCreateCommand / postStartCommand) and test by reopening in container.
Best Practices
- Prefer DevContainer Features (e.g., node, python, git) over manual Dockerfile steps for maintainability.
- Use postCreateCommand for one-time provisioning and postStartCommand for recurring tasks.
- Start from assets/devcontainer-template.json and customize gradually with clear comments.
- Document ports, extensions, and tools in the devcontainer.json for team clarity.
- Test changes by reopening the project in the container to validate behavior.
Example Use Cases
- Node.js + Python devcontainer using images and features, exposing port 3000 and running npm install in postCreateCommand.
- Python data-science workspace with python feature, Jupyter server on port 8888, and pip install in postCreateCommand.
- Docker-in-Docker setup using the docker-in-docker feature for CI-like workflows.
- Docker Compose setup with services 'web' and 'db', using dockerComposeFile and service definitions.
- Custom Dockerfile-based devcontainer with a tailored build context and specific tools installed.