All skills
jwynia avatar

/devcontainer

@99a8797
by J Wyniajwynia/agent-skills160 stars
20

Diagnose devcontainer configuration problems and guide development environment setup. This skill should be used when the user asks to 'set up devcontainer', 'fix container startup', 'configure VS Code dev container', 'Codespaces setup', or has Docker development environment issues. Keywords: devcontainer, docker, VS Code, Codespaces, container, development environment, Dockerfile.

Use this Skill: https://skilld.dev/gh/jwynia/agent-skills/devcontainer

This session only. Nothing lands on disk.

assetsdevcontainer-simple.md

≈1.1k tokens on demand. Your agent reads this file only when SKILL.md points to it.

Simple Image-Based Devcontainer Template

Use this template when:

  • You want the fastest setup
  • You're using a standard language/framework
  • You don't need custom system packages
  • The base image already has what you need

Basic Template

Create .devcontainer/devcontainer.json:

{
  "name": "Project Name",
  "image": "mcr.microsoft.com/devcontainers/base:ubuntu",

  // Features add common tools without custom Dockerfile
  "features": {
    "ghcr.io/devcontainers/features/git:1": {},
    "ghcr.io/devcontainers/features/github-cli:1": {}
  },

  // VS Code customization
  "customizations": {
    "vscode": {
      "extensions": [
        "esbenp.prettier-vscode",
        "dbaeumer.vscode-eslint"
      ],
      "settings": {
        "editor.formatOnSave": true
      }
    }
  },

  // Port forwarding for dev servers
  "forwardPorts": [3000],

  // Commands
  "postCreateCommand": "echo 'Ready to code!'",

  // Run as non-root user
  "remoteUser": "vscode"
}

Language-Specific Templates

Node.js

{
  "name": "Node.js",
  "image": "mcr.microsoft.com/devcontainers/javascript-node:20",

  "features": {
    "ghcr.io/devcontainers/features/git:1": {}
  },

  "customizations": {
    "vscode": {
      "extensions": [
        "dbaeumer.vscode-eslint",
        "esbenp.prettier-vscode"
      ]
    }
  },

  "forwardPorts": [3000],
  "postCreateCommand": "npm install",
  "remoteUser": "node"
}

Python

{
  "name": "Python",
  "image": "mcr.microsoft.com/devcontainers/python:3.11",

  "features": {
    "ghcr.io/devcontainers/features/git:1": {}
  },

  "customizations": {
    "vscode": {
      "extensions": [
        "ms-python.python",
        "ms-python.vscode-pylance"
      ],
      "settings": {
        "python.defaultInterpreterPath": "/usr/local/bin/python"
      }
    }
  },

  "postCreateCommand": "pip install -r requirements.txt",
  "remoteUser": "vscode"
}

Go

{
  "name": "Go",
  "image": "mcr.microsoft.com/devcontainers/go:1.21",

  "features": {
    "ghcr.io/devcontainers/features/git:1": {}
  },

  "customizations": {
    "vscode": {
      "extensions": [
        "golang.go"
      ]
    }
  },

  "postCreateCommand": "go mod download",
  "remoteUser": "vscode"
}

Rust

{
  "name": "Rust",
  "image": "mcr.microsoft.com/devcontainers/rust:1",

  "features": {
    "ghcr.io/devcontainers/features/git:1": {}
  },

  "customizations": {
    "vscode": {
      "extensions": [
        "rust-lang.rust-analyzer"
      ]
    }
  },

  "remoteUser": "vscode"
}

TypeScript (Deno)

{
  "name": "Deno",
  "image": "mcr.microsoft.com/devcontainers/base:ubuntu",

  "features": {
    "ghcr.io/devcontainers/features/git:1": {},
    "ghcr.io/anthropics/devcontainer-features/deno:1": {}
  },

  "customizations": {
    "vscode": {
      "extensions": [
        "denoland.vscode-deno"
      ],
      "settings": {
        "deno.enable": true
      }
    }
  },

  "remoteUser": "vscode"
}

Common Patterns

Environment Variables

{
  // Set during container creation (available in Dockerfile)
  "containerEnv": {
    "NODE_ENV": "development"
  },

  // Set at runtime (available in shell)
  "remoteEnv": {
    "API_URL": "${localEnv:API_URL}",
    "DEBUG": "true"
  }
}

Port Forwarding

{
  "forwardPorts": [3000, 5432],
  "portsAttributes": {
    "3000": {
      "label": "Frontend",
      "onAutoForward": "notify"
    },
    "5432": {
      "label": "Database",
      "onAutoForward": "silent"
    }
  }
}

Mounting Local Files

{
  "mounts": [
    "source=${localEnv:HOME}/.aws,target=/home/vscode/.aws,type=bind,readonly"
  ]
}

GitHub Codespaces Secrets

Secrets are available as environment variables. Reference them:

{
  "remoteEnv": {
    "DATABASE_URL": "${localEnv:DATABASE_URL}"
  }
}

Set secrets in GitHub: Settings → Codespaces → Secrets

When to Graduate to Dockerfile

Move to a Dockerfile-based setup when:

  • You need system packages not available as features
  • postCreateCommand is slow and could be cached
  • You need specific versions of tools
  • You want smaller image size
  • You need multi-stage builds

See devcontainer-dockerfile.md template.

Source: SKILL.md on GitHub

1 alert14d5 checks · Risk HIGH
  • Gen Agent Trust Hub14d

    The devcontainer skill provides diagnostic tools and templates for Docker development environments, including scripts to analyze configuration files and scan container images for vulnerabilities. It is classified as low risk because it processes local configuration files which could be manipulated to influence diagnostic output (indirect prompt injection) and references a remote installation script for the Trivy security scanner in its documentation.

  • Socket14d

    No alerts

  • Snyk14d

    Risk: LOW · No issues

  • Runlayer7mo

    7/8 files flagged

  • ZeroLeaks5mo

    Score: 93/100 · 2 sections analyzed

Signed by skilld at 99a8797. This ties the file your Agent reads to that commit on GitHub. It does not review the instructions.

Last checked against GitHub 2 months ago.

Dormantupdated 8 months ago
Other metadata
compatibility
Requires Docker Desktop or compatible container runtime. Works with VS Code and GitHub Codespaces.
metadata
{
  "author": "jwynia",
  "version": "1.0",
  "type": "diagnostic",
  "mode": "diagnostic+generative",
  "domain": "development"
}

README badge

README badge for jwynia/agent-skills/devcontainer