一键导入
devcontainer-init
Use when scaffolding a .devcontainer/ for Shield. Triggers on /shield init-devcontainer, "set up devcontainer", "isolate /implement".
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
Use when scaffolding a .devcontainer/ for Shield. Triggers on /shield init-devcontainer, "set up devcontainer", "isolate /implement".
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
基于 SOC 职业分类
Use when a skill needs step tracking, progress visibility, and resume support within a single phase. Called by skills, not directly by users.
Use when breaking down a project phase into stories with acceptance criteria, creating ADRs, or planning infrastructure work. Triggers on /plan, story breakdown, detailed plan, architecture doc.
Use when generating, editing, or merging Low-Level Design (LLD) documents at `docs/lld/<component>.md` or `docs/shield/<feature>/lld-<component>.md`. Triggers on /lld command (Path A) and on /plan TRD-driven authoring (Path B, M2 plan). Owns the backend and infra templates, atomic write, provenance stamp, and §14 Changelog convention.
Use when authoring a new PRD or upgrading a lean PRD to standard. Walks user through 20-section problem-first scaffold (or 10-section lean), pre-populates from prior /research transcript if present, defers Terminologies (§2) until after the rest is drafted (auto-fills from research glossary + scan of body), invokes shield:story-coverage between Sections 6 and 8 and shield:milestone-coverage between Sections 8 and 15, prompts for story Type (new/enhancement/existing), supports custom team templates via .shield.json. Triggers on /prd, write a PRD, author a PRD.
Use when the user invokes /backlog or asks to capture, view, promote, or remove an idea from the project backlog at docs/shield/backlog.json. Triggers on /backlog add|view|remove|promote and on agent-side "capture this as a backlog entry" calls during research/PRD/plan/implement flows.
Use when a plan, architecture doc, or execution plan exists and needs expert review before implementation. Produces a scored analysis with a P0-gated verdict and an enhanced plan. Triggers on /plan-review, review my plan, document review.
| name | devcontainer-init |
| description | Use when scaffolding a .devcontainer/ for Shield. Triggers on /shield init-devcontainer, "set up devcontainer", "isolate /implement". |
Scaffold a per-repo .devcontainer/ that runs /implement and other agent commands in filesystem + network egress isolation. Follows the design at docs/superpowers/specs/2026-05-18-devcontainer-implement-design.md.
/shield init-devcontainer..devcontainer/ already exists and matches what we'd produce → tell the user it's already set up.| Step | Action | Mandatory |
|---|---|---|
| 1 | Detect stacks via shield/scripts/detect_stack.py | Yes |
| 2 | Confirm with user (add / drop / correct) | Yes |
| 3 | Compose devcontainer.json via shield/scripts/compose_devcontainer.py | Yes |
| 4 | Copy templates: shield-firewall.sh, Dockerfile.tmpl, fill postCreate.sh.tmpl | Yes |
| 5 | Diff against existing .devcontainer/ if present; prompt before overwrite | Yes |
| 6 | Update .shield.json with devcontainer block | Yes |
| 7 | Print next-step instructions (VS Code / CLI) | Yes |
uv run python3 -c \
"from pathlib import Path; \
import sys; sys.path.insert(0, 'shield/scripts'); \
from detect_stack import detect_stack; \
print(' '.join(detect_stack(Path('.'))))"
Output is a space-separated list of stack tags (e.g., python node).
Show the detected stacks. Ask:
Detected: python, node
[a] proceed with these
[b] drop one or more
[c] add a stack not detected
uv run python3 -c \
"from pathlib import Path; \
import sys, json; \
sys.path.insert(0, 'shield/scripts'); \
from compose_devcontainer import compose_devcontainer; \
fm = Path('shield/skills/devcontainer/feature-map.json'); \
cfg = compose_devcontainer(stacks=['python', 'node'], feature_map_path=fm); \
print(json.dumps(cfg, indent=2))" > .devcontainer/devcontainer.json
Replace ['python', 'node'] with the confirmed-stack list.
mkdir -p .devcontainer
cp shield/skills/devcontainer/templates/shield-firewall.sh .devcontainer/shield-firewall.sh
cp shield/skills/devcontainer/templates/Dockerfile.tmpl .devcontainer/Dockerfile
Fill postCreate.sh from postCreate.sh.tmpl by substituting # {{HINTS}} with each confirmed-stack's post_create_hint from feature-map.json:
import json
from pathlib import Path
stacks = ["python", "node"] # confirmed list
fm = json.loads(Path("shield/skills/devcontainer/feature-map.json").read_text())
hints = "\n".join(fm[s]["post_create_hint"] for s in stacks if s in fm)
tmpl = Path("shield/skills/devcontainer/templates/postCreate.sh.tmpl").read_text()
Path(".devcontainer/postCreate.sh").write_text(tmpl.replace("# {{HINTS}}", hints))
chmod 0755 .devcontainer/postCreate.sh .devcontainer/shield-firewall.sh.
Before overwriting any file, diff the proposed new content against the existing file. If different, show the user the diff and ask: [o]verwrite / [k]eep existing / [s]how diff again.
import json
from pathlib import Path
path = Path(".shield.json")
data = json.loads(path.read_text()) if path.exists() else {}
data["devcontainer"] = {
"version": 1,
"stacks_detected": stacks,
"required": "ask",
"firewall_extra_allowlist": [],
}
path.write_text(json.dumps(data, indent=2) + "\n")
Devcontainer scaffolded.
Next:
VS Code: Cmd+Shift+P → "Dev Containers: Reopen in Container"
CLI: devcontainer up --workspace-folder .
devcontainer exec --workspace-folder . bash
Then inside the container:
claude /login # one-time per project; creds persist in named volume
Security caveats — see shield/README.md § Devcontainer.
| Mistake | Fix |
|---|---|
| Skipping the diff before overwrite | Always diff and confirm; users will lose customizations otherwise |
Naming the firewall script init-firewall.sh | Use shield-firewall.sh — claude-code#32113 will silently overwrite the upstream name |
| Hard-coding Feature versions instead of digests | Always use @sha256:... from feature-map.json; tag-only pins drift |
Forgetting to update .shield.json | Without the devcontainer block, the gate (Story 8) defaults to "ask" forever |