.claude/skills/flow-skill-setup-ai-ide-devcontainer/SKILL.md
Set up .devcontainer for AI IDE development. Generates devcontainer.json and optional Dockerfile for project tech stack, AI CLI integration (Claude Code, OpenCode), secrets, skill mounting, and security hardening. Use for AI-assisted devcontainer setup or flow-init delegation.
npx skillsauth add korchasa/ai-skel-ts flow-skill-setup-ai-ide-devcontainerInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
Creates a .devcontainer/ configuration for AI-agent-driven development.
Architecture: VS Code or Cursor opens the devcontainer (they support the devcontainer spec natively). AI tools work inside the container in two modes:
anthropic.claude-code, github.copilot) — installed automatically via customizations.vscode.extensions, share the same container config and env varsclaude CLI, opencode CLI) — run in the container terminal, use the same ~/.claude/ or ~/.config/opencode/ configBoth modes share config directories, env vars, and global skills. This skill configures all layers.
package.json, deno.json, go.mod, Cargo.toml, pyproject.toml, or similar)Scan the project root for stack indicators:
| Indicator File | Stack | Base Image |
|---|---|---|
| deno.json / deno.jsonc | Deno | mcr.microsoft.com/devcontainers/base:ubuntu + Deno feature |
| package.json / tsconfig.json | Node/TS | mcr.microsoft.com/devcontainers/typescript-node |
| pyproject.toml / requirements.txt / setup.py | Python | mcr.microsoft.com/devcontainers/python |
| go.mod | Go | mcr.microsoft.com/devcontainers/go |
| Cargo.toml | Rust | mcr.microsoft.com/devcontainers/rust |
| None / mixed | Generic | mcr.microsoft.com/devcontainers/base:ubuntu |
If multiple stacks detected, ask user which is primary. Secondary stacks will be added as features.
Scan the project for indicators that map to devcontainer features beyond the base stack. Use the indicator→need mapping in references/features-catalog.md, then search https://containers.dev/features for matching feature IDs.
pnpm-lock.yaml → need pnpm, *.tf → need Terraform)features block in step 5 (Generate Configuration)Skip this step only if user explicitly provided a complete feature list in their request.
Check if .devcontainer/ exists:
devcontainer.json, show diff after generating new version, ask for per-file confirmation before overwriting.Ask the user (skip items already answered in prior context):
postCreateCommand install script (see Claude Code § Install) + config volume + ANTHROPIC_API_KEYANTHROPIC_API_KEY (or other provider key)init-firewall.sh, adds NET_ADMIN/NET_RAW capabilitiesGenerate using the template logic in references/devcontainer-template.md.
Key structure:
{
"name": "<project-name>",
// Image-based OR Dockerfile-based (see step 4.4)
"image": "<base-image>", // OR "build": { "dockerfile": "Dockerfile" }
"features": { /* stack features + common-utils + github-cli */ },
"customizations": {
"vscode": {
"extensions": [ /* stack extensions + AI extensions */ ],
"settings": { /* stack-specific settings */ }
}
},
"remoteEnv": {
// Only for selected AI CLIs — see "AI CLI Setup Reference"
"ANTHROPIC_API_KEY": "${localEnv:ANTHROPIC_API_KEY}",
"GITHUB_TOKEN": "${localEnv:GITHUB_TOKEN}"
},
"secrets": {
// Codespaces prompts — add only for selected AI CLIs
"ANTHROPIC_API_KEY": {
"description": "API key for AI CLI tools (console.anthropic.com)"
},
"GITHUB_TOKEN": {
"description": "GitHub PAT for gh CLI"
}
},
"mounts": [ /* global config mount if enabled */ ],
"postCreateCommand": "<dependency-install-command>",
"postStartCommand": "git config --global --add safe.directory ${containerWorkspaceFolder}",
"remoteUser": "<non-root-user>"
}
Generate only when user chose custom Dockerfile in step 4.4. See references/dockerfile-patterns.md.
Generate only when user chose firewall in step 4.3. See references/firewall-template.md.
.devcontainer/ directory if missing.devcontainer/devcontainer.json.devcontainer/Dockerfile (if custom).devcontainer/init-firewall.sh (if firewall), make executable.devcontainer/devcontainer.json is valid JSON (parse it)FROM line present)init-firewall.sh exists: has shebang and set -euo pipefailremoteUser matches the user in the base image (e.g., node for Node images, vscode for mcr base images)If Claude Code was selected, display this note to the user after generation:
Claude Code auth: After the container starts, open a terminal inside it and run
claudeto log in via OAuth. Auth forwarding from macOS Keychain may handle this automatically, but if Claude Code reports auth errors, a manualclaude loginin the container terminal will fix it. Credentials are persisted in the config volume and survive container rebuilds.
| Stack | Features to Add |
|---|---|
| Deno | ghcr.io/devcontainers-extra/features/deno:latest |
| Node/TS | (included in base image) |
| Python | (included in base image) |
| Go | (included in base image) |
| Rust | (included in base image) |
| Common (always) | ghcr.io/devcontainers/features/common-utils:2, ghcr.io/devcontainers/features/github-cli:1 |
| Secondary Node | ghcr.io/devcontainers/features/node:1 (when Node needed alongside non-Node primary) |
| Discovered | Additional features from references/features-catalog.md based on project scan (Step 2) |
| Stack | Extensions |
|---|---|
| Deno | denoland.vscode-deno |
| Node/TS | dbaeumer.vscode-eslint, esbenp.prettier-vscode |
| Python | ms-python.python, ms-python.vscode-pylance |
| Go | golang.go |
| Rust | rust-lang.rust-analyzer |
| Common (always) | eamodio.gitlens, editorconfig.editorconfig |
| Tool | Extension ID | Notes |
|---|---|---|
| Claude Code | anthropic.claude-code | IDE extension + CLI inside container |
| GitHub Copilot | github.copilot, github.copilot-chat | IDE extension only |
OpenCode is a standalone TUI/CLI — no VS Code extension. It runs in the container terminal.
| Stack | Command |
|---|---|
| Deno | deno install or deno cache (check deno.json for deps) |
| Node/TS | npm install or yarn install or pnpm install (match lockfile) |
| Python | pip install -r requirements.txt or pip install -e . (match project) |
| Go | go mod download |
| Rust | cargo fetch |
| Base Image Pattern | remoteUser |
|---|---|
| mcr.microsoft.com/devcontainers/* | vscode |
| node:* | node |
| denoland/deno:* | deno |
| debian:* / ubuntu:* | Create non-root user in Dockerfile |
Each AI CLI has its own installation, config persistence, and global skills pattern. Apply only for selected tools.
Preferred method: Install via official script in postCreateCommand (curl -fsSL https://claude.ai/install.sh | bash).
Registry features (e.g., ghcr.io/devcontainers-extra/features/claude-code:1) are NOT recommended — they install outdated versions with broken OAuth.
For other AI CLIs, use devcontainer registry features where available (see references/features-catalog.md).
| Aspect | Details |
|---|---|
| Install (preferred) | postCreateCommand: curl -fsSL https://claude.ai/install.sh \| bash — always installs latest version with working OAuth |
| Install (alternative) | postCreateCommand: npm install -g @anthropic-ai/claude-code@latest |
| Install (NOT recommended) | Registry features (ghcr.io/devcontainers-extra/features/claude-code:1, ghcr.io/stu-bell/devcontainer-features/claude-code:0) — install outdated versions with broken OAuth callback |
| Config dir | ~/.claude/ (settings, skills, auth tokens in .credentials.json). ~/.claude.json (metadata, caches — auto-recreated, no tokens) |
| Auth tokens | Stored in ~/.claude/.credentials.json inside the config dir. On macOS host: Keychain service Claude Code-credentials. See references/auth-forwarding.md |
| Config volume | source=claude-config-${devcontainerId},target=/home/<user>/.claude,type=volume |
| Auth forwarding | Host Keychain → staging file → container volume. See references/auth-forwarding.md |
| Global skills mount | source=${localEnv:HOME}/.claude,target=/home/<user>/.claude-host,type=bind,readonly |
| Skills sync | rm -rf ~/.claude/skills ~/.claude/commands && cp -rL ~/.claude-host/skills ~/.claude/skills 2>/dev/null \|\| true && cp -rL ~/.claude-host/commands ~/.claude/commands 2>/dev/null \|\| true |
| Env vars | ANTHROPIC_API_KEY (API key auth). Do NOT set CLAUDE_CONFIG_DIR (breaks volume auth strategy). DISABLE_AUTOUPDATER=1 (optional, pin version) |
| Extension | anthropic.claude-code |
| Aspect | Details |
|---|---|
| Install (feature, preferred) | ghcr.io/jsburckhardt/devcontainer-features/opencode:1 |
| Install (manual fallback) | postCreateCommand: curl -fsSL https://opencode.ai/install \| bash |
| Config dir | ~/.config/opencode/ (settings, skills, commands, plugins) |
| Config volume | source=opencode-config-${devcontainerId},target=/home/<user>/.config/opencode,type=volume |
| Global skills mount | source=${localEnv:HOME}/.config/opencode,target=/home/<user>/.config/opencode-host,type=bind,readonly |
| Skills sync | rm -rf ~/.config/opencode/skills && cp -rL ~/.config/opencode-host/skills ~/.config/opencode/skills 2>/dev/null \|\| true |
| Env vars | ANTHROPIC_API_KEY (if using Anthropic provider) |
| Extension | None (standalone TUI/CLI, runs in terminal) |
| Aspect | Details |
|---|---|
| Install (feature) | ghcr.io/stu-bell/devcontainer-features/cursor-cli:0 |
| Extension | N/A (Cursor is the IDE host itself) |
*-host) to avoid overwriting container-local configreadonly — container should never write back to host configskills/ and commands/ via postStartCommand (runs on every start, picks up host updates on restart). Use cp -rL to dereference symlinks — host skills may be symlinks with host-relative paths unresolvable inside the containerpostCreateCommandAdd only for selected AI CLIs:
{
// Claude Code (when selected)
"ANTHROPIC_API_KEY": "${localEnv:ANTHROPIC_API_KEY}",
// WARNING: Do NOT set CLAUDE_CONFIG_DIR — it breaks the volume auth strategy.
// See references/auth-forwarding.md for details.
// OpenCode (when selected, if using Anthropic)
// Uses same ANTHROPIC_API_KEY
// GitHub (always)
"GITHUB_TOKEN": "${localEnv:GITHUB_TOKEN}"
}
Add only for selected AI CLIs:
{
"ANTHROPIC_API_KEY": {
"description": "API key for AI CLI tools (console.anthropic.com)"
},
"GITHUB_TOKEN": {
"description": "GitHub PAT for gh CLI"
}
}
| Hook | When | Use For |
|---|---|---|
| initializeCommand | On host, before container creation | Auth forwarding: extract host Keychain tokens to staging file (macOS only) |
| postCreateCommand | Once after container creation | Dependency install, CLI install, auth token copy from staging to volume |
| postStartCommand | Every container start | git safe.directory, global skills sync |
| postAttachCommand | Every IDE attach | Shell customization |
All hooks accept string, array, or object (parallel execution) format:
// Object form for parallel execution
"postCreateCommand": {
"deps": "npm install",
"cli": "curl -fsSL https://claude.ai/install.sh | bash"
}
tools
Scaffold a complete AI agent application skeleton with LLM integration, tool calling, observability, cost tracking, session management, and content fetching using @korchasa/ai-skel-ts. Use when the user asks to create an AI agent, add LLM integration, scaffold an AI application, or mentions "ai-skel", "agent skeleton", or "AI scaffold". Works with any programming language.
testing
Create structured specification for large features using phased decomposition. Produces documents/spec-{name}.md with dependency-ordered phases, atomic tasks, explicit boundaries, and per-phase status tracking.
documentation
Guidelines for writing comprehensive Product Requirements Documents (PRD)
development
How to write in informational style