devcontainer by jwynia/agent-skills
npx skills add https://github.com/jwynia/agent-skills --skill devcontainer诊断开发容器和 Docker 开发环境问题。帮助创建可复现、快速启动的开发环境,确保其在 VS Code、GitHub Codespaces 和团队成员之间保持一致运行。
在以下情况使用此技能:
在以下情况请勿使用此技能:
开发容器应提供即时生产力。每个配置选择都会影响启动时间、可复现性和团队上手速度。请明确这些权衡取舍。
症状: 手动设置、"请查阅 README"、在一台机器上工作但在其他机器上失败
干预措施:
assets/devcontainer-simple.md 模板症状: 启动时间超过 5 分钟、postCreateCommand 任务繁重、避免重建
关键问题:
广告位招租
在这里展示您的产品或服务
触达数万 AI 开发者,精准高效
postCreateCommand 中有什么内容?干预措施:
scripts/analyze-devcontainer.ts症状: JSON 错误、VS Code 无法连接、功能冲突
检查清单:
image、build.dockerfile、dockerComposeFilepublisher.extension-name 格式症状: 在 VS Code 中工作正常,在 Codespaces 中失败(或反之)
常见问题:
| 问题 | 本地 VS Code | Codespaces |
|---|---|---|
| Docker 套接字 | 通常可用 | 需要 Docker-in-Docker |
| 密钥 | .env 文件有效 | 使用 Codespaces 密钥 |
| 文件监视 | 原生支持 | 可能需要轮询 |
症状: 需要数据库/缓存/队列、服务间无法通信
干预措施:
assets/devcontainer-compose.md 模板症状: 构建失败、镜像过大、无缓存
最佳实践:
FROM mcr.microsoft.com/devcontainers/base:ubuntu
# 先安装依赖项(可缓存)
RUN apt-get update && apt-get install -y \
build-essential && rm -rf /var/lib/apt/lists/*
# 复制依赖文件然后安装(如果依赖项未更改则可缓存)
COPY package*.json ./
RUN npm install
# 最后复制代码(频繁变更)
COPY . .
指标:
| 脚本 | 用途 | 用法 |
|---|---|---|
analyze-devcontainer.ts | 查找问题和优化点 | deno run --allow-read scripts/analyze-devcontainer.ts |
validate-dockerfile.ts | 检查 Dockerfile 最佳实践 | deno run --allow-read scripts/validate-dockerfile.ts |
scan-image.ts | 漏洞扫描(封装 Trivy) | deno run --allow-run scripts/scan-image.ts [image] |
安装所有工具"以防万一" - 导致启动时间超过 10 分钟。修复: 从最小化开始。仅在需要时添加。
将所有操作都放在 postCreateCommand 中 - 每次都会运行。修复: 将稳定的操作移至 Dockerfile。
在运行的容器内进行手动更改。修复: 所有更改都应写入配置文件。
assets/devcontainer-simple.md - 基本的单容器设置assets/devcontainer-dockerfile.md - 自定义 Dockerfile 方法assets/devcontainer-compose.md - 多服务设置每周安装数
103
仓库
GitHub 星标数
42
首次出现
2026年1月20日
安全审计
安装于
opencode86
codex85
gemini-cli82
github-copilot79
cursor76
claude-code72
Diagnose devcontainer and Docker development environment problems. Help create reproducible, fast-starting development environments that work consistently across VS Code, GitHub Codespaces, and team members.
Use this skill when:
Do NOT use this skill when:
Development containers should provide instant productivity. Every configuration choice affects startup time, reproducibility, and team onboarding. Make these trade-offs explicit.
Symptoms: Manual setup, "check the README", works on one machine fails on others
Interventions:
assets/devcontainer-simple.md templateSymptoms: 5+ minute startup, heavy postCreateCommand, avoiding rebuilds
Key Questions:
Interventions:
scripts/analyze-devcontainer.tsSymptoms: JSON errors, VS Code won't connect, features conflicting
Checklist:
Symptoms: Works in VS Code, fails in Codespaces (or vice versa)
Common Issues:
| Issue | Local VS Code | Codespaces |
|---|---|---|
| Docker socket | Usually available | Docker-in-Docker needed |
| Secrets | .env files work | Use Codespaces secrets |
| File watching | Native | May need polling |
Symptoms: Need database/cache/queue, services can't communicate
Interventions:
assets/devcontainer-compose.md templateSymptoms: Build failures, huge images, no caching
Best Practices:
FROM mcr.microsoft.com/devcontainers/base:ubuntu
# Dependencies first (cached)
RUN apt-get update && apt-get install -y \
build-essential && rm -rf /var/lib/apt/lists/*
# Copy deps then install (cached if deps unchanged)
COPY package*.json ./
RUN npm install
# Code last (changes frequently)
COPY . .
Indicators:
| Script | Purpose | Usage |
|---|---|---|
analyze-devcontainer.ts | Find issues and optimizations | deno run --allow-read scripts/analyze-devcontainer.ts |
validate-dockerfile.ts | Check Dockerfile best practices | deno run --allow-read scripts/validate-dockerfile.ts |
scan-image.ts | Vulnerability scanning (wraps Trivy) | deno run --allow-run scripts/scan-image.ts [image] |
Installing every tool "just in case" - 10+ minute startups. Fix: Start minimal. Add only when needed.
Everything in postCreateCommand - runs every time. Fix: Move stable operations to Dockerfile.
Manual changes inside running containers. Fix: ALL changes go in config files.
assets/devcontainer-simple.md - Basic single-container setupassets/devcontainer-dockerfile.md - Custom Dockerfile approachassets/devcontainer-compose.md - Multi-service setupWeekly Installs
103
Repository
GitHub Stars
42
First Seen
Jan 20, 2026
Security Audits
Gen Agent Trust HubFailSocketPassSnykPass
Installed on
opencode86
codex85
gemini-cli82
github-copilot79
cursor76
claude-code72
Azure Data Explorer (Kusto) 查询技能:KQL数据分析、日志遥测与时间序列处理
138,800 周安装