live-dev-init

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

live-dev-init

live-dev-init

This skill initializes the development environment and performs preflight checks before any other deployment or configuration tasks are run.
bash
blocks are POSIX (Git Bash on Windows). Any logic beyond one command/pipe lives in
resources/*.js
(if applicable), never in shell control flow. If your Bash tool is cmd.exe or PowerShell, translate each snippet before running it.
本技能用于初始化开发环境,并在执行任何其他部署或配置任务前执行预检查。
bash
代码块采用POSIX标准(Windows系统使用Git Bash)。若涉及多条命令或管道的逻辑,需放在
resources/*.js
中(如适用),绝不能写在shell控制流里。如果你的Bash工具是cmd.exe或PowerShell,请在运行前转换每个代码片段。

1. Preflight (run silently, before planning)

1. 预检查(静默运行,在规划阶段前执行)

CheckProbeOn fail
git, gh
command -v git
,
command -v gh
,
gh auth status
run
scripts/install-git-gh-macos.command
|
scripts/install-git-gh-windows.ps1
. Never improvise install steps.
node
node --version
scripts/toolchain/catalog.json:node_lts_major
scripts/course-toolchain-macos.command base
|
scripts/course-toolchain-windows.ps1 -Profile base
vercel, firebase
npx vercel whoami
,
npx firebase login:list
npm install -D vercel firebase-tools
(never
-g
: EACCES). Login must pass before setting up config or deploying.
gitleaks
command -v gitleaks
install per table below, re-probe, never skip the scan gate
OSInstallFallback
macOS
brew install gitleaks
— brew may NOT exist (course installer uses Xcode CLT + curl, not brew)
curl latest release
gitleaks_*_darwin_$(uname -m).tar.gz
→ extract to
~/.local/bin
(mkdir + append to shell profile if absent). No sudo, no
/usr/local/bin
.
Windows
winget install gitleaks.gitleaks
download
gitleaks_*_windows_x64.zip
→ extract
gitleaks.exe
%USERPROFILE%\bin
setx PATH "%PATH%;%USERPROFILE%\bin"
.
~/.local/bin
and shell profiles do not apply here.
Then repair project state:
File / stateRequired valueNote
.nvmrc
catalog.json:node_lts_major
Sole source of truth.
resources/vercel-preview.yml
reads
node-version-file: '.nvmrc'
— never hardcode a Node major in the yml.
.gitignore
.env
,
.env.local
,
.env*.local
, service-account JSON glob
Repair before the first commit ever exists — the vault policy assumes these are ignored.
branch
develop
exists (else propose from
main
); work on
feature/<name>
off
develop
Secret Vault Policy (hard rule, no override). Credentials live only in Vercel Env Vars / GitHub Secrets / gitignored
.env.local
. Never hardcode in code, never commit real
.env
values, never print a real secret to chat, logs, or commit messages.
检查项检测方式失败处理
git、gh
command -v git
command -v gh
gh auth status
运行
scripts/install-git-gh-macos.command
scripts/install-git-gh-windows.ps1
。严禁自行编写安装步骤。
node
node --version
版本需 ≥
scripts/toolchain/catalog.json:node_lts_major
运行
scripts/course-toolchain-macos.command base
scripts/course-toolchain-windows.ps1 -Profile base
vercel、firebase
npx vercel whoami
npx firebase login:list
执行
npm install -D vercel firebase-tools
(绝不能使用
-g
参数,避免EACCES权限问题)。必须登录成功后才能进行配置设置或部署。
gitleaks
command -v gitleaks
按下方表格安装,重新检测,严禁跳过扫描环节
操作系统安装方式备选方案
macOS
brew install gitleaks
— 注意brew可能未安装(课程安装器使用Xcode CLT + curl,而非brew)
下载最新版本的
gitleaks_*_darwin_$(uname -m).tar.gz
→ 解压至
~/.local/bin
(若该目录不存在则创建,并添加到shell配置文件中)。禁止使用sudo,禁止安装到
/usr/local/bin
Windows
winget install gitleaks.gitleaks
下载
gitleaks_*_windows_x64.zip
→ 解压出
gitleaks.exe
→ 放入
%USERPROFILE%\bin
→ 执行
setx PATH "%PATH%;%USERPROFILE%\bin"
。此处不适用
~/.local/bin
和shell配置文件。
随后修复项目状态:
文件/状态必填值说明
.nvmrc
catalog.json:node_lts_major
这是唯一的可信来源。
resources/vercel-preview.yml
中配置了
node-version-file: '.nvmrc'
— 绝不能在yml文件中硬编码Node主版本号。
.gitignore
需包含
.env
.env.local
.env*.local
、服务账号JSON通配符
必须在第一次提交前修复 — 密钥库策略默认这些文件已被忽略。
分支
develop
分支必须存在(若不存在则从
main
分支创建);基于
develop
分支创建
feature/<name>
分支进行开发
密钥库策略(硬性规则,不可覆盖):凭据只能存储在Vercel环境变量/GitHub Secrets/已被git忽略的
.env.local
文件中。严禁在代码中硬编码,严禁提交真实的
.env
值,严禁在聊天、日志或提交信息中打印真实密钥。