Agent Skillsopen-mercato/open-mercato › om-dev-container-maintenance

om-dev-container-maintenance

GitHub

维护 VS Code Dev Container 配置,处理构建启动故障及环境不一致问题。涵盖 devcontainer.json、Dockerfile 等文件的审计、诊断与修复,确保开发环境与容器同步。

.ai/skills/om-dev-container-maintenance/SKILL.md open-mercato/open-mercato

Trigger Scenarios

修改 .devcontainer/ 目录下的文件 Dev Container 构建或启动失败 容器内服务行为异常 本地运行正常但 Dev Container 中异常

Install

npx skills add open-mercato/open-mercato --skill om-dev-container-maintenance -g -y
More Options

Non-standard path

npx skills add https://github.com/open-mercato/open-mercato/tree/main/.ai/skills/om-dev-container-maintenance -g -y

Use without installing

npx skills use open-mercato/open-mercato@om-dev-container-maintenance

指定 Agent (Claude Code)

npx skills add open-mercato/open-mercato --skill om-dev-container-maintenance -a claude-code -g -y

安装 repo 全部 skill

npx skills add open-mercato/open-mercato --all -g -y

预览 repo 内 skill

npx skills add open-mercato/open-mercato --list

SKILL.md

Frontmatter
{
    "name": "om-dev-container-maintenance",
    "description": "Maintain the VS Code Dev Container setup for Open Mercato. MUST use for ANY change to `.devcontainer\/` files. Also use when the container fails to build\/start, services inside misbehave, or \"works locally but not in dev container\". Triggers on \"dev container\", \"devcontainer\", \".devcontainer\"."
}

Dev Container Maintenance

Maintain .devcontainer/ so it stays in sync with the project's regular development requirements.

Spec & Documentation

  • Spec: .ai/specs/implemented/SPEC-050-2026-02-26-dev-container-setup.md
  • User docs: .devcontainer/README.md

Dev Container File Map

