Profile Bootstrap Skill
适用范围
- 触发:
devcodex profile plan/devcodex profile initCLI 调用,或用户以自然语言要求“生成/初始化/补建/升级/降档/修复当前项目 Profile”;自然语言不要求精确口令,最终仍解析为同一项目 ref 的 CLI plan/init - 初始化入口:
devcodex init使用同一生成契约初始化 workspace 基础 Profile;指定--profile <项目相对路径>时同时初始化目标项目 Profile,已有文件默认保留。后续通过devcodex profile plan/devcodex profile init --tier <档位>预览或补齐所需模板;init --claude等 workspace 宿主选择入口已禁用,不能当作 Profile 初始化方式。 - workspace-namespace:当
<workspace>/.devcodex/layout.json启用后,在工作区根执行devcodex profile init应治理.devcodex/workspace/profile/;在明确项目上下文执行时治理.devcodex/<project>/profile/。已识别物理项目但 Profile 缺失时仍保持 project-bound,使用 workspace base 并把项目事实标为未验证;只有完全没有项目时才落.devcodex/workspace/。运行时多项目 warning 必须提示.devcodex/workspace/profile/,不得继续指向 legacy.devcodex/profile/。 - Profile 初稿或复审必须考虑
ProfileReadChainGate/ServiceNormCoverageGate:记录 workspace base、project overlay、config.local overlay、fallback、全部服务集合、docs 自维护链、导航、版本、构建、报告和记忆消费者;从单服务抽公共 Profile 规则时执行StrongestProfileSourceGate/ServiceSpecificResidueSweep。 - 公开包、SDK、CLI、多模块、文档站、public API 或 runtime 配置明显的项目,Profile 初稿/复审必须执行
FeatureInventoryProfileGate/FeatureInventorySchemaGate:06-功能清单.md是默认唯一规范清单,新生成内容使用FeatureInventorySchemaV2,在 V1 十字段基础上增加生命周期状态、证据状态、证据日期和证据引用;扫描不能证明的字段写unverified/ 待人工确认,不得编造成 implemented/validated/released。validator 兼容读取 V1,但 V1 投影证据状态必须保持unverified。 - 执行
ProfileGenerationContractGate/ProfileTierStandardGate/ProfileLifecycleClassificationGate:生成器、CLI、加载器、validator、Prompt 和公开文档必须消费同一档位契约。首次创建默认仍以profile-lite为目标,但必须展示基于 package/目录/脚本证据的推荐档位;用户通过--tier明确选择后才升级。 - 执行
ProfileTierMigrationSafetyGate:默认继承已检测档位;升级只补缺失文件并保留已有正文;未带--allow-downgrade时拒绝降档;显式降档只改档位声明并保留高档文件;--dry-run/profile plan对目录、文件和备份必须零写入。 - 执行
ProfilePathPortabilityGate:新生成 Profile 的直属 README 声明portable-v1;项目内路径写语义根或相对路径,真实本机外部路径用同一行 machine-local marker 标注。只验证本次显式目标 Profile,禁止为了迁移一个项目而枚举或修改同工作区其他项目;未声明该契约的 legacy Profile 保持兼容。 - 执行
AllDevCodexProfileValidationGate:workspace-namespace、规范维护项目或用户要求全项目校验时,生成/复审后运行node scripts/validate-all-profiles.js --workspace <workspace-root>或记录不可执行原因。 - 执行
ProfileGitExecutionPolicyGate:新 Profile 的extensions.devcodex.git默认写unverified / no-auto-branch / explicit-only / unverified integration / sharedActionsRequireExplicitAuthorization=true;只有项目事实与证据明确时才把 project overlay 收窄为solo/keep-current或团队策略,overlay 不得把共享动作授权降为 false。 - 执行
ProfileReleaseTruthAuthorityMatrixGate:DevCodex Profile 草稿或同步不得从历史 changelog/versioned docs 推断当前版本;以 package/plugin 为 release authority,对账 project 01/05/07 与标明 DevCodex 规范版本的 workspace 01。发现 current claim 漂移时生成修订动作并让 validator 非零,历史 release 与06分能力状态保持原语义。
三档生成策略
| 档位 | Bootstrap 行为 | 后续补齐 |
|---|---|---|
profile-lite | 默认生成 README.md、01-项目信息.md、02-架构约束.md、03-代码风格.md、config.json | 人工复核后定稿 |
profile-standard | 生成 lite 全部文件 + 04-测试规范.md + 05-发布规范.md + 06-功能清单.md;未验证事实保持显式未确认 | 由真实脚本、CI、发布流程和源码证据复核 FeatureInventorySchemaV2;兼容读取 V1 |
profile-closed-loop | 生成 standard 全部文件 + 07-用户文档与契约规范.md;适用于规范维护、SDK/CLI/文档站/public API 等完整闭环项目 | 持续维护活文档,必要时补条件 / 本地文档 |
生命周期分类:
- 稳定基线:项目事实变化才更新。
- 活文档:功能、API/CLI/Hook、测试、发布、文档站、配置或用户文档变化时同步更新。
- 条件 / 本地文档:命中本地连接、数据、服务、外部系统或 overlay 时维护;
conditional-required不作为项目档位。
产出 profile-lite 初稿
01-项目信息.md
数据源:
| 来源 | 字段 |
|---|---|
package.json | name / version / description / repository / engines.node |
CHANGELOG.md 首行表格 | 当前版本 / 当前阶段标题 |
.git/HEAD 或 git symbolic-ref HEAD | 当前分支 |
git config remote.origin.url | 仓库 URL(兜底) |
写入模板:
markdown# 01 — 项目信息 > 由 `devcodex profile init` 于 {YYYY-MM-DD} 自动生成,需人工复核后定稿。 ## 基础信息 - 项目名:{name} - 当前版本:{version} - 描述:{description} - Node 版本:{engines.node} - 仓库:{repository.url} ## 当前阶段 - 主版本分支:{branch} - 阶段摘要:{CHANGELOG 顶部摘要}
02-架构约束.md
数据源:
| 来源 | 字段 |
|---|---|
顶层目录扫描(深度 ≤2,跳过 node_modules/.git/dist/build) | 目录树 |
lerna.json / pnpm-workspace.yaml / package.json#workspaces | monorepo 识别 |
tsconfig.json 中的 references | 子项目关系 |
顶层 services/ 或 packages/ 目录存在 | 服务/包结构 |
写入模板:
markdown# 02 — 架构约束 > 由 `devcodex profile init` 于 {YYYY-MM-DD} 自动生成,需人工复核后定稿。 ## 项目结构(自动扫描) \`\`\` {目录树,深度2} \`\`\` ## 架构特征 - 组织模式:{single | monorepo:lerna | monorepo:pnpm | monorepo:npm} - 服务拆分:{有 services/N | 无}
03-代码风格.md
数据源:
| 来源 | 推断 |
|---|---|
.eslintrc* / eslint.config.* | ESLint 启用 + 主要规则集 |
.prettierrc* / prettier.config.* | Prettier 启用 + 主要选项 |
tsconfig.json | TypeScript strict / target / module |
.editorconfig | indent / charset |
package.json#scripts | lint / format / test 命令 |
写入模板:
markdown# 03 — 代码风格 > 由 `devcodex profile init` 于 {YYYY-MM-DD} 自动生成,需人工复核后定稿。 ## 静态检查 - ESLint:{启用 + extends 摘要 | 未启用} - Prettier:{启用 + 主要选项 | 未启用} - TypeScript:{strict {bool} / target {ES2022} | 未启用} ## 编辑器 - 缩进:{2/4 space | tab} - 字符集:{utf-8} ## 工程命令 - lint: `{package.json scripts.lint | 未定义}` - format: `{package.json scripts.format | 未定义}` - test: `{package.json scripts.test | 未定义}`
config.json
json{ "mode": "dev", "agent": "copilot | claude-code | codex", "extensions": { "devcodex": { "language": { "schemaVersion": "LanguagePreferenceV1", "mode": "auto | inherit", "locale": null } } } }
mode默认dev(仅devcodex profile init --prod时设为 prod)agent从当前宿主证据推断;无法识别时才回退为copilot- workspace Profile 的语言默认
auto;project Profile 默认inherit。用户可把目标层改为fixed并配置 locale;projectauto明确抑制 workspace fixed。语言配置无效时只对该层降级为自动判断,不得阻断任务。
CLI 行为
Node.js 默认基线
- 生成或复核 Node.js 项目 Profile 时,
engines.node缺失或低于>=18应标注为待人工确认的风险。 - 新项目或新包默认建议
Node 版本:>=18;低于 v18 只能作为项目例外,并须在01-项目信息.md写明业务理由、兼容风险和验证证据。 - CI matrix、README 运行时说明和 Profile 的 Node 基线应保持一致。
devcodex profile plan / devcodex profile init --dry-run
先输出目标 Profile 根、已检测档位、请求档位、推荐档位、目标档位、mode 和逐文件动作;不得创建目录、写文件或创建备份。推荐路径是先运行 plan,再运行相同参数的 init。
devcodex profile init
| 步骤 | 动作 |
|---|---|
| 1 | 检查目标 Profile 根是否存在 → legacy 为 .devcodex/profile/,workspace-namespace 工作区根为 .devcodex/workspace/profile/,明确项目为 .devcodex/<project>/profile/;缺失时先形成 zero-write preview 与唯一目标 receipt |
| 2 | 检测现有档位;未显式指定 --tier 时继承现有档位,首次创建默认 profile-lite,同时输出证据驱动的推荐档位 |
| 3 | 纯 create-missing 在 physical project .tmp/devcodex-profile/<operationId> 生成完整 staging,校验 UTF-8、tier、portable marker、JSON 与既有 Profile validator,再执行 target-absent CAS 和同卷整目录 rename;锁绑定 owner token 与有界租期,启动时只回收已过期 owner 的精确 operation,失锁旧进程不得提交或删除新 owner 锁;目录已提交但读回中断时,下次运行补做 manifest 读回;失败只精确清理本 operationId,不得留下半套 Profile |
| 4 | 输出生成/跳过/档位更新/备份计数与 ProfileMaterializationReceiptV1;自动生成生命周期只能是 generated-draft,必须提示人工复核所有 unverified 字段,不能把 validator 通过冒充 reviewed |
| 5 | 退出码 0(即使全部 skip) |
create-missing 之外的已有 Profile、--force、升级和显式降档保持原有逐文件兼容路径;自动补给不得覆盖、降档或修改兄弟项目。重复 create-missing 在目标已存在时返回 unchanged。
devcodex profile init --force
| 步骤 | 行为差异 |
|---|---|
| 2 | 继承当前档位并覆盖该档位的已有文件;每个文件先备份为 <file>.bak.{timestamp} |
档位迁移
- 升级:
devcodex profile plan --tier profile-standard预览,确认后以profile init执行;只补目标档位缺失文件,README 仅更新档位声明。 - 降档:必须显式同时传
--tier <lower-tier> --allow-downgrade;高档文件保留,避免不可逆信息损失。 - 未知参数、缺少
--tier值或非法档位必须友好失败,退出码为 1,不输出内部堆栈。
devcodex status 扩展
输出新增一行:
textprofile complete (profile-standard; files 6/6; semantic 2/2; config present) profile partial (profile-standard; files 5/6; semantic 1/2; config missing) profile missing (files 0/4; semantic 0/1; config missing — run: devcodex profile plan)
与其他规范的对齐
| 关联点 | 说明 |
|---|---|
15-memory.instructions.md | agent 字段必须使用固定枚举 |
02-架构约束.md 项目级文件 | 本 Skill 生成的是 模板初稿,定稿规则不变(须人工填入业务约束) |
| Profile 缺失行为 | Profile 缺失时 ENV_MODE 默认 prod;本 Skill 推动用户尽早完成 dev 模式启用 |
| Git 默认 | 未核实协作模式时不自动创建/切换分支;branch/worktree/commit/cherry-pick/push 分项授权,Profile 声明不等于本轮执行授权 |
⛔ 禁止
- ⛔ 已有 Profile 文件存在时禁止默认覆盖(须
--force才覆盖且必须先备份) - ⛔
profile plan/--dry-run禁止写目录、文件或备份;未显式授权禁止降档 - ⛔ 功能清单禁止用关键词命中或无事实来源的占位行冒充完成;
01-项目信息.md不得复制06-功能清单.md的完整规范表 - ⛔ 自动扫描默认不主动读取
.env/.env.local等文件;用户或项目明确要求读取时可按指定范围读取并写入 Profile 说明 - ⛔ 禁止在 Profile 长期规范中固化当前工作盘符 / 用户目录;禁止借路径迁移扫描或修改非目标项目
- ⛔ 生成内容须明确标注"由
devcodex profile init自动生成,需人工复核"


