Devcontainer

From tinh2/skills-hub-registry · View interactive version

Devcontainer is an AI agent skill from the GitHub repository tinh2/skills-hub-registry. Generate a dev container for my project — auto-detect language, framework, and services like PostgreSQL or Redis, create devcontainer.json with VS Code extensions, port forwarding, post-create commands, Docker Compose for multi-service setups, and GitHub Codespaces compatibility

How to use this skill

Skill file

You are in AUTONOMOUS MODE. Do NOT ask questions. Do NOT pause for confirmation.

Execute every phase below in sequence, making decisions based on what you find.

============================================================

PHASE 0 — INPUT

============================================================

$ARGUMENTS may contain:

If no arguments, auto-detect everything and generate a full-featured config.

============================================================

PHASE 1 — STACK DETECTION

============================================================

Detect the project stack by scanning for manifest files:

Language & Runtime:

Services:

Package Manager:

Record: language, version, framework, package manager, required services (database, cache, queue).

============================================================

PHASE 2 — GENERATE DEVCONTAINER CONFIG

============================================================

Create .devcontainer/devcontainer.json:

Base Image Selection (use Microsoft Dev Container images):

Dev Container Features (add based on detected stack):

VS Code Extensions (match detected stack):

Port Forwarding (detect from project):

Post-Create Command:

============================================================

PHASE 3 — MULTI-SERVICE SETUP

============================================================

If the project requires services (database, cache, queue) OR --compose was passed:

Create .devcontainer/docker-compose.yml:

services:
  app:
    build:
      context: ..
      dockerfile: .devcontainer/Dockerfile
    volumes:
      - ..:/workspaces/${localWorkspaceFolderBasename}:cached
    command: sleep infinity

Add detected services:

Create .devcontainer/Dockerfile using the detected base image with any additional tooling.

Update devcontainer.json to reference docker-compose:

{
  "dockerComposeFile": "docker-compose.yml",
  "service": "app",
  "workspaceFolder": "/workspaces/${localWorkspaceFolderBasename}"
}

If no services are needed, use the simpler image or build approach directly in devcontainer.json.

============================================================

PHASE 4 — CODESPACES COMPATIBILITY

============================================================

Ensure GitHub Codespaces compatibility:

Verify the generated config is valid JSON (no trailing commas, proper escaping).

============================================================

SELF-HEALING VALIDATION (max 2 iterations)

============================================================

After completing, validate the output was produced correctly:

  1. Verify generated files exist and are syntactically valid.
  2. Run any available validation (lint, type-check, dry-run).
  3. If the skill produces configuration, verify it parses without errors.

IF VALIDATION FAILS:

============================================================

OUTPUT

============================================================

Print a summary of all generated files:

## Dev Container Setup Complete

### Files Created
- .devcontainer/devcontainer.json — main configuration
- .devcontainer/docker-compose.yml — multi-service orchestration (if applicable)
- .devcontainer/Dockerfile — custom image (if applicable)

### Detected Stack
- Language: {language} {version}
- Framework: {framework}
- Package Manager: {pm}
- Services: {postgresql, redis, etc. or "none"}

### Included Extensions
- {list of VS Code extensions}

### Port Forwarding
- {port}: {service description}

### Post-Create Setup
- {command that runs after container creation}

============================================================

NEXT STEPS

============================================================

  1. Open the project in VS Code and select "Reopen in Container"
  2. Or push to GitHub and open in Codespaces
  3. Run /env-setup to verify all dependencies and services are working
  4. Run /git-hooks to set up pre-commit hooks inside the container

============================================================

SELF-EVOLUTION TELEMETRY

============================================================

After producing output, record execution metadata for the /evolve pipeline.

Check if a project memory directory exists:

Entry format:

### /devcontainer — {{YYYY-MM-DD}}
- Outcome: {{SUCCESS | PARTIAL | FAILED}}
- Self-healed: {{yes — what was healed | no}}
- Iterations used: {{N}} / {{N max}}
- Bottleneck: {{phase that struggled or "none"}}
- Suggestion: {{one-line improvement idea for /evolve, or "none"}}

Only log if the memory directory exists. Skip silently if not found.

Keep entries concise — /evolve will parse these for skill improvement signals.

============================================================

DO NOT

============================================================

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.