env-setup-assistant
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseEnvironment Setup Assistant Skill
环境搭建助手Skill
Overview
概述
This skill helps you create reproducible, developer-friendly environments. Covers IDE configuration, tool installation, dependency management, onboarding documentation, and cross-platform compatibility.
本Skill可帮助你创建可复现、对开发者友好的环境,涵盖IDE配置、工具安装、依赖管理、入职文档编写及跨平台兼容性适配。
Environment Setup Philosophy
环境搭建理念
Principles
原则
- One command setup: New developers should run one command
- Reproducible: Same environment everywhere
- Documented: Clear instructions for edge cases
- Versioned: Lock tool and dependency versions
- 一键搭建:新开发者只需运行一条命令
- 可复现:在任何环境下都能得到相同的配置
- 文档化:针对边缘场景提供清晰说明
- 版本化:锁定工具和依赖的版本
Goals
目标
- DO: Automate everything possible
- DO: Detect and report issues early
- DO: Support multiple platforms (macOS, Linux, Windows)
- DON'T: Assume global installations
- DON'T: Require manual steps without documentation
- 要做:尽可能自动化所有流程
- 要做:尽早检测并报告问题
- 要做:支持多平台(macOS、Linux、Windows)
- 不要:依赖全局安装
- 不要:要求无文档说明的手动操作
Project Setup Script
项目搭建脚本
Comprehensive Setup Script
全面搭建脚本
bash
#!/bin/bashbash
#!/bin/bashscripts/setup.sh
scripts/setup.sh
set -e # Exit on error
set -e # Exit on error
Colors for output
Colors for output
RED='\033[0;31m'
GREEN='\033[0;32m'
YELLOW='\033[1;33m'
NC='\033[0m' # No Color
log_info() { echo -e "${GREEN}[INFO]${NC} $1"; }
log_warn() { echo -e "${YELLOW}[WARN]${NC} $1"; }
log_error() { echo -e "${RED}[ERROR]${NC} $1"; }
RED='\033[0;31m'
GREEN='\033[0;32m'
YELLOW='\033[1;33m'
NC='\033[0m' # No Color
log_info() { echo -e "${GREEN}[INFO]${NC} $1"; }
log_warn() { echo -e "${YELLOW}[WARN]${NC} $1"; }
log_error() { echo -e "${RED}[ERROR]${NC} $1"; }
===================
===================
Check Prerequisites
Check Prerequisites
===================
===================
check_command() {
if ! command -v "$1" &> /dev/null; then
log_error "$1 is not installed"
return 1
fi
log_info "$1 found: $(command -v $1)"
return 0
}
check_prerequisites() {
log_info "Checking prerequisites..."
local missing=0
check_command "node" || missing=$((missing + 1))
check_command "npm" || missing=$((missing + 1))
check_command "git" || missing=$((missing + 1))
# Check Node version
local node_version=$(node -v | cut -d'v' -f2)
local required_version="18.0.0"
if ! [ "$(printf '%s\n' "$required_version" "$node_version" | sort -V | head -n1)" = "$required_version" ]; then
log_error "Node.js version must be >= $required_version (found: $node_version)"
missing=$((missing + 1))
fi
if [ $missing -gt 0 ]; then
log_error "$missing prerequisite(s) missing"
echo ""
echo "Install missing tools:"
echo " - Node.js: https://nodejs.org/ or 'nvm install 20'"
echo " - Git: https://git-scm.com/"
exit 1
fi
log_info "All prerequisites met!"}
check_command() {
if ! command -v "$1" &> /dev/null; then
log_error "$1 is not installed"
return 1
fi
log_info "$1 found: $(command -v $1)"
return 0
}
check_prerequisites() {
log_info "Checking prerequisites..."
local missing=0
check_command "node" || missing=$((missing + 1))
check_command "npm" || missing=$((missing + 1))
check_command "git" || missing=$((missing + 1))
# Check Node version
local node_version=$(node -v | cut -d'v' -f2)
local required_version="18.0.0"
if ! [ "$(printf '%s\n' "$required_version" "$node_version" | sort -V | head -n1)" = "$required_version" ]; then
log_error "Node.js version must be >= $required_version (found: $node_version)"
missing=$((missing + 1))
fi
if [ $missing -gt 0 ]; then
log_error "$missing prerequisite(s) missing"
echo ""
echo "Install missing tools:"
echo " - Node.js: https://nodejs.org/ or 'nvm install 20'"
echo " - Git: https://git-scm.com/"
exit 1
fi
log_info "All prerequisites met!"}
===================
===================
Environment Setup
Environment Setup
===================
===================
setup_env() {
log_info "Setting up environment..."
if [ ! -f .env ]; then
if [ -f .env.example ]; then
cp .env.example .env
log_info "Created .env from .env.example"
log_warn "Please update .env with your values"
else
log_error "No .env.example found"
exit 1
fi
else
log_info ".env already exists"
fi}
setup_env() {
log_info "Setting up environment..."
if [ ! -f .env ]; then
if [ -f .env.example ]; then
cp .env.example .env
log_info "Created .env from .env.example"
log_warn "Please update .env with your values"
else
log_error "No .env.example found"
exit 1
fi
else
log_info ".env already exists"
fi}
===================
===================
Install Dependencies
Install Dependencies
===================
===================
install_dependencies() {
log_info "Installing dependencies..."
npm ci
log_info "Dependencies installed!"}
install_dependencies() {
log_info "Installing dependencies..."
npm ci
log_info "Dependencies installed!"}
===================
===================
Setup Git Hooks
Setup Git Hooks
===================
===================
setup_git_hooks() {
log_info "Setting up Git hooks..."
npx husky install 2>/dev/null || log_warn "Husky not configured"
log_info "Git hooks configured!"}
setup_git_hooks() {
log_info "Setting up Git hooks..."
npx husky install 2>/dev/null || log_warn "Husky not configured"
log_info "Git hooks configured!"}
===================
===================
Database Setup
Database Setup
===================
===================
setup_database() {
log_info "Setting up database..."
# Check if database is running
if ! pg_isready -h localhost -p 5432 &>/dev/null; then
log_warn "PostgreSQL not running on localhost:5432"
log_info "Start with: docker-compose up -d db"
return
fi
# Run migrations
npm run db:migrate 2>/dev/null || log_warn "No migrations to run"
# Seed data (development only)
if [ "$NODE_ENV" != "production" ]; then
npm run db:seed 2>/dev/null || log_warn "No seed script found"
fi
log_info "Database setup complete!"}
setup_database() {
log_info "Setting up database..."
# Check if database is running
if ! pg_isready -h localhost -p 5432 &>/dev/null; then
log_warn "PostgreSQL not running on localhost:5432"
log_info "Start with: docker-compose up -d db"
return
fi
# Run migrations
npm run db:migrate 2>/dev/null || log_warn "No migrations to run"
# Seed data (development only)
if [ "$NODE_ENV" != "production" ]; then
npm run db:seed 2>/dev/null || log_warn "No seed script found"
fi
log_info "Database setup complete!"}
===================
===================
Verify Setup
Verify Setup
===================
===================
verify_setup() {
log_info "Verifying setup..."
# Type check
npm run typecheck 2>/dev/null && log_info "TypeScript: OK" || log_warn "TypeScript check failed"
# Lint
npm run lint 2>/dev/null && log_info "Linting: OK" || log_warn "Linting issues found"
# Build test
npm run build 2>/dev/null && log_info "Build: OK" || log_error "Build failed"}
verify_setup() {
log_info "Verifying setup..."
# Type check
npm run typecheck 2>/dev/null && log_info "TypeScript: OK" || log_warn "TypeScript check failed"
# Lint
npm run lint 2>/dev/null && log_info "Linting: OK" || log_warn "Linting issues found"
# Build test
npm run build 2>/dev/null && log_info "Build: OK" || log_error "Build failed"}
===================
===================
Main
Main
===================
===================
main() {
echo ""
echo "================================"
echo " Project Setup"
echo "================================"
echo ""
check_prerequisites
echo ""
setup_env
echo ""
install_dependencies
echo ""
setup_git_hooks
echo ""
setup_database
echo ""
verify_setup
echo ""
echo "================================"
echo " Setup Complete!"
echo "================================"
echo ""
echo "Next steps:"
echo " 1. Update .env with your values"
echo " 2. Start development: npm run dev"
echo " 3. Open http://localhost:3000"
echo ""}
main "$@"
undefinedmain() {
echo ""
echo "================================"
echo " Project Setup"
echo "================================"
echo ""
check_prerequisites
echo ""
setup_env
echo ""
install_dependencies
echo ""
setup_git_hooks
echo ""
setup_database
echo ""
verify_setup
echo ""
echo "================================"
echo " Setup Complete!"
echo "================================"
echo ""
echo "Next steps:"
echo " 1. Update .env with your values"
echo " 2. Start development: npm run dev"
echo " 3. Open http://localhost:3000"
echo ""}
main "$@"
undefinedVersion Management
版本管理
.nvmrc / .node-version
.nvmrc / .node-version
20.10.020.10.0Tool Versions (asdf)
工具版本(asdf)
ini
undefinedini
undefined.tool-versions
.tool-versions
nodejs 20.10.0
pnpm 8.12.0
python 3.11.6
undefinednodejs 20.10.0
pnpm 8.12.0
python 3.11.6
undefinedVolta Configuration
Volta配置
json
// package.json
{
"volta": {
"node": "20.10.0",
"npm": "10.2.5"
}
}json
// package.json
{
"volta": {
"node": "20.10.0",
"npm": "10.2.5"
}
}IDE Configuration
IDE配置
VSCode Settings
VSCode设置
json
// .vscode/settings.json
{
// Editor
"editor.formatOnSave": true,
"editor.defaultFormatter": "esbenp.prettier-vscode",
"editor.codeActionsOnSave": {
"source.fixAll.eslint": "explicit",
"source.organizeImports": "explicit"
},
"editor.tabSize": 2,
"editor.insertSpaces": true,
"editor.rulers": [80, 120],
// Files
"files.trimTrailingWhitespace": true,
"files.insertFinalNewline": true,
"files.exclude": {
"**/.git": true,
"**/node_modules": true,
"**/.next": true
},
// TypeScript
"typescript.preferences.importModuleSpecifier": "relative",
"typescript.updateImportsOnFileMove.enabled": "always",
"typescript.tsdk": "node_modules/typescript/lib",
// Tailwind
"tailwindCSS.experimental.classRegex": [
["cva\\(([^)]*)\\)", "[\"'`]([^\"'`]*).*?[\"'`]"],
["cn\\(([^)]*)\\)", "[\"'`]([^\"'`]*).*?[\"'`]"]
],
// ESLint
"eslint.validate": [
"javascript",
"javascriptreact",
"typescript",
"typescriptreact"
],
// Prettier
"[typescript]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"
},
"[typescriptreact]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"
},
"[json]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"
}
}json
// .vscode/settings.json
{
// Editor
"editor.formatOnSave": true,
"editor.defaultFormatter": "esbenp.prettier-vscode",
"editor.codeActionsOnSave": {
"source.fixAll.eslint": "explicit",
"source.organizeImports": "explicit"
},
"editor.tabSize": 2,
"editor.insertSpaces": true,
"editor.rulers": [80, 120],
// Files
"files.trimTrailingWhitespace": true,
"files.insertFinalNewline": true,
"files.exclude": {
"**/.git": true,
"**/node_modules": true,
"**/.next": true
},
// TypeScript
"typescript.preferences.importModuleSpecifier": "relative",
"typescript.updateImportsOnFileMove.enabled": "always",
"typescript.tsdk": "node_modules/typescript/lib",
// Tailwind
"tailwindCSS.experimental.classRegex": [
["cva\\(([^)]*)\\)", "[\"'`]([^\"'`]*).*?[\"'`]"],
["cn\\(([^)]*)\\)", "[\"'`]([^\"'`]*).*?[\"'`]"]
],
// ESLint
"eslint.validate": [
"javascript",
"javascriptreact",
"typescript",
"typescriptreact"
],
// Prettier
"[typescript]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"
},
"[typescriptreact]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"
},
"[json]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"
}
}VSCode Extensions
VSCode扩展
json
// .vscode/extensions.json
{
"recommendations": [
// Essential
"esbenp.prettier-vscode",
"dbaeumer.vscode-eslint",
"bradlc.vscode-tailwindcss",
// TypeScript
"ms-vscode.vscode-typescript-next",
"yoavbls.pretty-ts-errors",
// React/Next.js
"dsznajder.es7-react-js-snippets",
"formulahendry.auto-rename-tag",
// Git
"eamodio.gitlens",
"mhutchie.git-graph",
// Productivity
"streetsidesoftware.code-spell-checker",
"usernamehw.errorlens",
"christian-kohler.path-intellisense",
// Theme (optional)
"GitHub.github-vscode-theme"
],
"unwantedRecommendations": []
}json
// .vscode/extensions.json
{
"recommendations": [
// Essential
"esbenp.prettier-vscode",
"dbaeumer.vscode-eslint",
"bradlc.vscode-tailwindcss",
// TypeScript
"ms-vscode.vscode-typescript-next",
"yoavbls.pretty-ts-errors",
// React/Next.js
"dsznajder.es7-react-js-snippets",
"formulahendry.auto-rename-tag",
// Git
"eamodio.gitlens",
"mhutchie.git-graph",
// Productivity
"streetsidesoftware.code-spell-checker",
"usernamehw.errorlens",
"christian-kohler.path-intellisense",
// Theme (optional)
"GitHub.github-vscode-theme"
],
"unwantedRecommendations": []
}VSCode Launch Configuration
VSCode启动配置
json
// .vscode/launch.json
{
"version": "0.2.0",
"configurations": [
{
"name": "Next.js: debug server-side",
"type": "node",
"request": "attach",
"port": 9229,
"skipFiles": ["<node_internals>/**"]
},
{
"name": "Next.js: debug client-side",
"type": "chrome",
"request": "launch",
"url": "http://localhost:3000"
},
{
"name": "Next.js: debug full stack",
"type": "node",
"request": "launch",
"program": "${workspaceFolder}/node_modules/.bin/next",
"args": ["dev"],
"cwd": "${workspaceFolder}",
"console": "integratedTerminal"
},
{
"name": "Jest: current file",
"type": "node",
"request": "launch",
"program": "${workspaceFolder}/node_modules/.bin/jest",
"args": [
"${fileBasename}",
"--config",
"jest.config.js",
"--runInBand"
],
"console": "integratedTerminal"
}
]
}json
// .vscode/launch.json
{
"version": "0.2.0",
"configurations": [
{
"name": "Next.js: debug server-side",
"type": "node",
"request": "attach",
"port": 9229,
"skipFiles": ["<node_internals>/**"]
},
{
"name": "Next.js: debug client-side",
"type": "chrome",
"request": "launch",
"url": "http://localhost:3000"
},
{
"name": "Next.js: debug full stack",
"type": "node",
"request": "launch",
"program": "${workspaceFolder}/node_modules/.bin/next",
"args": ["dev"],
"cwd": "${workspaceFolder}",
"console": "integratedTerminal"
},
{
"name": "Jest: current file",
"type": "node",
"request": "launch",
"program": "${workspaceFolder}/node_modules/.bin/jest",
"args": [
"${fileBasename}",
"--config",
"jest.config.js",
"--runInBand"
],
"console": "integratedTerminal"
}
]
}EditorConfig
EditorConfig配置
ini
undefinedini
undefined.editorconfig
.editorconfig
root = true
[*]
indent_style = space
indent_size = 2
end_of_line = lf
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true
[*.md]
trim_trailing_whitespace = false
[Makefile]
indent_style = tab
undefinedroot = true
[*]
indent_style = space
indent_size = 2
end_of_line = lf
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true
[*.md]
trim_trailing_whitespace = false
[Makefile]
indent_style = tab
undefinedGit Configuration
Git配置
.gitattributes
.gitattributes
gitattributes
undefinedgitattributes
undefined.gitattributes
.gitattributes
Auto detect text files
Auto detect text files
- text=auto eol=lf
- text=auto eol=lf
Documents
Documents
*.md text
*.txt text
*.md text
*.txt text
Source code
Source code
*.js text
*.jsx text
*.ts text
*.tsx text
*.css text
*.scss text
*.html text
*.json text
*.yaml text
*.yml text
*.js text
*.jsx text
*.ts text
*.tsx text
*.css text
*.scss text
*.html text
*.json text
*.yaml text
*.yml text
Docker
Docker
Dockerfile text
Dockerfile text
Shell
Shell
*.sh text eol=lf
*.sh text eol=lf
Windows
Windows
*.bat text eol=crlf
*.bat text eol=crlf
Binary
Binary
*.png binary
*.jpg binary
*.jpeg binary
*.gif binary
*.ico binary
*.woff binary
*.woff2 binary
*.ttf binary
*.eot binary
*.pdf binary
undefined*.png binary
*.jpg binary
*.jpeg binary
*.gif binary
*.ico binary
*.woff binary
*.woff2 binary
*.ttf binary
*.eot binary
*.pdf binary
undefinedPre-commit Hooks (Husky + lint-staged)
提交前钩子(Husky + lint-staged)
json
// package.json
{
"scripts": {
"prepare": "husky install"
},
"lint-staged": {
"*.{js,jsx,ts,tsx}": [
"eslint --fix",
"prettier --write"
],
"*.{json,md,yml,yaml}": [
"prettier --write"
]
}
}bash
undefinedjson
// package.json
{
"scripts": {
"prepare": "husky install"
},
"lint-staged": {
"*.{js,jsx,ts,tsx}": [
"eslint --fix",
"prettier --write"
],
"*.{json,md,yml,yaml}": [
"prettier --write"
]
}
}bash
undefined.husky/pre-commit
.husky/pre-commit
#!/bin/sh
. "$(dirname "$0")/_/husky.sh"
npx lint-staged
```bash#!/bin/sh
. "$(dirname "$0")/_/husky.sh"
npx lint-staged
```bash.husky/commit-msg
.husky/commit-msg
#!/bin/sh
. "$(dirname "$0")/_/husky.sh"
npx --no-install commitlint --edit "$1"
undefined#!/bin/sh
. "$(dirname "$0")/_/husky.sh"
npx --no-install commitlint --edit "$1"
undefinedOnboarding Documentation
入职文档
CONTRIBUTING.md Template
CONTRIBUTING.md模板
markdown
undefinedmarkdown
undefinedContributing Guide
贡献指南
Getting Started
快速上手
Prerequisites
前置要求
Quick Start
快速启动
bash
undefinedbash
undefinedClone the repository
克隆仓库
git clone https://github.com/org/project.git
cd project
git clone https://github.com/org/project.git
cd project
Run setup script
运行搭建脚本
./scripts/setup.sh
./scripts/setup.sh
Start development server
启动开发服务器
npm run dev
Open [http://localhost:3000](http://localhost:3000)npm run dev
打开 [http://localhost:3000](http://localhost:3000)Manual Setup
手动搭建
If the setup script doesn't work:
-
Install dependenciesbash
npm install -
Set up environmentbash
cp .env.example .env # Edit .env with your values -
Start servicesbash
docker-compose up -d -
Run migrationsbash
npm run db:migrate
如果搭建脚本无法运行:
-
安装依赖bash
npm install -
配置环境变量bash
cp .env.example .env # 编辑.env文件填入你的配置值 -
启动服务bash
docker-compose up -d -
运行数据库迁移bash
npm run db:migrate
Development Workflow
开发流程
Branch Naming
分支命名规范
- - New features
feature/description - - Bug fixes
fix/description - - Maintenance
chore/description - - Documentation
docs/description
- - 新功能
feature/description - - Bug修复
fix/description - - 维护任务
chore/description - - 文档更新
docs/description
Commit Messages
提交信息规范
We use Conventional Commits:
type(scope): description
[optional body]
[optional footer]Types: , , , , , ,
featfixdocsstylerefactortestchore我们遵循Conventional Commits规范:
type(scope): description
[可选正文]
[可选页脚]类型:(功能)、(修复)、(文档)、(格式)、(重构)、(测试)、(维护)
featfixdocsstylerefactortestchorePull Requests
拉取请求流程
- Create a branch from
main - Make your changes
- Run tests:
npm test - Run linting:
npm run lint - Create PR against
main
- 从分支创建新分支
main - 进行代码修改
- 运行测试:
npm test - 运行代码检查:
npm run lint - 创建针对分支的拉取请求
main
Available Scripts
可用脚本
| Command | Description |
|---|---|
| Start development server |
| Build for production |
| Run tests |
| Run linting |
| Run TypeScript checks |
| 命令 | 描述 |
|---|---|
| 启动开发服务器 |
| 构建生产版本 |
| 运行测试 |
| 运行代码检查 |
| 运行TypeScript类型检查 |
Architecture
架构说明
[Brief overview of project structure]
[项目结构简要概述]
Getting Help
获取帮助
- Check existing issues
- Ask in #dev-help Slack channel
- Reach out to @maintainer
undefined- 查看现有issues
- 在#dev-help Slack频道提问
- 联系@maintainer
undefinedDeveloper Onboarding Checklist
开发者入职清单
markdown
undefinedmarkdown
undefinedNew Developer Onboarding
新开发者入职指南
Day 1 - Environment Setup
第1天 - 环境搭建
- Clone repository
- Run setup script
- Verify development server starts
- Install IDE extensions
- Join Slack channels: #dev, #dev-help
- 克隆仓库
- 运行搭建脚本
- 验证开发服务器可正常启动
- 安装IDE扩展
- 加入Slack频道:#dev、#dev-help
Day 1 - Access
第1天 - 权限配置
- GitHub repository access
- Vercel team access
- Supabase project access
- 1Password vault access
- Figma access
- 获取GitHub仓库访问权限
- 获取Vercel团队访问权限
- 获取Supabase项目访问权限
- 获取1Password密码库访问权限
- 获取Figma访问权限
Week 1 - Understanding
第1周 - 项目认知
- Read CONTRIBUTING.md
- Review project architecture
- Complete starter task
- Pair with team member
- 阅读CONTRIBUTING.md
- 了解项目架构
- 完成入门任务
- 与团队成员结对开发
Helpful Links
实用链接
- Project Documentation
- Design System
- API Documentation
undefined- 项目文档
- 设计系统
- API文档
undefinedCross-Platform Compatibility
跨平台兼容性
Platform Detection Script
平台检测脚本
bash
undefinedbash
undefinedscripts/detect-platform.sh
scripts/detect-platform.sh
#!/bin/bash
detect_os() {
case "$(uname -s)" in
Darwin)
echo "macos"
;;
Linux)
echo "linux"
;;
CYGWIN*|MINGW*|MSYS*)
echo "windows"
;;
*)
echo "unknown"
;;
esac
}
detect_arch() {
case "$(uname -m)" in
x86_64)
echo "amd64"
;;
arm64|aarch64)
echo "arm64"
;;
*)
echo "unknown"
;;
esac
}
OS=$(detect_os)
ARCH=$(detect_arch)
echo "Detected: $OS ($ARCH)"
undefined#!/bin/bash
detect_os() {
case "$(uname -s)" in
Darwin)
echo "macos"
;;
Linux)
echo "linux"
;;
CYGWIN*|MINGW*|MSYS*)
echo "windows"
;;
*)
echo "unknown"
;;
esac
}
detect_arch() {
case "$(uname -m)" in
x86_64)
echo "amd64"
;;
arm64|aarch64)
echo "arm64"
;;
*)
echo "unknown"
;;
esac
}
OS=$(detect_os)
ARCH=$(detect_arch)
echo "Detected: $OS ($ARCH)"
undefinedWindows PowerShell Setup
Windows PowerShell搭建脚本
powershell
undefinedpowershell
undefinedscripts/setup.ps1
scripts/setup.ps1
Write-Host "Setting up development environment..." -ForegroundColor Green
Write-Host "Setting up development environment..." -ForegroundColor Green
Check Node.js
Check Node.js
if (-not (Get-Command node -ErrorAction SilentlyContinue)) {
Write-Host "Node.js not found. Please install from https://nodejs.org/" -ForegroundColor Red
exit 1
}
$nodeVersion = node -v
Write-Host "Node.js version: $nodeVersion" -ForegroundColor Cyan
if (-not (Get-Command node -ErrorAction SilentlyContinue)) {
Write-Host "Node.js not found. Please install from https://nodejs.org/" -ForegroundColor Red
exit 1
}
$nodeVersion = node -v
Write-Host "Node.js version: $nodeVersion" -ForegroundColor Cyan
Copy environment file
Copy environment file
if (-not (Test-Path .env)) {
if (Test-Path .env.example) {
Copy-Item .env.example .env
Write-Host "Created .env from .env.example" -ForegroundColor Yellow
}
}
if (-not (Test-Path .env)) {
if (Test-Path .env.example) {
Copy-Item .env.example .env
Write-Host "Created .env from .env.example" -ForegroundColor Yellow
}
}
Install dependencies
Install dependencies
Write-Host "Installing dependencies..." -ForegroundColor Green
npm ci
Write-Host "Installing dependencies..." -ForegroundColor Green
npm ci
Setup complete
Setup complete
Write-Host ""
Write-Host "Setup complete!" -ForegroundColor Green
Write-Host "Run 'npm run dev' to start development server" -ForegroundColor Cyan
undefinedWrite-Host ""
Write-Host "Setup complete!" -ForegroundColor Green
Write-Host "Run 'npm run dev' to start development server" -ForegroundColor Cyan
undefinedEnvironment Checklist
环境检查清单
Project Setup
项目搭建
- Setup script works on macOS, Linux, Windows
- Prerequisites documented with versions
- Environment variables documented
- IDE configuration committed
- Git hooks configured
- 搭建脚本可在macOS、Linux、Windows上正常运行
- 前置要求已附带版本说明
- 环境变量已文档化
- IDE配置已提交到仓库
- Git钩子已配置
Developer Experience
开发者体验
- One command setup
- Clear error messages
- Onboarding documentation
- Helpful npm scripts
- Debug configurations
- 支持一键搭建
- 提供清晰的错误提示
- 完善的入职文档
- 实用的npm脚本
- 调试配置已就绪
Code Quality
代码质量
- ESLint configured
- Prettier configured
- TypeScript strict mode
- Pre-commit hooks
- Editor integration
- ESLint已配置
- Prettier已配置
- TypeScript启用严格模式
- 提交前钩子已配置
- 编辑器集成已完成
When to Use This Skill
使用场景
Invoke this skill when:
- Starting a new project
- Onboarding new developers
- Standardizing team environments
- Troubleshooting development setup issues
- Creating setup automation
- Configuring IDE settings
- Setting up cross-platform development
在以下场景中可调用本Skill:
- 启动新项目
- 新开发者入职
- 标准化团队开发环境
- 排查开发环境搭建问题
- 创建搭建自动化流程
- 配置IDE设置
- 搭建跨平台开发环境