File Purpose When to modify
.devcontainer/devcontainer.json VS Code integration: lifecycle hooks, ports, extensions, env forwarding New ports, extensions, env vars to forward
.devcontainer/Dockerfile Workspace image: Node.js, system packages, Python/Ruby/Homebrew, Claude CLI, Yarn Node.js version bump, new system dep (apt-get install)
.devcontainer/docker-compose.yml Services + static volumes + health checks New service, version bump, new static volume
.devcontainer/docker-compose.volumes.yml Auto-generated dist/ volumes Never edit — regenerated by generate-compose-volumes.sh
.devcontainer/docker-compose.local.yml Personal overrides (gitignored) — extra bind mounts, env vars, services Developer edits for local needs; auto-created if missing
.devcontainer/scripts/setup-env.sh .env generation with hostname rewrites New .env.example keys needing container-specific values
.devcontainer/scripts/post-create.sh One-time bootstrap (install, build, generate, db init) New build steps, changed init sequence
.devcontainer/scripts/post-start.sh Per-start sync (install, migrate) New per-start maintenance steps
.devcontainer/scripts/generate-compose-volumes.sh Scans packages/*/, writes docker-compose.volumes.yml Only if volume naming convention changes

Workflow

1. Audit (compare regular setup vs dev container)

Read and follow the checklist in references/audit-checklist.md. It covers version alignment, service parity, env var sync, package coverage, system deps, port forwarding, and build sequence.

2. Diagnose (when something is broken)

Read the guide in references/troubleshooting.md. Covers container build failures, health check failures, postCreateCommand step failures, env var mismatches, volume permissions, and DB migration conflicts.

3. Fix (apply changes)

After identifying drift or bugs:

  1. Make the minimal change to the affected file(s) per the file map above
  2. New .env.example keys needing container values: add sed rules to setup-env.sh with verification
  3. New service: add to .devcontainer/docker-compose.yml with health check + forward port in devcontainer.json
  4. Node.js or Yarn version change: update .devcontainer/Dockerfile (FROM line and corepack prepare)
  5. Update documentation (see step 4 below) — this is mandatory for every change

4. Update documentation (mandatory after every change)

Every dev container change MUST be reflected in both documentation files. Skipping this causes drift between implementation and docs.

.devcontainer/README.md — user-facing docs

Update the relevant section(s):

  • Services table — when adding/removing/upgrading a service
  • Named Volumes table — when adding/removing volumes
  • Lifecycle Hooks section — when changing bootstrap steps
  • Environment Variables section — when changing env var handling
  • Key Design Decisions table — when making a new architectural choice
  • Common Tasks table — when adding new developer commands
  • Updating the Dev Container table — when the maintenance protocol itself changes
  • Troubleshooting table — when discovering new failure modes or fixes

.ai/specs/SPEC-050-2026-02-26-dev-container-setup.md — spec

Use the om-spec-writing skill (/om-spec-writing) to update the spec properly. At minimum:

  • Changelog section: Add a dated entry with a concise summary of what changed and why
  • Architecture / Volume Strategy / Configuration tables: Update if services, volumes, ports, or versions changed
  • Design Decisions table: Add a row if a new architectural decision was made
  • Risk Register: Add/update entries if the change introduces or mitigates a risk
  • Service Versions table: Update when any image tag changes
  • Compliance Matrix: Re-verify if the change touches areas covered by root AGENTS.md rules

The spec-writing skill ensures the update follows project conventions (TLDR, structured sections, compliance gate).

Key Comparison Points

Version sources (regular setup) vs targets (dev container):

Tool Regular source Dev container target
Node.js .nvmrc + package.json engines .devcontainer/Dockerfile FROM node:<ver>-slim
Yarn package.json "packageManager" .devcontainer/Dockerfile corepack prepare yarn@<ver>
PostgreSQL docker-compose.yml image tag .devcontainer/docker-compose.yml postgres image
Redis docker-compose.yml image tag .devcontainer/docker-compose.yml redis image
Meilisearch docker-compose.yml image tag .devcontainer/docker-compose.yml meilisearch image

Environment variable flow:

apps/mercato/.env.example
  → .devcontainer/scripts/setup-env.sh (sed rewrites)
  → apps/mercato/.env (generated, overwritten on rebuild)
  → apps/mercato/.env.local (manual overrides, never touched)

Build sequence equivalence:

Regular:   yarn install → yarn build:packages → yarn generate → yarn build:packages → yarn initialize
Container: post-create.sh steps [0]-[7] mirror this exact sequence

Version History

  • c915d76 Current 2026-07-24 20:43

Same Skill Collection

.ai/skills/codex/backend-ui-design/SKILL.md
.ai/skills/om-app-spec-writing/SKILL.md
.ai/skills/om-auto-continue-pr-loop/SKILL.md
.ai/skills/om-auto-create-pr-loop/SKILL.md
.ai/skills/om-auto-publish-pr/SKILL.md
.ai/skills/om-auto-qa-scenarios/SKILL.md
.ai/skills/om-auto-review-pr/SKILL.md
.ai/skills/om-auto-sec-report-pr/SKILL.md
.ai/skills/om-auto-sec-report/SKILL.md
.ai/skills/om-auto-upgrade-0.4.10-to-0.5.0/SKILL.md
.ai/skills/om-backend-ui-design/SKILL.md
.ai/skills/om-code-review/SKILL.md
.ai/skills/om-create-agents-md/SKILL.md
.ai/skills/om-ds-guardian/SKILL.md
.ai/skills/om-fix-specs/SKILL.md
.ai/skills/om-followup-issue-from-pr/SKILL.md
.ai/skills/om-help/SKILL.md
.ai/skills/om-implement-spec/SKILL.md
.ai/skills/om-integration-builder/SKILL.md
.ai/skills/om-integration-tests/SKILL.md
.ai/skills/om-migrate-mikro-orm/SKILL.md
.ai/skills/om-pre-implement-spec/SKILL.md
.ai/skills/om-prepare-issue/SKILL.md
.ai/skills/om-prepare-test-env/SKILL.md
.ai/skills/om-skill-creator/SKILL.md
.ai/skills/om-smart-test/SKILL.md
.ai/skills/om-spec-writing/SKILL.md
.ai/skills/om-create-ai-agent/SKILL.md
.ai/skills/om-gap-analysis/SKILL.md

Metadata

Files
0
Version
d61843e
Hash
6cc3070b
Indexed
2026-07-24 20:43

Главная - Вики-сайт
Copyright © 2011-2026 iteam. Current version is 2.155.2. UTC+08:00, 2026-08-20 07:28
浙ICP备14020137号-1 $Гость$